1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | 'use strict';
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | function getIdentifierForSelection(node) {
|
18 | if (node.kind === 'LinkedField' || node.kind === 'ScalarField') {
|
19 | return node.directives.length === 0 ? node.alias || node.name : (node.alias || node.name) + require("./GraphQLIRPrinter").printDirectives(node.directives);
|
20 | } else if (node.kind === 'FragmentSpread') {
|
21 | return node.args.length === 0 ? '...' + node.name : '...' + node.name + require("./GraphQLIRPrinter").printArguments(node.args);
|
22 | } else if (node.kind === 'MatchField') {
|
23 | var _node$metadata;
|
24 |
|
25 | var storageKey = (_node$metadata = node.metadata) === null || _node$metadata === void 0 ? void 0 : _node$metadata.storageKey;
|
26 | !(typeof storageKey === 'string') ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, 'getIdentifierForSelection: Expected MatchField `%s` to have a precomputed storageKey.', node.name) : require("fbjs/lib/invariant")(false) : void 0;
|
27 | return 'M:' + storageKey;
|
28 | } else if (node.kind === 'MatchBranch') {
|
29 | return 'B:' + node.name + '$' + node.module;
|
30 | } else if (node.kind === 'Defer') {
|
31 | return 'D:' + node.label;
|
32 | } else if (node.kind === 'Stream') {
|
33 | return 'S:' + node.label;
|
34 | } else if (node.kind === 'InlineFragment') {
|
35 | return 'I:' + node.typeCondition.name;
|
36 | } else if (node.kind === 'Condition') {
|
37 | return 'C:' + (node.condition.kind === 'Variable' ? '$' + node.condition.variableName : String(node.condition.value)) + String(node.passingValue);
|
38 | } else {
|
39 | !false ? process.env.NODE_ENV !== "production" ? require("fbjs/lib/invariant")(false, 'getIdentifierForSelection: Unexpected kind `%s`.', node.kind) : require("fbjs/lib/invariant")(false) : void 0;
|
40 | }
|
41 | }
|
42 |
|
43 | module.exports = getIdentifierForSelection; |
\ | No newline at end of file |