Spaces:
Paused
Paused
Download node_modules/graphql/validation/rules/KnownFragmentNamesRule.js from sam522/GenAI_Course: direct link, hf CLI and curl.
- Browser
- Download file 874 Bytes
-
https://huggingface.co/spaces/sam522/GenAI_Course/resolve/bbf0eafbb40cb551e2f40f8ad8a90a585be08221/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js
- Command line
-
hf download hf://spaces/sam522/GenAI_Course@bbf0eafbb40cb551e2f40f8ad8a90a585be08221/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js
-
curl -L -o KnownFragmentNamesRule.js https://huggingface.co/spaces/sam522/GenAI_Course/resolve/bbf0eafbb40cb551e2f40f8ad8a90a585be08221/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js
874 Bytes
| ; | |
| 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. | |
| * | |
| * See https://spec.graphql.org/draft/#sec-Fragment-spread-target-defined | |
| */ | |
| function KnownFragmentNamesRule(context) { | |
| return { | |
| FragmentSpread(node) { | |
| const fragmentName = node.name.value; | |
| const fragment = context.getFragment(fragmentName); | |
| if (!fragment) { | |
| context.reportError( | |
| new _GraphQLError.GraphQLError( | |
| `Unknown fragment "${fragmentName}".`, | |
| { | |
| nodes: node.name, | |
| }, | |
| ), | |
| ); | |
| } | |
| }, | |
| }; | |
| } | |