UNPKG

80.7 kBJavaScriptView Raw
1import { __assign, __spread, __read, __extends, __awaiter, __generator } from 'tslib';
2import { GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, isSpecifiedScalarType, isScalarType, visit, Kind, TypeInfo, visitWithTypeInfo, isObjectType, isInterfaceType, isLeafType, valueFromAST, extendSchema, parse, getNullableType, BREAK, buildSchema, getIntrospectionQuery, buildClientSchema } from 'graphql';
3import { applySchemaTransforms, getResponseKeyFromInfo, getErrors, mapSchema, MapperKind, renameType, visitData, visitResult, updateArgument, transformInputValue, relocatedError, getArgumentValues, valueMatchesCriteria, getDirectives, pruneSchema, selectObjectFields, appendObjectFields, modifyObjectFields, removeObjectFields, renameFieldNode } from '@graphql-tools/utils/es5';
4import { isSubschemaConfig, delegateToSchema, getSubschema, handleResult, defaultMergedResolver } from '@graphql-tools/delegate/es5';
5import { addResolversToSchema } from '@graphql-tools/schema/es5';
6
7function generateProxyingResolvers(subschemaOrSubschemaConfig, transforms) {
8 var _a;
9 var targetSchema;
10 var schemaTransforms = [];
11 var createProxyingResolver;
12 if (isSubschemaConfig(subschemaOrSubschemaConfig)) {
13 targetSchema = subschemaOrSubschemaConfig.schema;
14 createProxyingResolver = (_a = subschemaOrSubschemaConfig.createProxyingResolver) !== null && _a !== void 0 ? _a : defaultCreateProxyingResolver;
15 if (subschemaOrSubschemaConfig.transforms != null) {
16 schemaTransforms = schemaTransforms.concat(subschemaOrSubschemaConfig.transforms);
17 }
18 }
19 else {
20 targetSchema = subschemaOrSubschemaConfig;
21 createProxyingResolver = defaultCreateProxyingResolver;
22 }
23 if (transforms != null) {
24 schemaTransforms = schemaTransforms.concat(transforms);
25 }
26 var transformedSchema = applySchemaTransforms(targetSchema, schemaTransforms);
27 var operationTypes = {
28 query: targetSchema.getQueryType(),
29 mutation: targetSchema.getMutationType(),
30 subscription: targetSchema.getSubscriptionType(),
31 };
32 var resolvers = {};
33 Object.keys(operationTypes).forEach(function (operation) {
34 var rootType = operationTypes[operation];
35 if (rootType != null) {
36 var typeName_1 = rootType.name;
37 var fields = rootType.getFields();
38 resolvers[typeName_1] = {};
39 Object.keys(fields).forEach(function (fieldName) {
40 var proxyingResolver = createProxyingResolver({
41 schema: subschemaOrSubschemaConfig,
42 transforms: transforms,
43 transformedSchema: transformedSchema,
44 operation: operation,
45 fieldName: fieldName,
46 });
47 var finalResolver = createPossiblyNestedProxyingResolver(subschemaOrSubschemaConfig, proxyingResolver);
48 if (operation === 'subscription') {
49 resolvers[typeName_1][fieldName] = {
50 subscribe: finalResolver,
51 resolve: function (payload, _, __, _a) {
52 var targetFieldName = _a.fieldName;
53 return payload[targetFieldName];
54 },
55 };
56 }
57 else {
58 resolvers[typeName_1][fieldName] = {
59 resolve: finalResolver,
60 };
61 }
62 });
63 }
64 });
65 return resolvers;
66}
67function createPossiblyNestedProxyingResolver(subschemaOrSubschemaConfig, proxyingResolver) {
68 return function (parent, args, context, info) {
69 if (parent != null) {
70 var responseKey = getResponseKeyFromInfo(info);
71 var errors = getErrors(parent, responseKey);
72 // Check to see if the parent contains a proxied result
73 if (errors != null) {
74 var subschema = getSubschema(parent, responseKey);
75 // If there is a proxied result from this subschema, return it
76 // This can happen even for a root field when the root type ia
77 // also nested as a field within a different type.
78 if (subschemaOrSubschemaConfig === subschema && parent[responseKey] !== undefined) {
79 return handleResult(parent[responseKey], errors, subschema, context, info);
80 }
81 }
82 }
83 return proxyingResolver(parent, args, context, info);
84 };
85}
86function defaultCreateProxyingResolver(_a) {
87 var schema = _a.schema, operation = _a.operation, transforms = _a.transforms, transformedSchema = _a.transformedSchema;
88 return function (_parent, _args, context, info) {
89 return delegateToSchema({
90 schema: schema,
91 operation: operation,
92 context: context,
93 info: info,
94 transforms: transforms,
95 transformedSchema: transformedSchema,
96 });
97 };
98}
99
100function wrapSchema(subschemaOrSubschemaConfig, transforms) {
101 var targetSchema;
102 var schemaTransforms = [];
103 if (isSubschemaConfig(subschemaOrSubschemaConfig)) {
104 targetSchema = subschemaOrSubschemaConfig.schema;
105 if (subschemaOrSubschemaConfig.transforms != null) {
106 schemaTransforms = schemaTransforms.concat(subschemaOrSubschemaConfig.transforms);
107 }
108 }
109 else {
110 targetSchema = subschemaOrSubschemaConfig;
111 }
112 if (transforms != null) {
113 schemaTransforms = schemaTransforms.concat(transforms);
114 }
115 var proxyingResolvers = generateProxyingResolvers(subschemaOrSubschemaConfig, transforms);
116 var schema = createWrappingSchema(targetSchema, proxyingResolvers);
117 return applySchemaTransforms(schema, schemaTransforms);
118}
119function createWrappingSchema(schema, proxyingResolvers) {
120 var _a;
121 return mapSchema(schema, (_a = {},
122 _a[MapperKind.ROOT_OBJECT] = function (type) {
123 var config = type.toConfig();
124 var fieldConfigMap = config.fields;
125 Object.keys(fieldConfigMap).forEach(function (fieldName) {
126 fieldConfigMap[fieldName] = __assign(__assign({}, fieldConfigMap[fieldName]), proxyingResolvers[type.name][fieldName]);
127 });
128 return new GraphQLObjectType(config);
129 },
130 _a[MapperKind.OBJECT_TYPE] = function (type) {
131 var config = type.toConfig();
132 config.isTypeOf = undefined;
133 Object.keys(config.fields).forEach(function (fieldName) {
134 config.fields[fieldName].resolve = defaultMergedResolver;
135 config.fields[fieldName].subscribe = null;
136 });
137 return new GraphQLObjectType(config);
138 },
139 _a[MapperKind.INTERFACE_TYPE] = function (type) {
140 var config = type.toConfig();
141 delete config.resolveType;
142 return new GraphQLInterfaceType(config);
143 },
144 _a[MapperKind.UNION_TYPE] = function (type) {
145 var config = type.toConfig();
146 delete config.resolveType;
147 return new GraphQLUnionType(config);
148 },
149 _a));
150}
151
152var RenameTypes = /** @class */ (function () {
153 function RenameTypes(renamer, options) {
154 this.renamer = renamer;
155 this.map = Object.create(null);
156 this.reverseMap = Object.create(null);
157 var _a = options != null ? options : {}, _b = _a.renameBuiltins, renameBuiltins = _b === void 0 ? false : _b, _c = _a.renameScalars, renameScalars = _c === void 0 ? true : _c;
158 this.renameBuiltins = renameBuiltins;
159 this.renameScalars = renameScalars;
160 }
161 RenameTypes.prototype.transformSchema = function (originalSchema) {
162 var _a;
163 var _this = this;
164 return mapSchema(originalSchema, (_a = {},
165 _a[MapperKind.TYPE] = function (type) {
166 if (isSpecifiedScalarType(type) && !_this.renameBuiltins) {
167 return undefined;
168 }
169 if (isScalarType(type) && !_this.renameScalars) {
170 return undefined;
171 }
172 var oldName = type.name;
173 var newName = _this.renamer(oldName);
174 if (newName !== undefined && newName !== oldName) {
175 _this.map[oldName] = newName;
176 _this.reverseMap[newName] = oldName;
177 return renameType(type, newName);
178 }
179 },
180 _a[MapperKind.ROOT_OBJECT] = function () {
181 return undefined;
182 },
183 _a));
184 };
185 RenameTypes.prototype.transformRequest = function (originalRequest) {
186 var _a;
187 var _this = this;
188 var document = visit(originalRequest.document, (_a = {},
189 _a[Kind.NAMED_TYPE] = function (node) {
190 var name = node.name.value;
191 if (name in _this.reverseMap) {
192 return __assign(__assign({}, node), { name: {
193 kind: Kind.NAME,
194 value: _this.reverseMap[name],
195 } });
196 }
197 },
198 _a));
199 return __assign(__assign({}, originalRequest), { document: document });
200 };
201 RenameTypes.prototype.transformResult = function (result) {
202 var _this = this;
203 return __assign(__assign({}, result), { data: visitData(result.data, function (object) {
204 var typeName = object === null || object === void 0 ? void 0 : object.__typename;
205 if (typeName != null && typeName in _this.map) {
206 object.__typename = _this.map[typeName];
207 }
208 return object;
209 }) });
210 };
211 return RenameTypes;
212}());
213
214var FilterTypes = /** @class */ (function () {
215 function FilterTypes(filter) {
216 this.filter = filter;
217 }
218 FilterTypes.prototype.transformSchema = function (schema) {
219 var _a;
220 var _this = this;
221 return mapSchema(schema, (_a = {},
222 _a[MapperKind.TYPE] = function (type) {
223 if (_this.filter(type)) {
224 return undefined;
225 }
226 return null;
227 },
228 _a));
229 };
230 return FilterTypes;
231}());
232
233var RenameRootTypes = /** @class */ (function () {
234 function RenameRootTypes(renamer) {
235 this.renamer = renamer;
236 this.map = Object.create(null);
237 this.reverseMap = Object.create(null);
238 }
239 RenameRootTypes.prototype.transformSchema = function (originalSchema) {
240 var _a;
241 var _this = this;
242 return mapSchema(originalSchema, (_a = {},
243 _a[MapperKind.ROOT_OBJECT] = function (type) {
244 var oldName = type.name;
245 var newName = _this.renamer(oldName);
246 if (newName !== undefined && newName !== oldName) {
247 _this.map[oldName] = newName;
248 _this.reverseMap[newName] = oldName;
249 return renameType(type, newName);
250 }
251 },
252 _a));
253 };
254 RenameRootTypes.prototype.transformRequest = function (originalRequest) {
255 var _a;
256 var _this = this;
257 var document = visit(originalRequest.document, (_a = {},
258 _a[Kind.NAMED_TYPE] = function (node) {
259 var name = node.name.value;
260 if (name in _this.reverseMap) {
261 return __assign(__assign({}, node), { name: {
262 kind: Kind.NAME,
263 value: _this.reverseMap[name],
264 } });
265 }
266 },
267 _a));
268 return __assign(__assign({}, originalRequest), { document: document });
269 };
270 RenameRootTypes.prototype.transformResult = function (result) {
271 var _this = this;
272 return __assign(__assign({}, result), { data: visitData(result.data, function (object) {
273 var typeName = object === null || object === void 0 ? void 0 : object.__typename;
274 if (typeName != null && typeName in _this.map) {
275 object.__typename = _this.map[typeName];
276 }
277 return object;
278 }) });
279 };
280 return RenameRootTypes;
281}());
282
283var TransformCompositeFields = /** @class */ (function () {
284 function TransformCompositeFields(fieldTransformer, fieldNodeTransformer, dataTransformer, errorsTransformer) {
285 this.fieldTransformer = fieldTransformer;
286 this.fieldNodeTransformer = fieldNodeTransformer;
287 this.dataTransformer = dataTransformer;
288 this.errorsTransformer = errorsTransformer;
289 this.mapping = {};
290 }
291 TransformCompositeFields.prototype.transformSchema = function (originalSchema) {
292 var _a;
293 var _this = this;
294 this.transformedSchema = mapSchema(originalSchema, (_a = {},
295 _a[MapperKind.COMPOSITE_FIELD] = function (fieldConfig, fieldName, typeName) {
296 var transformedField = _this.fieldTransformer(typeName, fieldName, fieldConfig);
297 if (Array.isArray(transformedField)) {
298 var newFieldName = transformedField[0];
299 if (newFieldName !== fieldName) {
300 if (!(typeName in _this.mapping)) {
301 _this.mapping[typeName] = {};
302 }
303 _this.mapping[typeName][newFieldName] = fieldName;
304 }
305 }
306 return transformedField;
307 },
308 _a));
309 this.typeInfo = new TypeInfo(this.transformedSchema);
310 return this.transformedSchema;
311 };
312 TransformCompositeFields.prototype.transformRequest = function (originalRequest, _delegationContext, transformationContext) {
313 var document = originalRequest.document;
314 var fragments = Object.create(null);
315 document.definitions.forEach(function (def) {
316 if (def.kind === Kind.FRAGMENT_DEFINITION) {
317 fragments[def.name.value] = def;
318 }
319 });
320 return __assign(__assign({}, originalRequest), { document: this.transformDocument(document, fragments, transformationContext) });
321 };
322 TransformCompositeFields.prototype.transformResult = function (result, _delegationContext, transformationContext) {
323 var _this = this;
324 if (this.dataTransformer != null) {
325 result.data = visitData(result.data, function (value) { return _this.dataTransformer(value, transformationContext); });
326 }
327 if (this.errorsTransformer != null) {
328 result.errors = this.errorsTransformer(result.errors, transformationContext);
329 }
330 return result;
331 };
332 TransformCompositeFields.prototype.transformDocument = function (document, fragments, transformationContext) {
333 var _a;
334 var _this = this;
335 return visit(document, visitWithTypeInfo(this.typeInfo, {
336 leave: (_a = {},
337 _a[Kind.SELECTION_SET] = function (node) {
338 return _this.transformSelectionSet(node, _this.typeInfo, fragments, transformationContext);
339 },
340 _a),
341 }));
342 };
343 TransformCompositeFields.prototype.transformSelectionSet = function (node, typeInfo, fragments, transformationContext) {
344 var _this = this;
345 var parentType = typeInfo.getParentType();
346 if (parentType == null) {
347 return undefined;
348 }
349 var parentTypeName = parentType.name;
350 var newSelections = [];
351 node.selections.forEach(function (selection) {
352 var _a, _b;
353 if (selection.kind !== Kind.FIELD) {
354 newSelections.push(selection);
355 return;
356 }
357 var newName = selection.name.value;
358 if (_this.dataTransformer != null || _this.errorsTransformer != null) {
359 newSelections.push({
360 kind: Kind.FIELD,
361 name: {
362 kind: Kind.NAME,
363 value: '__typename',
364 },
365 });
366 }
367 var transformedSelection;
368 if (_this.fieldNodeTransformer == null) {
369 transformedSelection = selection;
370 }
371 else {
372 transformedSelection = _this.fieldNodeTransformer(parentTypeName, newName, selection, fragments, transformationContext);
373 transformedSelection = transformedSelection === undefined ? selection : transformedSelection;
374 }
375 if (Array.isArray(transformedSelection)) {
376 newSelections = newSelections.concat(transformedSelection);
377 return;
378 }
379 if (transformedSelection.kind !== Kind.FIELD) {
380 newSelections.push(transformedSelection);
381 return;
382 }
383 var typeMapping = _this.mapping[parentTypeName];
384 if (typeMapping == null) {
385 newSelections.push(transformedSelection);
386 return;
387 }
388 var oldName = _this.mapping[parentTypeName][newName];
389 if (oldName == null) {
390 newSelections.push(transformedSelection);
391 return;
392 }
393 newSelections.push(__assign(__assign({}, transformedSelection), { name: {
394 kind: Kind.NAME,
395 value: oldName,
396 }, alias: {
397 kind: Kind.NAME,
398 value: (_b = (_a = transformedSelection.alias) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : newName,
399 } }));
400 });
401 return __assign(__assign({}, node), { selections: newSelections });
402 };
403 return TransformCompositeFields;
404}());
405
406var TransformObjectFields = /** @class */ (function () {
407 function TransformObjectFields(objectFieldTransformer, fieldNodeTransformer) {
408 this.objectFieldTransformer = objectFieldTransformer;
409 this.fieldNodeTransformer = fieldNodeTransformer;
410 }
411 TransformObjectFields.prototype.transformSchema = function (originalSchema) {
412 var _this = this;
413 var compositeToObjectFieldTransformer = function (typeName, fieldName, fieldConfig) {
414 if (isObjectType(originalSchema.getType(typeName))) {
415 return _this.objectFieldTransformer(typeName, fieldName, fieldConfig);
416 }
417 return undefined;
418 };
419 this.transformer = new TransformCompositeFields(compositeToObjectFieldTransformer, this.fieldNodeTransformer);
420 return this.transformer.transformSchema(originalSchema);
421 };
422 TransformObjectFields.prototype.transformRequest = function (originalRequest, delegationContext, transformationContext) {
423 return this.transformer.transformRequest(originalRequest, delegationContext, transformationContext);
424 };
425 TransformObjectFields.prototype.transformResult = function (originalResult, delegationContext, transformationContext) {
426 return this.transformer.transformResult(originalResult, delegationContext, transformationContext);
427 };
428 return TransformObjectFields;
429}());
430
431var TransformRootFields = /** @class */ (function () {
432 function TransformRootFields(rootFieldTransformer, fieldNodeTransformer) {
433 this.rootFieldTransformer = rootFieldTransformer;
434 this.fieldNodeTransformer = fieldNodeTransformer;
435 }
436 TransformRootFields.prototype.transformSchema = function (originalSchema) {
437 var _this = this;
438 var _a, _b, _c;
439 var queryTypeName = (_a = originalSchema.getQueryType()) === null || _a === void 0 ? void 0 : _a.name;
440 var mutationTypeName = (_b = originalSchema.getMutationType()) === null || _b === void 0 ? void 0 : _b.name;
441 var subscriptionTypeName = (_c = originalSchema.getSubscriptionType()) === null || _c === void 0 ? void 0 : _c.name;
442 var rootToObjectFieldTransformer = function (typeName, fieldName, fieldConfig) {
443 if (typeName === queryTypeName) {
444 return _this.rootFieldTransformer('Query', fieldName, fieldConfig);
445 }
446 if (typeName === mutationTypeName) {
447 return _this.rootFieldTransformer('Mutation', fieldName, fieldConfig);
448 }
449 if (typeName === subscriptionTypeName) {
450 return _this.rootFieldTransformer('Subscription', fieldName, fieldConfig);
451 }
452 return undefined;
453 };
454 this.transformer = new TransformObjectFields(rootToObjectFieldTransformer, this.fieldNodeTransformer);
455 return this.transformer.transformSchema(originalSchema);
456 };
457 TransformRootFields.prototype.transformRequest = function (originalRequest, delegationContext, transformationContext) {
458 return this.transformer.transformRequest(originalRequest, delegationContext, transformationContext);
459 };
460 TransformRootFields.prototype.transformResult = function (originalResult, delegationContext, transformationContext) {
461 return this.transformer.transformResult(originalResult, delegationContext, transformationContext);
462 };
463 return TransformRootFields;
464}());
465
466var RenameRootFields = /** @class */ (function () {
467 function RenameRootFields(renamer) {
468 this.transformer = new TransformRootFields(function (operation, fieldName, fieldConfig) { return [renamer(operation, fieldName, fieldConfig), fieldConfig]; });
469 }
470 RenameRootFields.prototype.transformSchema = function (originalSchema) {
471 return this.transformer.transformSchema(originalSchema);
472 };
473 RenameRootFields.prototype.transformRequest = function (originalRequest) {
474 return this.transformer.transformRequest(originalRequest);
475 };
476 return RenameRootFields;
477}());
478
479var FilterRootFields = /** @class */ (function () {
480 function FilterRootFields(filter) {
481 this.transformer = new TransformRootFields(function (operation, fieldName, fieldConfig) {
482 if (filter(operation, fieldName, fieldConfig)) {
483 return undefined;
484 }
485 return null;
486 });
487 }
488 FilterRootFields.prototype.transformSchema = function (originalSchema) {
489 return this.transformer.transformSchema(originalSchema);
490 };
491 return FilterRootFields;
492}());
493
494var RenameObjectFields = /** @class */ (function () {
495 function RenameObjectFields(renamer) {
496 this.transformer = new TransformObjectFields(function (typeName, fieldName, fieldConfig) { return [
497 renamer(typeName, fieldName, fieldConfig),
498 fieldConfig,
499 ]; });
500 }
501 RenameObjectFields.prototype.transformSchema = function (originalSchema) {
502 return this.transformer.transformSchema(originalSchema);
503 };
504 RenameObjectFields.prototype.transformRequest = function (originalRequest) {
505 return this.transformer.transformRequest(originalRequest);
506 };
507 return RenameObjectFields;
508}());
509
510var FilterObjectFields = /** @class */ (function () {
511 function FilterObjectFields(filter) {
512 this.transformer = new TransformObjectFields(function (typeName, fieldName, fieldConfig) {
513 return filter(typeName, fieldName, fieldConfig) ? undefined : null;
514 });
515 }
516 FilterObjectFields.prototype.transformSchema = function (originalSchema) {
517 return this.transformer.transformSchema(originalSchema);
518 };
519 return FilterObjectFields;
520}());
521
522var TransformInterfaceFields = /** @class */ (function () {
523 function TransformInterfaceFields(interfaceFieldTransformer, fieldNodeTransformer) {
524 this.interfaceFieldTransformer = interfaceFieldTransformer;
525 this.fieldNodeTransformer = fieldNodeTransformer;
526 }
527 TransformInterfaceFields.prototype.transformSchema = function (originalSchema) {
528 var _this = this;
529 var compositeToObjectFieldTransformer = function (typeName, fieldName, fieldConfig) {
530 if (isInterfaceType(originalSchema.getType(typeName))) {
531 return _this.interfaceFieldTransformer(typeName, fieldName, fieldConfig);
532 }
533 return undefined;
534 };
535 this.transformer = new TransformCompositeFields(compositeToObjectFieldTransformer, this.fieldNodeTransformer);
536 return this.transformer.transformSchema(originalSchema);
537 };
538 TransformInterfaceFields.prototype.transformRequest = function (originalRequest, delegationContext, transformationContext) {
539 return this.transformer.transformRequest(originalRequest, delegationContext, transformationContext);
540 };
541 TransformInterfaceFields.prototype.transformResult = function (originalResult, delegationContext, transformationContext) {
542 return this.transformer.transformResult(originalResult, delegationContext, transformationContext);
543 };
544 return TransformInterfaceFields;
545}());
546
547var RenameInterfaceFields = /** @class */ (function () {
548 function RenameInterfaceFields(renamer) {
549 this.transformer = new TransformInterfaceFields(function (typeName, fieldName, fieldConfig) { return [
550 renamer(typeName, fieldName, fieldConfig),
551 fieldConfig,
552 ]; });
553 }
554 RenameInterfaceFields.prototype.transformSchema = function (originalSchema) {
555 return this.transformer.transformSchema(originalSchema);
556 };
557 RenameInterfaceFields.prototype.transformRequest = function (originalRequest) {
558 return this.transformer.transformRequest(originalRequest);
559 };
560 return RenameInterfaceFields;
561}());
562
563var FilterInterfaceFields = /** @class */ (function () {
564 function FilterInterfaceFields(filter) {
565 this.transformer = new TransformInterfaceFields(function (typeName, fieldName, fieldConfig) {
566 return filter(typeName, fieldName, fieldConfig) ? undefined : null;
567 });
568 }
569 FilterInterfaceFields.prototype.transformSchema = function (originalSchema) {
570 return this.transformer.transformSchema(originalSchema);
571 };
572 return FilterInterfaceFields;
573}());
574
575var TransformInputObjectFields = /** @class */ (function () {
576 function TransformInputObjectFields(inputFieldTransformer, inputFieldNodeTransformer, inputObjectNodeTransformer) {
577 this.inputFieldTransformer = inputFieldTransformer;
578 this.inputFieldNodeTransformer = inputFieldNodeTransformer;
579 this.inputObjectNodeTransformer = inputObjectNodeTransformer;
580 this.mapping = {};
581 }
582 TransformInputObjectFields.prototype.transformSchema = function (originalSchema) {
583 var _a;
584 var _this = this;
585 this.transformedSchema = mapSchema(originalSchema, (_a = {},
586 _a[MapperKind.INPUT_OBJECT_FIELD] = function (inputFieldConfig, fieldName, typeName) {
587 var transformedInputField = _this.inputFieldTransformer(typeName, fieldName, inputFieldConfig);
588 if (Array.isArray(transformedInputField)) {
589 var newFieldName = transformedInputField[0];
590 if (newFieldName !== fieldName) {
591 if (!(typeName in _this.mapping)) {
592 _this.mapping[typeName] = {};
593 }
594 _this.mapping[typeName][newFieldName] = fieldName;
595 }
596 }
597 return transformedInputField;
598 },
599 _a));
600 return this.transformedSchema;
601 };
602 TransformInputObjectFields.prototype.transformRequest = function (originalRequest, delegationContext) {
603 var fragments = Object.create(null);
604 originalRequest.document.definitions
605 .filter(function (def) { return def.kind === Kind.FRAGMENT_DEFINITION; })
606 .forEach(function (def) {
607 fragments[def.name.value] = def;
608 });
609 var document = this.transformDocument(originalRequest.document, this.mapping, this.inputFieldNodeTransformer, this.inputObjectNodeTransformer, originalRequest,
610 // cast to DelegationContext as workaround to avoid breaking change in types until next major version
611 delegationContext);
612 return __assign(__assign({}, originalRequest), { document: document });
613 };
614 TransformInputObjectFields.prototype.transformDocument = function (document, mapping, inputFieldNodeTransformer, inputObjectNodeTransformer, request, delegationContext) {
615 var _a;
616 var typeInfo = new TypeInfo(this.transformedSchema);
617 var newDocument = visit(document, visitWithTypeInfo(typeInfo, {
618 leave: (_a = {},
619 _a[Kind.OBJECT] = function (node) {
620 var parentType = typeInfo.getInputType();
621 if (parentType != null) {
622 var parentTypeName_1 = parentType.name;
623 var newInputFields_1 = [];
624 node.fields.forEach(function (inputField) {
625 var newName = inputField.name.value;
626 var transformedInputField = inputFieldNodeTransformer != null
627 ? inputFieldNodeTransformer(parentTypeName_1, newName, inputField, request, delegationContext)
628 : inputField;
629 if (Array.isArray(transformedInputField)) {
630 transformedInputField.forEach(function (individualTransformedInputField) {
631 var typeMapping = mapping[parentTypeName_1];
632 if (typeMapping == null) {
633 newInputFields_1.push(individualTransformedInputField);
634 return;
635 }
636 var oldName = typeMapping[newName];
637 if (oldName == null) {
638 newInputFields_1.push(individualTransformedInputField);
639 return;
640 }
641 newInputFields_1.push(__assign(__assign({}, individualTransformedInputField), { name: __assign(__assign({}, individualTransformedInputField.name), { value: oldName }) }));
642 });
643 return;
644 }
645 var typeMapping = mapping[parentTypeName_1];
646 if (typeMapping == null) {
647 newInputFields_1.push(transformedInputField);
648 return;
649 }
650 var oldName = typeMapping[newName];
651 if (oldName == null) {
652 newInputFields_1.push(transformedInputField);
653 return;
654 }
655 newInputFields_1.push(__assign(__assign({}, transformedInputField), { name: __assign(__assign({}, transformedInputField.name), { value: oldName }) }));
656 });
657 var newNode = __assign(__assign({}, node), { fields: newInputFields_1 });
658 return inputObjectNodeTransformer != null
659 ? inputObjectNodeTransformer(parentTypeName_1, newNode, request, delegationContext)
660 : newNode;
661 }
662 },
663 _a),
664 }));
665 return newDocument;
666 };
667 return TransformInputObjectFields;
668}());
669
670var RenameInputObjectFields = /** @class */ (function () {
671 function RenameInputObjectFields(renamer) {
672 var _this = this;
673 this.renamer = renamer;
674 this.transformer = new TransformInputObjectFields(function (typeName, inputFieldName, inputFieldConfig) {
675 var newName = renamer(typeName, inputFieldName, inputFieldConfig);
676 if (newName !== undefined && newName !== inputFieldName) {
677 return [renamer(typeName, inputFieldName, inputFieldConfig), inputFieldConfig];
678 }
679 }, function (typeName, inputFieldName, inputFieldNode) {
680 if (!(typeName in _this.reverseMap)) {
681 return inputFieldNode;
682 }
683 var inputFieldNameMap = _this.reverseMap[typeName];
684 if (!(inputFieldName in inputFieldNameMap)) {
685 return inputFieldNode;
686 }
687 return __assign(__assign({}, inputFieldNode), { name: __assign(__assign({}, inputFieldNode.name), { value: inputFieldNameMap[inputFieldName] }) });
688 });
689 this.reverseMap = Object.create(null);
690 }
691 RenameInputObjectFields.prototype.transformSchema = function (originalSchema) {
692 var _a;
693 var _this = this;
694 mapSchema(originalSchema, (_a = {},
695 _a[MapperKind.INPUT_OBJECT_FIELD] = function (inputFieldConfig, fieldName, typeName) {
696 var newName = _this.renamer(typeName, fieldName, inputFieldConfig);
697 if (newName !== undefined && newName !== fieldName) {
698 if (_this.reverseMap[typeName] == null) {
699 _this.reverseMap[typeName] = Object.create(null);
700 }
701 _this.reverseMap[typeName][newName] = fieldName;
702 }
703 return undefined;
704 },
705 _a[MapperKind.ROOT_OBJECT] = function () {
706 return undefined;
707 },
708 _a));
709 return this.transformer.transformSchema(originalSchema);
710 };
711 RenameInputObjectFields.prototype.transformRequest = function (originalRequest, delegationContext) {
712 return this.transformer.transformRequest(originalRequest, delegationContext);
713 };
714 return RenameInputObjectFields;
715}());
716
717var FilterInputObjectFields = /** @class */ (function () {
718 function FilterInputObjectFields(filter, inputObjectNodeTransformer) {
719 this.transformer = new TransformInputObjectFields(function (typeName, fieldName, inputFieldConfig) {
720 return filter(typeName, fieldName, inputFieldConfig) ? undefined : null;
721 }, undefined, inputObjectNodeTransformer);
722 }
723 FilterInputObjectFields.prototype.transformSchema = function (originalSchema) {
724 return this.transformer.transformSchema(originalSchema);
725 };
726 FilterInputObjectFields.prototype.transformRequest = function (originalRequest, delegationContext) {
727 return this.transformer.transformRequest(originalRequest, delegationContext);
728 };
729 return FilterInputObjectFields;
730}());
731
732var MapLeafValues = /** @class */ (function () {
733 function MapLeafValues(inputValueTransformer, outputValueTransformer) {
734 this.inputValueTransformer = inputValueTransformer;
735 this.outputValueTransformer = outputValueTransformer;
736 this.resultVisitorMap = Object.create(null);
737 }
738 MapLeafValues.prototype.transformSchema = function (originalSchema) {
739 var _this = this;
740 this.originalSchema = originalSchema;
741 var typeMap = originalSchema.getTypeMap();
742 Object.keys(typeMap).forEach(function (typeName) {
743 var type = typeMap[typeName];
744 if (!typeName.startsWith('__')) {
745 if (isLeafType(type)) {
746 _this.resultVisitorMap[typeName] = function (value) { return _this.outputValueTransformer(typeName, value); };
747 }
748 }
749 });
750 this.typeInfo = new TypeInfo(originalSchema);
751 return originalSchema;
752 };
753 MapLeafValues.prototype.transformRequest = function (originalRequest, _delegationContext, transformationContext) {
754 var document = originalRequest.document;
755 var variableValues = originalRequest.variables;
756 var operations = document.definitions.filter(function (def) { return def.kind === Kind.OPERATION_DEFINITION; });
757 var fragments = document.definitions.filter(function (def) { return def.kind === Kind.FRAGMENT_DEFINITION; });
758 var newOperations = this.transformOperations(operations, variableValues);
759 var transformedRequest = __assign(__assign({}, originalRequest), { document: __assign(__assign({}, document), { definitions: __spread(newOperations, fragments) }), variables: variableValues });
760 transformationContext.transformedRequest = transformedRequest;
761 return transformedRequest;
762 };
763 MapLeafValues.prototype.transformResult = function (originalResult, _delegationContext, transformationContext) {
764 return visitResult(originalResult, transformationContext.transformedRequest, this.originalSchema, this.resultVisitorMap);
765 };
766 MapLeafValues.prototype.transformOperations = function (operations, variableValues) {
767 var _this = this;
768 return operations.map(function (operation) {
769 var _a;
770 var variableDefinitionMap = operation.variableDefinitions.reduce(function (prev, def) {
771 var _a;
772 return (__assign(__assign({}, prev), (_a = {}, _a[def.variable.name.value] = def, _a)));
773 }, {});
774 var newOperation = visit(operation, visitWithTypeInfo(_this.typeInfo, (_a = {},
775 _a[Kind.FIELD] = function (node) { return _this.transformFieldNode(node, variableDefinitionMap, variableValues); },
776 _a)));
777 return __assign(__assign({}, newOperation), { variableDefinitions: Object.keys(variableDefinitionMap).map(function (varName) { return variableDefinitionMap[varName]; }) });
778 });
779 };
780 MapLeafValues.prototype.transformFieldNode = function (field, variableDefinitionMap, variableValues) {
781 var _this = this;
782 var targetField = this.typeInfo.getFieldDef();
783 if (!targetField.name.startsWith('__')) {
784 var argumentNodes = field.arguments;
785 if (argumentNodes != null) {
786 var argumentNodeMap_1 = argumentNodes.reduce(function (prev, argument) {
787 var _a;
788 return (__assign(__assign({}, prev), (_a = {}, _a[argument.name.value] = argument, _a)));
789 }, Object.create(null));
790 targetField.args.forEach(function (argument) {
791 var argName = argument.name;
792 var argType = argument.type;
793 var argumentNode = argumentNodeMap_1[argName];
794 var argValue = argumentNode === null || argumentNode === void 0 ? void 0 : argumentNode.value;
795 var value;
796 if (argValue != null) {
797 value = valueFromAST(argValue, argType, variableValues);
798 }
799 updateArgument(argName, argType, argumentNodeMap_1, variableDefinitionMap, variableValues, transformInputValue(argType, value, function (t, v) {
800 var newValue = _this.inputValueTransformer(t.name, v);
801 return newValue === undefined ? v : newValue;
802 }));
803 });
804 return __assign(__assign({}, field), { arguments: Object.keys(argumentNodeMap_1).map(function (argName) { return argumentNodeMap_1[argName]; }) });
805 }
806 }
807 };
808 return MapLeafValues;
809}());
810
811var TransformEnumValues = /** @class */ (function () {
812 function TransformEnumValues(enumValueTransformer, inputValueTransformer, outputValueTransformer) {
813 this.enumValueTransformer = enumValueTransformer;
814 this.mapping = Object.create(null);
815 this.reverseMapping = Object.create(null);
816 this.transformer = new MapLeafValues(generateValueTransformer(inputValueTransformer, this.reverseMapping), generateValueTransformer(outputValueTransformer, this.mapping));
817 }
818 TransformEnumValues.prototype.transformSchema = function (originalSchema) {
819 var _a;
820 var _this = this;
821 var transformedSchema = this.transformer.transformSchema(originalSchema);
822 this.transformedSchema = mapSchema(transformedSchema, (_a = {},
823 _a[MapperKind.ENUM_VALUE] = function (valueConfig, typeName, _schema, externalValue) {
824 return _this.transformEnumValue(typeName, externalValue, valueConfig);
825 },
826 _a));
827 return this.transformedSchema;
828 };
829 TransformEnumValues.prototype.transformRequest = function (originalRequest, delegationContext, transformationContext) {
830 return this.transformer.transformRequest(originalRequest, delegationContext, transformationContext);
831 };
832 TransformEnumValues.prototype.transformResult = function (originalResult, delegationContext, transformationContext) {
833 return this.transformer.transformResult(originalResult, delegationContext, transformationContext);
834 };
835 TransformEnumValues.prototype.transformEnumValue = function (typeName, externalValue, enumValueConfig) {
836 var transformedEnumValue = this.enumValueTransformer(typeName, externalValue, enumValueConfig);
837 if (Array.isArray(transformedEnumValue)) {
838 var newExternalValue = transformedEnumValue[0];
839 if (newExternalValue !== externalValue) {
840 if (!(typeName in this.mapping)) {
841 this.mapping[typeName] = Object.create(null);
842 this.reverseMapping[typeName] = Object.create(null);
843 }
844 this.mapping[typeName][externalValue] = newExternalValue;
845 this.reverseMapping[typeName][newExternalValue] = externalValue;
846 }
847 }
848 return transformedEnumValue;
849 };
850 return TransformEnumValues;
851}());
852function mapEnumValues(typeName, value, mapping) {
853 var _a;
854 var newExternalValue = (_a = mapping[typeName]) === null || _a === void 0 ? void 0 : _a[value];
855 return newExternalValue != null ? newExternalValue : value;
856}
857function generateValueTransformer(valueTransformer, mapping) {
858 if (valueTransformer == null) {
859 return function (typeName, value) { return mapEnumValues(typeName, value, mapping); };
860 }
861 else {
862 return function (typeName, value) { return mapEnumValues(typeName, valueTransformer(typeName, value), mapping); };
863 }
864}
865
866var TransformQuery = /** @class */ (function () {
867 function TransformQuery(_a) {
868 var path = _a.path, queryTransformer = _a.queryTransformer, _b = _a.resultTransformer, resultTransformer = _b === void 0 ? function (result) { return result; } : _b, _c = _a.errorPathTransformer, errorPathTransformer = _c === void 0 ? function (errorPath) { return [].concat(errorPath); } : _c, _d = _a.fragments, fragments = _d === void 0 ? {} : _d;
869 this.path = path;
870 this.queryTransformer = queryTransformer;
871 this.resultTransformer = resultTransformer;
872 this.errorPathTransformer = errorPathTransformer;
873 this.fragments = fragments;
874 }
875 TransformQuery.prototype.transformRequest = function (originalRequest) {
876 var _a;
877 var _this = this;
878 var pathLength = this.path.length;
879 var index = 0;
880 var document = visit(originalRequest.document, (_a = {},
881 _a[Kind.FIELD] = {
882 enter: function (node) {
883 if (index === pathLength || node.name.value !== _this.path[index]) {
884 return false;
885 }
886 index++;
887 if (index === pathLength) {
888 var selectionSet = _this.queryTransformer(node.selectionSet, _this.fragments);
889 return __assign(__assign({}, node), { selectionSet: selectionSet });
890 }
891 },
892 leave: function () {
893 index--;
894 },
895 },
896 _a));
897 return __assign(__assign({}, originalRequest), { document: document });
898 };
899 TransformQuery.prototype.transformResult = function (originalResult) {
900 var data = this.transformData(originalResult.data);
901 var errors = originalResult.errors;
902 return {
903 data: data,
904 errors: errors != null ? this.transformErrors(errors) : undefined,
905 };
906 };
907 TransformQuery.prototype.transformData = function (data) {
908 var leafIndex = this.path.length - 1;
909 var index = 0;
910 var newData = data;
911 if (newData) {
912 var next = this.path[index];
913 while (index < leafIndex) {
914 if (data[next]) {
915 newData = newData[next];
916 }
917 else {
918 break;
919 }
920 index++;
921 next = this.path[index];
922 }
923 newData[next] = this.resultTransformer(newData[next]);
924 }
925 return newData;
926 };
927 TransformQuery.prototype.transformErrors = function (errors) {
928 var _this = this;
929 return errors.map(function (error) {
930 var path = error.path;
931 var match = true;
932 var index = 0;
933 while (index < _this.path.length) {
934 if (path[index] !== _this.path[index]) {
935 match = false;
936 break;
937 }
938 index++;
939 }
940 var newPath = match ? path.slice(0, index).concat(_this.errorPathTransformer(path.slice(index))) : path;
941 return relocatedError(error, newPath);
942 });
943 };
944 return TransformQuery;
945}());
946
947var FilterObjectFieldDirectives = /** @class */ (function () {
948 function FilterObjectFieldDirectives(filter) {
949 this.filter = filter;
950 }
951 FilterObjectFieldDirectives.prototype.transformSchema = function (originalSchema) {
952 var _this = this;
953 var transformer = new TransformObjectFields(function (_typeName, _fieldName, fieldConfig) {
954 var keepDirectives = fieldConfig.astNode.directives.filter(function (dir) {
955 var directiveDef = originalSchema.getDirective(dir.name.value);
956 var directiveValue = directiveDef ? getArgumentValues(directiveDef, dir) : undefined;
957 return _this.filter(dir.name.value, directiveValue);
958 });
959 if (keepDirectives.length !== fieldConfig.astNode.directives.length) {
960 fieldConfig = __assign(__assign({}, fieldConfig), { astNode: __assign(__assign({}, fieldConfig.astNode), { directives: keepDirectives }) });
961 return fieldConfig;
962 }
963 });
964 return transformer.transformSchema(originalSchema);
965 };
966 return FilterObjectFieldDirectives;
967}());
968
969var RemoveObjectFieldDirectives = /** @class */ (function () {
970 function RemoveObjectFieldDirectives(directiveName, args) {
971 if (args === void 0) { args = {}; }
972 this.transformer = new FilterObjectFieldDirectives(function (dirName, dirValue) {
973 return !(valueMatchesCriteria(dirName, directiveName) && valueMatchesCriteria(dirValue, args));
974 });
975 }
976 RemoveObjectFieldDirectives.prototype.transformSchema = function (originalSchema) {
977 return this.transformer.transformSchema(originalSchema);
978 };
979 return RemoveObjectFieldDirectives;
980}());
981
982var RemoveObjectFieldsWithDirective = /** @class */ (function () {
983 function RemoveObjectFieldsWithDirective(directiveName, args) {
984 if (args === void 0) { args = {}; }
985 this.directiveName = directiveName;
986 this.args = args;
987 }
988 RemoveObjectFieldsWithDirective.prototype.transformSchema = function (originalSchema) {
989 var _this = this;
990 var transformer = new FilterObjectFields(function (_typeName, _fieldName, fieldConfig) {
991 var valueMap = getDirectives(originalSchema, fieldConfig);
992 return !Object.keys(valueMap).some(function (directiveName) {
993 return valueMatchesCriteria(directiveName, _this.directiveName) &&
994 ((Array.isArray(valueMap[directiveName]) &&
995 valueMap[directiveName].some(function (value) { return valueMatchesCriteria(value, _this.args); })) ||
996 valueMatchesCriteria(valueMap[directiveName], _this.args));
997 });
998 });
999 return transformer.transformSchema(originalSchema);
1000 };
1001 return RemoveObjectFieldsWithDirective;
1002}());
1003
1004var RemoveObjectFieldDeprecations = /** @class */ (function () {
1005 function RemoveObjectFieldDeprecations(reason) {
1006 var args = { reason: reason };
1007 this.removeDirectives = new FilterObjectFieldDirectives(function (dirName, dirValue) {
1008 return !(dirName === 'deprecated' && valueMatchesCriteria(dirValue, args));
1009 });
1010 this.removeDeprecations = new TransformObjectFields(function (_typeName, _fieldName, fieldConfig) {
1011 if (fieldConfig.deprecationReason && valueMatchesCriteria(fieldConfig.deprecationReason, reason)) {
1012 fieldConfig = __assign({}, fieldConfig);
1013 delete fieldConfig.deprecationReason;
1014 }
1015 return fieldConfig;
1016 });
1017 }
1018 RemoveObjectFieldDeprecations.prototype.transformSchema = function (originalSchema) {
1019 return this.removeDeprecations.transformSchema(this.removeDirectives.transformSchema(originalSchema));
1020 };
1021 return RemoveObjectFieldDeprecations;
1022}());
1023
1024var RemoveObjectFieldsWithDeprecation = /** @class */ (function () {
1025 function RemoveObjectFieldsWithDeprecation(reason) {
1026 this.transformer = new FilterObjectFields(function (_typeName, _fieldName, fieldConfig) {
1027 if (fieldConfig.deprecationReason) {
1028 return !valueMatchesCriteria(fieldConfig.deprecationReason, reason);
1029 }
1030 return true;
1031 });
1032 }
1033 RemoveObjectFieldsWithDeprecation.prototype.transformSchema = function (originalSchema) {
1034 return this.transformer.transformSchema(originalSchema);
1035 };
1036 return RemoveObjectFieldsWithDeprecation;
1037}());
1038
1039var MapFields = /** @class */ (function () {
1040 function MapFields(fieldNodeTransformerMap, objectValueTransformerMap, errorsTransformer) {
1041 this.transformer = new TransformCompositeFields(function () { return undefined; }, function (typeName, fieldName, fieldNode, fragments, transformationContext) {
1042 var typeTransformers = fieldNodeTransformerMap[typeName];
1043 if (typeTransformers == null) {
1044 return undefined;
1045 }
1046 var fieldNodeTransformer = typeTransformers[fieldName];
1047 if (fieldNodeTransformer == null) {
1048 return undefined;
1049 }
1050 return fieldNodeTransformer(fieldNode, fragments, transformationContext);
1051 }, objectValueTransformerMap != null
1052 ? function (data, transformationContext) {
1053 if (data == null) {
1054 return data;
1055 }
1056 var typeName = data.__typename;
1057 if (typeName == null) {
1058 return data;
1059 }
1060 var transformer = objectValueTransformerMap[typeName];
1061 if (transformer == null) {
1062 return data;
1063 }
1064 return transformer(data, transformationContext);
1065 }
1066 : undefined, errorsTransformer != null ? errorsTransformer : undefined);
1067 }
1068 MapFields.prototype.transformSchema = function (schema) {
1069 return this.transformer.transformSchema(schema);
1070 };
1071 MapFields.prototype.transformRequest = function (originalRequest, delegationContext, transformationContext) {
1072 return this.transformer.transformRequest(originalRequest, delegationContext, transformationContext);
1073 };
1074 MapFields.prototype.transformResult = function (originalResult, delegationContext, transformationContext) {
1075 return this.transformer.transformResult(originalResult, delegationContext, transformationContext);
1076 };
1077 return MapFields;
1078}());
1079
1080var ExtendSchema = /** @class */ (function () {
1081 function ExtendSchema(_a) {
1082 var typeDefs = _a.typeDefs, _b = _a.resolvers, resolvers = _b === void 0 ? {} : _b, defaultFieldResolver = _a.defaultFieldResolver, fieldNodeTransformerMap = _a.fieldNodeTransformerMap, objectValueTransformerMap = _a.objectValueTransformerMap, errorsTransformer = _a.errorsTransformer;
1083 this.typeDefs = typeDefs;
1084 this.resolvers = resolvers;
1085 this.defaultFieldResolver = defaultFieldResolver != null ? defaultFieldResolver : defaultMergedResolver;
1086 this.transformer = new MapFields(fieldNodeTransformerMap != null ? fieldNodeTransformerMap : {}, objectValueTransformerMap, errorsTransformer);
1087 }
1088 ExtendSchema.prototype.transformSchema = function (schema) {
1089 // MapFields's transformSchema function does not actually modify the schema --
1090 // it saves the current schema state, to be used later to transform requests.
1091 this.transformer.transformSchema(schema);
1092 return addResolversToSchema({
1093 schema: this.typeDefs ? extendSchema(schema, parse(this.typeDefs)) : schema,
1094 resolvers: this.resolvers != null ? this.resolvers : {},
1095 defaultFieldResolver: this.defaultFieldResolver,
1096 });
1097 };
1098 ExtendSchema.prototype.transformRequest = function (originalRequest, delegationContext, transformationContext) {
1099 return this.transformer.transformRequest(originalRequest, delegationContext, transformationContext);
1100 };
1101 ExtendSchema.prototype.transformResult = function (originalResult, delegationContext, transformationContext) {
1102 return this.transformer.transformResult(originalResult, delegationContext, transformationContext);
1103 };
1104 return ExtendSchema;
1105}());
1106
1107var PruneTypes = /** @class */ (function () {
1108 function PruneTypes(options) {
1109 this.options = options;
1110 }
1111 PruneTypes.prototype.transformSchema = function (schema) {
1112 return pruneSchema(schema, this.options);
1113 };
1114 return PruneTypes;
1115}());
1116
1117function defaultWrappingResolver(parent, args, context, info) {
1118 if (!parent) {
1119 return {};
1120 }
1121 return defaultMergedResolver(parent, args, context, info);
1122}
1123var WrapFields = /** @class */ (function () {
1124 function WrapFields(outerTypeName, wrappingFieldNames, wrappingTypeNames, fieldNames, wrappingResolver, prefix) {
1125 var _a, _b, _c;
1126 if (wrappingResolver === void 0) { wrappingResolver = defaultWrappingResolver; }
1127 if (prefix === void 0) { prefix = 'gqtld'; }
1128 this.outerTypeName = outerTypeName;
1129 this.wrappingFieldNames = wrappingFieldNames;
1130 this.wrappingTypeNames = wrappingTypeNames;
1131 this.numWraps = wrappingFieldNames.length;
1132 this.fieldNames = fieldNames;
1133 this.wrappingResolver = wrappingResolver;
1134 var remainingWrappingFieldNames = this.wrappingFieldNames.slice();
1135 var outerMostWrappingFieldName = remainingWrappingFieldNames.shift();
1136 this.transformer = new MapFields((_a = {},
1137 _a[outerTypeName] = (_b = {},
1138 _b[outerMostWrappingFieldName] = function (fieldNode, fragments, transformationContext) {
1139 return hoistFieldNodes({
1140 fieldNode: fieldNode,
1141 path: remainingWrappingFieldNames,
1142 fieldNames: fieldNames,
1143 fragments: fragments,
1144 transformationContext: transformationContext,
1145 prefix: prefix,
1146 });
1147 },
1148 _b),
1149 _a), (_c = {},
1150 _c[outerTypeName] = function (value, context) { return dehoistValue(value, context); },
1151 _c), function (errors, context) { return dehoistErrors(errors, context); });
1152 }
1153 WrapFields.prototype.transformSchema = function (schema) {
1154 var _a, _b, _c;
1155 var _this = this;
1156 var targetFieldConfigMap = selectObjectFields(schema, this.outerTypeName, !this.fieldNames ? function () { return true; } : function (fieldName) { return _this.fieldNames.includes(fieldName); });
1157 var wrapIndex = this.numWraps - 1;
1158 var wrappingTypeName = this.wrappingTypeNames[wrapIndex];
1159 var wrappingFieldName = this.wrappingFieldNames[wrapIndex];
1160 var newSchema = appendObjectFields(schema, wrappingTypeName, targetFieldConfigMap);
1161 for (wrapIndex--; wrapIndex > -1; wrapIndex--) {
1162 var nextWrappingTypeName = this.wrappingTypeNames[wrapIndex];
1163 newSchema = appendObjectFields(newSchema, nextWrappingTypeName, (_a = {},
1164 _a[wrappingFieldName] = {
1165 type: newSchema.getType(wrappingTypeName),
1166 resolve: this.wrappingResolver,
1167 },
1168 _a));
1169 wrappingTypeName = nextWrappingTypeName;
1170 wrappingFieldName = this.wrappingFieldNames[wrapIndex];
1171 }
1172 var selectedFieldNames = Object.keys(targetFieldConfigMap);
1173 _c = __read(modifyObjectFields(newSchema, this.outerTypeName, function (fieldName) { return selectedFieldNames.includes(fieldName); }, (_b = {},
1174 _b[wrappingFieldName] = {
1175 type: newSchema.getType(wrappingTypeName),
1176 resolve: this.wrappingResolver,
1177 },
1178 _b)), 1), newSchema = _c[0];
1179 return this.transformer.transformSchema(newSchema);
1180 };
1181 WrapFields.prototype.transformRequest = function (originalRequest, delegationContext, transformationContext) {
1182 transformationContext.nextIndex = 0;
1183 transformationContext.paths = Object.create(null);
1184 return this.transformer.transformRequest(originalRequest, delegationContext, transformationContext);
1185 };
1186 WrapFields.prototype.transformResult = function (originalResult, delegationContext, transformationContext) {
1187 return this.transformer.transformResult(originalResult, delegationContext, transformationContext);
1188 };
1189 return WrapFields;
1190}());
1191function collectFields(selectionSet, fragments, fields, visitedFragmentNames) {
1192 if (fields === void 0) { fields = []; }
1193 if (visitedFragmentNames === void 0) { visitedFragmentNames = {}; }
1194 if (selectionSet != null) {
1195 selectionSet.selections.forEach(function (selection) {
1196 switch (selection.kind) {
1197 case Kind.FIELD:
1198 fields.push(selection);
1199 break;
1200 case Kind.INLINE_FRAGMENT:
1201 collectFields(selection.selectionSet, fragments, fields, visitedFragmentNames);
1202 break;
1203 case Kind.FRAGMENT_SPREAD: {
1204 var fragmentName = selection.name.value;
1205 if (!visitedFragmentNames[fragmentName]) {
1206 visitedFragmentNames[fragmentName] = true;
1207 collectFields(fragments[fragmentName].selectionSet, fragments, fields, visitedFragmentNames);
1208 }
1209 break;
1210 }
1211 }
1212 });
1213 }
1214 return fields;
1215}
1216function aliasFieldNode(fieldNode, str) {
1217 return __assign(__assign({}, fieldNode), { alias: {
1218 kind: Kind.NAME,
1219 value: str,
1220 } });
1221}
1222function hoistFieldNodes(_a) {
1223 var fieldNode = _a.fieldNode, fieldNames = _a.fieldNames, path = _a.path, fragments = _a.fragments, transformationContext = _a.transformationContext, prefix = _a.prefix, _b = _a.index, index = _b === void 0 ? 0 : _b, _c = _a.wrappingPath, wrappingPath = _c === void 0 ? [] : _c;
1224 var alias = fieldNode.alias != null ? fieldNode.alias.value : fieldNode.name.value;
1225 var newFieldNodes = [];
1226 if (index < path.length) {
1227 var pathSegment_1 = path[index];
1228 collectFields(fieldNode.selectionSet, fragments).forEach(function (possibleFieldNode) {
1229 if (possibleFieldNode.name.value === pathSegment_1) {
1230 var newWrappingPath = wrappingPath.concat([alias]);
1231 newFieldNodes = newFieldNodes.concat(hoistFieldNodes({
1232 fieldNode: possibleFieldNode,
1233 fieldNames: fieldNames,
1234 path: path,
1235 fragments: fragments,
1236 transformationContext: transformationContext,
1237 prefix: prefix,
1238 index: index + 1,
1239 wrappingPath: newWrappingPath,
1240 }));
1241 }
1242 });
1243 }
1244 else {
1245 collectFields(fieldNode.selectionSet, fragments).forEach(function (possibleFieldNode) {
1246 if (!fieldNames || fieldNames.includes(possibleFieldNode.name.value)) {
1247 var nextIndex = transformationContext.nextIndex;
1248 transformationContext.nextIndex++;
1249 var indexingAlias = "__" + prefix + nextIndex + "__";
1250 transformationContext.paths[indexingAlias] = {
1251 pathToField: wrappingPath.concat([alias]),
1252 alias: possibleFieldNode.alias != null ? possibleFieldNode.alias.value : possibleFieldNode.name.value,
1253 };
1254 newFieldNodes.push(aliasFieldNode(possibleFieldNode, indexingAlias));
1255 }
1256 });
1257 }
1258 return newFieldNodes;
1259}
1260function dehoistValue(originalValue, context) {
1261 if (originalValue == null) {
1262 return originalValue;
1263 }
1264 var newValue = Object.create(null);
1265 Object.keys(originalValue).forEach(function (alias) {
1266 var obj = newValue;
1267 var path = context.paths[alias];
1268 if (path == null) {
1269 newValue[alias] = originalValue[alias];
1270 return;
1271 }
1272 var pathToField = path.pathToField;
1273 var fieldAlias = path.alias;
1274 pathToField.forEach(function (key) {
1275 obj = obj[key] = obj[key] || Object.create(null);
1276 });
1277 obj[fieldAlias] = originalValue[alias];
1278 });
1279 return newValue;
1280}
1281function dehoistErrors(errors, context) {
1282 if (errors === undefined) {
1283 return undefined;
1284 }
1285 return errors.map(function (error) {
1286 var originalPath = error.path;
1287 if (originalPath == null) {
1288 return error;
1289 }
1290 var newPath = [];
1291 originalPath.forEach(function (pathSegment) {
1292 if (typeof pathSegment !== 'string') {
1293 newPath.push(pathSegment);
1294 return;
1295 }
1296 var path = context.paths[pathSegment];
1297 if (path == null) {
1298 newPath.push(pathSegment);
1299 return;
1300 }
1301 newPath = newPath.concat(path.pathToField, [path.alias]);
1302 });
1303 return relocatedError(error, newPath);
1304 });
1305}
1306
1307var WrapType = /** @class */ (function () {
1308 function WrapType(outerTypeName, innerTypeName, fieldName) {
1309 this.transformer = new WrapFields(outerTypeName, [fieldName], [innerTypeName]);
1310 }
1311 WrapType.prototype.transformSchema = function (schema) {
1312 return this.transformer.transformSchema(schema);
1313 };
1314 WrapType.prototype.transformRequest = function (originalRequest, delegationContext, transformationContext) {
1315 return this.transformer.transformRequest(originalRequest, delegationContext, transformationContext);
1316 };
1317 WrapType.prototype.transformResult = function (originalResult, delegationContext, transformationContext) {
1318 return this.transformer.transformResult(originalResult, delegationContext, transformationContext);
1319 };
1320 return WrapType;
1321}());
1322
1323var HoistField = /** @class */ (function () {
1324 function HoistField(typeName, path, newFieldName, alias) {
1325 var _a, _b, _c;
1326 if (alias === void 0) { alias = '__gqtlw__'; }
1327 this.typeName = typeName;
1328 this.newFieldName = newFieldName;
1329 var pathToField = path.slice();
1330 var oldFieldName = pathToField.pop();
1331 this.oldFieldName = oldFieldName;
1332 this.pathToField = pathToField;
1333 this.transformer = new MapFields((_a = {},
1334 _a[typeName] = (_b = {},
1335 _b[newFieldName] = function (fieldNode) { return wrapFieldNode(renameFieldNode(fieldNode, oldFieldName), pathToField, alias); },
1336 _b),
1337 _a), (_c = {},
1338 _c[typeName] = function (value) { return unwrapValue(value, alias); },
1339 _c), function (errors) { return unwrapErrors(errors, alias); });
1340 }
1341 HoistField.prototype.transformSchema = function (schema) {
1342 var _a;
1343 var _this = this;
1344 var innerType = this.pathToField.reduce(function (acc, pathSegment) { return getNullableType(acc.getFields()[pathSegment].type); }, schema.getType(this.typeName));
1345 var _b = __read(removeObjectFields(schema, innerType.name, function (fieldName) { return fieldName === _this.oldFieldName; }), 2), newSchema = _b[0], targetFieldConfigMap = _b[1];
1346 var targetField = targetFieldConfigMap[this.oldFieldName];
1347 var targetType = targetField.type;
1348 newSchema = appendObjectFields(newSchema, this.typeName, (_a = {},
1349 _a[this.newFieldName] = {
1350 type: targetType,
1351 resolve: defaultMergedResolver,
1352 },
1353 _a));
1354 return this.transformer.transformSchema(newSchema);
1355 };
1356 HoistField.prototype.transformRequest = function (originalRequest, delegationContext, transformationContext) {
1357 return this.transformer.transformRequest(originalRequest, delegationContext, transformationContext);
1358 };
1359 HoistField.prototype.transformResult = function (originalResult, delegationContext, transformationContext) {
1360 return this.transformer.transformResult(originalResult, delegationContext, transformationContext);
1361 };
1362 return HoistField;
1363}());
1364function wrapFieldNode(fieldNode, path, alias) {
1365 var newFieldNode = fieldNode;
1366 path.forEach(function (fieldName) {
1367 newFieldNode = {
1368 kind: Kind.FIELD,
1369 alias: {
1370 kind: Kind.NAME,
1371 value: alias,
1372 },
1373 name: {
1374 kind: Kind.NAME,
1375 value: fieldName,
1376 },
1377 selectionSet: {
1378 kind: Kind.SELECTION_SET,
1379 selections: [fieldNode],
1380 },
1381 };
1382 });
1383 return newFieldNode;
1384}
1385function unwrapValue(originalValue, alias) {
1386 var newValue = originalValue;
1387 var object = newValue[alias];
1388 while (object != null) {
1389 newValue = object;
1390 object = newValue[alias];
1391 }
1392 delete originalValue[alias];
1393 Object.assign(originalValue, newValue);
1394 return originalValue;
1395}
1396function unwrapErrors(errors, alias) {
1397 if (errors === undefined) {
1398 return undefined;
1399 }
1400 return errors.map(function (error) {
1401 var originalPath = error.path;
1402 if (originalPath == null) {
1403 return error;
1404 }
1405 var newPath = originalPath.filter(function (pathSegment) { return pathSegment !== alias; });
1406 return relocatedError(error, newPath);
1407 });
1408}
1409
1410var WrapQuery = /** @class */ (function () {
1411 function WrapQuery(path, wrapper, extractor) {
1412 this.path = path;
1413 this.wrapper = wrapper;
1414 this.extractor = extractor;
1415 }
1416 WrapQuery.prototype.transformRequest = function (originalRequest) {
1417 var _a;
1418 var _this = this;
1419 var fieldPath = [];
1420 var ourPath = JSON.stringify(this.path);
1421 var document = visit(originalRequest.document, (_a = {},
1422 _a[Kind.FIELD] = {
1423 enter: function (node) {
1424 fieldPath.push(node.name.value);
1425 if (ourPath === JSON.stringify(fieldPath)) {
1426 var wrapResult = _this.wrapper(node.selectionSet);
1427 // Selection can be either a single selection or a selection set. If it's just one selection,
1428 // let's wrap it in a selection set. Otherwise, keep it as is.
1429 var selectionSet = wrapResult != null && wrapResult.kind === Kind.SELECTION_SET
1430 ? wrapResult
1431 : {
1432 kind: Kind.SELECTION_SET,
1433 selections: [wrapResult],
1434 };
1435 return __assign(__assign({}, node), { selectionSet: selectionSet });
1436 }
1437 },
1438 leave: function () {
1439 fieldPath.pop();
1440 },
1441 },
1442 _a));
1443 return __assign(__assign({}, originalRequest), { document: document });
1444 };
1445 WrapQuery.prototype.transformResult = function (originalResult) {
1446 var rootData = originalResult.data;
1447 if (rootData != null) {
1448 var data = rootData;
1449 var path = __spread(this.path);
1450 while (path.length > 1) {
1451 var next = path.shift();
1452 if (data[next]) {
1453 data = data[next];
1454 }
1455 }
1456 data[path[0]] = this.extractor(data[path[0]]);
1457 }
1458 return {
1459 data: rootData,
1460 errors: originalResult.errors,
1461 };
1462 };
1463 return WrapQuery;
1464}());
1465
1466var ExtractField = /** @class */ (function () {
1467 function ExtractField(_a) {
1468 var from = _a.from, to = _a.to;
1469 this.from = from;
1470 this.to = to;
1471 }
1472 ExtractField.prototype.transformRequest = function (originalRequest) {
1473 var _a, _b;
1474 var fromSelection;
1475 var ourPathFrom = JSON.stringify(this.from);
1476 var ourPathTo = JSON.stringify(this.to);
1477 var fieldPath = [];
1478 visit(originalRequest.document, (_a = {},
1479 _a[Kind.FIELD] = {
1480 enter: function (node) {
1481 fieldPath.push(node.name.value);
1482 if (ourPathFrom === JSON.stringify(fieldPath)) {
1483 fromSelection = node.selectionSet;
1484 return BREAK;
1485 }
1486 },
1487 leave: function () {
1488 fieldPath.pop();
1489 },
1490 },
1491 _a));
1492 fieldPath = [];
1493 var document = visit(originalRequest.document, (_b = {},
1494 _b[Kind.FIELD] = {
1495 enter: function (node) {
1496 fieldPath.push(node.name.value);
1497 if (ourPathTo === JSON.stringify(fieldPath) && fromSelection != null) {
1498 return __assign(__assign({}, node), { selectionSet: fromSelection });
1499 }
1500 },
1501 leave: function () {
1502 fieldPath.pop();
1503 },
1504 },
1505 _b));
1506 return __assign(__assign({}, originalRequest), { document: document });
1507 };
1508 return ExtractField;
1509}());
1510
1511function makeRemoteExecutableSchema(_a) {
1512 var schemaOrTypeDefs = _a.schema, executor = _a.executor, subscriber = _a.subscriber, _b = _a.createResolver, createResolver = _b === void 0 ? defaultCreateRemoteResolver : _b, buildSchemaOptions = _a.buildSchemaOptions;
1513 var targetSchema = typeof schemaOrTypeDefs === 'string' ? buildSchema(schemaOrTypeDefs, buildSchemaOptions) : schemaOrTypeDefs;
1514 return wrapSchema({
1515 schema: targetSchema,
1516 createProxyingResolver: function () { return createResolver(executor, subscriber); },
1517 });
1518}
1519function defaultCreateRemoteResolver(executor, subscriber) {
1520 return function (_parent, _args, context, info) {
1521 return delegateToSchema({
1522 schema: { schema: info.schema, executor: executor, subscriber: subscriber },
1523 context: context,
1524 info: info,
1525 });
1526 };
1527}
1528
1529var cleanInternalStack = function (stack) { return stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, ''); };
1530
1531/**
1532Escape RegExp special characters.
1533You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.
1534@example
1535```
1536import escapeStringRegexp = require('escape-string-regexp');
1537const escapedString = escapeStringRegexp('How much $ for a 🦄?');
1538//=> 'How much \\$ for a 🦄\\?'
1539new RegExp(escapedString);
1540```
1541*/
1542var escapeStringRegexp = function (string) {
1543 if (typeof string !== 'string') {
1544 throw new TypeError('Expected a string');
1545 }
1546 // Escape characters with special meaning either inside or outside character sets.
1547 // Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
1548 return string
1549 .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
1550 .replace(/-/g, '\\x2d');
1551};
1552
1553var extractPathRegex = /\s+at.*[(\s](.*)\)?/;
1554var pathRegex = /^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/;
1555/**
1556Clean up error stack traces. Removes the mostly unhelpful internal Node.js entries.
1557@param stack - The `stack` property of an `Error`.
1558@example
1559```
1560import cleanStack = require('clean-stack');
1561const error = new Error('Missing unicorn');
1562console.log(error.stack);
1563// Error: Missing unicorn
1564// at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
1565// at Module._compile (module.js:409:26)
1566// at Object.Module._extensions..js (module.js:416:10)
1567// at Module.load (module.js:343:32)
1568// at Function.Module._load (module.js:300:12)
1569// at Function.Module.runMain (module.js:441:10)
1570// at startup (node.js:139:18)
1571console.log(cleanStack(error.stack));
1572// Error: Missing unicorn
1573// at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
1574```
1575*/
1576var cleanStack = function (stack, basePath) {
1577 var basePathRegex = basePath && new RegExp("(at | \\()" + escapeStringRegexp(basePath), 'g');
1578 return stack.replace(/\\/g, '/')
1579 .split('\n')
1580 .filter(function (line) {
1581 var pathMatches = line.match(extractPathRegex);
1582 if (pathMatches === null || !pathMatches[1]) {
1583 return true;
1584 }
1585 var match = pathMatches[1];
1586 // Electron
1587 if (match.includes('.app/Contents/Resources/electron.asar') ||
1588 match.includes('.app/Contents/Resources/default_app.asar')) {
1589 return false;
1590 }
1591 return !pathRegex.test(match);
1592 })
1593 .filter(function (line) { return line.trim() !== ''; })
1594 .map(function (line) {
1595 if (basePathRegex) {
1596 line = line.replace(basePathRegex, '$1');
1597 }
1598 return line;
1599 })
1600 .join('\n');
1601};
1602
1603/**
1604Indent each line in a string.
1605@param string - The string to indent.
1606@param count - How many times you want `options.indent` repeated. Default: `1`.
1607@example
1608```
1609import indentString = require('indent-string');
1610indentString('Unicorns\nRainbows', 4);
1611//=> ' Unicorns\n Rainbows'
1612indentString('Unicorns\nRainbows', 4, {indent: '♥'});
1613//=> '♥♥♥♥Unicorns\n♥♥♥♥Rainbows'
1614```
1615*/
1616var indentString = function (string, count, options) {
1617 if (count === void 0) { count = 1; }
1618 options = Object.assign({
1619 indent: ' ',
1620 includeEmptyLines: false,
1621 }, options);
1622 if (typeof string !== 'string') {
1623 throw new TypeError("Expected `input` to be a `string`, got `" + typeof string + "`");
1624 }
1625 if (typeof count !== 'number') {
1626 throw new TypeError("Expected `count` to be a `number`, got `" + typeof count + "`");
1627 }
1628 if (count < 0) {
1629 throw new RangeError("Expected `count` to be at least 0, got `" + count + "`");
1630 }
1631 if (typeof options.indent !== 'string') {
1632 throw new TypeError("Expected `options.indent` to be a `string`, got `" + typeof options.indent + "`");
1633 }
1634 if (count === 0) {
1635 return string;
1636 }
1637 var regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
1638 return string.replace(regex, options.indent.repeat(count));
1639};
1640
1641var AggregateError = /** @class */ (function (_super) {
1642 __extends(AggregateError, _super);
1643 function AggregateError(errors) {
1644 var _this = this;
1645 if (!Array.isArray(errors)) {
1646 throw new TypeError("Expected input to be an Array, got " + typeof errors);
1647 }
1648 var normalizedErrors = errors.map(function (error) {
1649 if (error instanceof Error) {
1650 return error;
1651 }
1652 if (error !== null && typeof error === 'object') {
1653 // Handle plain error objects with message property and/or possibly other metadata
1654 return Object.assign(new Error(error.message), error);
1655 }
1656 return new Error(error);
1657 });
1658 var message = normalizedErrors
1659 .map(function (error) {
1660 // The `stack` property is not standardized, so we can't assume it exists
1661 return typeof error.stack === 'string' ? cleanInternalStack(cleanStack(error.stack)) : String(error);
1662 })
1663 .join('\n');
1664 message = '\n' + indentString(message, 4);
1665 _this = _super.call(this, message) || this;
1666 _this.name = 'AggregateError';
1667 Object.defineProperty(_this, Symbol.iterator, {
1668 get: function () { return function () { return normalizedErrors[Symbol.iterator](); }; },
1669 });
1670 return _this;
1671 }
1672 return AggregateError;
1673}(Error));
1674
1675function getSchemaFromIntrospection(introspectionResult) {
1676 var _a, _b;
1677 if ((_a = introspectionResult === null || introspectionResult === void 0 ? void 0 : introspectionResult.data) === null || _a === void 0 ? void 0 : _a.__schema) {
1678 return buildClientSchema(introspectionResult.data);
1679 }
1680 else if ((_b = introspectionResult === null || introspectionResult === void 0 ? void 0 : introspectionResult.errors) === null || _b === void 0 ? void 0 : _b.length) {
1681 if (introspectionResult.errors.length > 1) {
1682 var combinedError = new AggregateError(introspectionResult.errors);
1683 throw combinedError;
1684 }
1685 var error = introspectionResult.errors[0];
1686 throw error.originalError || error;
1687 }
1688 else {
1689 throw new Error('Could not obtain introspection result, received: ' + JSON.stringify(introspectionResult));
1690 }
1691}
1692function introspectSchema(executor, context, options) {
1693 return __awaiter(this, void 0, void 0, function () {
1694 var parsedIntrospectionQuery, introspectionResult;
1695 return __generator(this, function (_a) {
1696 switch (_a.label) {
1697 case 0:
1698 parsedIntrospectionQuery = parse(getIntrospectionQuery(options));
1699 return [4 /*yield*/, executor({
1700 document: parsedIntrospectionQuery,
1701 context: context,
1702 })];
1703 case 1:
1704 introspectionResult = _a.sent();
1705 return [2 /*return*/, getSchemaFromIntrospection(introspectionResult)];
1706 }
1707 });
1708 });
1709}
1710function introspectSchemaSync(executor, context, options) {
1711 var parsedIntrospectionQuery = parse(getIntrospectionQuery(options));
1712 var introspectionResult = executor({
1713 document: parsedIntrospectionQuery,
1714 context: context,
1715 });
1716 if ('then' in introspectionResult) {
1717 throw new Error("Executor cannot return promise value in introspectSchemaSync!");
1718 }
1719 return getSchemaFromIntrospection(introspectionResult);
1720}
1721
1722export { ExtendSchema, ExtractField, FilterInputObjectFields, FilterInterfaceFields, FilterObjectFieldDirectives, FilterObjectFields, FilterRootFields, FilterTypes, HoistField, MapFields, MapLeafValues, PruneTypes as PruneSchema, RemoveObjectFieldDeprecations, RemoveObjectFieldDirectives, RemoveObjectFieldsWithDeprecation, RemoveObjectFieldsWithDirective, RenameInputObjectFields, RenameInterfaceFields, RenameObjectFields, RenameRootFields, RenameRootTypes, RenameTypes, TransformCompositeFields, TransformEnumValues, TransformInputObjectFields, TransformInterfaceFields, TransformObjectFields, TransformQuery, TransformRootFields, WrapFields, WrapQuery, WrapType, defaultCreateProxyingResolver, defaultCreateRemoteResolver, generateProxyingResolvers, introspectSchema, introspectSchemaSync, makeRemoteExecutableSchema, wrapSchema };
1723//# sourceMappingURL=index.esm.js.map