Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-tools/wrap

Package Overview
Dependencies
Maintainers
3
Versions
1331
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/wrap - npm Package Compare versions

Comparing version 5.0.1-alpha-2ac6e4a.0 to 5.0.1-alpha-3268f17.0

149

index.cjs.js

@@ -29,2 +29,3 @@ 'use strict';

}
const transformedSchema = utils.applySchemaTransforms(targetSchema, schemaTransforms);
const operationTypes = {

@@ -47,3 +48,3 @@ query: targetSchema.getQueryType(),

transforms,
transformedSchema: utils.applySchemaTransforms(targetSchema, schemaTransforms),
transformedSchema,
operation,

@@ -113,6 +114,6 @@ fieldName,

const config = type.toConfig();
const fields = type.getFields();
Object.keys(fields).forEach(fieldName => {
config.fields[fieldName] = {
...utils.fieldToFieldConfig(fields[fieldName]),
const fieldConfigMap = config.fields;
Object.keys(fieldConfigMap).forEach(fieldName => {
fieldConfigMap[fieldName] = {
...fieldConfigMap[fieldName],
...proxyingResolvers[type.name][fieldName],

@@ -385,31 +386,28 @@ };

transformFields(type, fieldTransformer) {
const fields = type.getFields();
const newFields = {};
Object.keys(fields).forEach(fieldName => {
const field = fields[fieldName];
const transformedField = fieldTransformer(type.name, fieldName, field);
if (typeof transformedField === 'undefined') {
newFields[fieldName] = utils.fieldToFieldConfig(fields[fieldName]);
const config = type.toConfig();
const originalFieldConfigMap = config.fields;
const newFieldConfigMap = {};
Object.keys(originalFieldConfigMap).forEach(fieldName => {
const originalfieldConfig = originalFieldConfigMap[fieldName];
const transformedField = fieldTransformer(type.name, fieldName, originalfieldConfig);
if (transformedField === undefined) {
newFieldConfigMap[fieldName] = originalfieldConfig;
}
else if (transformedField !== null) {
const newName = transformedField.name;
if (newName) {
newFields[newName] =
transformedField.field != null
? transformedField.field
: utils.fieldToFieldConfig(fields[fieldName]);
if (newName !== fieldName) {
const typeName = type.name;
if (!(typeName in this.mapping)) {
this.mapping[typeName] = {};
}
this.mapping[typeName][newName] = fieldName;
else if (Array.isArray(transformedField)) {
const newFieldName = transformedField[0];
const newFieldConfig = transformedField[1];
newFieldConfigMap[newFieldName] = newFieldConfig;
if (newFieldName !== fieldName) {
const typeName = type.name;
if (!(typeName in this.mapping)) {
this.mapping[typeName] = {};
}
this.mapping[typeName][newFieldName] = fieldName;
}
else {
newFields[fieldName] = transformedField;
}
}
else if (transformedField != null) {
newFieldConfigMap[fieldName] = transformedField;
}
});
if (newFields == null || Object.keys(newFields).length === 0) {
if (!Object.keys(newFieldConfigMap).length) {
return null;

@@ -420,3 +418,3 @@ }

...type.toConfig(),
fields: newFields,
fields: newFieldConfigMap,
});

@@ -427,3 +425,3 @@ }

...type.toConfig(),
fields: newFields,
fields: newFieldConfigMap,
});

@@ -498,5 +496,5 @@ }

transformSchema(originalSchema) {
const compositeToObjectFieldTransformer = (typeName, fieldName, field) => {
const compositeToObjectFieldTransformer = (typeName, fieldName, fieldConfig) => {
if (graphql.isObjectType(originalSchema.getType(typeName))) {
return this.objectFieldTransformer(typeName, fieldName, field);
return this.objectFieldTransformer(typeName, fieldName, fieldConfig);
}

@@ -515,5 +513,5 @@ return undefined;

constructor(rootFieldTransformer, fieldNodeTransformer) {
const rootToObjectFieldTransformer = (typeName, fieldName, field) => {
const rootToObjectFieldTransformer = (typeName, fieldName, fieldConfig) => {
if (typeName === 'Query' || typeName === 'Mutation' || typeName === 'Subscription') {
return rootFieldTransformer(typeName, fieldName, field);
return rootFieldTransformer(typeName, fieldName, fieldConfig);
}

@@ -534,5 +532,3 @@ return undefined;

constructor(renamer) {
this.transformer = new TransformRootFields((operation, fieldName, field) => ({
name: renamer(operation, fieldName, field),
}));
this.transformer = new TransformRootFields((operation, fieldName, fieldConfig) => [renamer(operation, fieldName, fieldConfig), fieldConfig]);
}

@@ -549,4 +545,4 @@ transformSchema(originalSchema) {

constructor(filter) {
this.transformer = new TransformRootFields((operation, fieldName, field) => {
if (filter(operation, fieldName, field)) {
this.transformer = new TransformRootFields((operation, fieldName, fieldConfig) => {
if (filter(operation, fieldName, fieldConfig)) {
return undefined;

@@ -564,5 +560,6 @@ }

constructor(renamer) {
this.transformer = new TransformObjectFields((typeName, fieldName, field) => ({
name: renamer(typeName, fieldName, field),
}));
this.transformer = new TransformObjectFields((typeName, fieldName, fieldConfig) => [
renamer(typeName, fieldName, fieldConfig),
fieldConfig,
]);
}

@@ -579,3 +576,3 @@ transformSchema(originalSchema) {

constructor(filter) {
this.transformer = new TransformObjectFields((typeName, fieldName, field) => filter(typeName, fieldName, field) ? undefined : null);
this.transformer = new TransformObjectFields((typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ? undefined : null);
}

@@ -593,5 +590,5 @@ transformSchema(originalSchema) {

transformSchema(originalSchema) {
const compositeToObjectFieldTransformer = (typeName, fieldName, field) => {
const compositeToObjectFieldTransformer = (typeName, fieldName, fieldConfig) => {
if (graphql.isInterfaceType(originalSchema.getType(typeName))) {
return this.interfaceFieldTransformer(typeName, fieldName, field);
return this.interfaceFieldTransformer(typeName, fieldName, fieldConfig);
}

@@ -610,5 +607,6 @@ return undefined;

constructor(renamer) {
this.transformer = new TransformInterfaceFields((typeName, fieldName, field) => ({
name: renamer(typeName, fieldName, field),
}));
this.transformer = new TransformInterfaceFields((typeName, fieldName, fieldConfig) => [
renamer(typeName, fieldName, fieldConfig),
fieldConfig,
]);
}

@@ -625,3 +623,3 @@ transformSchema(originalSchema) {

constructor(filter) {
this.transformer = new TransformInterfaceFields((typeName, fieldName, field) => filter(typeName, fieldName, field) ? undefined : null);
this.transformer = new TransformInterfaceFields((typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ? undefined : null);
}

@@ -718,15 +716,3 @@ transformSchema(originalSchema) {

constructor(fieldNodeTransformerMap) {
this.transformer = new TransformObjectFields((_typeName, _fieldName, field) => ({
description: field.deprecationReason,
type: field.type,
args: field.args.reduce((prev, curr) => ({
...prev,
[curr.name]: curr,
}), {}),
resolve: field.resolve,
subscribe: field.subscribe,
deprecationReason: field.deprecationReason,
extensions: field.extensions,
astNode: field.astNode,
}), (typeName, fieldName, fieldNode, fragments) => {
this.transformer = new TransformObjectFields((_typeName, _fieldName, fieldConfig) => fieldConfig, (typeName, fieldName, fieldNode, fragments) => {
const typeTransformers = fieldNodeTransformerMap[typeName];

@@ -792,23 +778,25 @@ if (typeTransformers == null) {

transformSchema(schema) {
const typeMap = schema.getTypeMap();
const targetFields = utils.removeFields(typeMap, this.outerTypeName, !this.fieldNames ? () => true : fieldName => this.fieldNames.includes(fieldName));
let [newSchema, targetFieldConfigMap] = utils.removeObjectFields(schema, this.outerTypeName, !this.fieldNames ? () => true : fieldName => this.fieldNames.includes(fieldName));
let wrapIndex = this.numWraps - 1;
const innerMostWrappingTypeName = this.wrappingTypeNames[wrapIndex];
utils.appendFields(typeMap, innerMostWrappingTypeName, targetFields);
let wrappingTypeName = this.wrappingTypeNames[wrapIndex];
let wrappingFieldName = this.wrappingFieldNames[wrapIndex];
newSchema = utils.appendObjectFields(newSchema, wrappingTypeName, targetFieldConfigMap);
for (wrapIndex--; wrapIndex > -1; wrapIndex--) {
utils.appendFields(typeMap, this.wrappingTypeNames[wrapIndex], {
[this.wrappingFieldNames[wrapIndex + 1]]: {
type: typeMap[this.wrappingTypeNames[wrapIndex + 1]],
const nextWrappingTypeName = this.wrappingTypeNames[wrapIndex];
newSchema = utils.appendObjectFields(newSchema, nextWrappingTypeName, {
[wrappingFieldName]: {
type: newSchema.getType(wrappingTypeName),
resolve: delegate.defaultMergedResolver,
},
});
wrappingTypeName = nextWrappingTypeName;
wrappingFieldName = this.wrappingFieldNames[wrapIndex];
}
utils.appendFields(typeMap, this.outerTypeName, {
[this.wrappingFieldNames[0]]: {
type: typeMap[this.wrappingTypeNames[0]],
newSchema = utils.appendObjectFields(newSchema, this.outerTypeName, {
[wrappingFieldName]: {
type: newSchema.getType(wrappingTypeName),
resolve: delegate.createMergedResolver({ dehoist: true }),
},
});
utils.healSchema(schema);
return this.transformer.transformSchema(schema);
return this.transformer.transformSchema(newSchema);
}

@@ -846,7 +834,7 @@ transformRequest(originalRequest) {

transformSchema(schema) {
const typeMap = schema.getTypeMap();
const innerType = this.pathToField.reduce((acc, pathSegment) => graphql.getNullableType(acc.getFields()[pathSegment].type), typeMap[this.typeName]);
const targetField = utils.removeFields(typeMap, innerType.name, fieldName => fieldName === this.oldFieldName)[this.oldFieldName];
const innerType = this.pathToField.reduce((acc, pathSegment) => graphql.getNullableType(acc.getFields()[pathSegment].type), schema.getType(this.typeName));
let [newSchema, targetFieldConfigMap] = utils.removeObjectFields(schema, innerType.name, fieldName => fieldName === this.oldFieldName);
const targetField = targetFieldConfigMap[this.oldFieldName];
const targetType = targetField.type;
utils.appendFields(typeMap, this.typeName, {
newSchema = utils.appendObjectFields(newSchema, this.typeName, {
[this.newFieldName]: {

@@ -857,4 +845,3 @@ type: targetType,

});
utils.healSchema(schema);
return this.transformer.transformSchema(schema);
return this.transformer.transformSchema(newSchema);
}

@@ -861,0 +848,0 @@ transformRequest(originalRequest) {

import { GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, isSpecifiedScalarType, isScalarType, isObjectType, isInterfaceType, isUnionType, isInputObjectType, GraphQLInputObjectType, isEnumType, GraphQLEnumType, GraphQLScalarType, visit, Kind, TypeInfo, visitWithTypeInfo, extendSchema, parse, getNullableType, BREAK, buildSchema, getIntrospectionQuery, buildClientSchema } from 'graphql';
import { applySchemaTransforms, getResponseKeyFromInfo, getErrors, mapSchema, MapperKind, fieldToFieldConfig, relocatedError, hoistFieldNodes, removeFields, appendFields, healSchema, wrapFieldNode, renameFieldNode, CombinedError } from '@graphql-tools/utils';
import { applySchemaTransforms, getResponseKeyFromInfo, getErrors, mapSchema, MapperKind, relocatedError, hoistFieldNodes, removeObjectFields, appendObjectFields, wrapFieldNode, renameFieldNode, CombinedError } from '@graphql-tools/utils';
import { delegateToSchema, isSubschemaConfig, getSubschema, handleResult, defaultMergedResolver, createMergedResolver } from '@graphql-tools/delegate';

@@ -25,2 +25,3 @@ import { addResolversToSchema } from '@graphql-tools/schema';

}
const transformedSchema = applySchemaTransforms(targetSchema, schemaTransforms);
const operationTypes = {

@@ -43,3 +44,3 @@ query: targetSchema.getQueryType(),

transforms,
transformedSchema: applySchemaTransforms(targetSchema, schemaTransforms),
transformedSchema,
operation,

@@ -109,6 +110,6 @@ fieldName,

const config = type.toConfig();
const fields = type.getFields();
Object.keys(fields).forEach(fieldName => {
config.fields[fieldName] = {
...fieldToFieldConfig(fields[fieldName]),
const fieldConfigMap = config.fields;
Object.keys(fieldConfigMap).forEach(fieldName => {
fieldConfigMap[fieldName] = {
...fieldConfigMap[fieldName],
...proxyingResolvers[type.name][fieldName],

@@ -381,31 +382,28 @@ };

transformFields(type, fieldTransformer) {
const fields = type.getFields();
const newFields = {};
Object.keys(fields).forEach(fieldName => {
const field = fields[fieldName];
const transformedField = fieldTransformer(type.name, fieldName, field);
if (typeof transformedField === 'undefined') {
newFields[fieldName] = fieldToFieldConfig(fields[fieldName]);
const config = type.toConfig();
const originalFieldConfigMap = config.fields;
const newFieldConfigMap = {};
Object.keys(originalFieldConfigMap).forEach(fieldName => {
const originalfieldConfig = originalFieldConfigMap[fieldName];
const transformedField = fieldTransformer(type.name, fieldName, originalfieldConfig);
if (transformedField === undefined) {
newFieldConfigMap[fieldName] = originalfieldConfig;
}
else if (transformedField !== null) {
const newName = transformedField.name;
if (newName) {
newFields[newName] =
transformedField.field != null
? transformedField.field
: fieldToFieldConfig(fields[fieldName]);
if (newName !== fieldName) {
const typeName = type.name;
if (!(typeName in this.mapping)) {
this.mapping[typeName] = {};
}
this.mapping[typeName][newName] = fieldName;
else if (Array.isArray(transformedField)) {
const newFieldName = transformedField[0];
const newFieldConfig = transformedField[1];
newFieldConfigMap[newFieldName] = newFieldConfig;
if (newFieldName !== fieldName) {
const typeName = type.name;
if (!(typeName in this.mapping)) {
this.mapping[typeName] = {};
}
this.mapping[typeName][newFieldName] = fieldName;
}
else {
newFields[fieldName] = transformedField;
}
}
else if (transformedField != null) {
newFieldConfigMap[fieldName] = transformedField;
}
});
if (newFields == null || Object.keys(newFields).length === 0) {
if (!Object.keys(newFieldConfigMap).length) {
return null;

@@ -416,3 +414,3 @@ }

...type.toConfig(),
fields: newFields,
fields: newFieldConfigMap,
});

@@ -423,3 +421,3 @@ }

...type.toConfig(),
fields: newFields,
fields: newFieldConfigMap,
});

@@ -494,5 +492,5 @@ }

transformSchema(originalSchema) {
const compositeToObjectFieldTransformer = (typeName, fieldName, field) => {
const compositeToObjectFieldTransformer = (typeName, fieldName, fieldConfig) => {
if (isObjectType(originalSchema.getType(typeName))) {
return this.objectFieldTransformer(typeName, fieldName, field);
return this.objectFieldTransformer(typeName, fieldName, fieldConfig);
}

@@ -511,5 +509,5 @@ return undefined;

constructor(rootFieldTransformer, fieldNodeTransformer) {
const rootToObjectFieldTransformer = (typeName, fieldName, field) => {
const rootToObjectFieldTransformer = (typeName, fieldName, fieldConfig) => {
if (typeName === 'Query' || typeName === 'Mutation' || typeName === 'Subscription') {
return rootFieldTransformer(typeName, fieldName, field);
return rootFieldTransformer(typeName, fieldName, fieldConfig);
}

@@ -530,5 +528,3 @@ return undefined;

constructor(renamer) {
this.transformer = new TransformRootFields((operation, fieldName, field) => ({
name: renamer(operation, fieldName, field),
}));
this.transformer = new TransformRootFields((operation, fieldName, fieldConfig) => [renamer(operation, fieldName, fieldConfig), fieldConfig]);
}

@@ -545,4 +541,4 @@ transformSchema(originalSchema) {

constructor(filter) {
this.transformer = new TransformRootFields((operation, fieldName, field) => {
if (filter(operation, fieldName, field)) {
this.transformer = new TransformRootFields((operation, fieldName, fieldConfig) => {
if (filter(operation, fieldName, fieldConfig)) {
return undefined;

@@ -560,5 +556,6 @@ }

constructor(renamer) {
this.transformer = new TransformObjectFields((typeName, fieldName, field) => ({
name: renamer(typeName, fieldName, field),
}));
this.transformer = new TransformObjectFields((typeName, fieldName, fieldConfig) => [
renamer(typeName, fieldName, fieldConfig),
fieldConfig,
]);
}

@@ -575,3 +572,3 @@ transformSchema(originalSchema) {

constructor(filter) {
this.transformer = new TransformObjectFields((typeName, fieldName, field) => filter(typeName, fieldName, field) ? undefined : null);
this.transformer = new TransformObjectFields((typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ? undefined : null);
}

@@ -589,5 +586,5 @@ transformSchema(originalSchema) {

transformSchema(originalSchema) {
const compositeToObjectFieldTransformer = (typeName, fieldName, field) => {
const compositeToObjectFieldTransformer = (typeName, fieldName, fieldConfig) => {
if (isInterfaceType(originalSchema.getType(typeName))) {
return this.interfaceFieldTransformer(typeName, fieldName, field);
return this.interfaceFieldTransformer(typeName, fieldName, fieldConfig);
}

@@ -606,5 +603,6 @@ return undefined;

constructor(renamer) {
this.transformer = new TransformInterfaceFields((typeName, fieldName, field) => ({
name: renamer(typeName, fieldName, field),
}));
this.transformer = new TransformInterfaceFields((typeName, fieldName, fieldConfig) => [
renamer(typeName, fieldName, fieldConfig),
fieldConfig,
]);
}

@@ -621,3 +619,3 @@ transformSchema(originalSchema) {

constructor(filter) {
this.transformer = new TransformInterfaceFields((typeName, fieldName, field) => filter(typeName, fieldName, field) ? undefined : null);
this.transformer = new TransformInterfaceFields((typeName, fieldName, fieldConfig) => filter(typeName, fieldName, fieldConfig) ? undefined : null);
}

@@ -714,15 +712,3 @@ transformSchema(originalSchema) {

constructor(fieldNodeTransformerMap) {
this.transformer = new TransformObjectFields((_typeName, _fieldName, field) => ({
description: field.deprecationReason,
type: field.type,
args: field.args.reduce((prev, curr) => ({
...prev,
[curr.name]: curr,
}), {}),
resolve: field.resolve,
subscribe: field.subscribe,
deprecationReason: field.deprecationReason,
extensions: field.extensions,
astNode: field.astNode,
}), (typeName, fieldName, fieldNode, fragments) => {
this.transformer = new TransformObjectFields((_typeName, _fieldName, fieldConfig) => fieldConfig, (typeName, fieldName, fieldNode, fragments) => {
const typeTransformers = fieldNodeTransformerMap[typeName];

@@ -788,23 +774,25 @@ if (typeTransformers == null) {

transformSchema(schema) {
const typeMap = schema.getTypeMap();
const targetFields = removeFields(typeMap, this.outerTypeName, !this.fieldNames ? () => true : fieldName => this.fieldNames.includes(fieldName));
let [newSchema, targetFieldConfigMap] = removeObjectFields(schema, this.outerTypeName, !this.fieldNames ? () => true : fieldName => this.fieldNames.includes(fieldName));
let wrapIndex = this.numWraps - 1;
const innerMostWrappingTypeName = this.wrappingTypeNames[wrapIndex];
appendFields(typeMap, innerMostWrappingTypeName, targetFields);
let wrappingTypeName = this.wrappingTypeNames[wrapIndex];
let wrappingFieldName = this.wrappingFieldNames[wrapIndex];
newSchema = appendObjectFields(newSchema, wrappingTypeName, targetFieldConfigMap);
for (wrapIndex--; wrapIndex > -1; wrapIndex--) {
appendFields(typeMap, this.wrappingTypeNames[wrapIndex], {
[this.wrappingFieldNames[wrapIndex + 1]]: {
type: typeMap[this.wrappingTypeNames[wrapIndex + 1]],
const nextWrappingTypeName = this.wrappingTypeNames[wrapIndex];
newSchema = appendObjectFields(newSchema, nextWrappingTypeName, {
[wrappingFieldName]: {
type: newSchema.getType(wrappingTypeName),
resolve: defaultMergedResolver,
},
});
wrappingTypeName = nextWrappingTypeName;
wrappingFieldName = this.wrappingFieldNames[wrapIndex];
}
appendFields(typeMap, this.outerTypeName, {
[this.wrappingFieldNames[0]]: {
type: typeMap[this.wrappingTypeNames[0]],
newSchema = appendObjectFields(newSchema, this.outerTypeName, {
[wrappingFieldName]: {
type: newSchema.getType(wrappingTypeName),
resolve: createMergedResolver({ dehoist: true }),
},
});
healSchema(schema);
return this.transformer.transformSchema(schema);
return this.transformer.transformSchema(newSchema);
}

@@ -842,7 +830,7 @@ transformRequest(originalRequest) {

transformSchema(schema) {
const typeMap = schema.getTypeMap();
const innerType = this.pathToField.reduce((acc, pathSegment) => getNullableType(acc.getFields()[pathSegment].type), typeMap[this.typeName]);
const targetField = removeFields(typeMap, innerType.name, fieldName => fieldName === this.oldFieldName)[this.oldFieldName];
const innerType = this.pathToField.reduce((acc, pathSegment) => getNullableType(acc.getFields()[pathSegment].type), schema.getType(this.typeName));
let [newSchema, targetFieldConfigMap] = removeObjectFields(schema, innerType.name, fieldName => fieldName === this.oldFieldName);
const targetField = targetFieldConfigMap[this.oldFieldName];
const targetType = targetField.type;
appendFields(typeMap, this.typeName, {
newSchema = appendObjectFields(newSchema, this.typeName, {
[this.newFieldName]: {

@@ -853,4 +841,3 @@ type: targetType,

});
healSchema(schema);
return this.transformer.transformSchema(schema);
return this.transformer.transformSchema(newSchema);
}

@@ -857,0 +844,0 @@ transformRequest(originalRequest) {

{
"name": "@graphql-tools/wrap",
"version": "5.0.1-alpha-2ac6e4a.0",
"version": "5.0.1-alpha-3268f17.0",
"description": "A set of utils for faster development of GraphQL tools",

@@ -9,5 +9,5 @@ "peerDependencies": {

"dependencies": {
"@graphql-tools/delegate": "5.0.1-alpha-2ac6e4a.0",
"@graphql-tools/schema": "5.0.1-alpha-2ac6e4a.0",
"@graphql-tools/utils": "5.0.1-alpha-2ac6e4a.0",
"@graphql-tools/delegate": "5.0.1-alpha-3268f17.0",
"@graphql-tools/schema": "5.0.1-alpha-3268f17.0",
"@graphql-tools/utils": "5.0.1-alpha-3268f17.0",
"tslib": "1.11.1"

@@ -14,0 +14,0 @@ },

@@ -1,8 +0,8 @@

import { GraphQLField, GraphQLSchema } from 'graphql';
import { GraphQLSchema, GraphQLFieldConfig } from 'graphql';
import { Transform, Request } from '@graphql-tools/utils';
export default class RenameInterfaceFields implements Transform {
private readonly transformer;
constructor(renamer: (typeName: string, fieldName: string, field: GraphQLField<any, any>) => string);
constructor(renamer: (typeName: string, fieldName: string, fieldConfig: GraphQLFieldConfig<any, any>) => string);
transformSchema(originalSchema: GraphQLSchema): GraphQLSchema;
transformRequest(originalRequest: Request): Request;
}

@@ -1,8 +0,8 @@

import { GraphQLField, GraphQLSchema } from 'graphql';
import { GraphQLSchema, GraphQLFieldConfig } from 'graphql';
import { Transform, Request } from '@graphql-tools/utils';
export default class RenameObjectFields implements Transform {
private readonly transformer;
constructor(renamer: (typeName: string, fieldName: string, field: GraphQLField<any, any>) => string);
constructor(renamer: (typeName: string, fieldName: string, fieldConfig: GraphQLFieldConfig<any, any>) => string);
transformSchema(originalSchema: GraphQLSchema): GraphQLSchema;
transformRequest(originalRequest: Request): Request;
}

@@ -1,8 +0,8 @@

import { GraphQLField, GraphQLSchema } from 'graphql';
import { GraphQLSchema, GraphQLFieldConfig } from 'graphql';
import { Transform, Request } from '@graphql-tools/utils';
export default class RenameRootFields implements Transform {
private readonly transformer;
constructor(renamer: (operation: 'Query' | 'Mutation' | 'Subscription', name: string, field: GraphQLField<any, any>) => string);
constructor(renamer: (operation: 'Query' | 'Mutation' | 'Subscription', name: string, fieldConfig: GraphQLFieldConfig<any, any>) => string);
transformSchema(originalSchema: GraphQLSchema): GraphQLSchema;
transformRequest(originalRequest: Request): Request;
}

@@ -1,2 +0,2 @@

import { GraphQLSchema, GraphQLFieldResolver, BuildSchemaOptions, GraphQLField, GraphQLFieldConfig, FieldNode, FragmentDefinitionNode, SelectionNode } from 'graphql';
import { GraphQLSchema, GraphQLFieldResolver, BuildSchemaOptions, GraphQLFieldConfig, FieldNode, FragmentDefinitionNode, SelectionNode } from 'graphql';
import { Executor, Subscriber } from '@graphql-tools/delegate';

@@ -10,8 +10,4 @@ export interface IMakeRemoteExecutableSchemaOptions {

}
export interface RenamedFieldConfig {
name: string;
field?: GraphQLFieldConfig<any, any>;
}
export declare type FieldTransformer = (typeName: string, fieldName: string, field: GraphQLField<any, any>) => GraphQLFieldConfig<any, any> | RenamedFieldConfig | null | undefined;
export declare type RootFieldTransformer = (operation: 'Query' | 'Mutation' | 'Subscription', fieldName: string, field: GraphQLField<any, any>) => GraphQLFieldConfig<any, any> | RenamedFieldConfig | null | undefined;
export declare type FieldTransformer = (typeName: string, fieldName: string, fieldConfig: GraphQLFieldConfig<any, any>) => GraphQLFieldConfig<any, any> | [string, GraphQLFieldConfig<any, any>] | null | undefined;
export declare type RootFieldTransformer = (operation: 'Query' | 'Mutation' | 'Subscription', fieldName: string, fieldConfig: GraphQLFieldConfig<any, any>) => GraphQLFieldConfig<any, any> | [string, GraphQLFieldConfig<any, any>] | null | undefined;
export declare type FieldNodeTransformer = (typeName: string, fieldName: string, fieldNode: FieldNode, fragments: Record<string, FragmentDefinitionNode>) => SelectionNode | Array<SelectionNode>;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc