houdini 1.0.0 → 1.0.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 +89 -48
- package/build/cmd-esm/index.js +89 -48
- package/build/codegen/transforms/fragmentVariables.d.ts +2 -1
- package/build/codegen/validators/typeCheck.d.ts +1 -0
- package/build/codegen-cjs/index.js +87 -46
- package/build/codegen-esm/index.js +87 -46
- package/build/test-cjs/index.js +88 -46
- package/build/test-esm/index.js +88 -46
- package/build/vite-cjs/index.js +87 -46
- package/build/vite-esm/index.js +87 -46
- package/package.json +1 -1
|
@@ -3347,7 +3347,7 @@ var require_definition = __commonJS({
|
|
|
3347
3347
|
exports.assertInterfaceType = assertInterfaceType;
|
|
3348
3348
|
exports.isUnionType = isUnionType7;
|
|
3349
3349
|
exports.assertUnionType = assertUnionType;
|
|
3350
|
-
exports.isEnumType =
|
|
3350
|
+
exports.isEnumType = isEnumType7;
|
|
3351
3351
|
exports.assertEnumType = assertEnumType;
|
|
3352
3352
|
exports.isInputObjectType = isInputObjectType2;
|
|
3353
3353
|
exports.assertInputObjectType = assertInputObjectType;
|
|
@@ -3418,7 +3418,7 @@ var require_definition = __commonJS({
|
|
|
3418
3418
|
return Constructor;
|
|
3419
3419
|
}
|
|
3420
3420
|
function isType(type) {
|
|
3421
|
-
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) ||
|
|
3421
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType7(type) || isInputObjectType2(type) || isListType3(type) || isNonNullType6(type);
|
|
3422
3422
|
}
|
|
3423
3423
|
function assertType(type) {
|
|
3424
3424
|
if (!isType(type)) {
|
|
@@ -3462,11 +3462,11 @@ var require_definition = __commonJS({
|
|
|
3462
3462
|
}
|
|
3463
3463
|
return type;
|
|
3464
3464
|
}
|
|
3465
|
-
function
|
|
3465
|
+
function isEnumType7(type) {
|
|
3466
3466
|
return (0, _instanceOf.default)(type, GraphQLEnumType);
|
|
3467
3467
|
}
|
|
3468
3468
|
function assertEnumType(type) {
|
|
3469
|
-
if (!
|
|
3469
|
+
if (!isEnumType7(type)) {
|
|
3470
3470
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
|
|
3471
3471
|
}
|
|
3472
3472
|
return type;
|
|
@@ -3499,7 +3499,7 @@ var require_definition = __commonJS({
|
|
|
3499
3499
|
return type;
|
|
3500
3500
|
}
|
|
3501
3501
|
function isInputType(type) {
|
|
3502
|
-
return isScalarType7(type) ||
|
|
3502
|
+
return isScalarType7(type) || isEnumType7(type) || isInputObjectType2(type) || isWrappingType(type) && isInputType(type.ofType);
|
|
3503
3503
|
}
|
|
3504
3504
|
function assertInputType(type) {
|
|
3505
3505
|
if (!isInputType(type)) {
|
|
@@ -3508,7 +3508,7 @@ var require_definition = __commonJS({
|
|
|
3508
3508
|
return type;
|
|
3509
3509
|
}
|
|
3510
3510
|
function isOutputType(type) {
|
|
3511
|
-
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) ||
|
|
3511
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType7(type) || isWrappingType(type) && isOutputType(type.ofType);
|
|
3512
3512
|
}
|
|
3513
3513
|
function assertOutputType(type) {
|
|
3514
3514
|
if (!isOutputType(type)) {
|
|
@@ -3517,7 +3517,7 @@ var require_definition = __commonJS({
|
|
|
3517
3517
|
return type;
|
|
3518
3518
|
}
|
|
3519
3519
|
function isLeafType(type) {
|
|
3520
|
-
return isScalarType7(type) ||
|
|
3520
|
+
return isScalarType7(type) || isEnumType7(type);
|
|
3521
3521
|
}
|
|
3522
3522
|
function assertLeafType(type) {
|
|
3523
3523
|
if (!isLeafType(type)) {
|
|
@@ -3605,7 +3605,7 @@ var require_definition = __commonJS({
|
|
|
3605
3605
|
}
|
|
3606
3606
|
}
|
|
3607
3607
|
function isNamedType(type) {
|
|
3608
|
-
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) ||
|
|
3608
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType7(type) || isInputObjectType2(type);
|
|
3609
3609
|
}
|
|
3610
3610
|
function assertNamedType(type) {
|
|
3611
3611
|
if (!isNamedType(type)) {
|
|
@@ -57486,26 +57486,45 @@ function fragmentArguments(config2, filepath, definition) {
|
|
|
57486
57486
|
if (!typeArg || typeArg.kind !== "StringValue") {
|
|
57487
57487
|
return [];
|
|
57488
57488
|
}
|
|
57489
|
-
let type = typeArg.value;
|
|
57490
|
-
let name = arg.name.value;
|
|
57491
|
-
let required = false;
|
|
57489
|
+
let type = parseArgumentTypeString(typeArg.value);
|
|
57492
57490
|
let defaultValue = arg.value.fields?.find((arg2) => arg2.name.value === "default")?.value || null;
|
|
57493
|
-
if (type[type.length - 1] === "!") {
|
|
57494
|
-
type = type.slice(0, -1);
|
|
57495
|
-
required = true;
|
|
57496
|
-
defaultValue = null;
|
|
57497
|
-
}
|
|
57498
57491
|
return [
|
|
57499
57492
|
{
|
|
57500
|
-
name,
|
|
57493
|
+
name: arg.name.value,
|
|
57501
57494
|
type,
|
|
57502
|
-
required,
|
|
57495
|
+
required: type.kind === "NonNullType",
|
|
57503
57496
|
defaultValue
|
|
57504
57497
|
}
|
|
57505
57498
|
];
|
|
57506
57499
|
}) || []
|
|
57507
57500
|
);
|
|
57508
57501
|
}
|
|
57502
|
+
function parseArgumentTypeString(input) {
|
|
57503
|
+
if (input[input.length - 1] === "!") {
|
|
57504
|
+
const inner = parseArgumentTypeString(input.substring(0, input.length - 1));
|
|
57505
|
+
if (inner.kind === "NonNullType") {
|
|
57506
|
+
throw new Error("invalid type" + input);
|
|
57507
|
+
}
|
|
57508
|
+
return {
|
|
57509
|
+
kind: "NonNullType",
|
|
57510
|
+
type: inner
|
|
57511
|
+
};
|
|
57512
|
+
}
|
|
57513
|
+
if (input[input.length - 1] === "]") {
|
|
57514
|
+
const inner = parseArgumentTypeString(input.substring(1, input.length - 1));
|
|
57515
|
+
return {
|
|
57516
|
+
kind: "ListType",
|
|
57517
|
+
type: inner
|
|
57518
|
+
};
|
|
57519
|
+
}
|
|
57520
|
+
return {
|
|
57521
|
+
kind: "NamedType",
|
|
57522
|
+
name: {
|
|
57523
|
+
kind: "Name",
|
|
57524
|
+
value: input
|
|
57525
|
+
}
|
|
57526
|
+
};
|
|
57527
|
+
}
|
|
57509
57528
|
function collectDefaultArgumentValues(config2, filepath, definition) {
|
|
57510
57529
|
let result = {};
|
|
57511
57530
|
for (const { name, required, defaultValue } of fragmentArguments(
|
|
@@ -57568,19 +57587,9 @@ function fragmentArgumentsDefinitions(config2, filepath, definition) {
|
|
|
57568
57587
|
return [];
|
|
57569
57588
|
}
|
|
57570
57589
|
return args.map((arg) => {
|
|
57571
|
-
const innerType = {
|
|
57572
|
-
kind: "NamedType",
|
|
57573
|
-
name: {
|
|
57574
|
-
kind: "Name",
|
|
57575
|
-
value: arg.type
|
|
57576
|
-
}
|
|
57577
|
-
};
|
|
57578
57590
|
return {
|
|
57579
57591
|
kind: "VariableDefinition",
|
|
57580
|
-
type: arg.
|
|
57581
|
-
kind: "NonNullType",
|
|
57582
|
-
type: innerType
|
|
57583
|
-
},
|
|
57592
|
+
type: arg.type,
|
|
57584
57593
|
variable: {
|
|
57585
57594
|
kind: "Variable",
|
|
57586
57595
|
name: {
|
|
@@ -60917,7 +60926,7 @@ async function typeCheck(config2, docs) {
|
|
|
60917
60926
|
const lists = [];
|
|
60918
60927
|
const listTypes = [];
|
|
60919
60928
|
const fragments = {};
|
|
60920
|
-
for (const { document: parsed, filename } of docs) {
|
|
60929
|
+
for (const { document: parsed, originalString, filename } of docs) {
|
|
60921
60930
|
graphql24.visit(parsed, {
|
|
60922
60931
|
[graphql24.Kind.FRAGMENT_DEFINITION](definition) {
|
|
60923
60932
|
fragments[definition.name.value] = definition;
|
|
@@ -61115,7 +61124,7 @@ async function typeCheck(config2, docs) {
|
|
|
61115
61124
|
paginateArgs(config2, filepath),
|
|
61116
61125
|
noUnusedFragmentArguments(config2)
|
|
61117
61126
|
);
|
|
61118
|
-
for (const { filename, document: parsed } of docs) {
|
|
61127
|
+
for (const { filename, document: parsed, originalString } of docs) {
|
|
61119
61128
|
for (const error of graphql24.validate(config2.schema, parsed, rules(filename))) {
|
|
61120
61129
|
errors.push(
|
|
61121
61130
|
new HoudiniError({
|
|
@@ -61351,24 +61360,15 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
61351
61360
|
)
|
|
61352
61361
|
);
|
|
61353
61362
|
} else {
|
|
61354
|
-
const zipped = appliedArgumentNames.map(
|
|
61355
|
-
|
|
61356
|
-
|
|
61357
|
-
|
|
61358
|
-
]
|
|
61359
|
-
);
|
|
61363
|
+
const zipped = appliedArgumentNames.map((name) => [
|
|
61364
|
+
appliedArguments[name],
|
|
61365
|
+
fragmentArguments2[fragmentName].find((arg) => arg.name === name).type
|
|
61366
|
+
]);
|
|
61360
61367
|
for (const [applied, target] of zipped) {
|
|
61361
|
-
if (
|
|
61362
|
-
continue;
|
|
61363
|
-
}
|
|
61364
|
-
const appliedType = applied.value.kind.substring(
|
|
61365
|
-
0,
|
|
61366
|
-
applied.value.kind.length - "Value".length
|
|
61367
|
-
);
|
|
61368
|
-
if (appliedType !== target) {
|
|
61368
|
+
if (!valueIsType(config2, applied.value, target)) {
|
|
61369
61369
|
ctx.reportError(
|
|
61370
61370
|
new graphql24.GraphQLError(
|
|
61371
|
-
`Invalid argument type. Expected ${target}, found ${
|
|
61371
|
+
`Invalid argument type. Expected ${target}, found ${applied.value.kind}`
|
|
61372
61372
|
)
|
|
61373
61373
|
);
|
|
61374
61374
|
}
|
|
@@ -61378,6 +61378,47 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
61378
61378
|
};
|
|
61379
61379
|
};
|
|
61380
61380
|
}
|
|
61381
|
+
function valueIsType(config2, value, targetType) {
|
|
61382
|
+
if (value.kind === "NullValue") {
|
|
61383
|
+
return targetType.kind !== "NonNullType";
|
|
61384
|
+
}
|
|
61385
|
+
if (targetType.kind === "NonNullType") {
|
|
61386
|
+
targetType = targetType.type;
|
|
61387
|
+
}
|
|
61388
|
+
if (value.kind === "ListValue") {
|
|
61389
|
+
if (targetType.kind !== "ListType") {
|
|
61390
|
+
return false;
|
|
61391
|
+
}
|
|
61392
|
+
const listType = targetType.type;
|
|
61393
|
+
return value.values.every((value2) => valueIsType(config2, value2, listType));
|
|
61394
|
+
}
|
|
61395
|
+
if (value.kind === "BooleanValue") {
|
|
61396
|
+
return targetType.kind === "NamedType" && targetType.name.value === "Boolean";
|
|
61397
|
+
}
|
|
61398
|
+
if (value.kind === "StringValue") {
|
|
61399
|
+
return targetType.kind === "NamedType" && targetType.name.value === "String";
|
|
61400
|
+
}
|
|
61401
|
+
if (value.kind === "IntValue") {
|
|
61402
|
+
return targetType.kind === "NamedType" && targetType.name.value === "Int";
|
|
61403
|
+
}
|
|
61404
|
+
if (value.kind === "FloatValue") {
|
|
61405
|
+
return targetType.kind === "NamedType" && targetType.name.value === "Float";
|
|
61406
|
+
}
|
|
61407
|
+
if (value.kind === "ObjectValue" && targetType.kind === "NamedType") {
|
|
61408
|
+
return true;
|
|
61409
|
+
}
|
|
61410
|
+
if (value.kind === "EnumValue" && targetType.kind === "NamedType") {
|
|
61411
|
+
const enumType = config2.schema.getType(targetType.name.value);
|
|
61412
|
+
if (!graphql24.isEnumType(enumType)) {
|
|
61413
|
+
return false;
|
|
61414
|
+
}
|
|
61415
|
+
return enumType.getValues().some((enumValue) => enumValue.value === value.value);
|
|
61416
|
+
}
|
|
61417
|
+
if (value.kind === "Variable") {
|
|
61418
|
+
return true;
|
|
61419
|
+
}
|
|
61420
|
+
return false;
|
|
61421
|
+
}
|
|
61381
61422
|
function paginateArgs(config2, filepath) {
|
|
61382
61423
|
return function(ctx) {
|
|
61383
61424
|
let alreadyPaginated = false;
|
|
@@ -3352,7 +3352,7 @@ var require_definition = __commonJS({
|
|
|
3352
3352
|
exports.assertInterfaceType = assertInterfaceType;
|
|
3353
3353
|
exports.isUnionType = isUnionType7;
|
|
3354
3354
|
exports.assertUnionType = assertUnionType;
|
|
3355
|
-
exports.isEnumType =
|
|
3355
|
+
exports.isEnumType = isEnumType7;
|
|
3356
3356
|
exports.assertEnumType = assertEnumType;
|
|
3357
3357
|
exports.isInputObjectType = isInputObjectType2;
|
|
3358
3358
|
exports.assertInputObjectType = assertInputObjectType;
|
|
@@ -3423,7 +3423,7 @@ var require_definition = __commonJS({
|
|
|
3423
3423
|
return Constructor;
|
|
3424
3424
|
}
|
|
3425
3425
|
function isType(type) {
|
|
3426
|
-
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) ||
|
|
3426
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType7(type) || isInputObjectType2(type) || isListType3(type) || isNonNullType6(type);
|
|
3427
3427
|
}
|
|
3428
3428
|
function assertType(type) {
|
|
3429
3429
|
if (!isType(type)) {
|
|
@@ -3467,11 +3467,11 @@ var require_definition = __commonJS({
|
|
|
3467
3467
|
}
|
|
3468
3468
|
return type;
|
|
3469
3469
|
}
|
|
3470
|
-
function
|
|
3470
|
+
function isEnumType7(type) {
|
|
3471
3471
|
return (0, _instanceOf.default)(type, GraphQLEnumType);
|
|
3472
3472
|
}
|
|
3473
3473
|
function assertEnumType(type) {
|
|
3474
|
-
if (!
|
|
3474
|
+
if (!isEnumType7(type)) {
|
|
3475
3475
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
|
|
3476
3476
|
}
|
|
3477
3477
|
return type;
|
|
@@ -3504,7 +3504,7 @@ var require_definition = __commonJS({
|
|
|
3504
3504
|
return type;
|
|
3505
3505
|
}
|
|
3506
3506
|
function isInputType(type) {
|
|
3507
|
-
return isScalarType7(type) ||
|
|
3507
|
+
return isScalarType7(type) || isEnumType7(type) || isInputObjectType2(type) || isWrappingType(type) && isInputType(type.ofType);
|
|
3508
3508
|
}
|
|
3509
3509
|
function assertInputType(type) {
|
|
3510
3510
|
if (!isInputType(type)) {
|
|
@@ -3513,7 +3513,7 @@ var require_definition = __commonJS({
|
|
|
3513
3513
|
return type;
|
|
3514
3514
|
}
|
|
3515
3515
|
function isOutputType(type) {
|
|
3516
|
-
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) ||
|
|
3516
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType7(type) || isWrappingType(type) && isOutputType(type.ofType);
|
|
3517
3517
|
}
|
|
3518
3518
|
function assertOutputType(type) {
|
|
3519
3519
|
if (!isOutputType(type)) {
|
|
@@ -3522,7 +3522,7 @@ var require_definition = __commonJS({
|
|
|
3522
3522
|
return type;
|
|
3523
3523
|
}
|
|
3524
3524
|
function isLeafType(type) {
|
|
3525
|
-
return isScalarType7(type) ||
|
|
3525
|
+
return isScalarType7(type) || isEnumType7(type);
|
|
3526
3526
|
}
|
|
3527
3527
|
function assertLeafType(type) {
|
|
3528
3528
|
if (!isLeafType(type)) {
|
|
@@ -3610,7 +3610,7 @@ var require_definition = __commonJS({
|
|
|
3610
3610
|
}
|
|
3611
3611
|
}
|
|
3612
3612
|
function isNamedType(type) {
|
|
3613
|
-
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) ||
|
|
3613
|
+
return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType7(type) || isInputObjectType2(type);
|
|
3614
3614
|
}
|
|
3615
3615
|
function assertNamedType(type) {
|
|
3616
3616
|
if (!isNamedType(type)) {
|
|
@@ -57484,26 +57484,45 @@ function fragmentArguments(config2, filepath, definition) {
|
|
|
57484
57484
|
if (!typeArg || typeArg.kind !== "StringValue") {
|
|
57485
57485
|
return [];
|
|
57486
57486
|
}
|
|
57487
|
-
let type = typeArg.value;
|
|
57488
|
-
let name = arg.name.value;
|
|
57489
|
-
let required = false;
|
|
57487
|
+
let type = parseArgumentTypeString(typeArg.value);
|
|
57490
57488
|
let defaultValue = arg.value.fields?.find((arg2) => arg2.name.value === "default")?.value || null;
|
|
57491
|
-
if (type[type.length - 1] === "!") {
|
|
57492
|
-
type = type.slice(0, -1);
|
|
57493
|
-
required = true;
|
|
57494
|
-
defaultValue = null;
|
|
57495
|
-
}
|
|
57496
57489
|
return [
|
|
57497
57490
|
{
|
|
57498
|
-
name,
|
|
57491
|
+
name: arg.name.value,
|
|
57499
57492
|
type,
|
|
57500
|
-
required,
|
|
57493
|
+
required: type.kind === "NonNullType",
|
|
57501
57494
|
defaultValue
|
|
57502
57495
|
}
|
|
57503
57496
|
];
|
|
57504
57497
|
}) || []
|
|
57505
57498
|
);
|
|
57506
57499
|
}
|
|
57500
|
+
function parseArgumentTypeString(input) {
|
|
57501
|
+
if (input[input.length - 1] === "!") {
|
|
57502
|
+
const inner = parseArgumentTypeString(input.substring(0, input.length - 1));
|
|
57503
|
+
if (inner.kind === "NonNullType") {
|
|
57504
|
+
throw new Error("invalid type" + input);
|
|
57505
|
+
}
|
|
57506
|
+
return {
|
|
57507
|
+
kind: "NonNullType",
|
|
57508
|
+
type: inner
|
|
57509
|
+
};
|
|
57510
|
+
}
|
|
57511
|
+
if (input[input.length - 1] === "]") {
|
|
57512
|
+
const inner = parseArgumentTypeString(input.substring(1, input.length - 1));
|
|
57513
|
+
return {
|
|
57514
|
+
kind: "ListType",
|
|
57515
|
+
type: inner
|
|
57516
|
+
};
|
|
57517
|
+
}
|
|
57518
|
+
return {
|
|
57519
|
+
kind: "NamedType",
|
|
57520
|
+
name: {
|
|
57521
|
+
kind: "Name",
|
|
57522
|
+
value: input
|
|
57523
|
+
}
|
|
57524
|
+
};
|
|
57525
|
+
}
|
|
57507
57526
|
function collectDefaultArgumentValues(config2, filepath, definition) {
|
|
57508
57527
|
let result = {};
|
|
57509
57528
|
for (const { name, required, defaultValue } of fragmentArguments(
|
|
@@ -57566,19 +57585,9 @@ function fragmentArgumentsDefinitions(config2, filepath, definition) {
|
|
|
57566
57585
|
return [];
|
|
57567
57586
|
}
|
|
57568
57587
|
return args.map((arg) => {
|
|
57569
|
-
const innerType = {
|
|
57570
|
-
kind: "NamedType",
|
|
57571
|
-
name: {
|
|
57572
|
-
kind: "Name",
|
|
57573
|
-
value: arg.type
|
|
57574
|
-
}
|
|
57575
|
-
};
|
|
57576
57588
|
return {
|
|
57577
57589
|
kind: "VariableDefinition",
|
|
57578
|
-
type: arg.
|
|
57579
|
-
kind: "NonNullType",
|
|
57580
|
-
type: innerType
|
|
57581
|
-
},
|
|
57590
|
+
type: arg.type,
|
|
57582
57591
|
variable: {
|
|
57583
57592
|
kind: "Variable",
|
|
57584
57593
|
name: {
|
|
@@ -60915,7 +60924,7 @@ async function typeCheck(config2, docs) {
|
|
|
60915
60924
|
const lists = [];
|
|
60916
60925
|
const listTypes = [];
|
|
60917
60926
|
const fragments = {};
|
|
60918
|
-
for (const { document: parsed, filename } of docs) {
|
|
60927
|
+
for (const { document: parsed, originalString, filename } of docs) {
|
|
60919
60928
|
graphql24.visit(parsed, {
|
|
60920
60929
|
[graphql24.Kind.FRAGMENT_DEFINITION](definition) {
|
|
60921
60930
|
fragments[definition.name.value] = definition;
|
|
@@ -61113,7 +61122,7 @@ async function typeCheck(config2, docs) {
|
|
|
61113
61122
|
paginateArgs(config2, filepath),
|
|
61114
61123
|
noUnusedFragmentArguments(config2)
|
|
61115
61124
|
);
|
|
61116
|
-
for (const { filename, document: parsed } of docs) {
|
|
61125
|
+
for (const { filename, document: parsed, originalString } of docs) {
|
|
61117
61126
|
for (const error of graphql24.validate(config2.schema, parsed, rules(filename))) {
|
|
61118
61127
|
errors.push(
|
|
61119
61128
|
new HoudiniError({
|
|
@@ -61349,24 +61358,15 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
61349
61358
|
)
|
|
61350
61359
|
);
|
|
61351
61360
|
} else {
|
|
61352
|
-
const zipped = appliedArgumentNames.map(
|
|
61353
|
-
|
|
61354
|
-
|
|
61355
|
-
|
|
61356
|
-
]
|
|
61357
|
-
);
|
|
61361
|
+
const zipped = appliedArgumentNames.map((name) => [
|
|
61362
|
+
appliedArguments[name],
|
|
61363
|
+
fragmentArguments2[fragmentName].find((arg) => arg.name === name).type
|
|
61364
|
+
]);
|
|
61358
61365
|
for (const [applied, target] of zipped) {
|
|
61359
|
-
if (
|
|
61360
|
-
continue;
|
|
61361
|
-
}
|
|
61362
|
-
const appliedType = applied.value.kind.substring(
|
|
61363
|
-
0,
|
|
61364
|
-
applied.value.kind.length - "Value".length
|
|
61365
|
-
);
|
|
61366
|
-
if (appliedType !== target) {
|
|
61366
|
+
if (!valueIsType(config2, applied.value, target)) {
|
|
61367
61367
|
ctx.reportError(
|
|
61368
61368
|
new graphql24.GraphQLError(
|
|
61369
|
-
`Invalid argument type. Expected ${target}, found ${
|
|
61369
|
+
`Invalid argument type. Expected ${target}, found ${applied.value.kind}`
|
|
61370
61370
|
)
|
|
61371
61371
|
);
|
|
61372
61372
|
}
|
|
@@ -61376,6 +61376,47 @@ function validateFragmentArguments(config2, filepath, fragments) {
|
|
|
61376
61376
|
};
|
|
61377
61377
|
};
|
|
61378
61378
|
}
|
|
61379
|
+
function valueIsType(config2, value, targetType) {
|
|
61380
|
+
if (value.kind === "NullValue") {
|
|
61381
|
+
return targetType.kind !== "NonNullType";
|
|
61382
|
+
}
|
|
61383
|
+
if (targetType.kind === "NonNullType") {
|
|
61384
|
+
targetType = targetType.type;
|
|
61385
|
+
}
|
|
61386
|
+
if (value.kind === "ListValue") {
|
|
61387
|
+
if (targetType.kind !== "ListType") {
|
|
61388
|
+
return false;
|
|
61389
|
+
}
|
|
61390
|
+
const listType = targetType.type;
|
|
61391
|
+
return value.values.every((value2) => valueIsType(config2, value2, listType));
|
|
61392
|
+
}
|
|
61393
|
+
if (value.kind === "BooleanValue") {
|
|
61394
|
+
return targetType.kind === "NamedType" && targetType.name.value === "Boolean";
|
|
61395
|
+
}
|
|
61396
|
+
if (value.kind === "StringValue") {
|
|
61397
|
+
return targetType.kind === "NamedType" && targetType.name.value === "String";
|
|
61398
|
+
}
|
|
61399
|
+
if (value.kind === "IntValue") {
|
|
61400
|
+
return targetType.kind === "NamedType" && targetType.name.value === "Int";
|
|
61401
|
+
}
|
|
61402
|
+
if (value.kind === "FloatValue") {
|
|
61403
|
+
return targetType.kind === "NamedType" && targetType.name.value === "Float";
|
|
61404
|
+
}
|
|
61405
|
+
if (value.kind === "ObjectValue" && targetType.kind === "NamedType") {
|
|
61406
|
+
return true;
|
|
61407
|
+
}
|
|
61408
|
+
if (value.kind === "EnumValue" && targetType.kind === "NamedType") {
|
|
61409
|
+
const enumType = config2.schema.getType(targetType.name.value);
|
|
61410
|
+
if (!graphql24.isEnumType(enumType)) {
|
|
61411
|
+
return false;
|
|
61412
|
+
}
|
|
61413
|
+
return enumType.getValues().some((enumValue) => enumValue.value === value.value);
|
|
61414
|
+
}
|
|
61415
|
+
if (value.kind === "Variable") {
|
|
61416
|
+
return true;
|
|
61417
|
+
}
|
|
61418
|
+
return false;
|
|
61419
|
+
}
|
|
61379
61420
|
function paginateArgs(config2, filepath) {
|
|
61380
61421
|
return function(ctx) {
|
|
61381
61422
|
let alreadyPaginated = false;
|