
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@shopify/graphql-js-schema
Advanced tools
Transforms the JSON representation of a GraphQL schema into a set of ES6 type modules.
Transforms the JSON representation of a GraphQL schema into a set of ES6 type modules.
$ npm install @shopify/graphql-js-schema
To transform a GraphQL schema file (as json) into a set of ES6 consumable modules, run the following command.
graphql-js-schema --schema-file ./schema.json --outdir schema --schema-bundle-name="Schema"
This will create a directory called schema, and a root module called Schema
in
the file schema/schema.js
. It wall also collect all the non-scalar types in
schema/types
, and export them. The top level bundle exists for convenience,
but you can consume these modules however you like.
Exports one function that transforms a schema object into a list of files and their associated bodies.
import graphqlJsSchema from 'graphql-js-schema';
graphqlJsSchema(schemaHash, "BundleName").then((files) => {
// Do stuff with hashes in the format:
// {
// path: 'types/product.js',
// body: '...'
// }
});
import Schema from 'schema/schema';
Schema.Product.name // => Product
Schema.Product.implementsNode // => true
// Types are separated into scalars, objects and connections.
// Scalars:
Schema.Product.scalars
Schema.Product.scalars.handle
Schema.Product.scalars.handle.type // => String
Schema.Product.scalars.handle.kind // => SCALAR
Schema.Product.scalars.handle.isList // => false
Schema.Product.scalars.handle.args // => []
// Objects
Schema.Product.objects.images
Schema.Product.objects.images.type // => Image
Schema.Product.objects.images.kind // => OBJECT
Schema.Product.objects.images.isList // => true
Schema.Product.objects.images.args // => ["first", "maxWidth", "maxHeight", "crop", "scale"]
// Connections
Schema.Product.connections.collections
Schema.Product.connections.collections.type // => CollectionConnection
Schema.Product.connections.collections.kind // => OBJECT
Schema.Product.connections.collections.isList // => false
Schema.Product.connections.collections.args // => ["first", "after", "reverse"]
MIT, see LICENSE.md for details.
FAQs
Transforms the JSON representation of a GraphQL schema into a set of ES6 type modules.
We found that @shopify/graphql-js-schema demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.