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
package/build/vite-cjs/index.js
CHANGED
|
@@ -7495,7 +7495,7 @@ var require_definition = __commonJS({
|
|
|
7495
7495
|
exports.assertInterfaceType = assertInterfaceType;
|
|
7496
7496
|
exports.isUnionType = isUnionType13;
|
|
7497
7497
|
exports.assertUnionType = assertUnionType;
|
|
7498
|
-
exports.isEnumType =
|
|
7498
|
+
exports.isEnumType = isEnumType12;
|
|
7499
7499
|
exports.assertEnumType = assertEnumType;
|
|
7500
7500
|
exports.isInputObjectType = isInputObjectType8;
|
|
7501
7501
|
exports.assertInputObjectType = assertInputObjectType;
|
|
@@ -7566,7 +7566,7 @@ var require_definition = __commonJS({
|
|
|
7566
7566
|
return Constructor;
|
|
7567
7567
|
}
|
|
7568
7568
|
function isType(type) {
|
|
7569
|
-
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) ||
|
|
7569
|
+
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType12(type) || isInputObjectType8(type) || isListType8(type) || isNonNullType10(type);
|
|
7570
7570
|
}
|
|
7571
7571
|
function assertType(type) {
|
|
7572
7572
|
if (!isType(type)) {
|
|
@@ -7610,11 +7610,11 @@ var require_definition = __commonJS({
|
|
|
7610
7610
|
}
|
|
7611
7611
|
return type;
|
|
7612
7612
|
}
|
|
7613
|
-
function
|
|
7613
|
+
function isEnumType12(type) {
|
|
7614
7614
|
return (0, _instanceOf.default)(type, GraphQLEnumType4);
|
|
7615
7615
|
}
|
|
7616
7616
|
function assertEnumType(type) {
|
|
7617
|
-
if (!
|
|
7617
|
+
if (!isEnumType12(type)) {
|
|
7618
7618
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
|
|
7619
7619
|
}
|
|
7620
7620
|
return type;
|
|
@@ -7647,7 +7647,7 @@ var require_definition = __commonJS({
|
|
|
7647
7647
|
return type;
|
|
7648
7648
|
}
|
|
7649
7649
|
function isInputType(type) {
|
|
7650
|
-
return isScalarType13(type) ||
|
|
7650
|
+
return isScalarType13(type) || isEnumType12(type) || isInputObjectType8(type) || isWrappingType(type) && isInputType(type.ofType);
|
|
7651
7651
|
}
|
|
7652
7652
|
function assertInputType(type) {
|
|
7653
7653
|
if (!isInputType(type)) {
|
|
@@ -7656,7 +7656,7 @@ var require_definition = __commonJS({
|
|
|
7656
7656
|
return type;
|
|
7657
7657
|
}
|
|
7658
7658
|
function isOutputType(type) {
|
|
7659
|
-
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) ||
|
|
7659
|
+
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType12(type) || isWrappingType(type) && isOutputType(type.ofType);
|
|
7660
7660
|
}
|
|
7661
7661
|
function assertOutputType(type) {
|
|
7662
7662
|
if (!isOutputType(type)) {
|
|
@@ -7665,7 +7665,7 @@ var require_definition = __commonJS({
|
|
|
7665
7665
|
return type;
|
|
7666
7666
|
}
|
|
7667
7667
|
function isLeafType4(type) {
|
|
7668
|
-
return isScalarType13(type) ||
|
|
7668
|
+
return isScalarType13(type) || isEnumType12(type);
|
|
7669
7669
|
}
|
|
7670
7670
|
function assertLeafType(type) {
|
|
7671
7671
|
if (!isLeafType4(type)) {
|
|
@@ -7753,7 +7753,7 @@ var require_definition = __commonJS({
|
|
|
7753
7753
|
}
|
|
7754
7754
|
}
|
|
7755
7755
|
function isNamedType4(type) {
|
|
7756
|
-
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) ||
|
|
7756
|
+
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType12(type) || isInputObjectType8(type);
|
|
7757
7757
|
}
|
|
7758
7758
|
function assertNamedType(type) {
|
|
7759
7759
|
if (!isNamedType4(type)) {
|
|
@@ -70590,26 +70590,45 @@ function fragmentArguments(config4, filepath, definition) {
|
|
|
70590
70590
|
if (!typeArg || typeArg.kind !== "StringValue") {
|
|
70591
70591
|
return [];
|
|
70592
70592
|
}
|
|
70593
|
-
let type = typeArg.value;
|
|
70594
|
-
let name = arg.name.value;
|
|
70595
|
-
let required = false;
|
|
70593
|
+
let type = parseArgumentTypeString(typeArg.value);
|
|
70596
70594
|
let defaultValue = arg.value.fields?.find((arg2) => arg2.name.value === "default")?.value || null;
|
|
70597
|
-
if (type[type.length - 1] === "!") {
|
|
70598
|
-
type = type.slice(0, -1);
|
|
70599
|
-
required = true;
|
|
70600
|
-
defaultValue = null;
|
|
70601
|
-
}
|
|
70602
70595
|
return [
|
|
70603
70596
|
{
|
|
70604
|
-
name,
|
|
70597
|
+
name: arg.name.value,
|
|
70605
70598
|
type,
|
|
70606
|
-
required,
|
|
70599
|
+
required: type.kind === "NonNullType",
|
|
70607
70600
|
defaultValue
|
|
70608
70601
|
}
|
|
70609
70602
|
];
|
|
70610
70603
|
}) || []
|
|
70611
70604
|
);
|
|
70612
70605
|
}
|
|
70606
|
+
function parseArgumentTypeString(input) {
|
|
70607
|
+
if (input[input.length - 1] === "!") {
|
|
70608
|
+
const inner = parseArgumentTypeString(input.substring(0, input.length - 1));
|
|
70609
|
+
if (inner.kind === "NonNullType") {
|
|
70610
|
+
throw new Error("invalid type" + input);
|
|
70611
|
+
}
|
|
70612
|
+
return {
|
|
70613
|
+
kind: "NonNullType",
|
|
70614
|
+
type: inner
|
|
70615
|
+
};
|
|
70616
|
+
}
|
|
70617
|
+
if (input[input.length - 1] === "]") {
|
|
70618
|
+
const inner = parseArgumentTypeString(input.substring(1, input.length - 1));
|
|
70619
|
+
return {
|
|
70620
|
+
kind: "ListType",
|
|
70621
|
+
type: inner
|
|
70622
|
+
};
|
|
70623
|
+
}
|
|
70624
|
+
return {
|
|
70625
|
+
kind: "NamedType",
|
|
70626
|
+
name: {
|
|
70627
|
+
kind: "Name",
|
|
70628
|
+
value: input
|
|
70629
|
+
}
|
|
70630
|
+
};
|
|
70631
|
+
}
|
|
70613
70632
|
function collectDefaultArgumentValues(config4, filepath, definition) {
|
|
70614
70633
|
let result = {};
|
|
70615
70634
|
for (const { name, required, defaultValue } of fragmentArguments(
|
|
@@ -70672,19 +70691,9 @@ function fragmentArgumentsDefinitions(config4, filepath, definition) {
|
|
|
70672
70691
|
return [];
|
|
70673
70692
|
}
|
|
70674
70693
|
return args.map((arg) => {
|
|
70675
|
-
const innerType = {
|
|
70676
|
-
kind: "NamedType",
|
|
70677
|
-
name: {
|
|
70678
|
-
kind: "Name",
|
|
70679
|
-
value: arg.type
|
|
70680
|
-
}
|
|
70681
|
-
};
|
|
70682
70694
|
return {
|
|
70683
70695
|
kind: "VariableDefinition",
|
|
70684
|
-
type: arg.
|
|
70685
|
-
kind: "NonNullType",
|
|
70686
|
-
type: innerType
|
|
70687
|
-
},
|
|
70696
|
+
type: arg.type,
|
|
70688
70697
|
variable: {
|
|
70689
70698
|
kind: "Variable",
|
|
70690
70699
|
name: {
|
|
@@ -74027,7 +74036,7 @@ async function typeCheck(config4, docs) {
|
|
|
74027
74036
|
const lists = [];
|
|
74028
74037
|
const listTypes = [];
|
|
74029
74038
|
const fragments = {};
|
|
74030
|
-
for (const { document: parsed, filename } of docs) {
|
|
74039
|
+
for (const { document: parsed, originalString, filename } of docs) {
|
|
74031
74040
|
graphql25.visit(parsed, {
|
|
74032
74041
|
[graphql25.Kind.FRAGMENT_DEFINITION](definition) {
|
|
74033
74042
|
fragments[definition.name.value] = definition;
|
|
@@ -74225,7 +74234,7 @@ async function typeCheck(config4, docs) {
|
|
|
74225
74234
|
paginateArgs(config4, filepath),
|
|
74226
74235
|
noUnusedFragmentArguments(config4)
|
|
74227
74236
|
);
|
|
74228
|
-
for (const { filename, document: parsed } of docs) {
|
|
74237
|
+
for (const { filename, document: parsed, originalString } of docs) {
|
|
74229
74238
|
for (const error of graphql25.validate(config4.schema, parsed, rules(filename))) {
|
|
74230
74239
|
errors.push(
|
|
74231
74240
|
new HoudiniError({
|
|
@@ -74461,24 +74470,15 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
74461
74470
|
)
|
|
74462
74471
|
);
|
|
74463
74472
|
} else {
|
|
74464
|
-
const zipped = appliedArgumentNames.map(
|
|
74465
|
-
|
|
74466
|
-
|
|
74467
|
-
|
|
74468
|
-
]
|
|
74469
|
-
);
|
|
74473
|
+
const zipped = appliedArgumentNames.map((name) => [
|
|
74474
|
+
appliedArguments[name],
|
|
74475
|
+
fragmentArguments2[fragmentName].find((arg) => arg.name === name).type
|
|
74476
|
+
]);
|
|
74470
74477
|
for (const [applied, target] of zipped) {
|
|
74471
|
-
if (
|
|
74472
|
-
continue;
|
|
74473
|
-
}
|
|
74474
|
-
const appliedType = applied.value.kind.substring(
|
|
74475
|
-
0,
|
|
74476
|
-
applied.value.kind.length - "Value".length
|
|
74477
|
-
);
|
|
74478
|
-
if (appliedType !== target) {
|
|
74478
|
+
if (!valueIsType(config4, applied.value, target)) {
|
|
74479
74479
|
ctx.reportError(
|
|
74480
74480
|
new graphql25.GraphQLError(
|
|
74481
|
-
`Invalid argument type. Expected ${target}, found ${
|
|
74481
|
+
`Invalid argument type. Expected ${target}, found ${applied.value.kind}`
|
|
74482
74482
|
)
|
|
74483
74483
|
);
|
|
74484
74484
|
}
|
|
@@ -74488,6 +74488,47 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
74488
74488
|
};
|
|
74489
74489
|
};
|
|
74490
74490
|
}
|
|
74491
|
+
function valueIsType(config4, value, targetType) {
|
|
74492
|
+
if (value.kind === "NullValue") {
|
|
74493
|
+
return targetType.kind !== "NonNullType";
|
|
74494
|
+
}
|
|
74495
|
+
if (targetType.kind === "NonNullType") {
|
|
74496
|
+
targetType = targetType.type;
|
|
74497
|
+
}
|
|
74498
|
+
if (value.kind === "ListValue") {
|
|
74499
|
+
if (targetType.kind !== "ListType") {
|
|
74500
|
+
return false;
|
|
74501
|
+
}
|
|
74502
|
+
const listType = targetType.type;
|
|
74503
|
+
return value.values.every((value2) => valueIsType(config4, value2, listType));
|
|
74504
|
+
}
|
|
74505
|
+
if (value.kind === "BooleanValue") {
|
|
74506
|
+
return targetType.kind === "NamedType" && targetType.name.value === "Boolean";
|
|
74507
|
+
}
|
|
74508
|
+
if (value.kind === "StringValue") {
|
|
74509
|
+
return targetType.kind === "NamedType" && targetType.name.value === "String";
|
|
74510
|
+
}
|
|
74511
|
+
if (value.kind === "IntValue") {
|
|
74512
|
+
return targetType.kind === "NamedType" && targetType.name.value === "Int";
|
|
74513
|
+
}
|
|
74514
|
+
if (value.kind === "FloatValue") {
|
|
74515
|
+
return targetType.kind === "NamedType" && targetType.name.value === "Float";
|
|
74516
|
+
}
|
|
74517
|
+
if (value.kind === "ObjectValue" && targetType.kind === "NamedType") {
|
|
74518
|
+
return true;
|
|
74519
|
+
}
|
|
74520
|
+
if (value.kind === "EnumValue" && targetType.kind === "NamedType") {
|
|
74521
|
+
const enumType = config4.schema.getType(targetType.name.value);
|
|
74522
|
+
if (!graphql25.isEnumType(enumType)) {
|
|
74523
|
+
return false;
|
|
74524
|
+
}
|
|
74525
|
+
return enumType.getValues().some((enumValue) => enumValue.value === value.value);
|
|
74526
|
+
}
|
|
74527
|
+
if (value.kind === "Variable") {
|
|
74528
|
+
return true;
|
|
74529
|
+
}
|
|
74530
|
+
return false;
|
|
74531
|
+
}
|
|
74491
74532
|
function paginateArgs(config4, filepath) {
|
|
74492
74533
|
return function(ctx) {
|
|
74493
74534
|
let alreadyPaginated = false;
|
package/build/vite-esm/index.js
CHANGED
|
@@ -7500,7 +7500,7 @@ var require_definition = __commonJS({
|
|
|
7500
7500
|
exports.assertInterfaceType = assertInterfaceType;
|
|
7501
7501
|
exports.isUnionType = isUnionType13;
|
|
7502
7502
|
exports.assertUnionType = assertUnionType;
|
|
7503
|
-
exports.isEnumType =
|
|
7503
|
+
exports.isEnumType = isEnumType12;
|
|
7504
7504
|
exports.assertEnumType = assertEnumType;
|
|
7505
7505
|
exports.isInputObjectType = isInputObjectType8;
|
|
7506
7506
|
exports.assertInputObjectType = assertInputObjectType;
|
|
@@ -7571,7 +7571,7 @@ var require_definition = __commonJS({
|
|
|
7571
7571
|
return Constructor;
|
|
7572
7572
|
}
|
|
7573
7573
|
function isType(type) {
|
|
7574
|
-
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) ||
|
|
7574
|
+
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType12(type) || isInputObjectType8(type) || isListType8(type) || isNonNullType10(type);
|
|
7575
7575
|
}
|
|
7576
7576
|
function assertType(type) {
|
|
7577
7577
|
if (!isType(type)) {
|
|
@@ -7615,11 +7615,11 @@ var require_definition = __commonJS({
|
|
|
7615
7615
|
}
|
|
7616
7616
|
return type;
|
|
7617
7617
|
}
|
|
7618
|
-
function
|
|
7618
|
+
function isEnumType12(type) {
|
|
7619
7619
|
return (0, _instanceOf.default)(type, GraphQLEnumType4);
|
|
7620
7620
|
}
|
|
7621
7621
|
function assertEnumType(type) {
|
|
7622
|
-
if (!
|
|
7622
|
+
if (!isEnumType12(type)) {
|
|
7623
7623
|
throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
|
|
7624
7624
|
}
|
|
7625
7625
|
return type;
|
|
@@ -7652,7 +7652,7 @@ var require_definition = __commonJS({
|
|
|
7652
7652
|
return type;
|
|
7653
7653
|
}
|
|
7654
7654
|
function isInputType(type) {
|
|
7655
|
-
return isScalarType13(type) ||
|
|
7655
|
+
return isScalarType13(type) || isEnumType12(type) || isInputObjectType8(type) || isWrappingType(type) && isInputType(type.ofType);
|
|
7656
7656
|
}
|
|
7657
7657
|
function assertInputType(type) {
|
|
7658
7658
|
if (!isInputType(type)) {
|
|
@@ -7661,7 +7661,7 @@ var require_definition = __commonJS({
|
|
|
7661
7661
|
return type;
|
|
7662
7662
|
}
|
|
7663
7663
|
function isOutputType(type) {
|
|
7664
|
-
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) ||
|
|
7664
|
+
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType12(type) || isWrappingType(type) && isOutputType(type.ofType);
|
|
7665
7665
|
}
|
|
7666
7666
|
function assertOutputType(type) {
|
|
7667
7667
|
if (!isOutputType(type)) {
|
|
@@ -7670,7 +7670,7 @@ var require_definition = __commonJS({
|
|
|
7670
7670
|
return type;
|
|
7671
7671
|
}
|
|
7672
7672
|
function isLeafType4(type) {
|
|
7673
|
-
return isScalarType13(type) ||
|
|
7673
|
+
return isScalarType13(type) || isEnumType12(type);
|
|
7674
7674
|
}
|
|
7675
7675
|
function assertLeafType(type) {
|
|
7676
7676
|
if (!isLeafType4(type)) {
|
|
@@ -7758,7 +7758,7 @@ var require_definition = __commonJS({
|
|
|
7758
7758
|
}
|
|
7759
7759
|
}
|
|
7760
7760
|
function isNamedType4(type) {
|
|
7761
|
-
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) ||
|
|
7761
|
+
return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType12(type) || isInputObjectType8(type);
|
|
7762
7762
|
}
|
|
7763
7763
|
function assertNamedType(type) {
|
|
7764
7764
|
if (!isNamedType4(type)) {
|
|
@@ -70584,26 +70584,45 @@ function fragmentArguments(config4, filepath, definition) {
|
|
|
70584
70584
|
if (!typeArg || typeArg.kind !== "StringValue") {
|
|
70585
70585
|
return [];
|
|
70586
70586
|
}
|
|
70587
|
-
let type = typeArg.value;
|
|
70588
|
-
let name = arg.name.value;
|
|
70589
|
-
let required = false;
|
|
70587
|
+
let type = parseArgumentTypeString(typeArg.value);
|
|
70590
70588
|
let defaultValue = arg.value.fields?.find((arg2) => arg2.name.value === "default")?.value || null;
|
|
70591
|
-
if (type[type.length - 1] === "!") {
|
|
70592
|
-
type = type.slice(0, -1);
|
|
70593
|
-
required = true;
|
|
70594
|
-
defaultValue = null;
|
|
70595
|
-
}
|
|
70596
70589
|
return [
|
|
70597
70590
|
{
|
|
70598
|
-
name,
|
|
70591
|
+
name: arg.name.value,
|
|
70599
70592
|
type,
|
|
70600
|
-
required,
|
|
70593
|
+
required: type.kind === "NonNullType",
|
|
70601
70594
|
defaultValue
|
|
70602
70595
|
}
|
|
70603
70596
|
];
|
|
70604
70597
|
}) || []
|
|
70605
70598
|
);
|
|
70606
70599
|
}
|
|
70600
|
+
function parseArgumentTypeString(input) {
|
|
70601
|
+
if (input[input.length - 1] === "!") {
|
|
70602
|
+
const inner = parseArgumentTypeString(input.substring(0, input.length - 1));
|
|
70603
|
+
if (inner.kind === "NonNullType") {
|
|
70604
|
+
throw new Error("invalid type" + input);
|
|
70605
|
+
}
|
|
70606
|
+
return {
|
|
70607
|
+
kind: "NonNullType",
|
|
70608
|
+
type: inner
|
|
70609
|
+
};
|
|
70610
|
+
}
|
|
70611
|
+
if (input[input.length - 1] === "]") {
|
|
70612
|
+
const inner = parseArgumentTypeString(input.substring(1, input.length - 1));
|
|
70613
|
+
return {
|
|
70614
|
+
kind: "ListType",
|
|
70615
|
+
type: inner
|
|
70616
|
+
};
|
|
70617
|
+
}
|
|
70618
|
+
return {
|
|
70619
|
+
kind: "NamedType",
|
|
70620
|
+
name: {
|
|
70621
|
+
kind: "Name",
|
|
70622
|
+
value: input
|
|
70623
|
+
}
|
|
70624
|
+
};
|
|
70625
|
+
}
|
|
70607
70626
|
function collectDefaultArgumentValues(config4, filepath, definition) {
|
|
70608
70627
|
let result = {};
|
|
70609
70628
|
for (const { name, required, defaultValue } of fragmentArguments(
|
|
@@ -70666,19 +70685,9 @@ function fragmentArgumentsDefinitions(config4, filepath, definition) {
|
|
|
70666
70685
|
return [];
|
|
70667
70686
|
}
|
|
70668
70687
|
return args.map((arg) => {
|
|
70669
|
-
const innerType = {
|
|
70670
|
-
kind: "NamedType",
|
|
70671
|
-
name: {
|
|
70672
|
-
kind: "Name",
|
|
70673
|
-
value: arg.type
|
|
70674
|
-
}
|
|
70675
|
-
};
|
|
70676
70688
|
return {
|
|
70677
70689
|
kind: "VariableDefinition",
|
|
70678
|
-
type: arg.
|
|
70679
|
-
kind: "NonNullType",
|
|
70680
|
-
type: innerType
|
|
70681
|
-
},
|
|
70690
|
+
type: arg.type,
|
|
70682
70691
|
variable: {
|
|
70683
70692
|
kind: "Variable",
|
|
70684
70693
|
name: {
|
|
@@ -74021,7 +74030,7 @@ async function typeCheck(config4, docs) {
|
|
|
74021
74030
|
const lists = [];
|
|
74022
74031
|
const listTypes = [];
|
|
74023
74032
|
const fragments = {};
|
|
74024
|
-
for (const { document: parsed, filename } of docs) {
|
|
74033
|
+
for (const { document: parsed, originalString, filename } of docs) {
|
|
74025
74034
|
graphql25.visit(parsed, {
|
|
74026
74035
|
[graphql25.Kind.FRAGMENT_DEFINITION](definition) {
|
|
74027
74036
|
fragments[definition.name.value] = definition;
|
|
@@ -74219,7 +74228,7 @@ async function typeCheck(config4, docs) {
|
|
|
74219
74228
|
paginateArgs(config4, filepath),
|
|
74220
74229
|
noUnusedFragmentArguments(config4)
|
|
74221
74230
|
);
|
|
74222
|
-
for (const { filename, document: parsed } of docs) {
|
|
74231
|
+
for (const { filename, document: parsed, originalString } of docs) {
|
|
74223
74232
|
for (const error of graphql25.validate(config4.schema, parsed, rules(filename))) {
|
|
74224
74233
|
errors.push(
|
|
74225
74234
|
new HoudiniError({
|
|
@@ -74455,24 +74464,15 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
74455
74464
|
)
|
|
74456
74465
|
);
|
|
74457
74466
|
} else {
|
|
74458
|
-
const zipped = appliedArgumentNames.map(
|
|
74459
|
-
|
|
74460
|
-
|
|
74461
|
-
|
|
74462
|
-
]
|
|
74463
|
-
);
|
|
74467
|
+
const zipped = appliedArgumentNames.map((name) => [
|
|
74468
|
+
appliedArguments[name],
|
|
74469
|
+
fragmentArguments2[fragmentName].find((arg) => arg.name === name).type
|
|
74470
|
+
]);
|
|
74464
74471
|
for (const [applied, target] of zipped) {
|
|
74465
|
-
if (
|
|
74466
|
-
continue;
|
|
74467
|
-
}
|
|
74468
|
-
const appliedType = applied.value.kind.substring(
|
|
74469
|
-
0,
|
|
74470
|
-
applied.value.kind.length - "Value".length
|
|
74471
|
-
);
|
|
74472
|
-
if (appliedType !== target) {
|
|
74472
|
+
if (!valueIsType(config4, applied.value, target)) {
|
|
74473
74473
|
ctx.reportError(
|
|
74474
74474
|
new graphql25.GraphQLError(
|
|
74475
|
-
`Invalid argument type. Expected ${target}, found ${
|
|
74475
|
+
`Invalid argument type. Expected ${target}, found ${applied.value.kind}`
|
|
74476
74476
|
)
|
|
74477
74477
|
);
|
|
74478
74478
|
}
|
|
@@ -74482,6 +74482,47 @@ function validateFragmentArguments(config4, filepath, fragments) {
|
|
|
74482
74482
|
};
|
|
74483
74483
|
};
|
|
74484
74484
|
}
|
|
74485
|
+
function valueIsType(config4, value, targetType) {
|
|
74486
|
+
if (value.kind === "NullValue") {
|
|
74487
|
+
return targetType.kind !== "NonNullType";
|
|
74488
|
+
}
|
|
74489
|
+
if (targetType.kind === "NonNullType") {
|
|
74490
|
+
targetType = targetType.type;
|
|
74491
|
+
}
|
|
74492
|
+
if (value.kind === "ListValue") {
|
|
74493
|
+
if (targetType.kind !== "ListType") {
|
|
74494
|
+
return false;
|
|
74495
|
+
}
|
|
74496
|
+
const listType = targetType.type;
|
|
74497
|
+
return value.values.every((value2) => valueIsType(config4, value2, listType));
|
|
74498
|
+
}
|
|
74499
|
+
if (value.kind === "BooleanValue") {
|
|
74500
|
+
return targetType.kind === "NamedType" && targetType.name.value === "Boolean";
|
|
74501
|
+
}
|
|
74502
|
+
if (value.kind === "StringValue") {
|
|
74503
|
+
return targetType.kind === "NamedType" && targetType.name.value === "String";
|
|
74504
|
+
}
|
|
74505
|
+
if (value.kind === "IntValue") {
|
|
74506
|
+
return targetType.kind === "NamedType" && targetType.name.value === "Int";
|
|
74507
|
+
}
|
|
74508
|
+
if (value.kind === "FloatValue") {
|
|
74509
|
+
return targetType.kind === "NamedType" && targetType.name.value === "Float";
|
|
74510
|
+
}
|
|
74511
|
+
if (value.kind === "ObjectValue" && targetType.kind === "NamedType") {
|
|
74512
|
+
return true;
|
|
74513
|
+
}
|
|
74514
|
+
if (value.kind === "EnumValue" && targetType.kind === "NamedType") {
|
|
74515
|
+
const enumType = config4.schema.getType(targetType.name.value);
|
|
74516
|
+
if (!graphql25.isEnumType(enumType)) {
|
|
74517
|
+
return false;
|
|
74518
|
+
}
|
|
74519
|
+
return enumType.getValues().some((enumValue) => enumValue.value === value.value);
|
|
74520
|
+
}
|
|
74521
|
+
if (value.kind === "Variable") {
|
|
74522
|
+
return true;
|
|
74523
|
+
}
|
|
74524
|
+
return false;
|
|
74525
|
+
}
|
|
74485
74526
|
function paginateArgs(config4, filepath) {
|
|
74486
74527
|
return function(ctx) {
|
|
74487
74528
|
let alreadyPaginated = false;
|