
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@shopify/graphql-js-client
Advanced tools
Feature light client library for fetching resources via GraphQL
Feature light client library for fetching resources via GraphQL
$ yarn install graphql-js-client
GraphQLClient
requires a "type bundle" which is a set of ES6 modules generated by graphql-js-schema
that represent your GraphQL schema.
import GraphQLClient from 'graphql-js-client';
// This is the generated type bundle from graphql-js-schema
import types from './types.js';
const client = new GraphQLClient(types, {
url: 'https://graphql.myshopify.com/api/graphql',
fetcherOptions: {
headers: `Authorization: Basic ${btoa('some-storefront-access-token')}`
}
});
const products = [];
client.send(client.query((root) => {
root.add('shop', (shop) => {
shop.add('name');
shop.addConnection('products', {args: {first: 10}}, (product) => {
product.add('title');
});
});
}).then(({model, data}) => {
console.log(model); // The serialized model with rich features
console.log(data); // The raw data returned from the endpoint
products.push(...model.products);
if (model.products.hasNextPage) {
return client.fetchNextPage(model.products);
};
// `fetchNextPage` resolves with the model you wanted the next page of
}).then(({model, data}) => {
products.push(...model); // Page two of products
});
$ git clone git@github.com:Shopify/graphql-js-client.git
$ cd graphql-js-client
$ yarn install
$ yarn start
Then visit http://localhost:4200
$ yarn test
MIT, see LICENSE.md for details.
FAQs
Feature light client library for fetching resources via GraphQL
We found that @shopify/graphql-js-client 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.