@graphitation/supermassive 3.3.0 → 3.4.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/.eslintcache +1 -1
- package/CHANGELOG.md +18 -2
- package/lib/collectFields.d.ts +8 -21
- package/lib/collectFields.d.ts.map +1 -1
- package/lib/collectFields.js +95 -97
- package/lib/collectFields.js.map +2 -2
- package/lib/collectFields.mjs +95 -97
- package/lib/collectFields.mjs.map +2 -2
- package/lib/executeWithoutSchema.d.ts +50 -6
- package/lib/executeWithoutSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.js +517 -622
- package/lib/executeWithoutSchema.js.map +3 -3
- package/lib/executeWithoutSchema.mjs +518 -633
- package/lib/executeWithoutSchema.mjs.map +3 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/types.d.ts +27 -63
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utilities/decodeASTSchema.js +3 -0
- package/lib/utilities/decodeASTSchema.js.map +2 -2
- package/lib/utilities/decodeASTSchema.mjs +3 -0
- package/lib/utilities/decodeASTSchema.mjs.map +2 -2
- package/lib/values.d.ts +4 -5
- package/lib/values.d.ts.map +1 -1
- package/lib/values.js +8 -13
- package/lib/values.js.map +2 -2
- package/lib/values.mjs +8 -13
- package/lib/values.mjs.map +2 -2
- package/package.json +1 -1
- package/lib/IncrementalPublisher.d.ts +0 -131
- package/lib/IncrementalPublisher.d.ts.map +0 -1
- package/lib/IncrementalPublisher.js +0 -519
- package/lib/IncrementalPublisher.js.map +0 -7
- package/lib/IncrementalPublisher.mjs +0 -503
- package/lib/IncrementalPublisher.mjs.map +0 -7
- package/lib/buildFieldPlan.d.ts +0 -18
- package/lib/buildFieldPlan.d.ts.map +0 -1
- package/lib/buildFieldPlan.js +0 -120
- package/lib/buildFieldPlan.js.map +0 -7
- package/lib/buildFieldPlan.mjs +0 -101
- package/lib/buildFieldPlan.mjs.map +0 -7
- package/lib/jsutils/getBySet.d.ts +0 -2
- package/lib/jsutils/getBySet.d.ts.map +0 -1
- package/lib/jsutils/getBySet.js +0 -32
- package/lib/jsutils/getBySet.js.map +0 -7
- package/lib/jsutils/getBySet.mjs +0 -13
- package/lib/jsutils/getBySet.mjs.map +0 -7
- package/lib/jsutils/isSameSet.d.ts +0 -2
- package/lib/jsutils/isSameSet.d.ts.map +0 -1
- package/lib/jsutils/isSameSet.js +0 -34
- package/lib/jsutils/isSameSet.js.map +0 -7
- package/lib/jsutils/isSameSet.mjs +0 -15
- package/lib/jsutils/isSameSet.mjs.map +0 -7
- package/lib/jsutils/promiseWithResolvers.d.ts +0 -11
- package/lib/jsutils/promiseWithResolvers.d.ts.map +0 -1
- package/lib/jsutils/promiseWithResolvers.js +0 -32
- package/lib/jsutils/promiseWithResolvers.js.map +0 -7
- package/lib/jsutils/promiseWithResolvers.mjs +0 -13
- package/lib/jsutils/promiseWithResolvers.mjs.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
# Change Log - @graphitation/supermassive
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 15 Jan 2024 17:31:14 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 3.4.1
|
|
8
|
+
|
|
9
|
+
Mon, 15 Jan 2024 17:31:14 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Properly decode boolean in schema (mark@thedutchies.com)
|
|
14
|
+
|
|
15
|
+
## 3.4.0
|
|
16
|
+
|
|
17
|
+
Wed, 10 Jan 2024 12:26:58 GMT
|
|
18
|
+
|
|
19
|
+
### Minor changes
|
|
20
|
+
|
|
21
|
+
- Revert new executor and fix errors again (mnovikov@microsoft.com)
|
|
22
|
+
|
|
7
23
|
## 3.3.0
|
|
8
24
|
|
|
9
|
-
Tue, 09 Jan 2024 09:
|
|
25
|
+
Tue, 09 Jan 2024 09:30:02 GMT
|
|
10
26
|
|
|
11
27
|
### Minor changes
|
|
12
28
|
|
package/lib/collectFields.d.ts
CHANGED
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import { FieldNode
|
|
1
|
+
import { FieldNode } from "graphql";
|
|
2
2
|
import { ExecutionContext } from "./executeWithoutSchema";
|
|
3
|
-
|
|
4
|
-
import { ObjMap } from "./jsutils/ObjMap";
|
|
5
|
-
import { FieldGroup } from "./buildFieldPlan";
|
|
6
|
-
export interface DeferUsage {
|
|
7
|
-
label: string | undefined;
|
|
8
|
-
parentDeferUsage: DeferUsage | undefined;
|
|
9
|
-
}
|
|
10
|
-
export interface StreamUsage {
|
|
11
|
-
label: string | undefined;
|
|
12
|
-
initialCount: number;
|
|
13
|
-
fieldGroup: FieldGroup;
|
|
14
|
-
}
|
|
15
|
-
export interface FieldDetails {
|
|
16
|
-
node: FieldNode;
|
|
17
|
-
deferUsage: DeferUsage | undefined;
|
|
18
|
-
}
|
|
3
|
+
export type FieldGroup = ReadonlyArray<FieldNode>;
|
|
19
4
|
export type GroupedFieldSet = Map<string, FieldGroup>;
|
|
20
5
|
export interface PatchFields {
|
|
21
6
|
label: string | undefined;
|
|
22
7
|
groupedFieldSet: GroupedFieldSet;
|
|
23
8
|
}
|
|
9
|
+
export interface FieldsAndPatches {
|
|
10
|
+
groupedFieldSet: GroupedFieldSet;
|
|
11
|
+
patches: Array<PatchFields>;
|
|
12
|
+
}
|
|
24
13
|
/**
|
|
25
14
|
* Given a selectionSet, collects all of the fields and returns them.
|
|
26
15
|
*
|
|
@@ -30,7 +19,7 @@ export interface PatchFields {
|
|
|
30
19
|
*
|
|
31
20
|
* @internal
|
|
32
21
|
*/
|
|
33
|
-
export declare function collectFields(exeContext: ExecutionContext, runtimeTypeName: string):
|
|
22
|
+
export declare function collectFields(exeContext: ExecutionContext, runtimeTypeName: string): FieldsAndPatches;
|
|
34
23
|
/**
|
|
35
24
|
* Given an array of field nodes, collects all of the subfields of the passed
|
|
36
25
|
* in fields, and returns them at the end.
|
|
@@ -41,7 +30,5 @@ export declare function collectFields(exeContext: ExecutionContext, runtimeTypeN
|
|
|
41
30
|
*
|
|
42
31
|
* @internal
|
|
43
32
|
*/
|
|
44
|
-
export declare function collectSubfields(
|
|
45
|
-
[variable: string]: unknown;
|
|
46
|
-
}, operation: OperationDefinitionNode, returnTypeName: string, fieldDetails: ReadonlyArray<FieldDetails>): Map<string, ReadonlyArray<FieldDetails>>;
|
|
33
|
+
export declare function collectSubfields(exeContext: ExecutionContext, returnTypeName: string, fieldGroup: FieldGroup): FieldsAndPatches;
|
|
47
34
|
//# sourceMappingURL=collectFields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectFields.d.ts","sourceRoot":"","sources":["../src/collectFields.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,
|
|
1
|
+
{"version":3,"file":"collectFields.d.ts","sourceRoot":"","sources":["../src/collectFields.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAMV,MAAM,SAAS,CAAC;AAUjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;AAElD,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAEtD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,eAAe,CAAC;IACjC,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,gBAAgB,EAC5B,eAAe,EAAE,MAAM,GACtB,gBAAgB,CAalB;AAED;;;;;;;;;GASG;AAEH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,gBAAgB,EAC5B,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,UAAU,GACrB,gBAAgB,CAuBlB"}
|
package/lib/collectFields.js
CHANGED
|
@@ -39,141 +39,145 @@ var import_AccumulatorMap = require("./jsutils/AccumulatorMap");
|
|
|
39
39
|
var import_invariant = __toESM(require("invariant"));
|
|
40
40
|
var import_definition = require("./schema/definition");
|
|
41
41
|
function collectFields(exeContext, runtimeTypeName) {
|
|
42
|
+
const { operation } = exeContext;
|
|
42
43
|
const groupedFieldSet = new import_AccumulatorMap.AccumulatorMap();
|
|
43
|
-
const
|
|
44
|
-
schemaFragment: exeContext.schemaFragment,
|
|
45
|
-
fragments: exeContext.fragments,
|
|
46
|
-
variableValues: exeContext.variableValues,
|
|
47
|
-
runtimeTypeName,
|
|
48
|
-
operation: exeContext.operation,
|
|
49
|
-
visitedFragmentNames: /* @__PURE__ */ new Set()
|
|
50
|
-
};
|
|
44
|
+
const patches = [];
|
|
51
45
|
collectFieldsImpl(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
exeContext,
|
|
47
|
+
runtimeTypeName,
|
|
48
|
+
operation.selectionSet,
|
|
49
|
+
groupedFieldSet,
|
|
50
|
+
patches,
|
|
51
|
+
/* @__PURE__ */ new Set()
|
|
55
52
|
);
|
|
56
|
-
return groupedFieldSet;
|
|
53
|
+
return { groupedFieldSet, patches };
|
|
57
54
|
}
|
|
58
|
-
function collectSubfields(
|
|
59
|
-
const context = {
|
|
60
|
-
schemaFragment,
|
|
61
|
-
fragments,
|
|
62
|
-
variableValues,
|
|
63
|
-
runtimeTypeName: returnTypeName,
|
|
64
|
-
operation,
|
|
65
|
-
visitedFragmentNames: /* @__PURE__ */ new Set()
|
|
66
|
-
};
|
|
55
|
+
function collectSubfields(exeContext, returnTypeName, fieldGroup) {
|
|
67
56
|
const subGroupedFieldSet = new import_AccumulatorMap.AccumulatorMap();
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
const visitedFragmentNames = /* @__PURE__ */ new Set();
|
|
58
|
+
const subPatches = [];
|
|
59
|
+
const subFieldsAndPatches = {
|
|
60
|
+
groupedFieldSet: subGroupedFieldSet,
|
|
61
|
+
patches: subPatches
|
|
62
|
+
};
|
|
63
|
+
for (const node of fieldGroup) {
|
|
70
64
|
if (node.selectionSet) {
|
|
71
65
|
collectFieldsImpl(
|
|
72
|
-
|
|
66
|
+
exeContext,
|
|
67
|
+
returnTypeName,
|
|
73
68
|
node.selectionSet,
|
|
74
69
|
subGroupedFieldSet,
|
|
75
|
-
|
|
70
|
+
subPatches,
|
|
71
|
+
visitedFragmentNames
|
|
76
72
|
);
|
|
77
73
|
}
|
|
78
74
|
}
|
|
79
|
-
return
|
|
75
|
+
return subFieldsAndPatches;
|
|
80
76
|
}
|
|
81
|
-
function collectFieldsImpl(
|
|
82
|
-
const {
|
|
83
|
-
schemaFragment,
|
|
84
|
-
fragments,
|
|
85
|
-
variableValues,
|
|
86
|
-
runtimeTypeName,
|
|
87
|
-
operation,
|
|
88
|
-
visitedFragmentNames
|
|
89
|
-
} = context;
|
|
77
|
+
function collectFieldsImpl(exeContext, runtimeTypeName, selectionSet, groupedFieldSet, patches, visitedFragmentNames) {
|
|
90
78
|
for (const selection of selectionSet.selections) {
|
|
91
79
|
switch (selection.kind) {
|
|
92
80
|
case import_graphql.Kind.FIELD: {
|
|
93
|
-
if (!shouldIncludeNode(
|
|
81
|
+
if (!shouldIncludeNode(exeContext, selection)) {
|
|
94
82
|
continue;
|
|
95
83
|
}
|
|
96
|
-
groupedFieldSet.add(getFieldEntryKey(selection),
|
|
97
|
-
node: selection,
|
|
98
|
-
deferUsage: deferUsage != null ? deferUsage : parentDeferUsage
|
|
99
|
-
});
|
|
84
|
+
groupedFieldSet.add(getFieldEntryKey(selection), selection);
|
|
100
85
|
break;
|
|
101
86
|
}
|
|
102
87
|
case import_graphql.Kind.INLINE_FRAGMENT: {
|
|
103
|
-
if (!shouldIncludeNode(
|
|
88
|
+
if (!shouldIncludeNode(exeContext, selection) || !doesFragmentConditionMatch(
|
|
104
89
|
selection,
|
|
105
90
|
runtimeTypeName,
|
|
106
|
-
schemaFragment
|
|
91
|
+
exeContext.schemaFragment
|
|
107
92
|
)) {
|
|
108
93
|
continue;
|
|
109
94
|
}
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
95
|
+
const defer = getDeferValues(exeContext, selection);
|
|
96
|
+
if (defer) {
|
|
97
|
+
const patchFields = new import_AccumulatorMap.AccumulatorMap();
|
|
98
|
+
collectFieldsImpl(
|
|
99
|
+
exeContext,
|
|
100
|
+
runtimeTypeName,
|
|
101
|
+
selection.selectionSet,
|
|
102
|
+
patchFields,
|
|
103
|
+
patches,
|
|
104
|
+
visitedFragmentNames
|
|
105
|
+
);
|
|
106
|
+
patches.push({
|
|
107
|
+
label: defer.label,
|
|
108
|
+
groupedFieldSet: patchFields
|
|
109
|
+
});
|
|
110
|
+
} else {
|
|
111
|
+
collectFieldsImpl(
|
|
112
|
+
exeContext,
|
|
113
|
+
runtimeTypeName,
|
|
114
|
+
selection.selectionSet,
|
|
115
|
+
groupedFieldSet,
|
|
116
|
+
patches,
|
|
117
|
+
visitedFragmentNames
|
|
118
|
+
);
|
|
119
|
+
}
|
|
124
120
|
break;
|
|
125
121
|
}
|
|
126
122
|
case import_graphql.Kind.FRAGMENT_SPREAD: {
|
|
127
123
|
const fragName = selection.name.value;
|
|
128
|
-
|
|
129
|
-
schemaFragment,
|
|
130
|
-
operation,
|
|
131
|
-
variableValues,
|
|
132
|
-
selection,
|
|
133
|
-
parentDeferUsage
|
|
134
|
-
);
|
|
135
|
-
if (!newDeferUsage && (visitedFragmentNames.has(fragName) || !shouldIncludeNode(schemaFragment, variableValues, selection))) {
|
|
124
|
+
if (!shouldIncludeNode(exeContext, selection)) {
|
|
136
125
|
continue;
|
|
137
126
|
}
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
127
|
+
const defer = getDeferValues(exeContext, selection);
|
|
128
|
+
if (visitedFragmentNames.has(fragName) && !defer) {
|
|
140
129
|
continue;
|
|
141
130
|
}
|
|
142
|
-
|
|
131
|
+
const fragment = exeContext.fragments[fragName];
|
|
132
|
+
if (fragment == null || !doesFragmentConditionMatch(
|
|
133
|
+
fragment,
|
|
134
|
+
runtimeTypeName,
|
|
135
|
+
exeContext.schemaFragment
|
|
136
|
+
)) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (!defer) {
|
|
143
140
|
visitedFragmentNames.add(fragName);
|
|
144
141
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
142
|
+
if (defer) {
|
|
143
|
+
const patchFields = new import_AccumulatorMap.AccumulatorMap();
|
|
144
|
+
collectFieldsImpl(
|
|
145
|
+
exeContext,
|
|
146
|
+
runtimeTypeName,
|
|
147
|
+
fragment.selectionSet,
|
|
148
|
+
patchFields,
|
|
149
|
+
patches,
|
|
150
|
+
visitedFragmentNames
|
|
151
|
+
);
|
|
152
|
+
patches.push({
|
|
153
|
+
label: defer.label,
|
|
154
|
+
groupedFieldSet: patchFields
|
|
155
|
+
});
|
|
156
|
+
} else {
|
|
157
|
+
collectFieldsImpl(
|
|
158
|
+
exeContext,
|
|
159
|
+
runtimeTypeName,
|
|
160
|
+
fragment.selectionSet,
|
|
161
|
+
groupedFieldSet,
|
|
162
|
+
patches,
|
|
163
|
+
visitedFragmentNames
|
|
164
|
+
);
|
|
165
|
+
}
|
|
152
166
|
break;
|
|
153
167
|
}
|
|
154
168
|
}
|
|
155
169
|
}
|
|
156
170
|
}
|
|
157
|
-
function shouldIncludeNode(
|
|
171
|
+
function shouldIncludeNode(exeContext, node) {
|
|
158
172
|
var _a;
|
|
159
173
|
if (!((_a = node.directives) == null ? void 0 : _a.length)) {
|
|
160
174
|
return true;
|
|
161
175
|
}
|
|
162
|
-
const skip = (0, import_values.getDirectiveValues)(
|
|
163
|
-
schemaFragment,
|
|
164
|
-
import_directives.GraphQLSkipDirective,
|
|
165
|
-
node,
|
|
166
|
-
variableValues
|
|
167
|
-
);
|
|
176
|
+
const skip = (0, import_values.getDirectiveValues)(exeContext, import_directives.GraphQLSkipDirective, node);
|
|
168
177
|
if ((skip == null ? void 0 : skip.if) === true) {
|
|
169
178
|
return false;
|
|
170
179
|
}
|
|
171
|
-
const include = (0, import_values.getDirectiveValues)(
|
|
172
|
-
schemaFragment,
|
|
173
|
-
import_directives.GraphQLIncludeDirective,
|
|
174
|
-
node,
|
|
175
|
-
variableValues
|
|
176
|
-
);
|
|
180
|
+
const include = (0, import_values.getDirectiveValues)(exeContext, import_directives.GraphQLIncludeDirective, node);
|
|
177
181
|
if ((include == null ? void 0 : include.if) === false) {
|
|
178
182
|
return false;
|
|
179
183
|
}
|
|
@@ -196,13 +200,8 @@ function doesFragmentConditionMatch(fragment, typeName, { definitions }) {
|
|
|
196
200
|
function getFieldEntryKey(node) {
|
|
197
201
|
return node.alias ? node.alias.value : node.name.value;
|
|
198
202
|
}
|
|
199
|
-
function
|
|
200
|
-
const defer = (0, import_values.getDirectiveValues)(
|
|
201
|
-
schemaFragment,
|
|
202
|
-
import_directives.GraphQLDeferDirective,
|
|
203
|
-
node,
|
|
204
|
-
variableValues
|
|
205
|
-
);
|
|
203
|
+
function getDeferValues(exeContext, node) {
|
|
204
|
+
const defer = (0, import_values.getDirectiveValues)(exeContext, import_directives.GraphQLDeferDirective, node);
|
|
206
205
|
if (!defer) {
|
|
207
206
|
return;
|
|
208
207
|
}
|
|
@@ -210,11 +209,10 @@ function getDeferUsage(schemaFragment, operation, variableValues, node, parentDe
|
|
|
210
209
|
return;
|
|
211
210
|
}
|
|
212
211
|
(0, import_invariant.default)(
|
|
213
|
-
operation.operation !== "subscription",
|
|
212
|
+
exeContext.operation.operation !== "subscription",
|
|
214
213
|
"`@defer` directive not supported on subscription operations. Disable `@defer` by setting the `if` argument to `false`."
|
|
215
214
|
);
|
|
216
215
|
return {
|
|
217
|
-
label: typeof defer.label === "string" ? defer.label : void 0
|
|
218
|
-
parentDeferUsage
|
|
216
|
+
label: typeof defer.label === "string" ? defer.label : void 0
|
|
219
217
|
};
|
|
220
218
|
}
|
package/lib/collectFields.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/collectFields.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n Kind,\n FieldNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n InlineFragmentNode,\n SelectionNode,\n SelectionSetNode,\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import {\n Kind,\n FieldNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n InlineFragmentNode,\n SelectionNode,\n SelectionSetNode,\n} from \"graphql\";\nimport { getDirectiveValues } from \"./values\";\nimport {\n GraphQLSkipDirective,\n GraphQLIncludeDirective,\n GraphQLDeferDirective,\n} from \"./schema/directives\";\n\nimport { AccumulatorMap } from \"./jsutils/AccumulatorMap\";\nimport invariant from \"invariant\";\nimport { ExecutionContext } from \"./executeWithoutSchema\";\nimport { isAbstractType, isSubType } from \"./schema/definition\";\nimport { SchemaFragment } from \"./types\";\n\nexport type FieldGroup = ReadonlyArray<FieldNode>;\n\nexport type GroupedFieldSet = Map<string, FieldGroup>;\n\nexport interface PatchFields {\n label: string | undefined;\n groupedFieldSet: GroupedFieldSet;\n}\n\nexport interface FieldsAndPatches {\n groupedFieldSet: GroupedFieldSet;\n patches: Array<PatchFields>;\n}\n\n/**\n * Given a selectionSet, collects all of the fields and returns them.\n *\n * CollectFields requires the \"runtime type\" of an object. For a field that\n * returns an Interface or Union type, the \"runtime type\" will be the actual\n * object type returned by that field.\n *\n * @internal\n */\nexport function collectFields(\n exeContext: ExecutionContext,\n runtimeTypeName: string,\n): FieldsAndPatches {\n const { operation } = exeContext;\n const groupedFieldSet = new AccumulatorMap<string, FieldNode>();\n const patches: Array<PatchFields> = [];\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n operation.selectionSet,\n groupedFieldSet,\n patches,\n new Set(),\n );\n return { groupedFieldSet, patches };\n}\n\n/**\n * Given an array of field nodes, collects all of the subfields of the passed\n * in fields, and returns them at the end.\n *\n * CollectSubFields requires the \"return type\" of an object. For a field that\n * returns an Interface or Union type, the \"return type\" will be the actual\n * object type returned by that field.\n *\n * @internal\n */\n// eslint-disable-next-line max-params\nexport function collectSubfields(\n exeContext: ExecutionContext,\n returnTypeName: string,\n fieldGroup: FieldGroup,\n): FieldsAndPatches {\n const subGroupedFieldSet = new AccumulatorMap<string, FieldNode>();\n const visitedFragmentNames = new Set<string>();\n\n const subPatches: Array<PatchFields> = [];\n const subFieldsAndPatches = {\n groupedFieldSet: subGroupedFieldSet,\n patches: subPatches,\n };\n\n for (const node of fieldGroup) {\n if (node.selectionSet) {\n collectFieldsImpl(\n exeContext,\n returnTypeName,\n node.selectionSet,\n subGroupedFieldSet,\n subPatches,\n visitedFragmentNames,\n );\n }\n }\n return subFieldsAndPatches;\n}\n\n// eslint-disable-next-line max-params\nfunction collectFieldsImpl(\n exeContext: ExecutionContext,\n runtimeTypeName: string,\n selectionSet: SelectionSetNode,\n groupedFieldSet: AccumulatorMap<string, FieldNode>,\n patches: Array<PatchFields>,\n visitedFragmentNames: Set<string>,\n): void {\n for (const selection of selectionSet.selections) {\n switch (selection.kind) {\n case Kind.FIELD: {\n if (!shouldIncludeNode(exeContext, selection)) {\n continue;\n }\n groupedFieldSet.add(getFieldEntryKey(selection), selection);\n break;\n }\n case Kind.INLINE_FRAGMENT: {\n if (\n !shouldIncludeNode(exeContext, selection) ||\n !doesFragmentConditionMatch(\n selection,\n runtimeTypeName,\n exeContext.schemaFragment,\n )\n ) {\n continue;\n }\n\n const defer = getDeferValues(exeContext, selection);\n\n if (defer) {\n const patchFields = new AccumulatorMap<string, FieldNode>();\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n selection.selectionSet,\n patchFields,\n patches,\n visitedFragmentNames,\n );\n patches.push({\n label: defer.label,\n groupedFieldSet: patchFields,\n });\n } else {\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n selection.selectionSet,\n groupedFieldSet,\n patches,\n visitedFragmentNames,\n );\n }\n break;\n }\n case Kind.FRAGMENT_SPREAD: {\n const fragName = selection.name.value;\n\n if (!shouldIncludeNode(exeContext, selection)) {\n continue;\n }\n\n const defer = getDeferValues(exeContext, selection);\n if (visitedFragmentNames.has(fragName) && !defer) {\n continue;\n }\n\n const fragment = exeContext.fragments[fragName];\n if (\n fragment == null ||\n !doesFragmentConditionMatch(\n fragment,\n runtimeTypeName,\n exeContext.schemaFragment,\n )\n ) {\n continue;\n }\n\n if (!defer) {\n visitedFragmentNames.add(fragName);\n }\n\n if (defer) {\n const patchFields = new AccumulatorMap<string, FieldNode>();\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n fragment.selectionSet,\n patchFields,\n patches,\n visitedFragmentNames,\n );\n patches.push({\n label: defer.label,\n groupedFieldSet: patchFields,\n });\n } else {\n collectFieldsImpl(\n exeContext,\n runtimeTypeName,\n fragment.selectionSet,\n groupedFieldSet,\n patches,\n visitedFragmentNames,\n );\n }\n break;\n }\n }\n }\n}\n\n/**\n * Determines if a field should be included based on the @include and @skip\n * directives, where @skip has higher precedence than @include.\n */\nfunction shouldIncludeNode(\n exeContext: ExecutionContext,\n node: SelectionNode,\n): boolean {\n if (!node.directives?.length) {\n return true;\n }\n\n const skip = getDirectiveValues(exeContext, GraphQLSkipDirective, node);\n if (skip?.if === true) {\n return false;\n }\n\n const include = getDirectiveValues(exeContext, GraphQLIncludeDirective, node);\n if (include?.if === false) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Determines if a fragment is applicable to the given type.\n */\nfunction doesFragmentConditionMatch(\n fragment: FragmentDefinitionNode | InlineFragmentNode,\n typeName: string,\n { definitions }: SchemaFragment,\n): boolean {\n const typeConditionNode = fragment.typeCondition;\n if (!typeConditionNode) {\n return true;\n }\n\n const conditionalTypeName = typeConditionNode.name.value;\n\n if (conditionalTypeName === typeName) {\n return true;\n }\n if (isAbstractType(definitions, conditionalTypeName)) {\n return isSubType(definitions, conditionalTypeName, typeName);\n }\n return false;\n}\n\n/**\n * Implements the logic to compute the key of a given field's entry\n */\nfunction getFieldEntryKey(node: FieldNode): string {\n return node.alias ? node.alias.value : node.name.value;\n}\n\n/**\n * Returns an object containing the `@defer` arguments if a field should be\n * deferred based on the experimental flag, defer directive present and\n * not disabled by the \"if\" argument.\n */\nfunction getDeferValues(\n exeContext: ExecutionContext,\n node: FragmentSpreadNode | InlineFragmentNode,\n): undefined | { label: string | undefined } {\n const defer = getDirectiveValues(exeContext, GraphQLDeferDirective, node);\n\n if (!defer) {\n return;\n }\n\n if (defer.if === false) {\n return;\n }\n\n invariant(\n exeContext.operation.operation !== \"subscription\",\n \"`@defer` directive not supported on subscription operations. Disable `@defer` by setting the `if` argument to `false`.\",\n );\n\n return {\n label: typeof defer.label === \"string\" ? defer.label : undefined,\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAQO;AACP,oBAAmC;AACnC,wBAIO;AAEP,4BAA+B;AAC/B,uBAAsB;AAEtB,wBAA0C;AA0BnC,SAAS,cACd,YACA,iBACkB;AAClB,QAAM,EAAE,UAAU,IAAI;AACtB,QAAM,kBAAkB,IAAI,qCAAkC;AAC9D,QAAM,UAA8B,CAAC;AAC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