Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
graphql-transformer
Advanced tools
Readme
A tool to transform GraphQL schemas via simple functions
npm install --save graphql-transformer
Basic usage:
const transformedSchema = transformSchema(originalSchema, {
transformField(field: GraphQLNamedFieldConfig<any, any>, context) {
// Rename a field in a type
if (context.oldOuterType.name == 'MyType') {
return {
...field,
name: field.name + 'ButCooler'
}
}
return field;
},
transformObjectType(type: GraphQLObjectTypeConfig<any, any>) {
if (type.name == 'MyType') {
return {
...type,
name: 'MyCoolType'
};
}
return type;
},
transformFields(fields: GraphQLFieldConfigMap<any, any>, context) {
// You can even copy types on the fly and transform the copies
const type2 = context.copyType(context.oldOuterType, {
transformObjectType(typeConfig: GraphQLObjectTypeConfig<any, any>) {
return {
...typeConfig,
name: typeConfig.name + '2'
};
}
});
// This just adds a reflexive field "self" to all types, but its type does not have
// the "self" field (because it is a copy from the original type, see above)
// it also won't have the "cool" rename applied because the top-level transformers are not applied
return {
...fields,
self: {
type: type2,
resolve: (source: any) => source
}
}
}
});
This test case demonstrates that and how it works.
After cloning the repository, run
npm install
npm start
To run the test suite, run
npm test
To debug the tests in WebStorm, right-click on graphql-transformer-test.js
and choose Debug.
FAQs
transform GraphQL schemas with simple mapping functions
The npm package graphql-transformer receives a total of 6 weekly downloads. As such, graphql-transformer popularity was classified as not popular.
We found that graphql-transformer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.