houdini 0.19.4 → 1.0.0-next.1
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 +337 -355
- package/build/cmd-esm/index.js +337 -355
- package/build/codegen/utils/index.d.ts +0 -1
- package/build/codegen-cjs/index.js +324 -311
- package/build/codegen-esm/index.js +324 -311
- package/build/lib/graphql.d.ts +14 -0
- package/build/lib-cjs/index.js +119 -43
- package/build/lib-esm/index.js +115 -42
- package/build/runtime/lib/scalars.d.ts +1 -0
- package/build/runtime/lib/types.d.ts +1 -1
- package/build/runtime-cjs/lib/scalars.d.ts +1 -0
- package/build/runtime-cjs/lib/scalars.js +24 -1
- package/build/runtime-cjs/lib/types.d.ts +1 -1
- package/build/runtime-esm/lib/scalars.d.ts +1 -0
- package/build/runtime-esm/lib/scalars.js +23 -1
- package/build/runtime-esm/lib/types.d.ts +1 -1
- package/build/test-cjs/index.js +322 -309
- package/build/test-esm/index.js +322 -309
- package/build/vite-cjs/index.js +324 -311
- package/build/vite-esm/index.js +324 -311
- package/package.json +1 -1
- package/build/codegen/utils/graphql.d.ts +0 -15
|
@@ -9759,7 +9759,7 @@ var require_graphql = __commonJS({
|
|
|
9759
9759
|
Object.defineProperty(exports, "__esModule", {
|
|
9760
9760
|
value: true
|
|
9761
9761
|
});
|
|
9762
|
-
exports.graphql =
|
|
9762
|
+
exports.graphql = graphql27;
|
|
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
|
|
9772
|
+
function graphql27(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
9773
9773
|
var _arguments = arguments;
|
|
9774
9774
|
return new Promise(function(resolve2) {
|
|
9775
9775
|
return resolve2(
|
|
@@ -14714,9 +14714,9 @@ var require_graphql2 = __commonJS({
|
|
|
14714
14714
|
}
|
|
14715
14715
|
});
|
|
14716
14716
|
|
|
14717
|
-
// ../../node_modules/.pnpm/minimatch@5.1.
|
|
14717
|
+
// ../../node_modules/.pnpm/minimatch@5.1.2/node_modules/minimatch/lib/path.js
|
|
14718
14718
|
var require_path = __commonJS({
|
|
14719
|
-
"../../node_modules/.pnpm/minimatch@5.1.
|
|
14719
|
+
"../../node_modules/.pnpm/minimatch@5.1.2/node_modules/minimatch/lib/path.js"(exports, module) {
|
|
14720
14720
|
var isWindows = typeof process === "object" && process && process.platform === "win32";
|
|
14721
14721
|
module.exports = isWindows ? { sep: "\\" } : { sep: "/" };
|
|
14722
14722
|
}
|
|
@@ -14933,9 +14933,9 @@ var require_brace_expansion = __commonJS({
|
|
|
14933
14933
|
}
|
|
14934
14934
|
});
|
|
14935
14935
|
|
|
14936
|
-
// ../../node_modules/.pnpm/minimatch@5.1.
|
|
14936
|
+
// ../../node_modules/.pnpm/minimatch@5.1.2/node_modules/minimatch/minimatch.js
|
|
14937
14937
|
var require_minimatch = __commonJS({
|
|
14938
|
-
"../../node_modules/.pnpm/minimatch@5.1.
|
|
14938
|
+
"../../node_modules/.pnpm/minimatch@5.1.2/node_modules/minimatch/minimatch.js"(exports, module) {
|
|
14939
14939
|
var minimatch2 = module.exports = (p, pattern, options = {}) => {
|
|
14940
14940
|
assertValidPattern(pattern);
|
|
14941
14941
|
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
@@ -15021,7 +15021,9 @@ var require_minimatch = __commonJS({
|
|
|
15021
15021
|
return list;
|
|
15022
15022
|
};
|
|
15023
15023
|
var globUnescape = (s) => s.replace(/\\(.)/g, "$1");
|
|
15024
|
+
var charUnescape = (s) => s.replace(/\\([^-\]])/g, "$1");
|
|
15024
15025
|
var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
15026
|
+
var braExpEscape = (s) => s.replace(/[[\]\\]/g, "\\$&");
|
|
15025
15027
|
var Minimatch = class {
|
|
15026
15028
|
constructor(pattern, options) {
|
|
15027
15029
|
assertValidPattern(pattern);
|
|
@@ -15213,6 +15215,10 @@ var require_minimatch = __commonJS({
|
|
|
15213
15215
|
return false;
|
|
15214
15216
|
}
|
|
15215
15217
|
case "\\":
|
|
15218
|
+
if (inClass && pattern.charAt(i + 1) === "-") {
|
|
15219
|
+
re += c;
|
|
15220
|
+
continue;
|
|
15221
|
+
}
|
|
15216
15222
|
clearStateChar();
|
|
15217
15223
|
escaping = true;
|
|
15218
15224
|
continue;
|
|
@@ -15295,17 +15301,13 @@ var require_minimatch = __commonJS({
|
|
|
15295
15301
|
}
|
|
15296
15302
|
cs = pattern.substring(classStart + 1, i);
|
|
15297
15303
|
try {
|
|
15298
|
-
RegExp("[" + cs + "]");
|
|
15304
|
+
RegExp("[" + braExpEscape(charUnescape(cs)) + "]");
|
|
15305
|
+
re += c;
|
|
15299
15306
|
} catch (er) {
|
|
15300
|
-
|
|
15301
|
-
re = re.substring(0, reClassStart) + "\\[" + sp[0] + "\\]";
|
|
15302
|
-
hasMagic = hasMagic || sp[1];
|
|
15303
|
-
inClass = false;
|
|
15304
|
-
continue;
|
|
15307
|
+
re = re.substring(0, reClassStart) + "(?:$.)";
|
|
15305
15308
|
}
|
|
15306
15309
|
hasMagic = true;
|
|
15307
15310
|
inClass = false;
|
|
15308
|
-
re += c;
|
|
15309
15311
|
continue;
|
|
15310
15312
|
default:
|
|
15311
15313
|
clearStateChar();
|
|
@@ -23132,9 +23134,9 @@ var require_lib2 = __commonJS({
|
|
|
23132
23134
|
}
|
|
23133
23135
|
});
|
|
23134
23136
|
|
|
23135
|
-
// ../../node_modules/.pnpm/@babel+parser@7.20.
|
|
23137
|
+
// ../../node_modules/.pnpm/@babel+parser@7.20.7/node_modules/@babel/parser/lib/index.js
|
|
23136
23138
|
var require_lib3 = __commonJS({
|
|
23137
|
-
"../../node_modules/.pnpm/@babel+parser@7.20.
|
|
23139
|
+
"../../node_modules/.pnpm/@babel+parser@7.20.7/node_modules/@babel/parser/lib/index.js"(exports) {
|
|
23138
23140
|
"use strict";
|
|
23139
23141
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23140
23142
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
@@ -23250,9 +23252,9 @@ var require_lib3 = __commonJS({
|
|
|
23250
23252
|
AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.",
|
|
23251
23253
|
AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.",
|
|
23252
23254
|
AwaitNotInAsyncFunction: "'await' is only allowed within async functions.",
|
|
23253
|
-
BadGetterArity: "A 'get'
|
|
23254
|
-
BadSetterArity: "A 'set'
|
|
23255
|
-
BadSetterRestParameter: "A 'set'
|
|
23255
|
+
BadGetterArity: "A 'get' accessor must not have any formal parameters.",
|
|
23256
|
+
BadSetterArity: "A 'set' accessor must have exactly one formal parameter.",
|
|
23257
|
+
BadSetterRestParameter: "A 'set' accessor function argument must not be a rest parameter.",
|
|
23256
23258
|
ConstructorClassField: "Classes may not have a field named 'constructor'.",
|
|
23257
23259
|
ConstructorClassPrivateField: "Classes may not have a private field named '#constructor'.",
|
|
23258
23260
|
ConstructorIsAccessor: "Class constructor may not be an accessor.",
|
|
@@ -26686,7 +26688,7 @@ var require_lib3 = __commonJS({
|
|
|
26686
26688
|
}
|
|
26687
26689
|
this.parser.raise(toParseError, origin);
|
|
26688
26690
|
}
|
|
26689
|
-
|
|
26691
|
+
recordArrowParameterBindingError(error, {
|
|
26690
26692
|
at: node
|
|
26691
26693
|
}) {
|
|
26692
26694
|
const {
|
|
@@ -30445,6 +30447,7 @@ var require_lib3 = __commonJS({
|
|
|
30445
30447
|
}) => `Property '${propertyName}' cannot have an initializer because it is marked abstract.`,
|
|
30446
30448
|
AccesorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
|
|
30447
30449
|
AccesorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
|
|
30450
|
+
AccessorCannotBeOptional: "An 'accessor' property cannot be declared optional.",
|
|
30448
30451
|
ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
|
|
30449
30452
|
ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.",
|
|
30450
30453
|
ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
|
|
@@ -32407,8 +32410,12 @@ var require_lib3 = __commonJS({
|
|
|
32407
32410
|
node.typeParameters = typeParameters;
|
|
32408
32411
|
}
|
|
32409
32412
|
parseClassPropertyAnnotation(node) {
|
|
32410
|
-
if (!node.optional
|
|
32411
|
-
|
|
32413
|
+
if (!node.optional) {
|
|
32414
|
+
if (this.eat(35)) {
|
|
32415
|
+
node.definite = true;
|
|
32416
|
+
} else if (this.eat(17)) {
|
|
32417
|
+
node.optional = true;
|
|
32418
|
+
}
|
|
32412
32419
|
}
|
|
32413
32420
|
const type = this.tsTryParseTypeAnnotation();
|
|
32414
32421
|
if (type)
|
|
@@ -32447,6 +32454,15 @@ var require_lib3 = __commonJS({
|
|
|
32447
32454
|
this.parseClassPropertyAnnotation(node);
|
|
32448
32455
|
return super.parseClassPrivateProperty(node);
|
|
32449
32456
|
}
|
|
32457
|
+
parseClassAccessorProperty(node) {
|
|
32458
|
+
this.parseClassPropertyAnnotation(node);
|
|
32459
|
+
if (node.optional) {
|
|
32460
|
+
this.raise(TSErrors.AccessorCannotBeOptional, {
|
|
32461
|
+
at: node
|
|
32462
|
+
});
|
|
32463
|
+
}
|
|
32464
|
+
return super.parseClassAccessorProperty(node);
|
|
32465
|
+
}
|
|
32450
32466
|
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
|
|
32451
32467
|
const typeParameters = this.tsTryParseTypeParameters();
|
|
32452
32468
|
if (typeParameters && isConstructor) {
|
|
@@ -32657,7 +32673,7 @@ var require_lib3 = __commonJS({
|
|
|
32657
32673
|
case "TSNonNullExpression":
|
|
32658
32674
|
case "TSTypeAssertion":
|
|
32659
32675
|
if (isLHS) {
|
|
32660
|
-
this.expressionScope.
|
|
32676
|
+
this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, {
|
|
32661
32677
|
at: node
|
|
32662
32678
|
});
|
|
32663
32679
|
} else {
|
|
@@ -33364,7 +33380,7 @@ var require_lib3 = __commonJS({
|
|
|
33364
33380
|
parenthesized = unwrapParenthesizedExpression(node);
|
|
33365
33381
|
if (isLHS) {
|
|
33366
33382
|
if (parenthesized.type === "Identifier") {
|
|
33367
|
-
this.expressionScope.
|
|
33383
|
+
this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, {
|
|
33368
33384
|
at: node
|
|
33369
33385
|
});
|
|
33370
33386
|
} else if (parenthesized.type !== "MemberExpression") {
|
|
@@ -53922,7 +53938,7 @@ var require_main2 = __commonJS({
|
|
|
53922
53938
|
});
|
|
53923
53939
|
|
|
53924
53940
|
// src/codegen/index.ts
|
|
53925
|
-
var
|
|
53941
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
53926
53942
|
|
|
53927
53943
|
// src/lib/pipeline.ts
|
|
53928
53944
|
async function runPipeline(config2, pipeline, target) {
|
|
@@ -56079,6 +56095,60 @@ function definitionFromAncestors(ancestors) {
|
|
|
56079
56095
|
}
|
|
56080
56096
|
return definition;
|
|
56081
56097
|
}
|
|
56098
|
+
function unwrapType(config2, type, wrappers = []) {
|
|
56099
|
+
if (type.kind === "NonNullType") {
|
|
56100
|
+
return unwrapType(config2, type.type, [TypeWrapper.NonNull, ...wrappers]);
|
|
56101
|
+
}
|
|
56102
|
+
if (type instanceof graphql.GraphQLNonNull) {
|
|
56103
|
+
return unwrapType(config2, type.ofType, [TypeWrapper.NonNull, ...wrappers]);
|
|
56104
|
+
}
|
|
56105
|
+
if (wrappers[0] !== TypeWrapper.NonNull) {
|
|
56106
|
+
wrappers.unshift(TypeWrapper.Nullable);
|
|
56107
|
+
}
|
|
56108
|
+
if (type.kind === "ListType") {
|
|
56109
|
+
return unwrapType(config2, type.type, [TypeWrapper.List, ...wrappers]);
|
|
56110
|
+
}
|
|
56111
|
+
if (type instanceof graphql.GraphQLList) {
|
|
56112
|
+
return unwrapType(config2, type.ofType, [TypeWrapper.List, ...wrappers]);
|
|
56113
|
+
}
|
|
56114
|
+
const namedType = config2.schema.getType(type.name.value || type.name);
|
|
56115
|
+
if (!namedType) {
|
|
56116
|
+
throw new Error("Could not unwrap type: " + JSON.stringify(type));
|
|
56117
|
+
}
|
|
56118
|
+
return { type: namedType, wrappers };
|
|
56119
|
+
}
|
|
56120
|
+
function wrapType({
|
|
56121
|
+
type,
|
|
56122
|
+
wrappers
|
|
56123
|
+
}) {
|
|
56124
|
+
const head = wrappers[0];
|
|
56125
|
+
const tail = wrappers.slice(1);
|
|
56126
|
+
let kind = graphql.Kind.NAMED_TYPE;
|
|
56127
|
+
if (head === TypeWrapper.List) {
|
|
56128
|
+
kind = graphql.Kind.LIST_TYPE;
|
|
56129
|
+
} else if (head === TypeWrapper.NonNull) {
|
|
56130
|
+
kind = graphql.Kind.NON_NULL_TYPE;
|
|
56131
|
+
}
|
|
56132
|
+
if (kind === "NamedType") {
|
|
56133
|
+
return {
|
|
56134
|
+
kind,
|
|
56135
|
+
name: {
|
|
56136
|
+
kind: graphql.Kind.NAME,
|
|
56137
|
+
value: type.name
|
|
56138
|
+
}
|
|
56139
|
+
};
|
|
56140
|
+
}
|
|
56141
|
+
return {
|
|
56142
|
+
kind,
|
|
56143
|
+
type: wrapType({ type, wrappers: tail })
|
|
56144
|
+
};
|
|
56145
|
+
}
|
|
56146
|
+
var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
|
|
56147
|
+
TypeWrapper2["Nullable"] = "Nullable";
|
|
56148
|
+
TypeWrapper2["List"] = "List";
|
|
56149
|
+
TypeWrapper2["NonNull"] = "NonNull";
|
|
56150
|
+
return TypeWrapper2;
|
|
56151
|
+
})(TypeWrapper || {});
|
|
56082
56152
|
|
|
56083
56153
|
// src/lib/parse.ts
|
|
56084
56154
|
var import_parser = __toESM(require_lib3(), 1);
|
|
@@ -56323,7 +56393,7 @@ async function find_graphql(config2, parsedScript, walker) {
|
|
|
56323
56393
|
}
|
|
56324
56394
|
|
|
56325
56395
|
// src/codegen/generators/artifacts/index.ts
|
|
56326
|
-
var
|
|
56396
|
+
var graphql11 = __toESM(require_graphql2(), 1);
|
|
56327
56397
|
var recast5 = __toESM(require_main2(), 1);
|
|
56328
56398
|
|
|
56329
56399
|
// src/codegen/utils/commonjs.ts
|
|
@@ -56499,63 +56569,6 @@ var FieldCollection = class {
|
|
|
56499
56569
|
}
|
|
56500
56570
|
};
|
|
56501
56571
|
|
|
56502
|
-
// src/codegen/utils/graphql.ts
|
|
56503
|
-
var graphql3 = __toESM(require_graphql2(), 1);
|
|
56504
|
-
function unwrapType(config2, type, wrappers = []) {
|
|
56505
|
-
if (type.kind === "NonNullType") {
|
|
56506
|
-
return unwrapType(config2, type.type, [TypeWrapper.NonNull, ...wrappers]);
|
|
56507
|
-
}
|
|
56508
|
-
if (type instanceof graphql3.GraphQLNonNull) {
|
|
56509
|
-
return unwrapType(config2, type.ofType, [TypeWrapper.NonNull, ...wrappers]);
|
|
56510
|
-
}
|
|
56511
|
-
if (wrappers[0] !== TypeWrapper.NonNull) {
|
|
56512
|
-
wrappers.unshift(TypeWrapper.Nullable);
|
|
56513
|
-
}
|
|
56514
|
-
if (type.kind === "ListType") {
|
|
56515
|
-
return unwrapType(config2, type.type, [TypeWrapper.List, ...wrappers]);
|
|
56516
|
-
}
|
|
56517
|
-
if (type instanceof graphql3.GraphQLList) {
|
|
56518
|
-
return unwrapType(config2, type.ofType, [TypeWrapper.List, ...wrappers]);
|
|
56519
|
-
}
|
|
56520
|
-
const namedType = config2.schema.getType(type.name.value || type.name);
|
|
56521
|
-
if (!namedType) {
|
|
56522
|
-
throw new Error("Could not unwrap type: " + JSON.stringify(type));
|
|
56523
|
-
}
|
|
56524
|
-
return { type: namedType, wrappers };
|
|
56525
|
-
}
|
|
56526
|
-
function wrapType({
|
|
56527
|
-
type,
|
|
56528
|
-
wrappers
|
|
56529
|
-
}) {
|
|
56530
|
-
const head = wrappers[0];
|
|
56531
|
-
const tail = wrappers.slice(1);
|
|
56532
|
-
let kind = graphql3.Kind.NAMED_TYPE;
|
|
56533
|
-
if (head === TypeWrapper.List) {
|
|
56534
|
-
kind = graphql3.Kind.LIST_TYPE;
|
|
56535
|
-
} else if (head === TypeWrapper.NonNull) {
|
|
56536
|
-
kind = graphql3.Kind.NON_NULL_TYPE;
|
|
56537
|
-
}
|
|
56538
|
-
if (kind === "NamedType") {
|
|
56539
|
-
return {
|
|
56540
|
-
kind,
|
|
56541
|
-
name: {
|
|
56542
|
-
kind: graphql3.Kind.NAME,
|
|
56543
|
-
value: type.name
|
|
56544
|
-
}
|
|
56545
|
-
};
|
|
56546
|
-
}
|
|
56547
|
-
return {
|
|
56548
|
-
kind,
|
|
56549
|
-
type: wrapType({ type, wrappers: tail })
|
|
56550
|
-
};
|
|
56551
|
-
}
|
|
56552
|
-
var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
|
|
56553
|
-
TypeWrapper2["Nullable"] = "Nullable";
|
|
56554
|
-
TypeWrapper2["List"] = "List";
|
|
56555
|
-
TypeWrapper2["NonNull"] = "NonNull";
|
|
56556
|
-
return TypeWrapper2;
|
|
56557
|
-
})(TypeWrapper || {});
|
|
56558
|
-
|
|
56559
56572
|
// src/codegen/utils/moduleExport.ts
|
|
56560
56573
|
var recast2 = __toESM(require_main2(), 1);
|
|
56561
56574
|
var AST2 = recast2.types.builders;
|
|
@@ -56642,7 +56655,7 @@ ${exportDefaultFrom(`./${doc.name}`, doc.name)}`,
|
|
|
56642
56655
|
}
|
|
56643
56656
|
|
|
56644
56657
|
// src/codegen/generators/artifacts/inputs.ts
|
|
56645
|
-
var
|
|
56658
|
+
var graphql3 = __toESM(require_graphql2(), 1);
|
|
56646
56659
|
var recast3 = __toESM(require_main2(), 1);
|
|
56647
56660
|
var AST3 = recast3.types.builders;
|
|
56648
56661
|
function inputObject(config2, inputs) {
|
|
@@ -56667,10 +56680,10 @@ function walkInputs(config2, visitedTypes, inputObj, rootType) {
|
|
|
56667
56680
|
if (visitedTypes.has(type.name)) {
|
|
56668
56681
|
return;
|
|
56669
56682
|
}
|
|
56670
|
-
if (
|
|
56683
|
+
if (graphql3.isEnumType(type) || graphql3.isScalarType(type)) {
|
|
56671
56684
|
return;
|
|
56672
56685
|
}
|
|
56673
|
-
if (
|
|
56686
|
+
if (graphql3.isUnionType(type)) {
|
|
56674
56687
|
return;
|
|
56675
56688
|
}
|
|
56676
56689
|
visitedTypes.add(type.name);
|
|
@@ -56688,10 +56701,10 @@ function walkInputs(config2, visitedTypes, inputObj, rootType) {
|
|
|
56688
56701
|
}
|
|
56689
56702
|
|
|
56690
56703
|
// src/codegen/generators/artifacts/operations.ts
|
|
56691
|
-
var
|
|
56704
|
+
var graphql5 = __toESM(require_graphql2(), 1);
|
|
56692
56705
|
|
|
56693
56706
|
// src/codegen/generators/artifacts/utils.ts
|
|
56694
|
-
var
|
|
56707
|
+
var graphql4 = __toESM(require_graphql2(), 1);
|
|
56695
56708
|
var recast4 = __toESM(require_main2(), 1);
|
|
56696
56709
|
var AST4 = recast4.types.builders;
|
|
56697
56710
|
function serializeValue(value) {
|
|
@@ -56743,19 +56756,19 @@ function deepMerge(filepath, ...targets) {
|
|
|
56743
56756
|
function convertValue(config2, val) {
|
|
56744
56757
|
let value;
|
|
56745
56758
|
let kind;
|
|
56746
|
-
if (val.kind ===
|
|
56759
|
+
if (val.kind === graphql4.Kind.INT) {
|
|
56747
56760
|
value = parseInt(val.value, 10);
|
|
56748
56761
|
kind = "Int";
|
|
56749
|
-
} else if (val.kind ===
|
|
56762
|
+
} else if (val.kind === graphql4.Kind.FLOAT) {
|
|
56750
56763
|
value = parseFloat(val.value);
|
|
56751
56764
|
kind = "Float";
|
|
56752
|
-
} else if (val.kind ===
|
|
56765
|
+
} else if (val.kind === graphql4.Kind.BOOLEAN) {
|
|
56753
56766
|
value = val.value;
|
|
56754
56767
|
kind = "Boolean";
|
|
56755
|
-
} else if (val.kind ===
|
|
56768
|
+
} else if (val.kind === graphql4.Kind.VARIABLE) {
|
|
56756
56769
|
value = val.name.value;
|
|
56757
56770
|
kind = "Variable";
|
|
56758
|
-
} else if (val.kind ===
|
|
56771
|
+
} else if (val.kind === graphql4.Kind.STRING) {
|
|
56759
56772
|
value = val.value;
|
|
56760
56773
|
kind = "String";
|
|
56761
56774
|
}
|
|
@@ -56768,7 +56781,7 @@ function operationsByPath(config2, filepath, definition, filterTypes) {
|
|
|
56768
56781
|
return {};
|
|
56769
56782
|
}
|
|
56770
56783
|
const pathOperations = {};
|
|
56771
|
-
|
|
56784
|
+
graphql5.visit(definition, {
|
|
56772
56785
|
FragmentSpread(node, _, __, ___, ancestors) {
|
|
56773
56786
|
if (!config2.isListFragment(node.name.value)) {
|
|
56774
56787
|
return;
|
|
@@ -56927,7 +56940,7 @@ function ancestorKey(ancestors) {
|
|
|
56927
56940
|
}
|
|
56928
56941
|
|
|
56929
56942
|
// src/codegen/generators/artifacts/selection.ts
|
|
56930
|
-
var
|
|
56943
|
+
var graphql10 = __toESM(require_graphql2(), 1);
|
|
56931
56944
|
|
|
56932
56945
|
// ../../node_modules/.pnpm/@kitql+helper@0.5.0/node_modules/@kitql/helper/index.mjs
|
|
56933
56946
|
var config = {
|
|
@@ -56967,16 +56980,16 @@ function logYellow(str) {
|
|
|
56967
56980
|
}
|
|
56968
56981
|
|
|
56969
56982
|
// src/codegen/transforms/list.ts
|
|
56970
|
-
var
|
|
56983
|
+
var graphql8 = __toESM(require_graphql2(), 1);
|
|
56971
56984
|
|
|
56972
56985
|
// src/codegen/utils/objectIdentificationSelection.ts
|
|
56973
|
-
var
|
|
56986
|
+
var graphql6 = __toESM(require_graphql2(), 1);
|
|
56974
56987
|
var objectIdentificationSelection = (config2, type) => {
|
|
56975
56988
|
return config2.keyFieldsForType(type.name).map((key) => {
|
|
56976
56989
|
return {
|
|
56977
|
-
kind:
|
|
56990
|
+
kind: graphql6.Kind.FIELD,
|
|
56978
56991
|
name: {
|
|
56979
|
-
kind:
|
|
56992
|
+
kind: graphql6.Kind.NAME,
|
|
56980
56993
|
value: key
|
|
56981
56994
|
}
|
|
56982
56995
|
};
|
|
@@ -56984,7 +56997,7 @@ var objectIdentificationSelection = (config2, type) => {
|
|
|
56984
56997
|
};
|
|
56985
56998
|
|
|
56986
56999
|
// src/codegen/transforms/paginate.ts
|
|
56987
|
-
var
|
|
57000
|
+
var graphql7 = __toESM(require_graphql2(), 1);
|
|
56988
57001
|
async function paginate(config2, documents) {
|
|
56989
57002
|
const newDocs = [];
|
|
56990
57003
|
for (const doc of documents) {
|
|
@@ -57017,7 +57030,7 @@ async function paginate(config2, documents) {
|
|
|
57017
57030
|
};
|
|
57018
57031
|
let cursorType = "String";
|
|
57019
57032
|
let paginationPath = [];
|
|
57020
|
-
doc.document =
|
|
57033
|
+
doc.document = graphql7.visit(doc.document, {
|
|
57021
57034
|
Field(node, _, __, ___, ancestors) {
|
|
57022
57035
|
const paginateDirective = node.directives?.find(
|
|
57023
57036
|
(directive) => directive.name.value === config2.paginateDirective
|
|
@@ -57044,7 +57057,7 @@ async function paginate(config2, documents) {
|
|
|
57044
57057
|
flags.offset.enabled = offsetPagination;
|
|
57045
57058
|
flags.limit.enabled = offsetPagination;
|
|
57046
57059
|
paginationPath = ancestors.filter(
|
|
57047
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
57060
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql7.Kind.FIELD
|
|
57048
57061
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
57049
57062
|
return {
|
|
57050
57063
|
...node,
|
|
@@ -57065,7 +57078,7 @@ async function paginate(config2, documents) {
|
|
|
57065
57078
|
refetchUpdate = "prepend" /* prepend */;
|
|
57066
57079
|
}
|
|
57067
57080
|
let fragment = "";
|
|
57068
|
-
doc.document =
|
|
57081
|
+
doc.document = graphql7.visit(doc.document, {
|
|
57069
57082
|
OperationDefinition(node) {
|
|
57070
57083
|
if (node.operation !== "query") {
|
|
57071
57084
|
throw new HoudiniError({
|
|
@@ -57119,9 +57132,9 @@ async function paginate(config2, documents) {
|
|
|
57119
57132
|
directives: [
|
|
57120
57133
|
...node.directives || [],
|
|
57121
57134
|
{
|
|
57122
|
-
kind:
|
|
57135
|
+
kind: graphql7.Kind.DIRECTIVE,
|
|
57123
57136
|
name: {
|
|
57124
|
-
kind:
|
|
57137
|
+
kind: graphql7.Kind.NAME,
|
|
57125
57138
|
value: config2.argumentsDirective
|
|
57126
57139
|
}
|
|
57127
57140
|
}
|
|
@@ -57184,16 +57197,16 @@ async function paginate(config2, documents) {
|
|
|
57184
57197
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
57185
57198
|
const fragmentSpreadSelection = [
|
|
57186
57199
|
{
|
|
57187
|
-
kind:
|
|
57200
|
+
kind: graphql7.Kind.FRAGMENT_SPREAD,
|
|
57188
57201
|
name: {
|
|
57189
|
-
kind:
|
|
57202
|
+
kind: graphql7.Kind.NAME,
|
|
57190
57203
|
value: fragmentName
|
|
57191
57204
|
},
|
|
57192
57205
|
directives: [
|
|
57193
57206
|
{
|
|
57194
|
-
kind:
|
|
57207
|
+
kind: graphql7.Kind.DIRECTIVE,
|
|
57195
57208
|
name: {
|
|
57196
|
-
kind:
|
|
57209
|
+
kind: graphql7.Kind.NAME,
|
|
57197
57210
|
value: config2.withDirective
|
|
57198
57211
|
},
|
|
57199
57212
|
["arguments"]: paginationArgs.map(
|
|
@@ -57221,29 +57234,29 @@ async function paginate(config2, documents) {
|
|
|
57221
57234
|
});
|
|
57222
57235
|
const typeConfig = config2.typeConfig?.[fragment];
|
|
57223
57236
|
const queryDoc = {
|
|
57224
|
-
kind:
|
|
57237
|
+
kind: graphql7.Kind.DOCUMENT,
|
|
57225
57238
|
definitions: [
|
|
57226
57239
|
{
|
|
57227
|
-
kind:
|
|
57240
|
+
kind: graphql7.Kind.OPERATION_DEFINITION,
|
|
57228
57241
|
name: {
|
|
57229
|
-
kind:
|
|
57242
|
+
kind: graphql7.Kind.NAME,
|
|
57230
57243
|
value: refetchQueryName
|
|
57231
57244
|
},
|
|
57232
57245
|
operation: "query",
|
|
57233
57246
|
variableDefinitions: paginationArgs.map(
|
|
57234
57247
|
(arg) => ({
|
|
57235
|
-
kind:
|
|
57248
|
+
kind: graphql7.Kind.VARIABLE_DEFINITION,
|
|
57236
57249
|
type: {
|
|
57237
|
-
kind:
|
|
57250
|
+
kind: graphql7.Kind.NAMED_TYPE,
|
|
57238
57251
|
name: {
|
|
57239
|
-
kind:
|
|
57252
|
+
kind: graphql7.Kind.NAME,
|
|
57240
57253
|
value: arg.type
|
|
57241
57254
|
}
|
|
57242
57255
|
},
|
|
57243
57256
|
variable: {
|
|
57244
|
-
kind:
|
|
57257
|
+
kind: graphql7.Kind.VARIABLE,
|
|
57245
57258
|
name: {
|
|
57246
|
-
kind:
|
|
57259
|
+
kind: graphql7.Kind.NAME,
|
|
57247
57260
|
value: arg.name
|
|
57248
57261
|
}
|
|
57249
57262
|
},
|
|
@@ -57255,12 +57268,12 @@ async function paginate(config2, documents) {
|
|
|
57255
57268
|
).concat(
|
|
57256
57269
|
!nodeQuery ? [] : keys.map(
|
|
57257
57270
|
(key) => ({
|
|
57258
|
-
kind:
|
|
57271
|
+
kind: graphql7.Kind.VARIABLE_DEFINITION,
|
|
57259
57272
|
type: key.type,
|
|
57260
57273
|
variable: {
|
|
57261
|
-
kind:
|
|
57274
|
+
kind: graphql7.Kind.VARIABLE,
|
|
57262
57275
|
name: {
|
|
57263
|
-
kind:
|
|
57276
|
+
kind: graphql7.Kind.NAME,
|
|
57264
57277
|
value: key.name
|
|
57265
57278
|
}
|
|
57266
57279
|
}
|
|
@@ -57268,42 +57281,42 @@ async function paginate(config2, documents) {
|
|
|
57268
57281
|
)
|
|
57269
57282
|
),
|
|
57270
57283
|
selectionSet: {
|
|
57271
|
-
kind:
|
|
57284
|
+
kind: graphql7.Kind.SELECTION_SET,
|
|
57272
57285
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
57273
57286
|
{
|
|
57274
|
-
kind:
|
|
57287
|
+
kind: graphql7.Kind.FIELD,
|
|
57275
57288
|
name: {
|
|
57276
|
-
kind:
|
|
57289
|
+
kind: graphql7.Kind.NAME,
|
|
57277
57290
|
value: typeConfig?.resolve?.queryField || "node"
|
|
57278
57291
|
},
|
|
57279
57292
|
["arguments"]: keys.map((key) => ({
|
|
57280
|
-
kind:
|
|
57293
|
+
kind: graphql7.Kind.ARGUMENT,
|
|
57281
57294
|
name: {
|
|
57282
|
-
kind:
|
|
57295
|
+
kind: graphql7.Kind.NAME,
|
|
57283
57296
|
value: key.name
|
|
57284
57297
|
},
|
|
57285
57298
|
value: {
|
|
57286
|
-
kind:
|
|
57299
|
+
kind: graphql7.Kind.VARIABLE,
|
|
57287
57300
|
name: {
|
|
57288
|
-
kind:
|
|
57301
|
+
kind: graphql7.Kind.NAME,
|
|
57289
57302
|
value: key.name
|
|
57290
57303
|
}
|
|
57291
57304
|
}
|
|
57292
57305
|
})),
|
|
57293
57306
|
selectionSet: {
|
|
57294
|
-
kind:
|
|
57307
|
+
kind: graphql7.Kind.SELECTION_SET,
|
|
57295
57308
|
selections: [
|
|
57296
57309
|
{
|
|
57297
|
-
kind:
|
|
57310
|
+
kind: graphql7.Kind.FIELD,
|
|
57298
57311
|
name: {
|
|
57299
|
-
kind:
|
|
57312
|
+
kind: graphql7.Kind.NAME,
|
|
57300
57313
|
value: "__typename"
|
|
57301
57314
|
}
|
|
57302
57315
|
},
|
|
57303
57316
|
...(typeConfig?.keys || ["id"]).map((key) => ({
|
|
57304
|
-
kind:
|
|
57317
|
+
kind: graphql7.Kind.FIELD,
|
|
57305
57318
|
name: {
|
|
57306
|
-
kind:
|
|
57319
|
+
kind: graphql7.Kind.NAME,
|
|
57307
57320
|
value: key
|
|
57308
57321
|
}
|
|
57309
57322
|
})),
|
|
@@ -57365,15 +57378,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
57365
57378
|
}
|
|
57366
57379
|
function variableAsArgument(name2, variable) {
|
|
57367
57380
|
return {
|
|
57368
|
-
kind:
|
|
57381
|
+
kind: graphql7.Kind.ARGUMENT,
|
|
57369
57382
|
name: {
|
|
57370
|
-
kind:
|
|
57383
|
+
kind: graphql7.Kind.NAME,
|
|
57371
57384
|
value: name2
|
|
57372
57385
|
},
|
|
57373
57386
|
value: {
|
|
57374
|
-
kind:
|
|
57387
|
+
kind: graphql7.Kind.VARIABLE,
|
|
57375
57388
|
name: {
|
|
57376
|
-
kind:
|
|
57389
|
+
kind: graphql7.Kind.NAME,
|
|
57377
57390
|
value: variable ?? name2
|
|
57378
57391
|
}
|
|
57379
57392
|
}
|
|
@@ -57381,18 +57394,18 @@ function variableAsArgument(name2, variable) {
|
|
|
57381
57394
|
}
|
|
57382
57395
|
function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
57383
57396
|
return {
|
|
57384
|
-
kind:
|
|
57397
|
+
kind: graphql7.Kind.VARIABLE_DEFINITION,
|
|
57385
57398
|
type: {
|
|
57386
|
-
kind:
|
|
57399
|
+
kind: graphql7.Kind.NAMED_TYPE,
|
|
57387
57400
|
name: {
|
|
57388
|
-
kind:
|
|
57401
|
+
kind: graphql7.Kind.NAME,
|
|
57389
57402
|
value: type
|
|
57390
57403
|
}
|
|
57391
57404
|
},
|
|
57392
57405
|
variable: {
|
|
57393
|
-
kind:
|
|
57406
|
+
kind: graphql7.Kind.VARIABLE,
|
|
57394
57407
|
name: {
|
|
57395
|
-
kind:
|
|
57408
|
+
kind: graphql7.Kind.NAME,
|
|
57396
57409
|
value: variableName ?? name2
|
|
57397
57410
|
}
|
|
57398
57411
|
},
|
|
@@ -57404,9 +57417,9 @@ function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
|
57404
57417
|
}
|
|
57405
57418
|
function argumentNode(name2, value) {
|
|
57406
57419
|
return {
|
|
57407
|
-
kind:
|
|
57420
|
+
kind: graphql7.Kind.ARGUMENT,
|
|
57408
57421
|
name: {
|
|
57409
|
-
kind:
|
|
57422
|
+
kind: graphql7.Kind.NAME,
|
|
57410
57423
|
value: name2
|
|
57411
57424
|
},
|
|
57412
57425
|
value: objectNode(value)
|
|
@@ -57414,16 +57427,16 @@ function argumentNode(name2, value) {
|
|
|
57414
57427
|
}
|
|
57415
57428
|
function objectNode([type, defaultValue]) {
|
|
57416
57429
|
const node = {
|
|
57417
|
-
kind:
|
|
57430
|
+
kind: graphql7.Kind.OBJECT,
|
|
57418
57431
|
fields: [
|
|
57419
57432
|
{
|
|
57420
|
-
kind:
|
|
57433
|
+
kind: graphql7.Kind.OBJECT_FIELD,
|
|
57421
57434
|
name: {
|
|
57422
|
-
kind:
|
|
57435
|
+
kind: graphql7.Kind.NAME,
|
|
57423
57436
|
value: "type"
|
|
57424
57437
|
},
|
|
57425
57438
|
value: {
|
|
57426
|
-
kind:
|
|
57439
|
+
kind: graphql7.Kind.STRING,
|
|
57427
57440
|
value: type
|
|
57428
57441
|
}
|
|
57429
57442
|
}
|
|
@@ -57431,8 +57444,8 @@ function objectNode([type, defaultValue]) {
|
|
|
57431
57444
|
};
|
|
57432
57445
|
if (defaultValue) {
|
|
57433
57446
|
node.fields.push({
|
|
57434
|
-
kind:
|
|
57435
|
-
name: { kind:
|
|
57447
|
+
kind: graphql7.Kind.OBJECT_FIELD,
|
|
57448
|
+
name: { kind: graphql7.Kind.NAME, value: "default" },
|
|
57436
57449
|
value: {
|
|
57437
57450
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
57438
57451
|
value: defaultValue.toString()
|
|
@@ -57443,34 +57456,34 @@ function objectNode([type, defaultValue]) {
|
|
|
57443
57456
|
}
|
|
57444
57457
|
var pageInfoSelection = [
|
|
57445
57458
|
{
|
|
57446
|
-
kind:
|
|
57459
|
+
kind: graphql7.Kind.FIELD,
|
|
57447
57460
|
name: {
|
|
57448
|
-
kind:
|
|
57461
|
+
kind: graphql7.Kind.NAME,
|
|
57449
57462
|
value: "edges"
|
|
57450
57463
|
},
|
|
57451
57464
|
selectionSet: {
|
|
57452
|
-
kind:
|
|
57465
|
+
kind: graphql7.Kind.SELECTION_SET,
|
|
57453
57466
|
selections: [
|
|
57454
57467
|
{
|
|
57455
|
-
kind:
|
|
57468
|
+
kind: graphql7.Kind.FIELD,
|
|
57456
57469
|
name: {
|
|
57457
|
-
kind:
|
|
57470
|
+
kind: graphql7.Kind.NAME,
|
|
57458
57471
|
value: "cursor"
|
|
57459
57472
|
}
|
|
57460
57473
|
},
|
|
57461
57474
|
{
|
|
57462
|
-
kind:
|
|
57475
|
+
kind: graphql7.Kind.FIELD,
|
|
57463
57476
|
name: {
|
|
57464
|
-
kind:
|
|
57477
|
+
kind: graphql7.Kind.NAME,
|
|
57465
57478
|
value: "node"
|
|
57466
57479
|
},
|
|
57467
57480
|
selectionSet: {
|
|
57468
|
-
kind:
|
|
57481
|
+
kind: graphql7.Kind.SELECTION_SET,
|
|
57469
57482
|
selections: [
|
|
57470
57483
|
{
|
|
57471
|
-
kind:
|
|
57484
|
+
kind: graphql7.Kind.FIELD,
|
|
57472
57485
|
name: {
|
|
57473
|
-
kind:
|
|
57486
|
+
kind: graphql7.Kind.NAME,
|
|
57474
57487
|
value: "__typename"
|
|
57475
57488
|
}
|
|
57476
57489
|
}
|
|
@@ -57481,39 +57494,39 @@ var pageInfoSelection = [
|
|
|
57481
57494
|
}
|
|
57482
57495
|
},
|
|
57483
57496
|
{
|
|
57484
|
-
kind:
|
|
57497
|
+
kind: graphql7.Kind.FIELD,
|
|
57485
57498
|
name: {
|
|
57486
|
-
kind:
|
|
57499
|
+
kind: graphql7.Kind.NAME,
|
|
57487
57500
|
value: "pageInfo"
|
|
57488
57501
|
},
|
|
57489
57502
|
selectionSet: {
|
|
57490
|
-
kind:
|
|
57503
|
+
kind: graphql7.Kind.SELECTION_SET,
|
|
57491
57504
|
selections: [
|
|
57492
57505
|
{
|
|
57493
|
-
kind:
|
|
57506
|
+
kind: graphql7.Kind.FIELD,
|
|
57494
57507
|
name: {
|
|
57495
|
-
kind:
|
|
57508
|
+
kind: graphql7.Kind.NAME,
|
|
57496
57509
|
value: "hasPreviousPage"
|
|
57497
57510
|
}
|
|
57498
57511
|
},
|
|
57499
57512
|
{
|
|
57500
|
-
kind:
|
|
57513
|
+
kind: graphql7.Kind.FIELD,
|
|
57501
57514
|
name: {
|
|
57502
|
-
kind:
|
|
57515
|
+
kind: graphql7.Kind.NAME,
|
|
57503
57516
|
value: "hasNextPage"
|
|
57504
57517
|
}
|
|
57505
57518
|
},
|
|
57506
57519
|
{
|
|
57507
|
-
kind:
|
|
57520
|
+
kind: graphql7.Kind.FIELD,
|
|
57508
57521
|
name: {
|
|
57509
|
-
kind:
|
|
57522
|
+
kind: graphql7.Kind.NAME,
|
|
57510
57523
|
value: "startCursor"
|
|
57511
57524
|
}
|
|
57512
57525
|
},
|
|
57513
57526
|
{
|
|
57514
|
-
kind:
|
|
57527
|
+
kind: graphql7.Kind.FIELD,
|
|
57515
57528
|
name: {
|
|
57516
|
-
kind:
|
|
57529
|
+
kind: graphql7.Kind.NAME,
|
|
57517
57530
|
value: "endCursor"
|
|
57518
57531
|
}
|
|
57519
57532
|
}
|
|
@@ -57527,15 +57540,15 @@ async function addListFragments(config2, documents) {
|
|
|
57527
57540
|
const lists = {};
|
|
57528
57541
|
const errors = [];
|
|
57529
57542
|
for (const doc of documents) {
|
|
57530
|
-
doc.document =
|
|
57543
|
+
doc.document = graphql8.visit(doc.document, {
|
|
57531
57544
|
Directive(node, key, parent, path2, ancestors) {
|
|
57532
57545
|
if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
57533
57546
|
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
57534
57547
|
let error = {
|
|
57535
|
-
...new
|
|
57548
|
+
...new graphql8.GraphQLError(
|
|
57536
57549
|
"",
|
|
57537
57550
|
node,
|
|
57538
|
-
new
|
|
57551
|
+
new graphql8.Source(""),
|
|
57539
57552
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
57540
57553
|
path2
|
|
57541
57554
|
),
|
|
@@ -57587,7 +57600,7 @@ async function addListFragments(config2, documents) {
|
|
|
57587
57600
|
{
|
|
57588
57601
|
kind: "Argument",
|
|
57589
57602
|
name: {
|
|
57590
|
-
kind:
|
|
57603
|
+
kind: graphql8.Kind.NAME,
|
|
57591
57604
|
value: "connection"
|
|
57592
57605
|
},
|
|
57593
57606
|
value: {
|
|
@@ -57637,7 +57650,7 @@ async function addListFragments(config2, documents) {
|
|
|
57637
57650
|
const validDeletes = [
|
|
57638
57651
|
...new Set(
|
|
57639
57652
|
Object.values(lists).map(({ type }) => {
|
|
57640
|
-
if (!(type instanceof
|
|
57653
|
+
if (!(type instanceof graphql8.GraphQLObjectType)) {
|
|
57641
57654
|
return "";
|
|
57642
57655
|
}
|
|
57643
57656
|
if (config2.keyFieldsForType(type.name).length !== 1) {
|
|
@@ -57651,7 +57664,7 @@ async function addListFragments(config2, documents) {
|
|
|
57651
57664
|
return;
|
|
57652
57665
|
}
|
|
57653
57666
|
const generatedDoc = {
|
|
57654
|
-
kind:
|
|
57667
|
+
kind: graphql8.Kind.DOCUMENT,
|
|
57655
57668
|
definitions: Object.entries(lists).flatMap(
|
|
57656
57669
|
([name2, { selection: selection2, type }]) => {
|
|
57657
57670
|
const schemaType = config2.schema.getType(type.name);
|
|
@@ -57659,7 +57672,7 @@ async function addListFragments(config2, documents) {
|
|
|
57659
57672
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
57660
57673
|
}
|
|
57661
57674
|
const fragmentSelection = {
|
|
57662
|
-
kind:
|
|
57675
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57663
57676
|
selections: [...selection2.selections]
|
|
57664
57677
|
};
|
|
57665
57678
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
@@ -57674,14 +57687,14 @@ async function addListFragments(config2, documents) {
|
|
|
57674
57687
|
{
|
|
57675
57688
|
name: {
|
|
57676
57689
|
value: config2.listInsertFragment(name2),
|
|
57677
|
-
kind:
|
|
57690
|
+
kind: graphql8.Kind.NAME
|
|
57678
57691
|
},
|
|
57679
|
-
kind:
|
|
57692
|
+
kind: graphql8.Kind.FRAGMENT_DEFINITION,
|
|
57680
57693
|
selectionSet: fragmentSelection,
|
|
57681
57694
|
typeCondition: {
|
|
57682
|
-
kind:
|
|
57695
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57683
57696
|
name: {
|
|
57684
|
-
kind:
|
|
57697
|
+
kind: graphql8.Kind.NAME,
|
|
57685
57698
|
value: type.name
|
|
57686
57699
|
}
|
|
57687
57700
|
}
|
|
@@ -57689,32 +57702,32 @@ async function addListFragments(config2, documents) {
|
|
|
57689
57702
|
{
|
|
57690
57703
|
name: {
|
|
57691
57704
|
value: config2.listToggleFragment(name2),
|
|
57692
|
-
kind:
|
|
57705
|
+
kind: graphql8.Kind.NAME
|
|
57693
57706
|
},
|
|
57694
|
-
kind:
|
|
57707
|
+
kind: graphql8.Kind.FRAGMENT_DEFINITION,
|
|
57695
57708
|
selectionSet: fragmentSelection,
|
|
57696
57709
|
typeCondition: {
|
|
57697
|
-
kind:
|
|
57710
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57698
57711
|
name: {
|
|
57699
|
-
kind:
|
|
57712
|
+
kind: graphql8.Kind.NAME,
|
|
57700
57713
|
value: type.name
|
|
57701
57714
|
}
|
|
57702
57715
|
}
|
|
57703
57716
|
},
|
|
57704
57717
|
{
|
|
57705
|
-
kind:
|
|
57718
|
+
kind: graphql8.Kind.FRAGMENT_DEFINITION,
|
|
57706
57719
|
name: {
|
|
57707
57720
|
value: config2.listRemoveFragment(name2),
|
|
57708
|
-
kind:
|
|
57721
|
+
kind: graphql8.Kind.NAME
|
|
57709
57722
|
},
|
|
57710
57723
|
selectionSet: {
|
|
57711
|
-
kind:
|
|
57724
|
+
kind: graphql8.Kind.SELECTION_SET,
|
|
57712
57725
|
selections: [...objectIdentificationSelection(config2, type)]
|
|
57713
57726
|
},
|
|
57714
57727
|
typeCondition: {
|
|
57715
|
-
kind:
|
|
57728
|
+
kind: graphql8.Kind.NAMED_TYPE,
|
|
57716
57729
|
name: {
|
|
57717
|
-
kind:
|
|
57730
|
+
kind: graphql8.Kind.NAME,
|
|
57718
57731
|
value: type.name
|
|
57719
57732
|
}
|
|
57720
57733
|
}
|
|
@@ -57723,14 +57736,14 @@ async function addListFragments(config2, documents) {
|
|
|
57723
57736
|
}
|
|
57724
57737
|
).concat(
|
|
57725
57738
|
...validDeletes.map((typeName) => ({
|
|
57726
|
-
kind:
|
|
57739
|
+
kind: graphql8.Kind.DIRECTIVE_DEFINITION,
|
|
57727
57740
|
name: {
|
|
57728
|
-
kind:
|
|
57741
|
+
kind: graphql8.Kind.NAME,
|
|
57729
57742
|
value: config2.listDeleteDirective(typeName)
|
|
57730
57743
|
},
|
|
57731
57744
|
locations: [
|
|
57732
57745
|
{
|
|
57733
|
-
kind:
|
|
57746
|
+
kind: graphql8.Kind.NAME,
|
|
57734
57747
|
value: "FIELD"
|
|
57735
57748
|
}
|
|
57736
57749
|
],
|
|
@@ -57738,8 +57751,8 @@ async function addListFragments(config2, documents) {
|
|
|
57738
57751
|
}))
|
|
57739
57752
|
)
|
|
57740
57753
|
};
|
|
57741
|
-
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
57742
|
-
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
57754
|
+
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql8.print).join("\n\n");
|
|
57755
|
+
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql8.print).join("\n\n");
|
|
57743
57756
|
documents.push({
|
|
57744
57757
|
name: "generated::lists",
|
|
57745
57758
|
kind: "HoudiniFragment" /* Fragment */,
|
|
@@ -57824,11 +57837,11 @@ var nodeNotDefinedMessage = (config2) => `Looks like you are trying to use the $
|
|
|
57824
57837
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
57825
57838
|
|
|
57826
57839
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
57827
|
-
var
|
|
57840
|
+
var graphql9 = __toESM(require_graphql2(), 1);
|
|
57828
57841
|
function fieldKey(config2, field) {
|
|
57829
57842
|
const attributeName = field.alias?.value || field.name.value;
|
|
57830
|
-
const printed =
|
|
57831
|
-
const secondParse =
|
|
57843
|
+
const printed = graphql9.print(field);
|
|
57844
|
+
const secondParse = graphql9.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
57832
57845
|
const paginated = !!field.directives?.find(
|
|
57833
57846
|
(directive) => directive.name.value === config2.paginateDirective
|
|
57834
57847
|
);
|
|
@@ -57923,8 +57936,8 @@ function selection({
|
|
|
57923
57936
|
const typeConditionName = field.typeCondition.name.value;
|
|
57924
57937
|
const typeCondition = config2.schema.getType(typeConditionName);
|
|
57925
57938
|
const possibleTypes = [];
|
|
57926
|
-
if (!
|
|
57927
|
-
} else if (
|
|
57939
|
+
if (!graphql10.isAbstractType(typeCondition)) {
|
|
57940
|
+
} else if (graphql10.isAbstractType(parentType)) {
|
|
57928
57941
|
const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
57929
57942
|
for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
|
|
57930
57943
|
if (possibleParentTypes.includes(possible.name)) {
|
|
@@ -57972,7 +57985,7 @@ function selection({
|
|
|
57972
57985
|
} else {
|
|
57973
57986
|
let typeRef = type.getFields()[field.name.value].type;
|
|
57974
57987
|
fieldType = getRootType(typeRef);
|
|
57975
|
-
nullable = !
|
|
57988
|
+
nullable = !graphql10.isNonNullType(typeRef);
|
|
57976
57989
|
}
|
|
57977
57990
|
const typeName = fieldType.toString();
|
|
57978
57991
|
const pathSoFar = path2.concat(attributeName);
|
|
@@ -58037,7 +58050,7 @@ function selection({
|
|
|
58037
58050
|
{}
|
|
58038
58051
|
);
|
|
58039
58052
|
}
|
|
58040
|
-
if (
|
|
58053
|
+
if (graphql10.isInterfaceType(fieldType) || graphql10.isUnionType(fieldType)) {
|
|
58041
58054
|
fieldObj.abstract = true;
|
|
58042
58055
|
}
|
|
58043
58056
|
object.fields = {
|
|
@@ -58094,7 +58107,7 @@ function artifactGenerator(stats) {
|
|
|
58094
58107
|
return async function(config2, docs) {
|
|
58095
58108
|
const filterTypes = {};
|
|
58096
58109
|
for (const doc of docs) {
|
|
58097
|
-
|
|
58110
|
+
graphql11.visit(doc.document, {
|
|
58098
58111
|
Directive(node, _, __, ___, ancestors) {
|
|
58099
58112
|
if (node.name.value !== config2.listDirective) {
|
|
58100
58113
|
return;
|
|
@@ -58153,7 +58166,7 @@ function artifactGenerator(stats) {
|
|
|
58153
58166
|
return;
|
|
58154
58167
|
}
|
|
58155
58168
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
58156
|
-
let documentWithoutInternalDirectives =
|
|
58169
|
+
let documentWithoutInternalDirectives = graphql11.visit(document, {
|
|
58157
58170
|
Directive(node) {
|
|
58158
58171
|
if (config2.isInternalDirective(node)) {
|
|
58159
58172
|
return null;
|
|
@@ -58166,7 +58179,7 @@ function artifactGenerator(stats) {
|
|
|
58166
58179
|
}
|
|
58167
58180
|
}
|
|
58168
58181
|
});
|
|
58169
|
-
let documentWithoutExtraVariables =
|
|
58182
|
+
let documentWithoutExtraVariables = graphql11.visit(
|
|
58170
58183
|
documentWithoutInternalDirectives,
|
|
58171
58184
|
{
|
|
58172
58185
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -58177,13 +58190,13 @@ function artifactGenerator(stats) {
|
|
|
58177
58190
|
}
|
|
58178
58191
|
}
|
|
58179
58192
|
);
|
|
58180
|
-
let rawString =
|
|
58193
|
+
let rawString = graphql11.print(documentWithoutExtraVariables);
|
|
58181
58194
|
let docKind = doc.kind;
|
|
58182
58195
|
const operations = document.definitions.filter(
|
|
58183
|
-
({ kind }) => kind ===
|
|
58196
|
+
({ kind }) => kind === graphql11.Kind.OPERATION_DEFINITION
|
|
58184
58197
|
);
|
|
58185
58198
|
const fragments = document.definitions.filter(
|
|
58186
|
-
({ kind }) => kind ===
|
|
58199
|
+
({ kind }) => kind === graphql11.Kind.FRAGMENT_DEFINITION
|
|
58187
58200
|
);
|
|
58188
58201
|
let rootType = "";
|
|
58189
58202
|
let selectionSet;
|
|
@@ -58425,15 +58438,15 @@ async function generatePluginRuntime(config2, plugin) {
|
|
|
58425
58438
|
var recast12 = __toESM(require_main2(), 1);
|
|
58426
58439
|
|
|
58427
58440
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
58428
|
-
var
|
|
58441
|
+
var graphql14 = __toESM(require_graphql2(), 1);
|
|
58429
58442
|
var recast9 = __toESM(require_main2(), 1);
|
|
58430
58443
|
|
|
58431
58444
|
// src/codegen/generators/typescript/typeReference.ts
|
|
58432
|
-
var
|
|
58445
|
+
var graphql13 = __toESM(require_graphql2(), 1);
|
|
58433
58446
|
var recast8 = __toESM(require_main2(), 1);
|
|
58434
58447
|
|
|
58435
58448
|
// src/codegen/generators/typescript/types.ts
|
|
58436
|
-
var
|
|
58449
|
+
var graphql12 = __toESM(require_graphql2(), 1);
|
|
58437
58450
|
var recast7 = __toESM(require_main2(), 1);
|
|
58438
58451
|
var AST7 = recast7.types.builders;
|
|
58439
58452
|
function readonlyProperty(prop, enable = true) {
|
|
@@ -58467,7 +58480,7 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
58467
58480
|
return AST7.tsStringKeyword();
|
|
58468
58481
|
}
|
|
58469
58482
|
default: {
|
|
58470
|
-
if (
|
|
58483
|
+
if (graphql12.isNonNullType(target) && "ofType" in target) {
|
|
58471
58484
|
return scalarPropertyValue(
|
|
58472
58485
|
config2,
|
|
58473
58486
|
missingScalars,
|
|
@@ -58488,7 +58501,7 @@ var AST8 = recast8.types.builders;
|
|
|
58488
58501
|
function tsTypeReference(config2, missingScalars, definition) {
|
|
58489
58502
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
58490
58503
|
let result;
|
|
58491
|
-
if (
|
|
58504
|
+
if (graphql13.isScalarType(type)) {
|
|
58492
58505
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58493
58506
|
} else {
|
|
58494
58507
|
result = AST8.tsTypeReference(AST8.identifier(type.name));
|
|
@@ -58509,17 +58522,17 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
58509
58522
|
var AST9 = recast9.types.builders;
|
|
58510
58523
|
function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
58511
58524
|
const { type } = unwrapType(config2, rootType);
|
|
58512
|
-
if (
|
|
58525
|
+
if (graphql14.isScalarType(type)) {
|
|
58513
58526
|
return;
|
|
58514
58527
|
}
|
|
58515
58528
|
if (visitedTypes.has(type.name)) {
|
|
58516
58529
|
return;
|
|
58517
58530
|
}
|
|
58518
|
-
if (
|
|
58531
|
+
if (graphql14.isUnionType(type)) {
|
|
58519
58532
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
58520
58533
|
}
|
|
58521
58534
|
visitedTypes.add(type.name);
|
|
58522
|
-
if (
|
|
58535
|
+
if (graphql14.isEnumType(type)) {
|
|
58523
58536
|
ensureImports({
|
|
58524
58537
|
config: config2,
|
|
58525
58538
|
body,
|
|
@@ -58536,7 +58549,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
58536
58549
|
AST9.tsPropertySignature(
|
|
58537
58550
|
AST9.identifier(field.name),
|
|
58538
58551
|
AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
58539
|
-
|
|
58552
|
+
graphql14.isNullableType(field.type)
|
|
58540
58553
|
)
|
|
58541
58554
|
);
|
|
58542
58555
|
}
|
|
@@ -58544,7 +58557,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
58544
58557
|
}
|
|
58545
58558
|
|
|
58546
58559
|
// src/codegen/generators/typescript/imperativeCache.ts
|
|
58547
|
-
var
|
|
58560
|
+
var graphql15 = __toESM(require_graphql2(), 1);
|
|
58548
58561
|
var recast10 = __toESM(require_main2(), 1);
|
|
58549
58562
|
var AST10 = recast10.types.builders;
|
|
58550
58563
|
async function imperativeCacheTypef(config2, docs) {
|
|
@@ -58580,7 +58593,7 @@ function typeDefinitions(config2, body) {
|
|
|
58580
58593
|
const operationTypes = [config2.schema.getMutationType(), config2.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
|
|
58581
58594
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
58582
58595
|
const types14 = Object.values(config2.schema.getTypeMap()).filter(
|
|
58583
|
-
(type) => !
|
|
58596
|
+
(type) => !graphql15.isAbstractType(type) && !graphql15.isScalarType(type) && !graphql15.isEnumType(type) && !graphql15.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
|
|
58584
58597
|
);
|
|
58585
58598
|
return AST10.tsTypeLiteral(
|
|
58586
58599
|
types14.map((type) => {
|
|
@@ -58590,7 +58603,7 @@ function typeDefinitions(config2, body) {
|
|
|
58590
58603
|
}
|
|
58591
58604
|
let idFields = AST10.tsNeverKeyword();
|
|
58592
58605
|
const keys = keyFieldsForType(config2.configFile, type.name);
|
|
58593
|
-
if (
|
|
58606
|
+
if (graphql15.isObjectType(type) && keys.length > 0 && keys.every((key) => type.getFields()[key])) {
|
|
58594
58607
|
idFields = AST10.tsTypeLiteral(
|
|
58595
58608
|
keys.map((key) => {
|
|
58596
58609
|
const fieldType = type.getFields()[key];
|
|
@@ -58607,21 +58620,21 @@ function typeDefinitions(config2, body) {
|
|
|
58607
58620
|
idFields = AST10.tsTypeLiteral([]);
|
|
58608
58621
|
}
|
|
58609
58622
|
let fields = AST10.tsTypeLiteral([]);
|
|
58610
|
-
if (
|
|
58623
|
+
if (graphql15.isObjectType(type)) {
|
|
58611
58624
|
fields = AST10.tsTypeLiteral(
|
|
58612
58625
|
Object.entries(type.getFields()).map(
|
|
58613
58626
|
([key, fieldType]) => {
|
|
58614
58627
|
const unwrapped = unwrapType(config2, fieldType.type);
|
|
58615
58628
|
let typeOptions = AST10.tsUnionType([]);
|
|
58616
|
-
if (
|
|
58629
|
+
if (graphql15.isScalarType(unwrapped.type)) {
|
|
58617
58630
|
typeOptions.types.push(
|
|
58618
58631
|
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
58619
58632
|
);
|
|
58620
|
-
} else if (
|
|
58633
|
+
} else if (graphql15.isEnumType(unwrapped.type)) {
|
|
58621
58634
|
typeOptions.types.push(
|
|
58622
58635
|
AST10.tsTypeReference(AST10.identifier(unwrapped.type.name))
|
|
58623
58636
|
);
|
|
58624
|
-
} else if (!
|
|
58637
|
+
} else if (!graphql15.isAbstractType(unwrapped.type)) {
|
|
58625
58638
|
typeOptions.types.push(record(unwrapped.type.name));
|
|
58626
58639
|
} else {
|
|
58627
58640
|
typeOptions.types.push(
|
|
@@ -58707,7 +58720,7 @@ function listDefinitions(config2, docs) {
|
|
|
58707
58720
|
const lists = [];
|
|
58708
58721
|
const visitedLists = /* @__PURE__ */ new Set();
|
|
58709
58722
|
for (const doc of docs) {
|
|
58710
|
-
|
|
58723
|
+
graphql15.visit(doc.document, {
|
|
58711
58724
|
Directive(node, key, parent, path2, ancestors) {
|
|
58712
58725
|
if (![config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
58713
58726
|
return;
|
|
@@ -58727,7 +58740,7 @@ function listDefinitions(config2, docs) {
|
|
|
58727
58740
|
const targetFieldDefinition = parentType.getFields()[targetField.name.value];
|
|
58728
58741
|
const { type: listType } = unwrapType(config2, targetFieldDefinition.type);
|
|
58729
58742
|
const possibleTypes = [];
|
|
58730
|
-
if (
|
|
58743
|
+
if (graphql15.isAbstractType(listType)) {
|
|
58731
58744
|
possibleTypes.push(
|
|
58732
58745
|
...config2.schema.getPossibleTypes(listType).map((possible) => possible.name)
|
|
58733
58746
|
);
|
|
@@ -58791,7 +58804,7 @@ function record(name2) {
|
|
|
58791
58804
|
}
|
|
58792
58805
|
|
|
58793
58806
|
// src/codegen/generators/typescript/inlineType.ts
|
|
58794
|
-
var
|
|
58807
|
+
var graphql16 = __toESM(require_graphql2(), 1);
|
|
58795
58808
|
var recast11 = __toESM(require_main2(), 1);
|
|
58796
58809
|
var AST11 = recast11.types.builders;
|
|
58797
58810
|
var fragmentKey = "$fragments";
|
|
@@ -58810,9 +58823,9 @@ function inlineType({
|
|
|
58810
58823
|
}) {
|
|
58811
58824
|
const { type, wrappers } = unwrapType(config2, rootType);
|
|
58812
58825
|
let result;
|
|
58813
|
-
if (
|
|
58826
|
+
if (graphql16.isScalarType(type)) {
|
|
58814
58827
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
58815
|
-
} else if (
|
|
58828
|
+
} else if (graphql16.isEnumType(type)) {
|
|
58816
58829
|
if (!visitedTypes.has(type.name)) {
|
|
58817
58830
|
ensureImports({
|
|
58818
58831
|
config: config2,
|
|
@@ -58830,11 +58843,11 @@ function inlineType({
|
|
|
58830
58843
|
for (const selection2 of selections) {
|
|
58831
58844
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
58832
58845
|
const fragmentType = config2.schema.getType(selection2.typeCondition.name.value);
|
|
58833
|
-
if (!
|
|
58846
|
+
if (!graphql16.isInterfaceType(type) && !graphql16.isUnionType(type)) {
|
|
58834
58847
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
58835
58848
|
continue;
|
|
58836
58849
|
}
|
|
58837
|
-
if (!
|
|
58850
|
+
if (!graphql16.isInterfaceType(fragmentType) && !graphql16.isUnionType(fragmentType)) {
|
|
58838
58851
|
if (!inlineFragments[fragmentType.name]) {
|
|
58839
58852
|
inlineFragments[fragmentType.name] = [];
|
|
58840
58853
|
}
|
|
@@ -58954,7 +58967,7 @@ function inlineType({
|
|
|
58954
58967
|
}
|
|
58955
58968
|
}
|
|
58956
58969
|
}
|
|
58957
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
58970
|
+
if (objectType.type === "TSTypeLiteral" && !graphql16.isInterfaceType(fragmentRootType) && !graphql16.isUnionType(fragmentRootType)) {
|
|
58958
58971
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
58959
58972
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
58960
58973
|
);
|
|
@@ -59021,7 +59034,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
59021
59034
|
},
|
|
59022
59035
|
type: schema.getType("String")
|
|
59023
59036
|
};
|
|
59024
|
-
} else if (
|
|
59037
|
+
} else if (graphql16.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
59025
59038
|
fields = rootType.ofType.getFields();
|
|
59026
59039
|
} else {
|
|
59027
59040
|
fields = rootType.getFields();
|
|
@@ -59033,7 +59046,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
59033
59046
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
59034
59047
|
});
|
|
59035
59048
|
}
|
|
59036
|
-
const fieldType =
|
|
59049
|
+
const fieldType = graphql16.getNamedType(field.type);
|
|
59037
59050
|
if (!fieldType) {
|
|
59038
59051
|
throw new HoudiniError({
|
|
59039
59052
|
filepath,
|
|
@@ -59354,7 +59367,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
59354
59367
|
}
|
|
59355
59368
|
|
|
59356
59369
|
// src/codegen/generators/persistedQueries/index.ts
|
|
59357
|
-
var
|
|
59370
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
59358
59371
|
async function persistOutputGenerator(config2, docs) {
|
|
59359
59372
|
if (typeof config2.persistedQueryPath !== "string" || config2.persistedQueryPath.length === 0)
|
|
59360
59373
|
return;
|
|
@@ -59366,8 +59379,8 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59366
59379
|
if (!generateArtifact) {
|
|
59367
59380
|
return acc;
|
|
59368
59381
|
}
|
|
59369
|
-
let rawString =
|
|
59370
|
-
|
|
59382
|
+
let rawString = graphql17.print(
|
|
59383
|
+
graphql17.visit(document, {
|
|
59371
59384
|
Directive(node) {
|
|
59372
59385
|
if (config2.isInternalDirective(node)) {
|
|
59373
59386
|
return null;
|
|
@@ -59376,7 +59389,7 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59376
59389
|
})
|
|
59377
59390
|
);
|
|
59378
59391
|
const operations = document.definitions.filter(
|
|
59379
|
-
({ kind }) => kind ===
|
|
59392
|
+
({ kind }) => kind === graphql17.Kind.OPERATION_DEFINITION
|
|
59380
59393
|
);
|
|
59381
59394
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
59382
59395
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -59389,11 +59402,11 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
59389
59402
|
}
|
|
59390
59403
|
|
|
59391
59404
|
// src/codegen/generators/definitions/enums.ts
|
|
59392
|
-
var
|
|
59405
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
59393
59406
|
var recast13 = __toESM(require_main2(), 1);
|
|
59394
59407
|
var AST13 = recast13.types.builders;
|
|
59395
59408
|
async function definitionsGenerator(config2) {
|
|
59396
|
-
const enums =
|
|
59409
|
+
const enums = graphql18.parse(graphql18.printSchema(config2.schema)).definitions.filter(
|
|
59397
59410
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
59398
59411
|
).filter((def) => !config2.isInternalEnum(def));
|
|
59399
59412
|
const runtimeDefinitions = recast13.print(
|
|
@@ -59566,7 +59579,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
59566
59579
|
}
|
|
59567
59580
|
|
|
59568
59581
|
// src/codegen/transforms/schema.ts
|
|
59569
|
-
var
|
|
59582
|
+
var graphql20 = __toESM(require_graphql2(), 1);
|
|
59570
59583
|
async function graphqlExtensions(config2, documents) {
|
|
59571
59584
|
const internalSchema = `
|
|
59572
59585
|
enum CachePolicy {
|
|
@@ -59644,19 +59657,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
59644
59657
|
"""
|
|
59645
59658
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
59646
59659
|
`;
|
|
59647
|
-
let currentSchema =
|
|
59660
|
+
let currentSchema = graphql20.printSchema(config2.schema);
|
|
59648
59661
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
59649
59662
|
currentSchema += internalSchema;
|
|
59650
59663
|
}
|
|
59651
59664
|
config2.newSchema += internalSchema;
|
|
59652
|
-
config2.schema =
|
|
59665
|
+
config2.schema = graphql20.buildSchema(currentSchema);
|
|
59653
59666
|
}
|
|
59654
59667
|
|
|
59655
59668
|
// src/codegen/transforms/typename.ts
|
|
59656
|
-
var
|
|
59669
|
+
var graphql21 = __toESM(require_graphql2(), 1);
|
|
59657
59670
|
async function addTypename(config2, documents) {
|
|
59658
59671
|
for (const doc of documents) {
|
|
59659
|
-
doc.document =
|
|
59672
|
+
doc.document = graphql21.visit(doc.document, {
|
|
59660
59673
|
Field(node, key, parent, path2, ancestors) {
|
|
59661
59674
|
if (!node.selectionSet) {
|
|
59662
59675
|
return;
|
|
@@ -59668,7 +59681,7 @@ async function addTypename(config2, documents) {
|
|
|
59668
59681
|
);
|
|
59669
59682
|
const field = type.getFields()[node.name.value];
|
|
59670
59683
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59671
|
-
if (
|
|
59684
|
+
if (graphql21.isInterfaceType(fieldType) || graphql21.isUnionType(fieldType)) {
|
|
59672
59685
|
return {
|
|
59673
59686
|
...node,
|
|
59674
59687
|
selectionSet: {
|
|
@@ -59676,9 +59689,9 @@ async function addTypename(config2, documents) {
|
|
|
59676
59689
|
selections: [
|
|
59677
59690
|
...node.selectionSet.selections,
|
|
59678
59691
|
{
|
|
59679
|
-
kind:
|
|
59692
|
+
kind: graphql21.Kind.FIELD,
|
|
59680
59693
|
name: {
|
|
59681
|
-
kind:
|
|
59694
|
+
kind: graphql21.Kind.NAME,
|
|
59682
59695
|
value: "__typename"
|
|
59683
59696
|
}
|
|
59684
59697
|
}
|
|
@@ -59692,10 +59705,10 @@ async function addTypename(config2, documents) {
|
|
|
59692
59705
|
}
|
|
59693
59706
|
|
|
59694
59707
|
// src/codegen/transforms/addID.ts
|
|
59695
|
-
var
|
|
59708
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
59696
59709
|
async function addID(config2, documents) {
|
|
59697
59710
|
for (const doc of documents) {
|
|
59698
|
-
doc.document =
|
|
59711
|
+
doc.document = graphql22.visit(doc.document, {
|
|
59699
59712
|
Field(node, key, parent, path2, ancestors) {
|
|
59700
59713
|
if (!node.selectionSet) {
|
|
59701
59714
|
return;
|
|
@@ -59708,7 +59721,7 @@ async function addID(config2, documents) {
|
|
|
59708
59721
|
const field = type.getFields()[node.name.value];
|
|
59709
59722
|
const fieldType = unwrapType(config2, field.type).type;
|
|
59710
59723
|
if (node.selectionSet?.selections.length > 0) {
|
|
59711
|
-
if (!
|
|
59724
|
+
if (!graphql22.isObjectType(fieldType) && !graphql22.isInterfaceType(fieldType)) {
|
|
59712
59725
|
return;
|
|
59713
59726
|
}
|
|
59714
59727
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -59723,9 +59736,9 @@ async function addID(config2, documents) {
|
|
|
59723
59736
|
continue;
|
|
59724
59737
|
}
|
|
59725
59738
|
selections.push({
|
|
59726
|
-
kind:
|
|
59739
|
+
kind: graphql22.Kind.FIELD,
|
|
59727
59740
|
name: {
|
|
59728
|
-
kind:
|
|
59741
|
+
kind: graphql22.Kind.NAME,
|
|
59729
59742
|
value: keyField
|
|
59730
59743
|
}
|
|
59731
59744
|
});
|
|
@@ -59744,8 +59757,8 @@ async function addID(config2, documents) {
|
|
|
59744
59757
|
}
|
|
59745
59758
|
|
|
59746
59759
|
// src/codegen/transforms/fragmentVariables.ts
|
|
59747
|
-
var
|
|
59748
|
-
var GraphqlKinds2 =
|
|
59760
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
59761
|
+
var GraphqlKinds2 = graphql23.Kind;
|
|
59749
59762
|
async function fragmentVariables(config2, documents) {
|
|
59750
59763
|
const fragments = collectFragments(config2, documents);
|
|
59751
59764
|
const generatedFragments = {};
|
|
@@ -59768,7 +59781,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
59768
59781
|
});
|
|
59769
59782
|
}
|
|
59770
59783
|
const doc = {
|
|
59771
|
-
kind:
|
|
59784
|
+
kind: graphql23.Kind.DOCUMENT,
|
|
59772
59785
|
definitions: Object.values(generatedFragments)
|
|
59773
59786
|
};
|
|
59774
59787
|
documents.push({
|
|
@@ -59804,7 +59817,7 @@ function inlineFragmentArgs({
|
|
|
59804
59817
|
filepath,
|
|
59805
59818
|
document
|
|
59806
59819
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
59807
|
-
const result =
|
|
59820
|
+
const result = graphql23.visit(document, {
|
|
59808
59821
|
FragmentSpread(node) {
|
|
59809
59822
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
59810
59823
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -59892,7 +59905,7 @@ function inlineFragmentArgs({
|
|
|
59892
59905
|
});
|
|
59893
59906
|
if (newName) {
|
|
59894
59907
|
result.name = {
|
|
59895
|
-
kind:
|
|
59908
|
+
kind: graphql23.Kind.NAME,
|
|
59896
59909
|
value: newName
|
|
59897
59910
|
};
|
|
59898
59911
|
}
|
|
@@ -60004,7 +60017,7 @@ function operationScope(operation) {
|
|
|
60004
60017
|
}
|
|
60005
60018
|
|
|
60006
60019
|
// src/codegen/validators/typeCheck.ts
|
|
60007
|
-
var
|
|
60020
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
60008
60021
|
async function typeCheck(config2, docs) {
|
|
60009
60022
|
const errors = [];
|
|
60010
60023
|
const freeLists = [];
|
|
@@ -60012,11 +60025,11 @@ async function typeCheck(config2, docs) {
|
|
|
60012
60025
|
const listTypes = [];
|
|
60013
60026
|
const fragments = {};
|
|
60014
60027
|
for (const { document: parsed, filename } of docs) {
|
|
60015
|
-
|
|
60016
|
-
[
|
|
60028
|
+
graphql24.visit(parsed, {
|
|
60029
|
+
[graphql24.Kind.FRAGMENT_DEFINITION](definition) {
|
|
60017
60030
|
fragments[definition.name.value] = definition;
|
|
60018
60031
|
},
|
|
60019
|
-
[
|
|
60032
|
+
[graphql24.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
60020
60033
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
60021
60034
|
return;
|
|
60022
60035
|
}
|
|
@@ -60062,14 +60075,14 @@ async function typeCheck(config2, docs) {
|
|
|
60062
60075
|
);
|
|
60063
60076
|
return;
|
|
60064
60077
|
}
|
|
60065
|
-
if (
|
|
60078
|
+
if (graphql24.isListType(rootType) || graphql24.isNonNullType(rootType) && graphql24.isListType(rootType.ofType)) {
|
|
60066
60079
|
needsParent = true;
|
|
60067
60080
|
break;
|
|
60068
60081
|
}
|
|
60069
|
-
if (
|
|
60082
|
+
if (graphql24.isNonNullType(rootType) && "ofType" in rootType) {
|
|
60070
60083
|
rootType = rootType.ofType;
|
|
60071
60084
|
}
|
|
60072
|
-
if (
|
|
60085
|
+
if (graphql24.isScalarType(rootType)) {
|
|
60073
60086
|
break;
|
|
60074
60087
|
}
|
|
60075
60088
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -60145,9 +60158,9 @@ async function typeCheck(config2, docs) {
|
|
|
60145
60158
|
);
|
|
60146
60159
|
}
|
|
60147
60160
|
let targetTypes = [type];
|
|
60148
|
-
if (
|
|
60161
|
+
if (graphql24.isUnionType(type)) {
|
|
60149
60162
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
60150
|
-
} else if (
|
|
60163
|
+
} else if (graphql24.isInterfaceType(type)) {
|
|
60151
60164
|
try {
|
|
60152
60165
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
60153
60166
|
if (!type.getFields()[key]) {
|
|
@@ -60185,13 +60198,13 @@ async function typeCheck(config2, docs) {
|
|
|
60185
60198
|
if (errors.length > 0) {
|
|
60186
60199
|
throw errors;
|
|
60187
60200
|
}
|
|
60188
|
-
const rules = (filepath) => [...
|
|
60201
|
+
const rules = (filepath) => [...graphql24.specifiedRules].filter(
|
|
60189
60202
|
(rule) => ![
|
|
60190
|
-
|
|
60191
|
-
|
|
60192
|
-
|
|
60193
|
-
|
|
60194
|
-
|
|
60203
|
+
graphql24.NoUnusedFragmentsRule,
|
|
60204
|
+
graphql24.KnownFragmentNamesRule,
|
|
60205
|
+
graphql24.ExecutableDefinitionsRule,
|
|
60206
|
+
graphql24.KnownDirectivesRule,
|
|
60207
|
+
graphql24.KnownArgumentNamesRule
|
|
60195
60208
|
].includes(rule)
|
|
60196
60209
|
).concat(
|
|
60197
60210
|
validateLists({
|
|
@@ -60210,7 +60223,7 @@ async function typeCheck(config2, docs) {
|
|
|
60210
60223
|
noUnusedFragmentArguments(config2)
|
|
60211
60224
|
);
|
|
60212
60225
|
for (const { filename, document: parsed } of docs) {
|
|
60213
|
-
for (const error of
|
|
60226
|
+
for (const error of graphql24.validate(config2.schema, parsed, rules(filename))) {
|
|
60214
60227
|
errors.push(
|
|
60215
60228
|
new HoudiniError({
|
|
60216
60229
|
filepath: filename,
|
|
@@ -60236,7 +60249,7 @@ var validateLists = ({
|
|
|
60236
60249
|
if (!config2.isListFragment(node.name.value)) {
|
|
60237
60250
|
if (!fragments[node.name.value]) {
|
|
60238
60251
|
ctx.reportError(
|
|
60239
|
-
new
|
|
60252
|
+
new graphql24.GraphQLError(
|
|
60240
60253
|
"Encountered unknown fragment: " + node.name.value
|
|
60241
60254
|
)
|
|
60242
60255
|
);
|
|
@@ -60246,7 +60259,7 @@ var validateLists = ({
|
|
|
60246
60259
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
60247
60260
|
if (!lists.includes(listName)) {
|
|
60248
60261
|
ctx.reportError(
|
|
60249
|
-
new
|
|
60262
|
+
new graphql24.GraphQLError(
|
|
60250
60263
|
"Encountered fragment referencing unknown list: " + listName
|
|
60251
60264
|
)
|
|
60252
60265
|
);
|
|
@@ -60271,7 +60284,7 @@ var validateLists = ({
|
|
|
60271
60284
|
);
|
|
60272
60285
|
if (parentArg) {
|
|
60273
60286
|
ctx.reportError(
|
|
60274
|
-
new
|
|
60287
|
+
new graphql24.GraphQLError(
|
|
60275
60288
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
60276
60289
|
)
|
|
60277
60290
|
);
|
|
@@ -60287,7 +60300,7 @@ var validateLists = ({
|
|
|
60287
60300
|
return;
|
|
60288
60301
|
}
|
|
60289
60302
|
ctx.reportError(
|
|
60290
|
-
new
|
|
60303
|
+
new graphql24.GraphQLError(
|
|
60291
60304
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
60292
60305
|
)
|
|
60293
60306
|
);
|
|
@@ -60297,7 +60310,7 @@ var validateLists = ({
|
|
|
60297
60310
|
const directiveName = node.name.value;
|
|
60298
60311
|
if (directiveName === "connection") {
|
|
60299
60312
|
ctx.reportError(
|
|
60300
|
-
new
|
|
60313
|
+
new graphql24.GraphQLError(
|
|
60301
60314
|
"@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."
|
|
60302
60315
|
)
|
|
60303
60316
|
);
|
|
@@ -60306,7 +60319,7 @@ var validateLists = ({
|
|
|
60306
60319
|
if (!config2.isInternalDirective(node)) {
|
|
60307
60320
|
if (!config2.schema.getDirective(directiveName)) {
|
|
60308
60321
|
ctx.reportError(
|
|
60309
|
-
new
|
|
60322
|
+
new graphql24.GraphQLError(
|
|
60310
60323
|
"Encountered unknown directive: " + directiveName
|
|
60311
60324
|
)
|
|
60312
60325
|
);
|
|
@@ -60315,7 +60328,7 @@ var validateLists = ({
|
|
|
60315
60328
|
}
|
|
60316
60329
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
60317
60330
|
ctx.reportError(
|
|
60318
|
-
new
|
|
60331
|
+
new graphql24.GraphQLError(
|
|
60319
60332
|
"Encountered directive referencing unknown list: " + directiveName
|
|
60320
60333
|
)
|
|
60321
60334
|
);
|
|
@@ -60326,7 +60339,7 @@ var validateLists = ({
|
|
|
60326
60339
|
};
|
|
60327
60340
|
function knownArguments(config2) {
|
|
60328
60341
|
return function(ctx) {
|
|
60329
|
-
const nativeValidator =
|
|
60342
|
+
const nativeValidator = graphql24.KnownArgumentNamesRule(ctx);
|
|
60330
60343
|
return {
|
|
60331
60344
|
...nativeValidator,
|
|
60332
60345
|
Directive(directiveNode) {
|
|
@@ -60359,7 +60372,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60359
60372
|
for (const arg of node.arguments || []) {
|
|
60360
60373
|
if (arg.value.kind !== "ObjectValue") {
|
|
60361
60374
|
ctx.reportError(
|
|
60362
|
-
new
|
|
60375
|
+
new graphql24.GraphQLError("values in @arguments must be an object")
|
|
60363
60376
|
);
|
|
60364
60377
|
return;
|
|
60365
60378
|
}
|
|
@@ -60369,13 +60382,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60369
60382
|
);
|
|
60370
60383
|
if (!typeArg) {
|
|
60371
60384
|
ctx.reportError(
|
|
60372
|
-
new
|
|
60385
|
+
new graphql24.GraphQLError("missing type field for @arguments directive")
|
|
60373
60386
|
);
|
|
60374
60387
|
return;
|
|
60375
60388
|
}
|
|
60376
|
-
if (typeArg.value.kind !==
|
|
60389
|
+
if (typeArg.value.kind !== graphql24.Kind.STRING) {
|
|
60377
60390
|
ctx.reportError(
|
|
60378
|
-
new
|
|
60391
|
+
new graphql24.GraphQLError("type field to @arguments must be a string")
|
|
60379
60392
|
);
|
|
60380
60393
|
return;
|
|
60381
60394
|
}
|
|
@@ -60388,7 +60401,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60388
60401
|
);
|
|
60389
60402
|
if (typeArg.value.value !== defaultValueType) {
|
|
60390
60403
|
ctx.reportError(
|
|
60391
|
-
new
|
|
60404
|
+
new graphql24.GraphQLError(
|
|
60392
60405
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
60393
60406
|
)
|
|
60394
60407
|
);
|
|
@@ -60406,7 +60419,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60406
60419
|
try {
|
|
60407
60420
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
60408
60421
|
} catch (e) {
|
|
60409
|
-
ctx.reportError(new
|
|
60422
|
+
ctx.reportError(new graphql24.GraphQLError(e.message));
|
|
60410
60423
|
return;
|
|
60411
60424
|
}
|
|
60412
60425
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -60429,7 +60442,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60429
60442
|
);
|
|
60430
60443
|
if (missing.length > 0) {
|
|
60431
60444
|
ctx.reportError(
|
|
60432
|
-
new
|
|
60445
|
+
new graphql24.GraphQLError(
|
|
60433
60446
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
60434
60447
|
)
|
|
60435
60448
|
);
|
|
@@ -60440,7 +60453,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60440
60453
|
);
|
|
60441
60454
|
if (unknown.length > 0) {
|
|
60442
60455
|
ctx.reportError(
|
|
60443
|
-
new
|
|
60456
|
+
new graphql24.GraphQLError(
|
|
60444
60457
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
60445
60458
|
)
|
|
60446
60459
|
);
|
|
@@ -60452,7 +60465,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60452
60465
|
]
|
|
60453
60466
|
);
|
|
60454
60467
|
for (const [applied, target] of zipped) {
|
|
60455
|
-
if (applied.value.kind ===
|
|
60468
|
+
if (applied.value.kind === graphql24.Kind.VARIABLE || applied.value.kind === graphql24.Kind.LIST || applied.value.kind === graphql24.Kind.OBJECT) {
|
|
60456
60469
|
continue;
|
|
60457
60470
|
}
|
|
60458
60471
|
const appliedType = applied.value.kind.substring(
|
|
@@ -60461,7 +60474,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
60461
60474
|
);
|
|
60462
60475
|
if (appliedType !== target) {
|
|
60463
60476
|
ctx.reportError(
|
|
60464
|
-
new
|
|
60477
|
+
new graphql24.GraphQLError(
|
|
60465
60478
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
60466
60479
|
)
|
|
60467
60480
|
);
|
|
@@ -60482,7 +60495,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60482
60495
|
}
|
|
60483
60496
|
if (alreadyPaginated) {
|
|
60484
60497
|
ctx.reportError(
|
|
60485
|
-
new
|
|
60498
|
+
new graphql24.GraphQLError(
|
|
60486
60499
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
60487
60500
|
)
|
|
60488
60501
|
);
|
|
@@ -60497,7 +60510,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60497
60510
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
60498
60511
|
if (hasRequiredArgs) {
|
|
60499
60512
|
ctx.reportError(
|
|
60500
|
-
new
|
|
60513
|
+
new graphql24.GraphQLError(
|
|
60501
60514
|
"@paginate cannot appear on a document with required args"
|
|
60502
60515
|
)
|
|
60503
60516
|
);
|
|
@@ -60529,14 +60542,14 @@ function paginateArgs(config2, filepath) {
|
|
|
60529
60542
|
const backwards = appliedArgs.has("last");
|
|
60530
60543
|
if (!forward && !backwards) {
|
|
60531
60544
|
ctx.reportError(
|
|
60532
|
-
new
|
|
60545
|
+
new graphql24.GraphQLError(
|
|
60533
60546
|
"A field with cursor-based pagination must have a first or last argument"
|
|
60534
60547
|
)
|
|
60535
60548
|
);
|
|
60536
60549
|
}
|
|
60537
60550
|
if (forward && backwards) {
|
|
60538
60551
|
ctx.reportError(
|
|
60539
|
-
new
|
|
60552
|
+
new graphql24.GraphQLError(
|
|
60540
60553
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
60541
60554
|
)
|
|
60542
60555
|
);
|
|
@@ -60550,7 +60563,7 @@ function paginateArgs(config2, filepath) {
|
|
|
60550
60563
|
);
|
|
60551
60564
|
if (!appliedLimitArg) {
|
|
60552
60565
|
ctx.reportError(
|
|
60553
|
-
new
|
|
60566
|
+
new graphql24.GraphQLError(
|
|
60554
60567
|
"A field with offset-based pagination must have a limit argument"
|
|
60555
60568
|
)
|
|
60556
60569
|
);
|
|
@@ -60566,20 +60579,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
60566
60579
|
const args = /* @__PURE__ */ new Set();
|
|
60567
60580
|
return {
|
|
60568
60581
|
enter(node) {
|
|
60569
|
-
if (node.kind ===
|
|
60582
|
+
if (node.kind === graphql24.Kind.FRAGMENT_DEFINITION) {
|
|
60570
60583
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
60571
60584
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
60572
60585
|
args.add(arg);
|
|
60573
60586
|
}
|
|
60574
|
-
} else if (node.kind ===
|
|
60587
|
+
} else if (node.kind === graphql24.Kind.VARIABLE) {
|
|
60575
60588
|
args.delete(node.name.value);
|
|
60576
60589
|
}
|
|
60577
60590
|
},
|
|
60578
60591
|
leave(node) {
|
|
60579
|
-
if (node.kind ===
|
|
60592
|
+
if (node.kind === graphql24.Kind.FRAGMENT_DEFINITION) {
|
|
60580
60593
|
if (args.size > 0) {
|
|
60581
60594
|
ctx.reportError(
|
|
60582
|
-
new
|
|
60595
|
+
new graphql24.GraphQLError(
|
|
60583
60596
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
60584
60597
|
)
|
|
60585
60598
|
);
|
|
@@ -60615,7 +60628,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60615
60628
|
if (definition.kind === "OperationDefinition") {
|
|
60616
60629
|
if (definition.operation !== "query") {
|
|
60617
60630
|
ctx.reportError(
|
|
60618
|
-
new
|
|
60631
|
+
new graphql24.GraphQLError(
|
|
60619
60632
|
`@${node.name.value} must fall on a fragment or query document`
|
|
60620
60633
|
)
|
|
60621
60634
|
);
|
|
@@ -60627,7 +60640,7 @@ function nodeDirectives(config2, directives) {
|
|
|
60627
60640
|
}
|
|
60628
60641
|
if (!possibleNodes.includes(definitionType)) {
|
|
60629
60642
|
ctx.reportError(
|
|
60630
|
-
new
|
|
60643
|
+
new graphql24.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
60631
60644
|
);
|
|
60632
60645
|
}
|
|
60633
60646
|
}
|
|
@@ -60646,7 +60659,7 @@ function checkMutationOperation(config2) {
|
|
|
60646
60659
|
);
|
|
60647
60660
|
if (append && prepend) {
|
|
60648
60661
|
ctx.reportError(
|
|
60649
|
-
new
|
|
60662
|
+
new graphql24.GraphQLError(
|
|
60650
60663
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
60651
60664
|
)
|
|
60652
60665
|
);
|
|
@@ -60660,7 +60673,7 @@ function checkMutationOperation(config2) {
|
|
|
60660
60673
|
);
|
|
60661
60674
|
if (parentId && allLists) {
|
|
60662
60675
|
ctx.reportError(
|
|
60663
|
-
new
|
|
60676
|
+
new graphql24.GraphQLError(
|
|
60664
60677
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
60665
60678
|
)
|
|
60666
60679
|
);
|
|
@@ -60682,7 +60695,7 @@ function checkMaskDirective(config2) {
|
|
|
60682
60695
|
);
|
|
60683
60696
|
if (maskEnableDirective && maskDisableDirective) {
|
|
60684
60697
|
ctx.reportError(
|
|
60685
|
-
new
|
|
60698
|
+
new graphql24.GraphQLError(
|
|
60686
60699
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
60687
60700
|
)
|
|
60688
60701
|
);
|
|
@@ -60698,7 +60711,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
60698
60711
|
if (!nodeInterface) {
|
|
60699
60712
|
return null;
|
|
60700
60713
|
}
|
|
60701
|
-
if (!
|
|
60714
|
+
if (!graphql24.isInterfaceType(nodeInterface)) {
|
|
60702
60715
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
60703
60716
|
return null;
|
|
60704
60717
|
}
|
|
@@ -60796,11 +60809,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
60796
60809
|
}
|
|
60797
60810
|
|
|
60798
60811
|
// src/codegen/validators/noIDAlias.ts
|
|
60799
|
-
var
|
|
60812
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
60800
60813
|
async function noIDAlias(config2, docs) {
|
|
60801
60814
|
const errors = [];
|
|
60802
60815
|
for (const { filename, document } of docs) {
|
|
60803
|
-
|
|
60816
|
+
graphql25.visit(document, {
|
|
60804
60817
|
Field(node, _, __, ___, ancestors) {
|
|
60805
60818
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
60806
60819
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -60998,12 +61011,12 @@ async function processJSFile(config2, contents) {
|
|
|
60998
61011
|
return documents;
|
|
60999
61012
|
}
|
|
61000
61013
|
async function processGraphQLDocument(config2, filepath, document) {
|
|
61001
|
-
const parsedDoc =
|
|
61014
|
+
const parsedDoc = graphql26.parse(document);
|
|
61002
61015
|
const operations = parsedDoc.definitions.filter(
|
|
61003
|
-
({ kind: kind2 }) => kind2 ===
|
|
61016
|
+
({ kind: kind2 }) => kind2 === graphql26.Kind.OPERATION_DEFINITION
|
|
61004
61017
|
);
|
|
61005
61018
|
const fragments = parsedDoc.definitions.filter(
|
|
61006
|
-
({ kind: kind2 }) => kind2 ===
|
|
61019
|
+
({ kind: kind2 }) => kind2 === graphql26.Kind.FRAGMENT_DEFINITION
|
|
61007
61020
|
);
|
|
61008
61021
|
if (operations.length > 1) {
|
|
61009
61022
|
throw new HoudiniError({
|