Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function replaceArgs(args: GraphQLFieldConfigArgumentMap) {
return mapValues(args, arg => ({
...arg,
type: replaceType(arg.type)
}));
}
}
function replaceInputFields(
fieldsMap: GraphQLInputFieldConfigMap
): GraphQLInputFieldConfigMap {
return mapValues(fieldsMap, field => ({
...field,
type: replaceType(field.type)
}));
}
.flat();
for (const { operation, type } of operationTypes) {
operationTypeMap[operation] = type.name.value;
}
} else {
operationTypeMap = {
query: "Query",
mutation: "Mutation",
subscription: "Subscription"
};
}
schema = new GraphQLSchema({
...schema.toConfig(),
...mapValues(operationTypeMap, typeName =>
typeName
? (schema.getType(typeName) as GraphQLObjectType)
: undefined
)
});
for (const module of modules) {
if (!module.resolvers) continue;
addResolversToSchema(schema, module.resolvers);
}
return schema;
}
function replaceFields(
fieldsMap: GraphQLFieldConfigMap
): GraphQLFieldConfigMap {
return mapValues(fieldsMap, field => ({
...field,
type: replaceType(field.type),
args: field.args ? replaceArgs(field.args) : undefined
}));
}
export function operationHash(operation: string): string {
return createHash("sha256")
.update(operation)
.digest("hex");
}
(accumulator, element, index, array) => {
const result = callbackfn(element, index, array);
if (isNotNullOrUndefined(result)) {
accumulator.push(result);
}
return accumulator;
},
[] as U[],