houdini 0.19.3 → 0.20.0
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 -313
- package/build/vite-esm/index.js +324 -313
- package/package.json +1 -1
- package/build/codegen/utils/graphql.d.ts +0 -15
package/build/cmd-esm/index.js
CHANGED
|
@@ -11513,7 +11513,7 @@ var require_graphql = __commonJS({
|
|
|
11513
11513
|
Object.defineProperty(exports, "__esModule", {
|
|
11514
11514
|
value: true
|
|
11515
11515
|
});
|
|
11516
|
-
exports.graphql =
|
|
11516
|
+
exports.graphql = graphql29;
|
|
11517
11517
|
exports.graphqlSync = graphqlSync;
|
|
11518
11518
|
var _isPromise = _interopRequireDefault(require_isPromise());
|
|
11519
11519
|
var _parser = require_parser();
|
|
@@ -11523,7 +11523,7 @@ var require_graphql = __commonJS({
|
|
|
11523
11523
|
function _interopRequireDefault(obj) {
|
|
11524
11524
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
11525
11525
|
}
|
|
11526
|
-
function
|
|
11526
|
+
function graphql29(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
11527
11527
|
var _arguments = arguments;
|
|
11528
11528
|
return new Promise(function(resolve2) {
|
|
11529
11529
|
return resolve2(
|
|
@@ -16468,9 +16468,9 @@ var require_graphql2 = __commonJS({
|
|
|
16468
16468
|
}
|
|
16469
16469
|
});
|
|
16470
16470
|
|
|
16471
|
-
// ../../node_modules/.pnpm/minimatch@5.1.
|
|
16471
|
+
// ../../node_modules/.pnpm/minimatch@5.1.2/node_modules/minimatch/lib/path.js
|
|
16472
16472
|
var require_path = __commonJS({
|
|
16473
|
-
"../../node_modules/.pnpm/minimatch@5.1.
|
|
16473
|
+
"../../node_modules/.pnpm/minimatch@5.1.2/node_modules/minimatch/lib/path.js"(exports, module) {
|
|
16474
16474
|
var isWindows = typeof process === "object" && process && process.platform === "win32";
|
|
16475
16475
|
module.exports = isWindows ? { sep: "\\" } : { sep: "/" };
|
|
16476
16476
|
}
|
|
@@ -16687,9 +16687,9 @@ var require_brace_expansion = __commonJS({
|
|
|
16687
16687
|
}
|
|
16688
16688
|
});
|
|
16689
16689
|
|
|
16690
|
-
// ../../node_modules/.pnpm/minimatch@5.1.
|
|
16690
|
+
// ../../node_modules/.pnpm/minimatch@5.1.2/node_modules/minimatch/minimatch.js
|
|
16691
16691
|
var require_minimatch = __commonJS({
|
|
16692
|
-
"../../node_modules/.pnpm/minimatch@5.1.
|
|
16692
|
+
"../../node_modules/.pnpm/minimatch@5.1.2/node_modules/minimatch/minimatch.js"(exports, module) {
|
|
16693
16693
|
var minimatch2 = module.exports = (p, pattern, options = {}) => {
|
|
16694
16694
|
assertValidPattern(pattern);
|
|
16695
16695
|
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
@@ -16775,7 +16775,9 @@ var require_minimatch = __commonJS({
|
|
|
16775
16775
|
return list;
|
|
16776
16776
|
};
|
|
16777
16777
|
var globUnescape = (s2) => s2.replace(/\\(.)/g, "$1");
|
|
16778
|
+
var charUnescape = (s2) => s2.replace(/\\([^-\]])/g, "$1");
|
|
16778
16779
|
var regExpEscape = (s2) => s2.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
16780
|
+
var braExpEscape = (s2) => s2.replace(/[[\]\\]/g, "\\$&");
|
|
16779
16781
|
var Minimatch = class {
|
|
16780
16782
|
constructor(pattern, options) {
|
|
16781
16783
|
assertValidPattern(pattern);
|
|
@@ -16967,6 +16969,10 @@ var require_minimatch = __commonJS({
|
|
|
16967
16969
|
return false;
|
|
16968
16970
|
}
|
|
16969
16971
|
case "\\":
|
|
16972
|
+
if (inClass && pattern.charAt(i2 + 1) === "-") {
|
|
16973
|
+
re += c;
|
|
16974
|
+
continue;
|
|
16975
|
+
}
|
|
16970
16976
|
clearStateChar();
|
|
16971
16977
|
escaping = true;
|
|
16972
16978
|
continue;
|
|
@@ -17049,17 +17055,13 @@ var require_minimatch = __commonJS({
|
|
|
17049
17055
|
}
|
|
17050
17056
|
cs = pattern.substring(classStart + 1, i2);
|
|
17051
17057
|
try {
|
|
17052
|
-
RegExp("[" + cs + "]");
|
|
17058
|
+
RegExp("[" + braExpEscape(charUnescape(cs)) + "]");
|
|
17059
|
+
re += c;
|
|
17053
17060
|
} catch (er) {
|
|
17054
|
-
|
|
17055
|
-
re = re.substring(0, reClassStart) + "\\[" + sp[0] + "\\]";
|
|
17056
|
-
hasMagic = hasMagic || sp[1];
|
|
17057
|
-
inClass = false;
|
|
17058
|
-
continue;
|
|
17061
|
+
re = re.substring(0, reClassStart) + "(?:$.)";
|
|
17059
17062
|
}
|
|
17060
17063
|
hasMagic = true;
|
|
17061
17064
|
inClass = false;
|
|
17062
|
-
re += c;
|
|
17063
17065
|
continue;
|
|
17064
17066
|
default:
|
|
17065
17067
|
clearStateChar();
|
|
@@ -29235,9 +29237,9 @@ var init_multipart_parser = __esm({
|
|
|
29235
29237
|
}
|
|
29236
29238
|
});
|
|
29237
29239
|
|
|
29238
|
-
// ../../node_modules/.pnpm/@babel+parser@7.20.
|
|
29240
|
+
// ../../node_modules/.pnpm/@babel+parser@7.20.7/node_modules/@babel/parser/lib/index.js
|
|
29239
29241
|
var require_lib3 = __commonJS({
|
|
29240
|
-
"../../node_modules/.pnpm/@babel+parser@7.20.
|
|
29242
|
+
"../../node_modules/.pnpm/@babel+parser@7.20.7/node_modules/@babel/parser/lib/index.js"(exports) {
|
|
29241
29243
|
"use strict";
|
|
29242
29244
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29243
29245
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
@@ -29353,9 +29355,9 @@ var require_lib3 = __commonJS({
|
|
|
29353
29355
|
AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.",
|
|
29354
29356
|
AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.",
|
|
29355
29357
|
AwaitNotInAsyncFunction: "'await' is only allowed within async functions.",
|
|
29356
|
-
BadGetterArity: "A 'get'
|
|
29357
|
-
BadSetterArity: "A 'set'
|
|
29358
|
-
BadSetterRestParameter: "A 'set'
|
|
29358
|
+
BadGetterArity: "A 'get' accessor must not have any formal parameters.",
|
|
29359
|
+
BadSetterArity: "A 'set' accessor must have exactly one formal parameter.",
|
|
29360
|
+
BadSetterRestParameter: "A 'set' accessor function argument must not be a rest parameter.",
|
|
29359
29361
|
ConstructorClassField: "Classes may not have a field named 'constructor'.",
|
|
29360
29362
|
ConstructorClassPrivateField: "Classes may not have a private field named '#constructor'.",
|
|
29361
29363
|
ConstructorIsAccessor: "Class constructor may not be an accessor.",
|
|
@@ -32789,7 +32791,7 @@ var require_lib3 = __commonJS({
|
|
|
32789
32791
|
}
|
|
32790
32792
|
this.parser.raise(toParseError, origin);
|
|
32791
32793
|
}
|
|
32792
|
-
|
|
32794
|
+
recordArrowParameterBindingError(error, {
|
|
32793
32795
|
at: node
|
|
32794
32796
|
}) {
|
|
32795
32797
|
const {
|
|
@@ -36548,6 +36550,7 @@ var require_lib3 = __commonJS({
|
|
|
36548
36550
|
}) => `Property '${propertyName}' cannot have an initializer because it is marked abstract.`,
|
|
36549
36551
|
AccesorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
|
|
36550
36552
|
AccesorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
|
|
36553
|
+
AccessorCannotBeOptional: "An 'accessor' property cannot be declared optional.",
|
|
36551
36554
|
ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
|
|
36552
36555
|
ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.",
|
|
36553
36556
|
ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
|
|
@@ -38510,8 +38513,12 @@ var require_lib3 = __commonJS({
|
|
|
38510
38513
|
node.typeParameters = typeParameters;
|
|
38511
38514
|
}
|
|
38512
38515
|
parseClassPropertyAnnotation(node) {
|
|
38513
|
-
if (!node.optional
|
|
38514
|
-
|
|
38516
|
+
if (!node.optional) {
|
|
38517
|
+
if (this.eat(35)) {
|
|
38518
|
+
node.definite = true;
|
|
38519
|
+
} else if (this.eat(17)) {
|
|
38520
|
+
node.optional = true;
|
|
38521
|
+
}
|
|
38515
38522
|
}
|
|
38516
38523
|
const type = this.tsTryParseTypeAnnotation();
|
|
38517
38524
|
if (type)
|
|
@@ -38550,6 +38557,15 @@ var require_lib3 = __commonJS({
|
|
|
38550
38557
|
this.parseClassPropertyAnnotation(node);
|
|
38551
38558
|
return super.parseClassPrivateProperty(node);
|
|
38552
38559
|
}
|
|
38560
|
+
parseClassAccessorProperty(node) {
|
|
38561
|
+
this.parseClassPropertyAnnotation(node);
|
|
38562
|
+
if (node.optional) {
|
|
38563
|
+
this.raise(TSErrors.AccessorCannotBeOptional, {
|
|
38564
|
+
at: node
|
|
38565
|
+
});
|
|
38566
|
+
}
|
|
38567
|
+
return super.parseClassAccessorProperty(node);
|
|
38568
|
+
}
|
|
38553
38569
|
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
|
|
38554
38570
|
const typeParameters = this.tsTryParseTypeParameters();
|
|
38555
38571
|
if (typeParameters && isConstructor) {
|
|
@@ -38760,7 +38776,7 @@ var require_lib3 = __commonJS({
|
|
|
38760
38776
|
case "TSNonNullExpression":
|
|
38761
38777
|
case "TSTypeAssertion":
|
|
38762
38778
|
if (isLHS) {
|
|
38763
|
-
this.expressionScope.
|
|
38779
|
+
this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, {
|
|
38764
38780
|
at: node
|
|
38765
38781
|
});
|
|
38766
38782
|
} else {
|
|
@@ -39467,7 +39483,7 @@ var require_lib3 = __commonJS({
|
|
|
39467
39483
|
parenthesized = unwrapParenthesizedExpression(node);
|
|
39468
39484
|
if (isLHS) {
|
|
39469
39485
|
if (parenthesized.type === "Identifier") {
|
|
39470
|
-
this.expressionScope.
|
|
39486
|
+
this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, {
|
|
39471
39487
|
at: node
|
|
39472
39488
|
});
|
|
39473
39489
|
} else if (parenthesized.type !== "MemberExpression") {
|
|
@@ -72252,6 +72268,60 @@ function formatErrors(e2, afterError) {
|
|
|
72252
72268
|
afterError?.(e2);
|
|
72253
72269
|
}
|
|
72254
72270
|
}
|
|
72271
|
+
function unwrapType(config2, type, wrappers = []) {
|
|
72272
|
+
if (type.kind === "NonNullType") {
|
|
72273
|
+
return unwrapType(config2, type.type, [TypeWrapper.NonNull, ...wrappers]);
|
|
72274
|
+
}
|
|
72275
|
+
if (type instanceof graphql3.GraphQLNonNull) {
|
|
72276
|
+
return unwrapType(config2, type.ofType, [TypeWrapper.NonNull, ...wrappers]);
|
|
72277
|
+
}
|
|
72278
|
+
if (wrappers[0] !== TypeWrapper.NonNull) {
|
|
72279
|
+
wrappers.unshift(TypeWrapper.Nullable);
|
|
72280
|
+
}
|
|
72281
|
+
if (type.kind === "ListType") {
|
|
72282
|
+
return unwrapType(config2, type.type, [TypeWrapper.List, ...wrappers]);
|
|
72283
|
+
}
|
|
72284
|
+
if (type instanceof graphql3.GraphQLList) {
|
|
72285
|
+
return unwrapType(config2, type.ofType, [TypeWrapper.List, ...wrappers]);
|
|
72286
|
+
}
|
|
72287
|
+
const namedType = config2.schema.getType(type.name.value || type.name);
|
|
72288
|
+
if (!namedType) {
|
|
72289
|
+
throw new Error("Could not unwrap type: " + JSON.stringify(type));
|
|
72290
|
+
}
|
|
72291
|
+
return { type: namedType, wrappers };
|
|
72292
|
+
}
|
|
72293
|
+
function wrapType({
|
|
72294
|
+
type,
|
|
72295
|
+
wrappers
|
|
72296
|
+
}) {
|
|
72297
|
+
const head = wrappers[0];
|
|
72298
|
+
const tail = wrappers.slice(1);
|
|
72299
|
+
let kind = graphql3.Kind.NAMED_TYPE;
|
|
72300
|
+
if (head === TypeWrapper.List) {
|
|
72301
|
+
kind = graphql3.Kind.LIST_TYPE;
|
|
72302
|
+
} else if (head === TypeWrapper.NonNull) {
|
|
72303
|
+
kind = graphql3.Kind.NON_NULL_TYPE;
|
|
72304
|
+
}
|
|
72305
|
+
if (kind === "NamedType") {
|
|
72306
|
+
return {
|
|
72307
|
+
kind,
|
|
72308
|
+
name: {
|
|
72309
|
+
kind: graphql3.Kind.NAME,
|
|
72310
|
+
value: type.name
|
|
72311
|
+
}
|
|
72312
|
+
};
|
|
72313
|
+
}
|
|
72314
|
+
return {
|
|
72315
|
+
kind,
|
|
72316
|
+
type: wrapType({ type, wrappers: tail })
|
|
72317
|
+
};
|
|
72318
|
+
}
|
|
72319
|
+
var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
|
|
72320
|
+
TypeWrapper2["Nullable"] = "Nullable";
|
|
72321
|
+
TypeWrapper2["List"] = "List";
|
|
72322
|
+
TypeWrapper2["NonNull"] = "NonNull";
|
|
72323
|
+
return TypeWrapper2;
|
|
72324
|
+
})(TypeWrapper || {});
|
|
72255
72325
|
|
|
72256
72326
|
// src/lib/parse.ts
|
|
72257
72327
|
var import_parser = __toESM(require_lib3(), 1);
|
|
@@ -72500,10 +72570,10 @@ async function find_graphql(config2, parsedScript, walker) {
|
|
|
72500
72570
|
}
|
|
72501
72571
|
|
|
72502
72572
|
// src/codegen/index.ts
|
|
72503
|
-
var
|
|
72573
|
+
var graphql28 = __toESM(require_graphql2(), 1);
|
|
72504
72574
|
|
|
72505
72575
|
// src/codegen/generators/artifacts/index.ts
|
|
72506
|
-
var
|
|
72576
|
+
var graphql13 = __toESM(require_graphql2(), 1);
|
|
72507
72577
|
var recast5 = __toESM(require_main2(), 1);
|
|
72508
72578
|
|
|
72509
72579
|
// src/codegen/utils/commonjs.ts
|
|
@@ -72679,63 +72749,6 @@ var FieldCollection = class {
|
|
|
72679
72749
|
}
|
|
72680
72750
|
};
|
|
72681
72751
|
|
|
72682
|
-
// src/codegen/utils/graphql.ts
|
|
72683
|
-
var graphql5 = __toESM(require_graphql2(), 1);
|
|
72684
|
-
function unwrapType(config2, type, wrappers = []) {
|
|
72685
|
-
if (type.kind === "NonNullType") {
|
|
72686
|
-
return unwrapType(config2, type.type, [TypeWrapper.NonNull, ...wrappers]);
|
|
72687
|
-
}
|
|
72688
|
-
if (type instanceof graphql5.GraphQLNonNull) {
|
|
72689
|
-
return unwrapType(config2, type.ofType, [TypeWrapper.NonNull, ...wrappers]);
|
|
72690
|
-
}
|
|
72691
|
-
if (wrappers[0] !== TypeWrapper.NonNull) {
|
|
72692
|
-
wrappers.unshift(TypeWrapper.Nullable);
|
|
72693
|
-
}
|
|
72694
|
-
if (type.kind === "ListType") {
|
|
72695
|
-
return unwrapType(config2, type.type, [TypeWrapper.List, ...wrappers]);
|
|
72696
|
-
}
|
|
72697
|
-
if (type instanceof graphql5.GraphQLList) {
|
|
72698
|
-
return unwrapType(config2, type.ofType, [TypeWrapper.List, ...wrappers]);
|
|
72699
|
-
}
|
|
72700
|
-
const namedType = config2.schema.getType(type.name.value || type.name);
|
|
72701
|
-
if (!namedType) {
|
|
72702
|
-
throw new Error("Could not unwrap type: " + JSON.stringify(type));
|
|
72703
|
-
}
|
|
72704
|
-
return { type: namedType, wrappers };
|
|
72705
|
-
}
|
|
72706
|
-
function wrapType({
|
|
72707
|
-
type,
|
|
72708
|
-
wrappers
|
|
72709
|
-
}) {
|
|
72710
|
-
const head = wrappers[0];
|
|
72711
|
-
const tail = wrappers.slice(1);
|
|
72712
|
-
let kind = graphql5.Kind.NAMED_TYPE;
|
|
72713
|
-
if (head === TypeWrapper.List) {
|
|
72714
|
-
kind = graphql5.Kind.LIST_TYPE;
|
|
72715
|
-
} else if (head === TypeWrapper.NonNull) {
|
|
72716
|
-
kind = graphql5.Kind.NON_NULL_TYPE;
|
|
72717
|
-
}
|
|
72718
|
-
if (kind === "NamedType") {
|
|
72719
|
-
return {
|
|
72720
|
-
kind,
|
|
72721
|
-
name: {
|
|
72722
|
-
kind: graphql5.Kind.NAME,
|
|
72723
|
-
value: type.name
|
|
72724
|
-
}
|
|
72725
|
-
};
|
|
72726
|
-
}
|
|
72727
|
-
return {
|
|
72728
|
-
kind,
|
|
72729
|
-
type: wrapType({ type, wrappers: tail })
|
|
72730
|
-
};
|
|
72731
|
-
}
|
|
72732
|
-
var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
|
|
72733
|
-
TypeWrapper2["Nullable"] = "Nullable";
|
|
72734
|
-
TypeWrapper2["List"] = "List";
|
|
72735
|
-
TypeWrapper2["NonNull"] = "NonNull";
|
|
72736
|
-
return TypeWrapper2;
|
|
72737
|
-
})(TypeWrapper || {});
|
|
72738
|
-
|
|
72739
72752
|
// src/codegen/utils/moduleExport.ts
|
|
72740
72753
|
var recast2 = __toESM(require_main2(), 1);
|
|
72741
72754
|
var AST2 = recast2.types.builders;
|
|
@@ -72822,7 +72835,7 @@ ${exportDefaultFrom(`./${doc.name}`, doc.name)}`,
|
|
|
72822
72835
|
}
|
|
72823
72836
|
|
|
72824
72837
|
// src/codegen/generators/artifacts/inputs.ts
|
|
72825
|
-
var
|
|
72838
|
+
var graphql5 = __toESM(require_graphql2(), 1);
|
|
72826
72839
|
var recast3 = __toESM(require_main2(), 1);
|
|
72827
72840
|
var AST3 = recast3.types.builders;
|
|
72828
72841
|
function inputObject(config2, inputs) {
|
|
@@ -72847,10 +72860,10 @@ function walkInputs(config2, visitedTypes, inputObj, rootType) {
|
|
|
72847
72860
|
if (visitedTypes.has(type.name)) {
|
|
72848
72861
|
return;
|
|
72849
72862
|
}
|
|
72850
|
-
if (
|
|
72863
|
+
if (graphql5.isEnumType(type) || graphql5.isScalarType(type)) {
|
|
72851
72864
|
return;
|
|
72852
72865
|
}
|
|
72853
|
-
if (
|
|
72866
|
+
if (graphql5.isUnionType(type)) {
|
|
72854
72867
|
return;
|
|
72855
72868
|
}
|
|
72856
72869
|
visitedTypes.add(type.name);
|
|
@@ -72868,10 +72881,10 @@ function walkInputs(config2, visitedTypes, inputObj, rootType) {
|
|
|
72868
72881
|
}
|
|
72869
72882
|
|
|
72870
72883
|
// src/codegen/generators/artifacts/operations.ts
|
|
72871
|
-
var
|
|
72884
|
+
var graphql7 = __toESM(require_graphql2(), 1);
|
|
72872
72885
|
|
|
72873
72886
|
// src/codegen/generators/artifacts/utils.ts
|
|
72874
|
-
var
|
|
72887
|
+
var graphql6 = __toESM(require_graphql2(), 1);
|
|
72875
72888
|
var recast4 = __toESM(require_main2(), 1);
|
|
72876
72889
|
var AST4 = recast4.types.builders;
|
|
72877
72890
|
function serializeValue(value) {
|
|
@@ -72923,19 +72936,19 @@ function deepMerge(filepath, ...targets) {
|
|
|
72923
72936
|
function convertValue(config2, val) {
|
|
72924
72937
|
let value;
|
|
72925
72938
|
let kind;
|
|
72926
|
-
if (val.kind ===
|
|
72939
|
+
if (val.kind === graphql6.Kind.INT) {
|
|
72927
72940
|
value = parseInt(val.value, 10);
|
|
72928
72941
|
kind = "Int";
|
|
72929
|
-
} else if (val.kind ===
|
|
72942
|
+
} else if (val.kind === graphql6.Kind.FLOAT) {
|
|
72930
72943
|
value = parseFloat(val.value);
|
|
72931
72944
|
kind = "Float";
|
|
72932
|
-
} else if (val.kind ===
|
|
72945
|
+
} else if (val.kind === graphql6.Kind.BOOLEAN) {
|
|
72933
72946
|
value = val.value;
|
|
72934
72947
|
kind = "Boolean";
|
|
72935
|
-
} else if (val.kind ===
|
|
72948
|
+
} else if (val.kind === graphql6.Kind.VARIABLE) {
|
|
72936
72949
|
value = val.name.value;
|
|
72937
72950
|
kind = "Variable";
|
|
72938
|
-
} else if (val.kind ===
|
|
72951
|
+
} else if (val.kind === graphql6.Kind.STRING) {
|
|
72939
72952
|
value = val.value;
|
|
72940
72953
|
kind = "String";
|
|
72941
72954
|
}
|
|
@@ -72948,7 +72961,7 @@ function operationsByPath(config2, filepath, definition, filterTypes) {
|
|
|
72948
72961
|
return {};
|
|
72949
72962
|
}
|
|
72950
72963
|
const pathOperations = {};
|
|
72951
|
-
|
|
72964
|
+
graphql7.visit(definition, {
|
|
72952
72965
|
FragmentSpread(node, _, __, ___, ancestors) {
|
|
72953
72966
|
if (!config2.isListFragment(node.name.value)) {
|
|
72954
72967
|
return;
|
|
@@ -73107,7 +73120,7 @@ function ancestorKey(ancestors) {
|
|
|
73107
73120
|
}
|
|
73108
73121
|
|
|
73109
73122
|
// src/codegen/generators/artifacts/selection.ts
|
|
73110
|
-
var
|
|
73123
|
+
var graphql12 = __toESM(require_graphql2(), 1);
|
|
73111
73124
|
|
|
73112
73125
|
// ../../node_modules/.pnpm/@kitql+helper@0.5.0/node_modules/@kitql/helper/index.mjs
|
|
73113
73126
|
var config = {
|
|
@@ -73147,16 +73160,16 @@ function logYellow(str) {
|
|
|
73147
73160
|
}
|
|
73148
73161
|
|
|
73149
73162
|
// src/codegen/transforms/list.ts
|
|
73150
|
-
var
|
|
73163
|
+
var graphql10 = __toESM(require_graphql2(), 1);
|
|
73151
73164
|
|
|
73152
73165
|
// src/codegen/utils/objectIdentificationSelection.ts
|
|
73153
|
-
var
|
|
73166
|
+
var graphql8 = __toESM(require_graphql2(), 1);
|
|
73154
73167
|
var objectIdentificationSelection = (config2, type) => {
|
|
73155
73168
|
return config2.keyFieldsForType(type.name).map((key) => {
|
|
73156
73169
|
return {
|
|
73157
|
-
kind:
|
|
73170
|
+
kind: graphql8.Kind.FIELD,
|
|
73158
73171
|
name: {
|
|
73159
|
-
kind:
|
|
73172
|
+
kind: graphql8.Kind.NAME,
|
|
73160
73173
|
value: key
|
|
73161
73174
|
}
|
|
73162
73175
|
};
|
|
@@ -73164,7 +73177,7 @@ var objectIdentificationSelection = (config2, type) => {
|
|
|
73164
73177
|
};
|
|
73165
73178
|
|
|
73166
73179
|
// src/codegen/transforms/paginate.ts
|
|
73167
|
-
var
|
|
73180
|
+
var graphql9 = __toESM(require_graphql2(), 1);
|
|
73168
73181
|
async function paginate(config2, documents) {
|
|
73169
73182
|
const newDocs = [];
|
|
73170
73183
|
for (const doc of documents) {
|
|
@@ -73197,7 +73210,7 @@ async function paginate(config2, documents) {
|
|
|
73197
73210
|
};
|
|
73198
73211
|
let cursorType = "String";
|
|
73199
73212
|
let paginationPath = [];
|
|
73200
|
-
doc.document =
|
|
73213
|
+
doc.document = graphql9.visit(doc.document, {
|
|
73201
73214
|
Field(node, _, __, ___, ancestors) {
|
|
73202
73215
|
const paginateDirective = node.directives?.find(
|
|
73203
73216
|
(directive) => directive.name.value === config2.paginateDirective
|
|
@@ -73224,7 +73237,7 @@ async function paginate(config2, documents) {
|
|
|
73224
73237
|
flags.offset.enabled = offsetPagination;
|
|
73225
73238
|
flags.limit.enabled = offsetPagination;
|
|
73226
73239
|
paginationPath = ancestors.filter(
|
|
73227
|
-
(ancestor) => !Array.isArray(ancestor) && ancestor.kind ===
|
|
73240
|
+
(ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql9.Kind.FIELD
|
|
73228
73241
|
).concat(node).map((field) => field.alias?.value || field.name.value);
|
|
73229
73242
|
return {
|
|
73230
73243
|
...node,
|
|
@@ -73245,7 +73258,7 @@ async function paginate(config2, documents) {
|
|
|
73245
73258
|
refetchUpdate = "prepend" /* prepend */;
|
|
73246
73259
|
}
|
|
73247
73260
|
let fragment = "";
|
|
73248
|
-
doc.document =
|
|
73261
|
+
doc.document = graphql9.visit(doc.document, {
|
|
73249
73262
|
OperationDefinition(node) {
|
|
73250
73263
|
if (node.operation !== "query") {
|
|
73251
73264
|
throw new HoudiniError({
|
|
@@ -73299,9 +73312,9 @@ async function paginate(config2, documents) {
|
|
|
73299
73312
|
directives: [
|
|
73300
73313
|
...node.directives || [],
|
|
73301
73314
|
{
|
|
73302
|
-
kind:
|
|
73315
|
+
kind: graphql9.Kind.DIRECTIVE,
|
|
73303
73316
|
name: {
|
|
73304
|
-
kind:
|
|
73317
|
+
kind: graphql9.Kind.NAME,
|
|
73305
73318
|
value: config2.argumentsDirective
|
|
73306
73319
|
}
|
|
73307
73320
|
}
|
|
@@ -73364,16 +73377,16 @@ async function paginate(config2, documents) {
|
|
|
73364
73377
|
const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
|
|
73365
73378
|
const fragmentSpreadSelection = [
|
|
73366
73379
|
{
|
|
73367
|
-
kind:
|
|
73380
|
+
kind: graphql9.Kind.FRAGMENT_SPREAD,
|
|
73368
73381
|
name: {
|
|
73369
|
-
kind:
|
|
73382
|
+
kind: graphql9.Kind.NAME,
|
|
73370
73383
|
value: fragmentName
|
|
73371
73384
|
},
|
|
73372
73385
|
directives: [
|
|
73373
73386
|
{
|
|
73374
|
-
kind:
|
|
73387
|
+
kind: graphql9.Kind.DIRECTIVE,
|
|
73375
73388
|
name: {
|
|
73376
|
-
kind:
|
|
73389
|
+
kind: graphql9.Kind.NAME,
|
|
73377
73390
|
value: config2.withDirective
|
|
73378
73391
|
},
|
|
73379
73392
|
["arguments"]: paginationArgs.map(
|
|
@@ -73401,29 +73414,29 @@ async function paginate(config2, documents) {
|
|
|
73401
73414
|
});
|
|
73402
73415
|
const typeConfig = config2.typeConfig?.[fragment];
|
|
73403
73416
|
const queryDoc = {
|
|
73404
|
-
kind:
|
|
73417
|
+
kind: graphql9.Kind.DOCUMENT,
|
|
73405
73418
|
definitions: [
|
|
73406
73419
|
{
|
|
73407
|
-
kind:
|
|
73420
|
+
kind: graphql9.Kind.OPERATION_DEFINITION,
|
|
73408
73421
|
name: {
|
|
73409
|
-
kind:
|
|
73422
|
+
kind: graphql9.Kind.NAME,
|
|
73410
73423
|
value: refetchQueryName
|
|
73411
73424
|
},
|
|
73412
73425
|
operation: "query",
|
|
73413
73426
|
variableDefinitions: paginationArgs.map(
|
|
73414
73427
|
(arg) => ({
|
|
73415
|
-
kind:
|
|
73428
|
+
kind: graphql9.Kind.VARIABLE_DEFINITION,
|
|
73416
73429
|
type: {
|
|
73417
|
-
kind:
|
|
73430
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
73418
73431
|
name: {
|
|
73419
|
-
kind:
|
|
73432
|
+
kind: graphql9.Kind.NAME,
|
|
73420
73433
|
value: arg.type
|
|
73421
73434
|
}
|
|
73422
73435
|
},
|
|
73423
73436
|
variable: {
|
|
73424
|
-
kind:
|
|
73437
|
+
kind: graphql9.Kind.VARIABLE,
|
|
73425
73438
|
name: {
|
|
73426
|
-
kind:
|
|
73439
|
+
kind: graphql9.Kind.NAME,
|
|
73427
73440
|
value: arg.name
|
|
73428
73441
|
}
|
|
73429
73442
|
},
|
|
@@ -73435,12 +73448,12 @@ async function paginate(config2, documents) {
|
|
|
73435
73448
|
).concat(
|
|
73436
73449
|
!nodeQuery ? [] : keys.map(
|
|
73437
73450
|
(key) => ({
|
|
73438
|
-
kind:
|
|
73451
|
+
kind: graphql9.Kind.VARIABLE_DEFINITION,
|
|
73439
73452
|
type: key.type,
|
|
73440
73453
|
variable: {
|
|
73441
|
-
kind:
|
|
73454
|
+
kind: graphql9.Kind.VARIABLE,
|
|
73442
73455
|
name: {
|
|
73443
|
-
kind:
|
|
73456
|
+
kind: graphql9.Kind.NAME,
|
|
73444
73457
|
value: key.name
|
|
73445
73458
|
}
|
|
73446
73459
|
}
|
|
@@ -73448,42 +73461,42 @@ async function paginate(config2, documents) {
|
|
|
73448
73461
|
)
|
|
73449
73462
|
),
|
|
73450
73463
|
selectionSet: {
|
|
73451
|
-
kind:
|
|
73464
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
73452
73465
|
selections: !nodeQuery ? fragmentSpreadSelection : [
|
|
73453
73466
|
{
|
|
73454
|
-
kind:
|
|
73467
|
+
kind: graphql9.Kind.FIELD,
|
|
73455
73468
|
name: {
|
|
73456
|
-
kind:
|
|
73469
|
+
kind: graphql9.Kind.NAME,
|
|
73457
73470
|
value: typeConfig?.resolve?.queryField || "node"
|
|
73458
73471
|
},
|
|
73459
73472
|
["arguments"]: keys.map((key) => ({
|
|
73460
|
-
kind:
|
|
73473
|
+
kind: graphql9.Kind.ARGUMENT,
|
|
73461
73474
|
name: {
|
|
73462
|
-
kind:
|
|
73475
|
+
kind: graphql9.Kind.NAME,
|
|
73463
73476
|
value: key.name
|
|
73464
73477
|
},
|
|
73465
73478
|
value: {
|
|
73466
|
-
kind:
|
|
73479
|
+
kind: graphql9.Kind.VARIABLE,
|
|
73467
73480
|
name: {
|
|
73468
|
-
kind:
|
|
73481
|
+
kind: graphql9.Kind.NAME,
|
|
73469
73482
|
value: key.name
|
|
73470
73483
|
}
|
|
73471
73484
|
}
|
|
73472
73485
|
})),
|
|
73473
73486
|
selectionSet: {
|
|
73474
|
-
kind:
|
|
73487
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
73475
73488
|
selections: [
|
|
73476
73489
|
{
|
|
73477
|
-
kind:
|
|
73490
|
+
kind: graphql9.Kind.FIELD,
|
|
73478
73491
|
name: {
|
|
73479
|
-
kind:
|
|
73492
|
+
kind: graphql9.Kind.NAME,
|
|
73480
73493
|
value: "__typename"
|
|
73481
73494
|
}
|
|
73482
73495
|
},
|
|
73483
73496
|
...(typeConfig?.keys || ["id"]).map((key) => ({
|
|
73484
|
-
kind:
|
|
73497
|
+
kind: graphql9.Kind.FIELD,
|
|
73485
73498
|
name: {
|
|
73486
|
-
kind:
|
|
73499
|
+
kind: graphql9.Kind.NAME,
|
|
73487
73500
|
value: key
|
|
73488
73501
|
}
|
|
73489
73502
|
})),
|
|
@@ -73545,15 +73558,15 @@ function replaceArgumentsWithVariables(args, flags) {
|
|
|
73545
73558
|
}
|
|
73546
73559
|
function variableAsArgument(name2, variable) {
|
|
73547
73560
|
return {
|
|
73548
|
-
kind:
|
|
73561
|
+
kind: graphql9.Kind.ARGUMENT,
|
|
73549
73562
|
name: {
|
|
73550
|
-
kind:
|
|
73563
|
+
kind: graphql9.Kind.NAME,
|
|
73551
73564
|
value: name2
|
|
73552
73565
|
},
|
|
73553
73566
|
value: {
|
|
73554
|
-
kind:
|
|
73567
|
+
kind: graphql9.Kind.VARIABLE,
|
|
73555
73568
|
name: {
|
|
73556
|
-
kind:
|
|
73569
|
+
kind: graphql9.Kind.NAME,
|
|
73557
73570
|
value: variable ?? name2
|
|
73558
73571
|
}
|
|
73559
73572
|
}
|
|
@@ -73561,18 +73574,18 @@ function variableAsArgument(name2, variable) {
|
|
|
73561
73574
|
}
|
|
73562
73575
|
function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
73563
73576
|
return {
|
|
73564
|
-
kind:
|
|
73577
|
+
kind: graphql9.Kind.VARIABLE_DEFINITION,
|
|
73565
73578
|
type: {
|
|
73566
|
-
kind:
|
|
73579
|
+
kind: graphql9.Kind.NAMED_TYPE,
|
|
73567
73580
|
name: {
|
|
73568
|
-
kind:
|
|
73581
|
+
kind: graphql9.Kind.NAME,
|
|
73569
73582
|
value: type
|
|
73570
73583
|
}
|
|
73571
73584
|
},
|
|
73572
73585
|
variable: {
|
|
73573
|
-
kind:
|
|
73586
|
+
kind: graphql9.Kind.VARIABLE,
|
|
73574
73587
|
name: {
|
|
73575
|
-
kind:
|
|
73588
|
+
kind: graphql9.Kind.NAME,
|
|
73576
73589
|
value: variableName ?? name2
|
|
73577
73590
|
}
|
|
73578
73591
|
},
|
|
@@ -73584,9 +73597,9 @@ function staticVariableDefinition(name2, type, defaultValue, variableName) {
|
|
|
73584
73597
|
}
|
|
73585
73598
|
function argumentNode(name2, value) {
|
|
73586
73599
|
return {
|
|
73587
|
-
kind:
|
|
73600
|
+
kind: graphql9.Kind.ARGUMENT,
|
|
73588
73601
|
name: {
|
|
73589
|
-
kind:
|
|
73602
|
+
kind: graphql9.Kind.NAME,
|
|
73590
73603
|
value: name2
|
|
73591
73604
|
},
|
|
73592
73605
|
value: objectNode(value)
|
|
@@ -73594,16 +73607,16 @@ function argumentNode(name2, value) {
|
|
|
73594
73607
|
}
|
|
73595
73608
|
function objectNode([type, defaultValue]) {
|
|
73596
73609
|
const node = {
|
|
73597
|
-
kind:
|
|
73610
|
+
kind: graphql9.Kind.OBJECT,
|
|
73598
73611
|
fields: [
|
|
73599
73612
|
{
|
|
73600
|
-
kind:
|
|
73613
|
+
kind: graphql9.Kind.OBJECT_FIELD,
|
|
73601
73614
|
name: {
|
|
73602
|
-
kind:
|
|
73615
|
+
kind: graphql9.Kind.NAME,
|
|
73603
73616
|
value: "type"
|
|
73604
73617
|
},
|
|
73605
73618
|
value: {
|
|
73606
|
-
kind:
|
|
73619
|
+
kind: graphql9.Kind.STRING,
|
|
73607
73620
|
value: type
|
|
73608
73621
|
}
|
|
73609
73622
|
}
|
|
@@ -73611,8 +73624,8 @@ function objectNode([type, defaultValue]) {
|
|
|
73611
73624
|
};
|
|
73612
73625
|
if (defaultValue) {
|
|
73613
73626
|
node.fields.push({
|
|
73614
|
-
kind:
|
|
73615
|
-
name: { kind:
|
|
73627
|
+
kind: graphql9.Kind.OBJECT_FIELD,
|
|
73628
|
+
name: { kind: graphql9.Kind.NAME, value: "default" },
|
|
73616
73629
|
value: {
|
|
73617
73630
|
kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
|
|
73618
73631
|
value: defaultValue.toString()
|
|
@@ -73623,34 +73636,34 @@ function objectNode([type, defaultValue]) {
|
|
|
73623
73636
|
}
|
|
73624
73637
|
var pageInfoSelection = [
|
|
73625
73638
|
{
|
|
73626
|
-
kind:
|
|
73639
|
+
kind: graphql9.Kind.FIELD,
|
|
73627
73640
|
name: {
|
|
73628
|
-
kind:
|
|
73641
|
+
kind: graphql9.Kind.NAME,
|
|
73629
73642
|
value: "edges"
|
|
73630
73643
|
},
|
|
73631
73644
|
selectionSet: {
|
|
73632
|
-
kind:
|
|
73645
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
73633
73646
|
selections: [
|
|
73634
73647
|
{
|
|
73635
|
-
kind:
|
|
73648
|
+
kind: graphql9.Kind.FIELD,
|
|
73636
73649
|
name: {
|
|
73637
|
-
kind:
|
|
73650
|
+
kind: graphql9.Kind.NAME,
|
|
73638
73651
|
value: "cursor"
|
|
73639
73652
|
}
|
|
73640
73653
|
},
|
|
73641
73654
|
{
|
|
73642
|
-
kind:
|
|
73655
|
+
kind: graphql9.Kind.FIELD,
|
|
73643
73656
|
name: {
|
|
73644
|
-
kind:
|
|
73657
|
+
kind: graphql9.Kind.NAME,
|
|
73645
73658
|
value: "node"
|
|
73646
73659
|
},
|
|
73647
73660
|
selectionSet: {
|
|
73648
|
-
kind:
|
|
73661
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
73649
73662
|
selections: [
|
|
73650
73663
|
{
|
|
73651
|
-
kind:
|
|
73664
|
+
kind: graphql9.Kind.FIELD,
|
|
73652
73665
|
name: {
|
|
73653
|
-
kind:
|
|
73666
|
+
kind: graphql9.Kind.NAME,
|
|
73654
73667
|
value: "__typename"
|
|
73655
73668
|
}
|
|
73656
73669
|
}
|
|
@@ -73661,39 +73674,39 @@ var pageInfoSelection = [
|
|
|
73661
73674
|
}
|
|
73662
73675
|
},
|
|
73663
73676
|
{
|
|
73664
|
-
kind:
|
|
73677
|
+
kind: graphql9.Kind.FIELD,
|
|
73665
73678
|
name: {
|
|
73666
|
-
kind:
|
|
73679
|
+
kind: graphql9.Kind.NAME,
|
|
73667
73680
|
value: "pageInfo"
|
|
73668
73681
|
},
|
|
73669
73682
|
selectionSet: {
|
|
73670
|
-
kind:
|
|
73683
|
+
kind: graphql9.Kind.SELECTION_SET,
|
|
73671
73684
|
selections: [
|
|
73672
73685
|
{
|
|
73673
|
-
kind:
|
|
73686
|
+
kind: graphql9.Kind.FIELD,
|
|
73674
73687
|
name: {
|
|
73675
|
-
kind:
|
|
73688
|
+
kind: graphql9.Kind.NAME,
|
|
73676
73689
|
value: "hasPreviousPage"
|
|
73677
73690
|
}
|
|
73678
73691
|
},
|
|
73679
73692
|
{
|
|
73680
|
-
kind:
|
|
73693
|
+
kind: graphql9.Kind.FIELD,
|
|
73681
73694
|
name: {
|
|
73682
|
-
kind:
|
|
73695
|
+
kind: graphql9.Kind.NAME,
|
|
73683
73696
|
value: "hasNextPage"
|
|
73684
73697
|
}
|
|
73685
73698
|
},
|
|
73686
73699
|
{
|
|
73687
|
-
kind:
|
|
73700
|
+
kind: graphql9.Kind.FIELD,
|
|
73688
73701
|
name: {
|
|
73689
|
-
kind:
|
|
73702
|
+
kind: graphql9.Kind.NAME,
|
|
73690
73703
|
value: "startCursor"
|
|
73691
73704
|
}
|
|
73692
73705
|
},
|
|
73693
73706
|
{
|
|
73694
|
-
kind:
|
|
73707
|
+
kind: graphql9.Kind.FIELD,
|
|
73695
73708
|
name: {
|
|
73696
|
-
kind:
|
|
73709
|
+
kind: graphql9.Kind.NAME,
|
|
73697
73710
|
value: "endCursor"
|
|
73698
73711
|
}
|
|
73699
73712
|
}
|
|
@@ -73707,15 +73720,15 @@ async function addListFragments(config2, documents) {
|
|
|
73707
73720
|
const lists = {};
|
|
73708
73721
|
const errors = [];
|
|
73709
73722
|
for (const doc of documents) {
|
|
73710
|
-
doc.document =
|
|
73723
|
+
doc.document = graphql10.visit(doc.document, {
|
|
73711
73724
|
Directive(node, key, parent, path2, ancestors) {
|
|
73712
73725
|
if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
73713
73726
|
const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
|
|
73714
73727
|
let error = {
|
|
73715
|
-
...new
|
|
73728
|
+
...new graphql10.GraphQLError(
|
|
73716
73729
|
"",
|
|
73717
73730
|
node,
|
|
73718
|
-
new
|
|
73731
|
+
new graphql10.Source(""),
|
|
73719
73732
|
node.loc ? [node.loc.start, node.loc.end] : null,
|
|
73720
73733
|
path2
|
|
73721
73734
|
),
|
|
@@ -73767,7 +73780,7 @@ async function addListFragments(config2, documents) {
|
|
|
73767
73780
|
{
|
|
73768
73781
|
kind: "Argument",
|
|
73769
73782
|
name: {
|
|
73770
|
-
kind:
|
|
73783
|
+
kind: graphql10.Kind.NAME,
|
|
73771
73784
|
value: "connection"
|
|
73772
73785
|
},
|
|
73773
73786
|
value: {
|
|
@@ -73817,7 +73830,7 @@ async function addListFragments(config2, documents) {
|
|
|
73817
73830
|
const validDeletes = [
|
|
73818
73831
|
...new Set(
|
|
73819
73832
|
Object.values(lists).map(({ type }) => {
|
|
73820
|
-
if (!(type instanceof
|
|
73833
|
+
if (!(type instanceof graphql10.GraphQLObjectType)) {
|
|
73821
73834
|
return "";
|
|
73822
73835
|
}
|
|
73823
73836
|
if (config2.keyFieldsForType(type.name).length !== 1) {
|
|
@@ -73831,7 +73844,7 @@ async function addListFragments(config2, documents) {
|
|
|
73831
73844
|
return;
|
|
73832
73845
|
}
|
|
73833
73846
|
const generatedDoc = {
|
|
73834
|
-
kind:
|
|
73847
|
+
kind: graphql10.Kind.DOCUMENT,
|
|
73835
73848
|
definitions: Object.entries(lists).flatMap(
|
|
73836
73849
|
([name2, { selection: selection2, type }]) => {
|
|
73837
73850
|
const schemaType = config2.schema.getType(type.name);
|
|
@@ -73839,7 +73852,7 @@ async function addListFragments(config2, documents) {
|
|
|
73839
73852
|
throw new HoudiniError({ message: "Lists must have a selection" });
|
|
73840
73853
|
}
|
|
73841
73854
|
const fragmentSelection = {
|
|
73842
|
-
kind:
|
|
73855
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73843
73856
|
selections: [...selection2.selections]
|
|
73844
73857
|
};
|
|
73845
73858
|
if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
|
|
@@ -73854,14 +73867,14 @@ async function addListFragments(config2, documents) {
|
|
|
73854
73867
|
{
|
|
73855
73868
|
name: {
|
|
73856
73869
|
value: config2.listInsertFragment(name2),
|
|
73857
|
-
kind:
|
|
73870
|
+
kind: graphql10.Kind.NAME
|
|
73858
73871
|
},
|
|
73859
|
-
kind:
|
|
73872
|
+
kind: graphql10.Kind.FRAGMENT_DEFINITION,
|
|
73860
73873
|
selectionSet: fragmentSelection,
|
|
73861
73874
|
typeCondition: {
|
|
73862
|
-
kind:
|
|
73875
|
+
kind: graphql10.Kind.NAMED_TYPE,
|
|
73863
73876
|
name: {
|
|
73864
|
-
kind:
|
|
73877
|
+
kind: graphql10.Kind.NAME,
|
|
73865
73878
|
value: type.name
|
|
73866
73879
|
}
|
|
73867
73880
|
}
|
|
@@ -73869,32 +73882,32 @@ async function addListFragments(config2, documents) {
|
|
|
73869
73882
|
{
|
|
73870
73883
|
name: {
|
|
73871
73884
|
value: config2.listToggleFragment(name2),
|
|
73872
|
-
kind:
|
|
73885
|
+
kind: graphql10.Kind.NAME
|
|
73873
73886
|
},
|
|
73874
|
-
kind:
|
|
73887
|
+
kind: graphql10.Kind.FRAGMENT_DEFINITION,
|
|
73875
73888
|
selectionSet: fragmentSelection,
|
|
73876
73889
|
typeCondition: {
|
|
73877
|
-
kind:
|
|
73890
|
+
kind: graphql10.Kind.NAMED_TYPE,
|
|
73878
73891
|
name: {
|
|
73879
|
-
kind:
|
|
73892
|
+
kind: graphql10.Kind.NAME,
|
|
73880
73893
|
value: type.name
|
|
73881
73894
|
}
|
|
73882
73895
|
}
|
|
73883
73896
|
},
|
|
73884
73897
|
{
|
|
73885
|
-
kind:
|
|
73898
|
+
kind: graphql10.Kind.FRAGMENT_DEFINITION,
|
|
73886
73899
|
name: {
|
|
73887
73900
|
value: config2.listRemoveFragment(name2),
|
|
73888
|
-
kind:
|
|
73901
|
+
kind: graphql10.Kind.NAME
|
|
73889
73902
|
},
|
|
73890
73903
|
selectionSet: {
|
|
73891
|
-
kind:
|
|
73904
|
+
kind: graphql10.Kind.SELECTION_SET,
|
|
73892
73905
|
selections: [...objectIdentificationSelection(config2, type)]
|
|
73893
73906
|
},
|
|
73894
73907
|
typeCondition: {
|
|
73895
|
-
kind:
|
|
73908
|
+
kind: graphql10.Kind.NAMED_TYPE,
|
|
73896
73909
|
name: {
|
|
73897
|
-
kind:
|
|
73910
|
+
kind: graphql10.Kind.NAME,
|
|
73898
73911
|
value: type.name
|
|
73899
73912
|
}
|
|
73900
73913
|
}
|
|
@@ -73903,14 +73916,14 @@ async function addListFragments(config2, documents) {
|
|
|
73903
73916
|
}
|
|
73904
73917
|
).concat(
|
|
73905
73918
|
...validDeletes.map((typeName) => ({
|
|
73906
|
-
kind:
|
|
73919
|
+
kind: graphql10.Kind.DIRECTIVE_DEFINITION,
|
|
73907
73920
|
name: {
|
|
73908
|
-
kind:
|
|
73921
|
+
kind: graphql10.Kind.NAME,
|
|
73909
73922
|
value: config2.listDeleteDirective(typeName)
|
|
73910
73923
|
},
|
|
73911
73924
|
locations: [
|
|
73912
73925
|
{
|
|
73913
|
-
kind:
|
|
73926
|
+
kind: graphql10.Kind.NAME,
|
|
73914
73927
|
value: "FIELD"
|
|
73915
73928
|
}
|
|
73916
73929
|
],
|
|
@@ -73918,8 +73931,8 @@ async function addListFragments(config2, documents) {
|
|
|
73918
73931
|
}))
|
|
73919
73932
|
)
|
|
73920
73933
|
};
|
|
73921
|
-
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(
|
|
73922
|
-
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(
|
|
73934
|
+
config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql10.print).join("\n\n");
|
|
73935
|
+
config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql10.print).join("\n\n");
|
|
73923
73936
|
documents.push({
|
|
73924
73937
|
name: "generated::lists",
|
|
73925
73938
|
kind: "HoudiniFragment" /* Fragment */,
|
|
@@ -74004,11 +74017,11 @@ var nodeNotDefinedMessage = (config2) => `Looks like you are trying to use the $
|
|
|
74004
74017
|
For more information, visit this link: ${siteURL}/guides/pagination`;
|
|
74005
74018
|
|
|
74006
74019
|
// src/codegen/generators/artifacts/fieldKey.ts
|
|
74007
|
-
var
|
|
74020
|
+
var graphql11 = __toESM(require_graphql2(), 1);
|
|
74008
74021
|
function fieldKey(config2, field) {
|
|
74009
74022
|
const attributeName = field.alias?.value || field.name.value;
|
|
74010
|
-
const printed =
|
|
74011
|
-
const secondParse =
|
|
74023
|
+
const printed = graphql11.print(field);
|
|
74024
|
+
const secondParse = graphql11.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
74012
74025
|
const paginated = !!field.directives?.find(
|
|
74013
74026
|
(directive) => directive.name.value === config2.paginateDirective
|
|
74014
74027
|
);
|
|
@@ -74103,8 +74116,8 @@ function selection({
|
|
|
74103
74116
|
const typeConditionName = field.typeCondition.name.value;
|
|
74104
74117
|
const typeCondition = config2.schema.getType(typeConditionName);
|
|
74105
74118
|
const possibleTypes = [];
|
|
74106
|
-
if (!
|
|
74107
|
-
} else if (
|
|
74119
|
+
if (!graphql12.isAbstractType(typeCondition)) {
|
|
74120
|
+
} else if (graphql12.isAbstractType(parentType)) {
|
|
74108
74121
|
const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
|
|
74109
74122
|
for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
|
|
74110
74123
|
if (possibleParentTypes.includes(possible.name)) {
|
|
@@ -74152,7 +74165,7 @@ function selection({
|
|
|
74152
74165
|
} else {
|
|
74153
74166
|
let typeRef = type.getFields()[field.name.value].type;
|
|
74154
74167
|
fieldType = getRootType(typeRef);
|
|
74155
|
-
nullable = !
|
|
74168
|
+
nullable = !graphql12.isNonNullType(typeRef);
|
|
74156
74169
|
}
|
|
74157
74170
|
const typeName = fieldType.toString();
|
|
74158
74171
|
const pathSoFar = path2.concat(attributeName);
|
|
@@ -74217,7 +74230,7 @@ function selection({
|
|
|
74217
74230
|
{}
|
|
74218
74231
|
);
|
|
74219
74232
|
}
|
|
74220
|
-
if (
|
|
74233
|
+
if (graphql12.isInterfaceType(fieldType) || graphql12.isUnionType(fieldType)) {
|
|
74221
74234
|
fieldObj.abstract = true;
|
|
74222
74235
|
}
|
|
74223
74236
|
object.fields = {
|
|
@@ -74274,7 +74287,7 @@ function artifactGenerator(stats) {
|
|
|
74274
74287
|
return async function(config2, docs) {
|
|
74275
74288
|
const filterTypes = {};
|
|
74276
74289
|
for (const doc of docs) {
|
|
74277
|
-
|
|
74290
|
+
graphql13.visit(doc.document, {
|
|
74278
74291
|
Directive(node, _, __, ___, ancestors) {
|
|
74279
74292
|
if (node.name.value !== config2.listDirective) {
|
|
74280
74293
|
return;
|
|
@@ -74333,7 +74346,7 @@ function artifactGenerator(stats) {
|
|
|
74333
74346
|
return;
|
|
74334
74347
|
}
|
|
74335
74348
|
const usedVariableNames = /* @__PURE__ */ new Set();
|
|
74336
|
-
let documentWithoutInternalDirectives =
|
|
74349
|
+
let documentWithoutInternalDirectives = graphql13.visit(document, {
|
|
74337
74350
|
Directive(node) {
|
|
74338
74351
|
if (config2.isInternalDirective(node)) {
|
|
74339
74352
|
return null;
|
|
@@ -74346,7 +74359,7 @@ function artifactGenerator(stats) {
|
|
|
74346
74359
|
}
|
|
74347
74360
|
}
|
|
74348
74361
|
});
|
|
74349
|
-
let documentWithoutExtraVariables =
|
|
74362
|
+
let documentWithoutExtraVariables = graphql13.visit(
|
|
74350
74363
|
documentWithoutInternalDirectives,
|
|
74351
74364
|
{
|
|
74352
74365
|
VariableDefinition(variableDefinitionNode) {
|
|
@@ -74357,13 +74370,13 @@ function artifactGenerator(stats) {
|
|
|
74357
74370
|
}
|
|
74358
74371
|
}
|
|
74359
74372
|
);
|
|
74360
|
-
let rawString =
|
|
74373
|
+
let rawString = graphql13.print(documentWithoutExtraVariables);
|
|
74361
74374
|
let docKind = doc.kind;
|
|
74362
74375
|
const operations = document.definitions.filter(
|
|
74363
|
-
({ kind }) => kind ===
|
|
74376
|
+
({ kind }) => kind === graphql13.Kind.OPERATION_DEFINITION
|
|
74364
74377
|
);
|
|
74365
74378
|
const fragments = document.definitions.filter(
|
|
74366
|
-
({ kind }) => kind ===
|
|
74379
|
+
({ kind }) => kind === graphql13.Kind.FRAGMENT_DEFINITION
|
|
74367
74380
|
);
|
|
74368
74381
|
let rootType = "";
|
|
74369
74382
|
let selectionSet;
|
|
@@ -74605,15 +74618,15 @@ async function generatePluginRuntime(config2, plugin) {
|
|
|
74605
74618
|
var recast12 = __toESM(require_main2(), 1);
|
|
74606
74619
|
|
|
74607
74620
|
// src/codegen/generators/typescript/addReferencedInputTypes.ts
|
|
74608
|
-
var
|
|
74621
|
+
var graphql16 = __toESM(require_graphql2(), 1);
|
|
74609
74622
|
var recast9 = __toESM(require_main2(), 1);
|
|
74610
74623
|
|
|
74611
74624
|
// src/codegen/generators/typescript/typeReference.ts
|
|
74612
|
-
var
|
|
74625
|
+
var graphql15 = __toESM(require_graphql2(), 1);
|
|
74613
74626
|
var recast8 = __toESM(require_main2(), 1);
|
|
74614
74627
|
|
|
74615
74628
|
// src/codegen/generators/typescript/types.ts
|
|
74616
|
-
var
|
|
74629
|
+
var graphql14 = __toESM(require_graphql2(), 1);
|
|
74617
74630
|
var recast7 = __toESM(require_main2(), 1);
|
|
74618
74631
|
var AST7 = recast7.types.builders;
|
|
74619
74632
|
function readonlyProperty(prop, enable = true) {
|
|
@@ -74647,7 +74660,7 @@ function scalarPropertyValue(config2, missingScalars, target) {
|
|
|
74647
74660
|
return AST7.tsStringKeyword();
|
|
74648
74661
|
}
|
|
74649
74662
|
default: {
|
|
74650
|
-
if (
|
|
74663
|
+
if (graphql14.isNonNullType(target) && "ofType" in target) {
|
|
74651
74664
|
return scalarPropertyValue(
|
|
74652
74665
|
config2,
|
|
74653
74666
|
missingScalars,
|
|
@@ -74668,7 +74681,7 @@ var AST8 = recast8.types.builders;
|
|
|
74668
74681
|
function tsTypeReference(config2, missingScalars, definition) {
|
|
74669
74682
|
const { type, wrappers } = unwrapType(config2, definition.type);
|
|
74670
74683
|
let result;
|
|
74671
|
-
if (
|
|
74684
|
+
if (graphql15.isScalarType(type)) {
|
|
74672
74685
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
74673
74686
|
} else {
|
|
74674
74687
|
result = AST8.tsTypeReference(AST8.identifier(type.name));
|
|
@@ -74689,17 +74702,17 @@ function tsTypeReference(config2, missingScalars, definition) {
|
|
|
74689
74702
|
var AST9 = recast9.types.builders;
|
|
74690
74703
|
function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
|
|
74691
74704
|
const { type } = unwrapType(config2, rootType);
|
|
74692
|
-
if (
|
|
74705
|
+
if (graphql16.isScalarType(type)) {
|
|
74693
74706
|
return;
|
|
74694
74707
|
}
|
|
74695
74708
|
if (visitedTypes.has(type.name)) {
|
|
74696
74709
|
return;
|
|
74697
74710
|
}
|
|
74698
|
-
if (
|
|
74711
|
+
if (graphql16.isUnionType(type)) {
|
|
74699
74712
|
throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
|
|
74700
74713
|
}
|
|
74701
74714
|
visitedTypes.add(type.name);
|
|
74702
|
-
if (
|
|
74715
|
+
if (graphql16.isEnumType(type)) {
|
|
74703
74716
|
ensureImports({
|
|
74704
74717
|
config: config2,
|
|
74705
74718
|
body,
|
|
@@ -74716,7 +74729,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
74716
74729
|
AST9.tsPropertySignature(
|
|
74717
74730
|
AST9.identifier(field.name),
|
|
74718
74731
|
AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
|
|
74719
|
-
|
|
74732
|
+
graphql16.isNullableType(field.type)
|
|
74720
74733
|
)
|
|
74721
74734
|
);
|
|
74722
74735
|
}
|
|
@@ -74724,7 +74737,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
|
|
|
74724
74737
|
}
|
|
74725
74738
|
|
|
74726
74739
|
// src/codegen/generators/typescript/imperativeCache.ts
|
|
74727
|
-
var
|
|
74740
|
+
var graphql17 = __toESM(require_graphql2(), 1);
|
|
74728
74741
|
var recast10 = __toESM(require_main2(), 1);
|
|
74729
74742
|
var AST10 = recast10.types.builders;
|
|
74730
74743
|
async function imperativeCacheTypef(config2, docs) {
|
|
@@ -74760,7 +74773,7 @@ function typeDefinitions(config2, body) {
|
|
|
74760
74773
|
const operationTypes = [config2.schema.getMutationType(), config2.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
|
|
74761
74774
|
const visitedTypes = /* @__PURE__ */ new Set();
|
|
74762
74775
|
const types16 = Object.values(config2.schema.getTypeMap()).filter(
|
|
74763
|
-
(type) => !
|
|
74776
|
+
(type) => !graphql17.isAbstractType(type) && !graphql17.isScalarType(type) && !graphql17.isEnumType(type) && !graphql17.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
|
|
74764
74777
|
);
|
|
74765
74778
|
return AST10.tsTypeLiteral(
|
|
74766
74779
|
types16.map((type) => {
|
|
@@ -74770,7 +74783,7 @@ function typeDefinitions(config2, body) {
|
|
|
74770
74783
|
}
|
|
74771
74784
|
let idFields = AST10.tsNeverKeyword();
|
|
74772
74785
|
const keys = keyFieldsForType(config2.configFile, type.name);
|
|
74773
|
-
if (
|
|
74786
|
+
if (graphql17.isObjectType(type) && keys.length > 0 && keys.every((key) => type.getFields()[key])) {
|
|
74774
74787
|
idFields = AST10.tsTypeLiteral(
|
|
74775
74788
|
keys.map((key) => {
|
|
74776
74789
|
const fieldType = type.getFields()[key];
|
|
@@ -74787,21 +74800,21 @@ function typeDefinitions(config2, body) {
|
|
|
74787
74800
|
idFields = AST10.tsTypeLiteral([]);
|
|
74788
74801
|
}
|
|
74789
74802
|
let fields = AST10.tsTypeLiteral([]);
|
|
74790
|
-
if (
|
|
74803
|
+
if (graphql17.isObjectType(type)) {
|
|
74791
74804
|
fields = AST10.tsTypeLiteral(
|
|
74792
74805
|
Object.entries(type.getFields()).map(
|
|
74793
74806
|
([key, fieldType]) => {
|
|
74794
74807
|
const unwrapped = unwrapType(config2, fieldType.type);
|
|
74795
74808
|
let typeOptions = AST10.tsUnionType([]);
|
|
74796
|
-
if (
|
|
74809
|
+
if (graphql17.isScalarType(unwrapped.type)) {
|
|
74797
74810
|
typeOptions.types.push(
|
|
74798
74811
|
scalarPropertyValue(config2, /* @__PURE__ */ new Set(), unwrapped.type)
|
|
74799
74812
|
);
|
|
74800
|
-
} else if (
|
|
74813
|
+
} else if (graphql17.isEnumType(unwrapped.type)) {
|
|
74801
74814
|
typeOptions.types.push(
|
|
74802
74815
|
AST10.tsTypeReference(AST10.identifier(unwrapped.type.name))
|
|
74803
74816
|
);
|
|
74804
|
-
} else if (!
|
|
74817
|
+
} else if (!graphql17.isAbstractType(unwrapped.type)) {
|
|
74805
74818
|
typeOptions.types.push(record(unwrapped.type.name));
|
|
74806
74819
|
} else {
|
|
74807
74820
|
typeOptions.types.push(
|
|
@@ -74887,7 +74900,7 @@ function listDefinitions(config2, docs) {
|
|
|
74887
74900
|
const lists = [];
|
|
74888
74901
|
const visitedLists = /* @__PURE__ */ new Set();
|
|
74889
74902
|
for (const doc of docs) {
|
|
74890
|
-
|
|
74903
|
+
graphql17.visit(doc.document, {
|
|
74891
74904
|
Directive(node, key, parent, path2, ancestors) {
|
|
74892
74905
|
if (![config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
74893
74906
|
return;
|
|
@@ -74907,7 +74920,7 @@ function listDefinitions(config2, docs) {
|
|
|
74907
74920
|
const targetFieldDefinition = parentType.getFields()[targetField.name.value];
|
|
74908
74921
|
const { type: listType } = unwrapType(config2, targetFieldDefinition.type);
|
|
74909
74922
|
const possibleTypes = [];
|
|
74910
|
-
if (
|
|
74923
|
+
if (graphql17.isAbstractType(listType)) {
|
|
74911
74924
|
possibleTypes.push(
|
|
74912
74925
|
...config2.schema.getPossibleTypes(listType).map((possible) => possible.name)
|
|
74913
74926
|
);
|
|
@@ -74971,7 +74984,7 @@ function record(name2) {
|
|
|
74971
74984
|
}
|
|
74972
74985
|
|
|
74973
74986
|
// src/codegen/generators/typescript/inlineType.ts
|
|
74974
|
-
var
|
|
74987
|
+
var graphql18 = __toESM(require_graphql2(), 1);
|
|
74975
74988
|
var recast11 = __toESM(require_main2(), 1);
|
|
74976
74989
|
var AST11 = recast11.types.builders;
|
|
74977
74990
|
var fragmentKey = "$fragments";
|
|
@@ -74990,9 +75003,9 @@ function inlineType({
|
|
|
74990
75003
|
}) {
|
|
74991
75004
|
const { type, wrappers } = unwrapType(config2, rootType);
|
|
74992
75005
|
let result;
|
|
74993
|
-
if (
|
|
75006
|
+
if (graphql18.isScalarType(type)) {
|
|
74994
75007
|
result = scalarPropertyValue(config2, missingScalars, type);
|
|
74995
|
-
} else if (
|
|
75008
|
+
} else if (graphql18.isEnumType(type)) {
|
|
74996
75009
|
if (!visitedTypes.has(type.name)) {
|
|
74997
75010
|
ensureImports({
|
|
74998
75011
|
config: config2,
|
|
@@ -75010,11 +75023,11 @@ function inlineType({
|
|
|
75010
75023
|
for (const selection2 of selections) {
|
|
75011
75024
|
if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
|
|
75012
75025
|
const fragmentType = config2.schema.getType(selection2.typeCondition.name.value);
|
|
75013
|
-
if (!
|
|
75026
|
+
if (!graphql18.isInterfaceType(type) && !graphql18.isUnionType(type)) {
|
|
75014
75027
|
selectedFields.push(...selection2.selectionSet.selections);
|
|
75015
75028
|
continue;
|
|
75016
75029
|
}
|
|
75017
|
-
if (!
|
|
75030
|
+
if (!graphql18.isInterfaceType(fragmentType) && !graphql18.isUnionType(fragmentType)) {
|
|
75018
75031
|
if (!inlineFragments[fragmentType.name]) {
|
|
75019
75032
|
inlineFragments[fragmentType.name] = [];
|
|
75020
75033
|
}
|
|
@@ -75134,7 +75147,7 @@ function inlineType({
|
|
|
75134
75147
|
}
|
|
75135
75148
|
}
|
|
75136
75149
|
}
|
|
75137
|
-
if (objectType.type === "TSTypeLiteral" && !
|
|
75150
|
+
if (objectType.type === "TSTypeLiteral" && !graphql18.isInterfaceType(fragmentRootType) && !graphql18.isUnionType(fragmentRootType)) {
|
|
75138
75151
|
const existingTypenameIndex = objectType.members.findIndex(
|
|
75139
75152
|
(member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
|
|
75140
75153
|
);
|
|
@@ -75201,7 +75214,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
75201
75214
|
},
|
|
75202
75215
|
type: schema.getType("String")
|
|
75203
75216
|
};
|
|
75204
|
-
} else if (
|
|
75217
|
+
} else if (graphql18.isNonNullType(rootType) && "getFields" in rootType.ofType) {
|
|
75205
75218
|
fields = rootType.ofType.getFields();
|
|
75206
75219
|
} else {
|
|
75207
75220
|
fields = rootType.getFields();
|
|
@@ -75213,7 +75226,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection2) {
|
|
|
75213
75226
|
message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
|
|
75214
75227
|
});
|
|
75215
75228
|
}
|
|
75216
|
-
const fieldType =
|
|
75229
|
+
const fieldType = graphql18.getNamedType(field.type);
|
|
75217
75230
|
if (!fieldType) {
|
|
75218
75231
|
throw new HoudiniError({
|
|
75219
75232
|
filepath,
|
|
@@ -75534,7 +75547,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
|
|
|
75534
75547
|
}
|
|
75535
75548
|
|
|
75536
75549
|
// src/codegen/generators/persistedQueries/index.ts
|
|
75537
|
-
var
|
|
75550
|
+
var graphql19 = __toESM(require_graphql2(), 1);
|
|
75538
75551
|
async function persistOutputGenerator(config2, docs) {
|
|
75539
75552
|
if (typeof config2.persistedQueryPath !== "string" || config2.persistedQueryPath.length === 0)
|
|
75540
75553
|
return;
|
|
@@ -75546,8 +75559,8 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75546
75559
|
if (!generateArtifact) {
|
|
75547
75560
|
return acc;
|
|
75548
75561
|
}
|
|
75549
|
-
let rawString =
|
|
75550
|
-
|
|
75562
|
+
let rawString = graphql19.print(
|
|
75563
|
+
graphql19.visit(document, {
|
|
75551
75564
|
Directive(node) {
|
|
75552
75565
|
if (config2.isInternalDirective(node)) {
|
|
75553
75566
|
return null;
|
|
@@ -75556,7 +75569,7 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75556
75569
|
})
|
|
75557
75570
|
);
|
|
75558
75571
|
const operations = document.definitions.filter(
|
|
75559
|
-
({ kind }) => kind ===
|
|
75572
|
+
({ kind }) => kind === graphql19.Kind.OPERATION_DEFINITION
|
|
75560
75573
|
);
|
|
75561
75574
|
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
75562
75575
|
acc[hashDocument(rawString)] = rawString;
|
|
@@ -75569,11 +75582,11 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
75569
75582
|
}
|
|
75570
75583
|
|
|
75571
75584
|
// src/codegen/generators/definitions/enums.ts
|
|
75572
|
-
var
|
|
75585
|
+
var graphql20 = __toESM(require_graphql2(), 1);
|
|
75573
75586
|
var recast13 = __toESM(require_main2(), 1);
|
|
75574
75587
|
var AST13 = recast13.types.builders;
|
|
75575
75588
|
async function definitionsGenerator(config2) {
|
|
75576
|
-
const enums =
|
|
75589
|
+
const enums = graphql20.parse(graphql20.printSchema(config2.schema)).definitions.filter(
|
|
75577
75590
|
(definition) => definition.kind === "EnumTypeDefinition"
|
|
75578
75591
|
).filter((def) => !config2.isInternalEnum(def));
|
|
75579
75592
|
const runtimeDefinitions = recast13.print(
|
|
@@ -75746,7 +75759,7 @@ function flattenFragments(filepath, operation, fragments) {
|
|
|
75746
75759
|
}
|
|
75747
75760
|
|
|
75748
75761
|
// src/codegen/transforms/schema.ts
|
|
75749
|
-
var
|
|
75762
|
+
var graphql22 = __toESM(require_graphql2(), 1);
|
|
75750
75763
|
async function graphqlExtensions(config2, documents) {
|
|
75751
75764
|
const internalSchema = `
|
|
75752
75765
|
enum CachePolicy {
|
|
@@ -75824,19 +75837,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
|
|
|
75824
75837
|
"""
|
|
75825
75838
|
directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
|
|
75826
75839
|
`;
|
|
75827
|
-
let currentSchema =
|
|
75840
|
+
let currentSchema = graphql22.printSchema(config2.schema);
|
|
75828
75841
|
if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
|
|
75829
75842
|
currentSchema += internalSchema;
|
|
75830
75843
|
}
|
|
75831
75844
|
config2.newSchema += internalSchema;
|
|
75832
|
-
config2.schema =
|
|
75845
|
+
config2.schema = graphql22.buildSchema(currentSchema);
|
|
75833
75846
|
}
|
|
75834
75847
|
|
|
75835
75848
|
// src/codegen/transforms/typename.ts
|
|
75836
|
-
var
|
|
75849
|
+
var graphql23 = __toESM(require_graphql2(), 1);
|
|
75837
75850
|
async function addTypename(config2, documents) {
|
|
75838
75851
|
for (const doc of documents) {
|
|
75839
|
-
doc.document =
|
|
75852
|
+
doc.document = graphql23.visit(doc.document, {
|
|
75840
75853
|
Field(node, key, parent, path2, ancestors) {
|
|
75841
75854
|
if (!node.selectionSet) {
|
|
75842
75855
|
return;
|
|
@@ -75848,7 +75861,7 @@ async function addTypename(config2, documents) {
|
|
|
75848
75861
|
);
|
|
75849
75862
|
const field = type.getFields()[node.name.value];
|
|
75850
75863
|
const fieldType = unwrapType(config2, field.type).type;
|
|
75851
|
-
if (
|
|
75864
|
+
if (graphql23.isInterfaceType(fieldType) || graphql23.isUnionType(fieldType)) {
|
|
75852
75865
|
return {
|
|
75853
75866
|
...node,
|
|
75854
75867
|
selectionSet: {
|
|
@@ -75856,9 +75869,9 @@ async function addTypename(config2, documents) {
|
|
|
75856
75869
|
selections: [
|
|
75857
75870
|
...node.selectionSet.selections,
|
|
75858
75871
|
{
|
|
75859
|
-
kind:
|
|
75872
|
+
kind: graphql23.Kind.FIELD,
|
|
75860
75873
|
name: {
|
|
75861
|
-
kind:
|
|
75874
|
+
kind: graphql23.Kind.NAME,
|
|
75862
75875
|
value: "__typename"
|
|
75863
75876
|
}
|
|
75864
75877
|
}
|
|
@@ -75872,10 +75885,10 @@ async function addTypename(config2, documents) {
|
|
|
75872
75885
|
}
|
|
75873
75886
|
|
|
75874
75887
|
// src/codegen/transforms/addID.ts
|
|
75875
|
-
var
|
|
75888
|
+
var graphql24 = __toESM(require_graphql2(), 1);
|
|
75876
75889
|
async function addID(config2, documents) {
|
|
75877
75890
|
for (const doc of documents) {
|
|
75878
|
-
doc.document =
|
|
75891
|
+
doc.document = graphql24.visit(doc.document, {
|
|
75879
75892
|
Field(node, key, parent, path2, ancestors) {
|
|
75880
75893
|
if (!node.selectionSet) {
|
|
75881
75894
|
return;
|
|
@@ -75888,7 +75901,7 @@ async function addID(config2, documents) {
|
|
|
75888
75901
|
const field = type.getFields()[node.name.value];
|
|
75889
75902
|
const fieldType = unwrapType(config2, field.type).type;
|
|
75890
75903
|
if (node.selectionSet?.selections.length > 0) {
|
|
75891
|
-
if (!
|
|
75904
|
+
if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
|
|
75892
75905
|
return;
|
|
75893
75906
|
}
|
|
75894
75907
|
const keyFields = config2.keyFieldsForType(fieldType.name);
|
|
@@ -75903,9 +75916,9 @@ async function addID(config2, documents) {
|
|
|
75903
75916
|
continue;
|
|
75904
75917
|
}
|
|
75905
75918
|
selections.push({
|
|
75906
|
-
kind:
|
|
75919
|
+
kind: graphql24.Kind.FIELD,
|
|
75907
75920
|
name: {
|
|
75908
|
-
kind:
|
|
75921
|
+
kind: graphql24.Kind.NAME,
|
|
75909
75922
|
value: keyField
|
|
75910
75923
|
}
|
|
75911
75924
|
});
|
|
@@ -75924,8 +75937,8 @@ async function addID(config2, documents) {
|
|
|
75924
75937
|
}
|
|
75925
75938
|
|
|
75926
75939
|
// src/codegen/transforms/fragmentVariables.ts
|
|
75927
|
-
var
|
|
75928
|
-
var GraphqlKinds2 =
|
|
75940
|
+
var graphql25 = __toESM(require_graphql2(), 1);
|
|
75941
|
+
var GraphqlKinds2 = graphql25.Kind;
|
|
75929
75942
|
async function fragmentVariables(config2, documents) {
|
|
75930
75943
|
const fragments = collectFragments(config2, documents);
|
|
75931
75944
|
const generatedFragments = {};
|
|
@@ -75948,7 +75961,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
75948
75961
|
});
|
|
75949
75962
|
}
|
|
75950
75963
|
const doc = {
|
|
75951
|
-
kind:
|
|
75964
|
+
kind: graphql25.Kind.DOCUMENT,
|
|
75952
75965
|
definitions: Object.values(generatedFragments)
|
|
75953
75966
|
};
|
|
75954
75967
|
documents.push({
|
|
@@ -75984,7 +75997,7 @@ function inlineFragmentArgs({
|
|
|
75984
75997
|
filepath,
|
|
75985
75998
|
document
|
|
75986
75999
|
).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
|
|
75987
|
-
const result =
|
|
76000
|
+
const result = graphql25.visit(document, {
|
|
75988
76001
|
FragmentSpread(node) {
|
|
75989
76002
|
const { definition } = fragmentDefinitions[node.name.value];
|
|
75990
76003
|
let { args, hash } = collectWithArguments(config2, filepath, node, scope);
|
|
@@ -76072,7 +76085,7 @@ function inlineFragmentArgs({
|
|
|
76072
76085
|
});
|
|
76073
76086
|
if (newName) {
|
|
76074
76087
|
result.name = {
|
|
76075
|
-
kind:
|
|
76088
|
+
kind: graphql25.Kind.NAME,
|
|
76076
76089
|
value: newName
|
|
76077
76090
|
};
|
|
76078
76091
|
}
|
|
@@ -76184,7 +76197,7 @@ function operationScope(operation) {
|
|
|
76184
76197
|
}
|
|
76185
76198
|
|
|
76186
76199
|
// src/codegen/validators/typeCheck.ts
|
|
76187
|
-
var
|
|
76200
|
+
var graphql26 = __toESM(require_graphql2(), 1);
|
|
76188
76201
|
async function typeCheck(config2, docs) {
|
|
76189
76202
|
const errors = [];
|
|
76190
76203
|
const freeLists = [];
|
|
@@ -76192,11 +76205,11 @@ async function typeCheck(config2, docs) {
|
|
|
76192
76205
|
const listTypes = [];
|
|
76193
76206
|
const fragments = {};
|
|
76194
76207
|
for (const { document: parsed, filename } of docs) {
|
|
76195
|
-
|
|
76196
|
-
[
|
|
76208
|
+
graphql26.visit(parsed, {
|
|
76209
|
+
[graphql26.Kind.FRAGMENT_DEFINITION](definition) {
|
|
76197
76210
|
fragments[definition.name.value] = definition;
|
|
76198
76211
|
},
|
|
76199
|
-
[
|
|
76212
|
+
[graphql26.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
|
|
76200
76213
|
if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
|
|
76201
76214
|
return;
|
|
76202
76215
|
}
|
|
@@ -76242,14 +76255,14 @@ async function typeCheck(config2, docs) {
|
|
|
76242
76255
|
);
|
|
76243
76256
|
return;
|
|
76244
76257
|
}
|
|
76245
|
-
if (
|
|
76258
|
+
if (graphql26.isListType(rootType) || graphql26.isNonNullType(rootType) && graphql26.isListType(rootType.ofType)) {
|
|
76246
76259
|
needsParent = true;
|
|
76247
76260
|
break;
|
|
76248
76261
|
}
|
|
76249
|
-
if (
|
|
76262
|
+
if (graphql26.isNonNullType(rootType) && "ofType" in rootType) {
|
|
76250
76263
|
rootType = rootType.ofType;
|
|
76251
76264
|
}
|
|
76252
|
-
if (
|
|
76265
|
+
if (graphql26.isScalarType(rootType)) {
|
|
76253
76266
|
break;
|
|
76254
76267
|
}
|
|
76255
76268
|
rootType = rootType?.getFields()[parent2.name.value]?.type;
|
|
@@ -76325,9 +76338,9 @@ async function typeCheck(config2, docs) {
|
|
|
76325
76338
|
);
|
|
76326
76339
|
}
|
|
76327
76340
|
let targetTypes = [type];
|
|
76328
|
-
if (
|
|
76341
|
+
if (graphql26.isUnionType(type)) {
|
|
76329
76342
|
targetTypes = config2.schema.getPossibleTypes(type);
|
|
76330
|
-
} else if (
|
|
76343
|
+
} else if (graphql26.isInterfaceType(type)) {
|
|
76331
76344
|
try {
|
|
76332
76345
|
for (const key of config2.keyFieldsForType(type.name)) {
|
|
76333
76346
|
if (!type.getFields()[key]) {
|
|
@@ -76365,13 +76378,13 @@ async function typeCheck(config2, docs) {
|
|
|
76365
76378
|
if (errors.length > 0) {
|
|
76366
76379
|
throw errors;
|
|
76367
76380
|
}
|
|
76368
|
-
const rules = (filepath) => [...
|
|
76381
|
+
const rules = (filepath) => [...graphql26.specifiedRules].filter(
|
|
76369
76382
|
(rule) => ![
|
|
76370
|
-
|
|
76371
|
-
|
|
76372
|
-
|
|
76373
|
-
|
|
76374
|
-
|
|
76383
|
+
graphql26.NoUnusedFragmentsRule,
|
|
76384
|
+
graphql26.KnownFragmentNamesRule,
|
|
76385
|
+
graphql26.ExecutableDefinitionsRule,
|
|
76386
|
+
graphql26.KnownDirectivesRule,
|
|
76387
|
+
graphql26.KnownArgumentNamesRule
|
|
76375
76388
|
].includes(rule)
|
|
76376
76389
|
).concat(
|
|
76377
76390
|
validateLists({
|
|
@@ -76390,7 +76403,7 @@ async function typeCheck(config2, docs) {
|
|
|
76390
76403
|
noUnusedFragmentArguments(config2)
|
|
76391
76404
|
);
|
|
76392
76405
|
for (const { filename, document: parsed } of docs) {
|
|
76393
|
-
for (const error of
|
|
76406
|
+
for (const error of graphql26.validate(config2.schema, parsed, rules(filename))) {
|
|
76394
76407
|
errors.push(
|
|
76395
76408
|
new HoudiniError({
|
|
76396
76409
|
filepath: filename,
|
|
@@ -76416,7 +76429,7 @@ var validateLists = ({
|
|
|
76416
76429
|
if (!config2.isListFragment(node.name.value)) {
|
|
76417
76430
|
if (!fragments[node.name.value]) {
|
|
76418
76431
|
ctx.reportError(
|
|
76419
|
-
new
|
|
76432
|
+
new graphql26.GraphQLError(
|
|
76420
76433
|
"Encountered unknown fragment: " + node.name.value
|
|
76421
76434
|
)
|
|
76422
76435
|
);
|
|
@@ -76426,7 +76439,7 @@ var validateLists = ({
|
|
|
76426
76439
|
const listName = config2.listNameFromFragment(node.name.value);
|
|
76427
76440
|
if (!lists.includes(listName)) {
|
|
76428
76441
|
ctx.reportError(
|
|
76429
|
-
new
|
|
76442
|
+
new graphql26.GraphQLError(
|
|
76430
76443
|
"Encountered fragment referencing unknown list: " + listName
|
|
76431
76444
|
)
|
|
76432
76445
|
);
|
|
@@ -76451,7 +76464,7 @@ var validateLists = ({
|
|
|
76451
76464
|
);
|
|
76452
76465
|
if (parentArg) {
|
|
76453
76466
|
ctx.reportError(
|
|
76454
|
-
new
|
|
76467
|
+
new graphql26.GraphQLError(
|
|
76455
76468
|
`@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
|
|
76456
76469
|
)
|
|
76457
76470
|
);
|
|
@@ -76467,7 +76480,7 @@ var validateLists = ({
|
|
|
76467
76480
|
return;
|
|
76468
76481
|
}
|
|
76469
76482
|
ctx.reportError(
|
|
76470
|
-
new
|
|
76483
|
+
new graphql26.GraphQLError(
|
|
76471
76484
|
`For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
|
|
76472
76485
|
)
|
|
76473
76486
|
);
|
|
@@ -76477,7 +76490,7 @@ var validateLists = ({
|
|
|
76477
76490
|
const directiveName = node.name.value;
|
|
76478
76491
|
if (directiveName === "connection") {
|
|
76479
76492
|
ctx.reportError(
|
|
76480
|
-
new
|
|
76493
|
+
new graphql26.GraphQLError(
|
|
76481
76494
|
"@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."
|
|
76482
76495
|
)
|
|
76483
76496
|
);
|
|
@@ -76486,7 +76499,7 @@ var validateLists = ({
|
|
|
76486
76499
|
if (!config2.isInternalDirective(node)) {
|
|
76487
76500
|
if (!config2.schema.getDirective(directiveName)) {
|
|
76488
76501
|
ctx.reportError(
|
|
76489
|
-
new
|
|
76502
|
+
new graphql26.GraphQLError(
|
|
76490
76503
|
"Encountered unknown directive: " + directiveName
|
|
76491
76504
|
)
|
|
76492
76505
|
);
|
|
@@ -76495,7 +76508,7 @@ var validateLists = ({
|
|
|
76495
76508
|
}
|
|
76496
76509
|
if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
|
|
76497
76510
|
ctx.reportError(
|
|
76498
|
-
new
|
|
76511
|
+
new graphql26.GraphQLError(
|
|
76499
76512
|
"Encountered directive referencing unknown list: " + directiveName
|
|
76500
76513
|
)
|
|
76501
76514
|
);
|
|
@@ -76506,7 +76519,7 @@ var validateLists = ({
|
|
|
76506
76519
|
};
|
|
76507
76520
|
function knownArguments(config2) {
|
|
76508
76521
|
return function(ctx) {
|
|
76509
|
-
const nativeValidator =
|
|
76522
|
+
const nativeValidator = graphql26.KnownArgumentNamesRule(ctx);
|
|
76510
76523
|
return {
|
|
76511
76524
|
...nativeValidator,
|
|
76512
76525
|
Directive(directiveNode) {
|
|
@@ -76539,7 +76552,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76539
76552
|
for (const arg of node.arguments || []) {
|
|
76540
76553
|
if (arg.value.kind !== "ObjectValue") {
|
|
76541
76554
|
ctx.reportError(
|
|
76542
|
-
new
|
|
76555
|
+
new graphql26.GraphQLError("values in @arguments must be an object")
|
|
76543
76556
|
);
|
|
76544
76557
|
return;
|
|
76545
76558
|
}
|
|
@@ -76549,13 +76562,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76549
76562
|
);
|
|
76550
76563
|
if (!typeArg) {
|
|
76551
76564
|
ctx.reportError(
|
|
76552
|
-
new
|
|
76565
|
+
new graphql26.GraphQLError("missing type field for @arguments directive")
|
|
76553
76566
|
);
|
|
76554
76567
|
return;
|
|
76555
76568
|
}
|
|
76556
|
-
if (typeArg.value.kind !==
|
|
76569
|
+
if (typeArg.value.kind !== graphql26.Kind.STRING) {
|
|
76557
76570
|
ctx.reportError(
|
|
76558
|
-
new
|
|
76571
|
+
new graphql26.GraphQLError("type field to @arguments must be a string")
|
|
76559
76572
|
);
|
|
76560
76573
|
return;
|
|
76561
76574
|
}
|
|
@@ -76568,7 +76581,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76568
76581
|
);
|
|
76569
76582
|
if (typeArg.value.value !== defaultValueType) {
|
|
76570
76583
|
ctx.reportError(
|
|
76571
|
-
new
|
|
76584
|
+
new graphql26.GraphQLError(
|
|
76572
76585
|
`Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
|
|
76573
76586
|
)
|
|
76574
76587
|
);
|
|
@@ -76586,7 +76599,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76586
76599
|
try {
|
|
76587
76600
|
args = fragmentArguments(config2, filepath, fragments[fragmentName]);
|
|
76588
76601
|
} catch (e2) {
|
|
76589
|
-
ctx.reportError(new
|
|
76602
|
+
ctx.reportError(new graphql26.GraphQLError(e2.message));
|
|
76590
76603
|
return;
|
|
76591
76604
|
}
|
|
76592
76605
|
fragmentArguments2[fragmentName] = args;
|
|
@@ -76609,7 +76622,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76609
76622
|
);
|
|
76610
76623
|
if (missing.length > 0) {
|
|
76611
76624
|
ctx.reportError(
|
|
76612
|
-
new
|
|
76625
|
+
new graphql26.GraphQLError(
|
|
76613
76626
|
"The following arguments are missing from this fragment: " + JSON.stringify(missing)
|
|
76614
76627
|
)
|
|
76615
76628
|
);
|
|
@@ -76620,7 +76633,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76620
76633
|
);
|
|
76621
76634
|
if (unknown.length > 0) {
|
|
76622
76635
|
ctx.reportError(
|
|
76623
|
-
new
|
|
76636
|
+
new graphql26.GraphQLError(
|
|
76624
76637
|
"Encountered unknown arguments: " + JSON.stringify(unknown)
|
|
76625
76638
|
)
|
|
76626
76639
|
);
|
|
@@ -76632,7 +76645,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76632
76645
|
]
|
|
76633
76646
|
);
|
|
76634
76647
|
for (const [applied, target] of zipped) {
|
|
76635
|
-
if (applied.value.kind ===
|
|
76648
|
+
if (applied.value.kind === graphql26.Kind.VARIABLE || applied.value.kind === graphql26.Kind.LIST || applied.value.kind === graphql26.Kind.OBJECT) {
|
|
76636
76649
|
continue;
|
|
76637
76650
|
}
|
|
76638
76651
|
const appliedType = applied.value.kind.substring(
|
|
@@ -76641,7 +76654,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
76641
76654
|
);
|
|
76642
76655
|
if (appliedType !== target) {
|
|
76643
76656
|
ctx.reportError(
|
|
76644
|
-
new
|
|
76657
|
+
new graphql26.GraphQLError(
|
|
76645
76658
|
`Invalid argument type. Expected ${target}, found ${appliedType}`
|
|
76646
76659
|
)
|
|
76647
76660
|
);
|
|
@@ -76662,7 +76675,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76662
76675
|
}
|
|
76663
76676
|
if (alreadyPaginated) {
|
|
76664
76677
|
ctx.reportError(
|
|
76665
|
-
new
|
|
76678
|
+
new graphql26.GraphQLError(
|
|
76666
76679
|
`@${config2.paginateDirective} can only appear in a document once.`
|
|
76667
76680
|
)
|
|
76668
76681
|
);
|
|
@@ -76677,7 +76690,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76677
76690
|
const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
|
|
76678
76691
|
if (hasRequiredArgs) {
|
|
76679
76692
|
ctx.reportError(
|
|
76680
|
-
new
|
|
76693
|
+
new graphql26.GraphQLError(
|
|
76681
76694
|
"@paginate cannot appear on a document with required args"
|
|
76682
76695
|
)
|
|
76683
76696
|
);
|
|
@@ -76709,14 +76722,14 @@ function paginateArgs(config2, filepath) {
|
|
|
76709
76722
|
const backwards = appliedArgs.has("last");
|
|
76710
76723
|
if (!forward && !backwards) {
|
|
76711
76724
|
ctx.reportError(
|
|
76712
|
-
new
|
|
76725
|
+
new graphql26.GraphQLError(
|
|
76713
76726
|
"A field with cursor-based pagination must have a first or last argument"
|
|
76714
76727
|
)
|
|
76715
76728
|
);
|
|
76716
76729
|
}
|
|
76717
76730
|
if (forward && backwards) {
|
|
76718
76731
|
ctx.reportError(
|
|
76719
|
-
new
|
|
76732
|
+
new graphql26.GraphQLError(
|
|
76720
76733
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
|
76721
76734
|
)
|
|
76722
76735
|
);
|
|
@@ -76730,7 +76743,7 @@ function paginateArgs(config2, filepath) {
|
|
|
76730
76743
|
);
|
|
76731
76744
|
if (!appliedLimitArg) {
|
|
76732
76745
|
ctx.reportError(
|
|
76733
|
-
new
|
|
76746
|
+
new graphql26.GraphQLError(
|
|
76734
76747
|
"A field with offset-based pagination must have a limit argument"
|
|
76735
76748
|
)
|
|
76736
76749
|
);
|
|
@@ -76746,20 +76759,20 @@ function noUnusedFragmentArguments(config2) {
|
|
|
76746
76759
|
const args = /* @__PURE__ */ new Set();
|
|
76747
76760
|
return {
|
|
76748
76761
|
enter(node) {
|
|
76749
|
-
if (node.kind ===
|
|
76762
|
+
if (node.kind === graphql26.Kind.FRAGMENT_DEFINITION) {
|
|
76750
76763
|
const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
|
|
76751
76764
|
for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
|
|
76752
76765
|
args.add(arg);
|
|
76753
76766
|
}
|
|
76754
|
-
} else if (node.kind ===
|
|
76767
|
+
} else if (node.kind === graphql26.Kind.VARIABLE) {
|
|
76755
76768
|
args.delete(node.name.value);
|
|
76756
76769
|
}
|
|
76757
76770
|
},
|
|
76758
76771
|
leave(node) {
|
|
76759
|
-
if (node.kind ===
|
|
76772
|
+
if (node.kind === graphql26.Kind.FRAGMENT_DEFINITION) {
|
|
76760
76773
|
if (args.size > 0) {
|
|
76761
76774
|
ctx.reportError(
|
|
76762
|
-
new
|
|
76775
|
+
new graphql26.GraphQLError(
|
|
76763
76776
|
"Encountered unused fragment arguments: " + [...args].join(",")
|
|
76764
76777
|
)
|
|
76765
76778
|
);
|
|
@@ -76795,7 +76808,7 @@ function nodeDirectives(config2, directives) {
|
|
|
76795
76808
|
if (definition.kind === "OperationDefinition") {
|
|
76796
76809
|
if (definition.operation !== "query") {
|
|
76797
76810
|
ctx.reportError(
|
|
76798
|
-
new
|
|
76811
|
+
new graphql26.GraphQLError(
|
|
76799
76812
|
`@${node.name.value} must fall on a fragment or query document`
|
|
76800
76813
|
)
|
|
76801
76814
|
);
|
|
@@ -76807,7 +76820,7 @@ function nodeDirectives(config2, directives) {
|
|
|
76807
76820
|
}
|
|
76808
76821
|
if (!possibleNodes.includes(definitionType)) {
|
|
76809
76822
|
ctx.reportError(
|
|
76810
|
-
new
|
|
76823
|
+
new graphql26.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
|
|
76811
76824
|
);
|
|
76812
76825
|
}
|
|
76813
76826
|
}
|
|
@@ -76826,7 +76839,7 @@ function checkMutationOperation(config2) {
|
|
|
76826
76839
|
);
|
|
76827
76840
|
if (append && prepend) {
|
|
76828
76841
|
ctx.reportError(
|
|
76829
|
-
new
|
|
76842
|
+
new graphql26.GraphQLError(
|
|
76830
76843
|
`You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
|
|
76831
76844
|
)
|
|
76832
76845
|
);
|
|
@@ -76840,7 +76853,7 @@ function checkMutationOperation(config2) {
|
|
|
76840
76853
|
);
|
|
76841
76854
|
if (parentId && allLists) {
|
|
76842
76855
|
ctx.reportError(
|
|
76843
|
-
new
|
|
76856
|
+
new graphql26.GraphQLError(
|
|
76844
76857
|
`You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
|
|
76845
76858
|
)
|
|
76846
76859
|
);
|
|
@@ -76862,7 +76875,7 @@ function checkMaskDirective(config2) {
|
|
|
76862
76875
|
);
|
|
76863
76876
|
if (maskEnableDirective && maskDisableDirective) {
|
|
76864
76877
|
ctx.reportError(
|
|
76865
|
-
new
|
|
76878
|
+
new graphql26.GraphQLError(
|
|
76866
76879
|
`You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
|
|
76867
76880
|
)
|
|
76868
76881
|
);
|
|
@@ -76878,7 +76891,7 @@ function getAndVerifyNodeInterface(config2) {
|
|
|
76878
76891
|
if (!nodeInterface) {
|
|
76879
76892
|
return null;
|
|
76880
76893
|
}
|
|
76881
|
-
if (!
|
|
76894
|
+
if (!graphql26.isInterfaceType(nodeInterface)) {
|
|
76882
76895
|
displayInvalidNodeFieldMessage(config2.logLevel);
|
|
76883
76896
|
return null;
|
|
76884
76897
|
}
|
|
@@ -76976,11 +76989,11 @@ async function uniqueDocumentNames(config2, docs) {
|
|
|
76976
76989
|
}
|
|
76977
76990
|
|
|
76978
76991
|
// src/codegen/validators/noIDAlias.ts
|
|
76979
|
-
var
|
|
76992
|
+
var graphql27 = __toESM(require_graphql2(), 1);
|
|
76980
76993
|
async function noIDAlias(config2, docs) {
|
|
76981
76994
|
const errors = [];
|
|
76982
76995
|
for (const { filename, document } of docs) {
|
|
76983
|
-
|
|
76996
|
+
graphql27.visit(document, {
|
|
76984
76997
|
Field(node, _, __, ___, ancestors) {
|
|
76985
76998
|
const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
|
|
76986
76999
|
if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
|
|
@@ -77178,12 +77191,12 @@ async function processJSFile(config2, contents) {
|
|
|
77178
77191
|
return documents;
|
|
77179
77192
|
}
|
|
77180
77193
|
async function processGraphQLDocument(config2, filepath, document) {
|
|
77181
|
-
const parsedDoc =
|
|
77194
|
+
const parsedDoc = graphql28.parse(document);
|
|
77182
77195
|
const operations = parsedDoc.definitions.filter(
|
|
77183
|
-
({ kind: kind2 }) => kind2 ===
|
|
77196
|
+
({ kind: kind2 }) => kind2 === graphql28.Kind.OPERATION_DEFINITION
|
|
77184
77197
|
);
|
|
77185
77198
|
const fragments = parsedDoc.definitions.filter(
|
|
77186
|
-
({ kind: kind2 }) => kind2 ===
|
|
77199
|
+
({ kind: kind2 }) => kind2 === graphql28.Kind.FRAGMENT_DEFINITION
|
|
77187
77200
|
);
|
|
77188
77201
|
if (operations.length > 1) {
|
|
77189
77202
|
throw new HoudiniError({
|
|
@@ -77489,7 +77502,7 @@ async function init(_path, args) {
|
|
|
77489
77502
|
} else if (framework === "svelte") {
|
|
77490
77503
|
await updateSvelteMainJs(targetPath);
|
|
77491
77504
|
}
|
|
77492
|
-
await updateViteConfig(targetPath, framework
|
|
77505
|
+
await updateViteConfig(targetPath, framework);
|
|
77493
77506
|
await tjsConfig(targetPath, framework);
|
|
77494
77507
|
console.log();
|
|
77495
77508
|
console.log("\u{1F3A9} Welcome to Houdini!");
|
|
@@ -77603,8 +77616,8 @@ async function tjsConfig(targetPath, framework) {
|
|
|
77603
77616
|
}
|
|
77604
77617
|
return false;
|
|
77605
77618
|
}
|
|
77606
|
-
async function updateViteConfig(targetPath, framework
|
|
77607
|
-
const viteConfigPath = path_exports.join(targetPath,
|
|
77619
|
+
async function updateViteConfig(targetPath, framework) {
|
|
77620
|
+
const viteConfigPath = path_exports.join(targetPath, "vite.config.js");
|
|
77608
77621
|
const viteConfigKit = `import { sveltekit } from '@sveltejs/kit/vite';
|
|
77609
77622
|
import houdini from 'houdini/vite';
|
|
77610
77623
|
|
|
@@ -77613,16 +77626,6 @@ const config = {
|
|
|
77613
77626
|
plugins: [houdini(), sveltekit()],
|
|
77614
77627
|
}
|
|
77615
77628
|
|
|
77616
|
-
export default config;
|
|
77617
|
-
`;
|
|
77618
|
-
const viteConfigKitTs = `import { sveltekit } from '@sveltejs/kit/vite';
|
|
77619
|
-
import houdini from 'houdini/vite';
|
|
77620
|
-
import type { UserConfig } from "vite";
|
|
77621
|
-
|
|
77622
|
-
const config: UserConfig = {
|
|
77623
|
-
plugins: [houdini(), sveltekit()],
|
|
77624
|
-
}
|
|
77625
|
-
|
|
77626
77629
|
export default config;
|
|
77627
77630
|
`;
|
|
77628
77631
|
const viteConfigSvelte = `import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|
@@ -77635,39 +77638,18 @@ const config = {
|
|
|
77635
77638
|
|
|
77636
77639
|
export default config;
|
|
77637
77640
|
`;
|
|
77638
|
-
|
|
77639
|
-
|
|
77640
|
-
import type { UserConfig } from "vite";
|
|
77641
|
-
|
|
77642
|
-
const config: UserConfig = {
|
|
77643
|
-
plugins: [houdini(), svelte()],
|
|
77644
|
-
}
|
|
77645
|
-
|
|
77646
|
-
export default config;
|
|
77647
|
-
`;
|
|
77648
|
-
let content = "NOTHING!";
|
|
77649
|
-
if (framework === "kit" && typescript) {
|
|
77650
|
-
content = viteConfigKitTs;
|
|
77651
|
-
} else if (framework === "kit" && !typescript) {
|
|
77641
|
+
let content;
|
|
77642
|
+
if (framework === "kit") {
|
|
77652
77643
|
content = viteConfigKit;
|
|
77653
|
-
} else if (framework === "svelte"
|
|
77654
|
-
content = viteConfigSvelteTs;
|
|
77655
|
-
} else if (framework === "svelte" && !typescript) {
|
|
77644
|
+
} else if (framework === "svelte") {
|
|
77656
77645
|
content = viteConfigSvelte;
|
|
77657
77646
|
} else {
|
|
77658
77647
|
throw new Error("Unknown updateViteConfig()");
|
|
77659
77648
|
}
|
|
77660
|
-
|
|
77661
|
-
|
|
77662
|
-
|
|
77663
|
-
|
|
77664
|
-
});
|
|
77665
|
-
} else {
|
|
77666
|
-
await updateFile({
|
|
77667
|
-
filepath: viteConfigPath,
|
|
77668
|
-
content: framework === "kit" ? viteConfigKit : viteConfigSvelte
|
|
77669
|
-
});
|
|
77670
|
-
}
|
|
77649
|
+
await updateFile({
|
|
77650
|
+
filepath: viteConfigPath,
|
|
77651
|
+
content: framework === "kit" ? viteConfigKit : viteConfigSvelte
|
|
77652
|
+
});
|
|
77671
77653
|
}
|
|
77672
77654
|
async function updateSvelteConfig(targetPath, typescript) {
|
|
77673
77655
|
const svelteConfigPath = path_exports.join(targetPath, "svelte.config.js");
|
|
@@ -77688,7 +77670,7 @@ const config = {
|
|
|
77688
77670
|
}
|
|
77689
77671
|
};
|
|
77690
77672
|
|
|
77691
|
-
export default config;
|
|
77673
|
+
export default config;
|
|
77692
77674
|
`;
|
|
77693
77675
|
const newContentJs = `import adapter from '@sveltejs/adapter-auto';
|
|
77694
77676
|
|
|
@@ -77738,8 +77720,8 @@ async function updatePackageJSON(targetPath) {
|
|
|
77738
77720
|
}
|
|
77739
77721
|
packageJSON.devDependencies = {
|
|
77740
77722
|
...packageJSON.devDependencies,
|
|
77741
|
-
houdini: "^0.
|
|
77742
|
-
"houdini-svelte": "^0.
|
|
77723
|
+
houdini: "^0.20.0",
|
|
77724
|
+
"houdini-svelte": "^0.20.0",
|
|
77743
77725
|
graphql: "^15.8.0"
|
|
77744
77726
|
};
|
|
77745
77727
|
await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
|