mirror of
https://github.com/Instadapp/Swap-Aggregator-Subgraph.git
synced 2024-07-29 21:57:12 +00:00
28 lines
732 B
JavaScript
28 lines
732 B
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.KnownFragmentNamesRule = KnownFragmentNamesRule;
|
|
|
|
var _GraphQLError = require("../../error/GraphQLError.js");
|
|
|
|
/**
|
|
* Known fragment names
|
|
*
|
|
* A GraphQL document is only valid if all `...Fragment` fragment spreads refer
|
|
* to fragments defined in the same document.
|
|
*/
|
|
function KnownFragmentNamesRule(context) {
|
|
return {
|
|
FragmentSpread: function FragmentSpread(node) {
|
|
var fragmentName = node.name.value;
|
|
var fragment = context.getFragment(fragmentName);
|
|
|
|
if (!fragment) {
|
|
context.reportError(new _GraphQLError.GraphQLError("Unknown fragment \"".concat(fragmentName, "\"."), node.name));
|
|
}
|
|
}
|
|
};
|
|
}
|