@iwci/shopify-app-utils
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Shopify tools

This library adds a variety of utilities to simpliy usage of some shopify APIs.

Features

Admin GraphQL API client

Shopify tools can replace the @shopify/shopify-api default graphql client. The client is basically a port of the hydrogen's storefront client, but for the admin api. It offers more flexibility and add the possibility to use a cache, if available.

You can create a new client like this:

import { AdminApiClient } from '@iwci/shopify-tools';
import { LATEST_API_VERSION } from '@shopify/shopify-api';

const client = AdminApiClient({
  storeDomain: `https://exampleshop.myshopify.com`,
  adminApiSecret: "admin api access token",
  adminApiVersion: LATEST_API_VERSION,
  cache: typeof caches !== 'undefined' ? await caches.open(session.shop) : undefined,
});
}

Caching:

If you are running in an environment that supports cache (like Cloudflare Workers), are really want to cache (using some K/V storage), you can use a cache like this:

const cache = typeof caches !== 'undefined' ? await caches.open(session.shop) : undefined;

const client = AdminApiClient({
  // ...
  cache,
});
}

Using @shopify/shopify-api Session:

If you already have a session from @shopify/shopify-api you can easily create a client using the getClient() function.

const client = await getClient(session)

Bulk operations

Query batching

Webhook wrapper

Package Sidebar

Install

npm i @iwci/shopify-app-utils

Weekly Downloads

7

Version

1.0.2

License

MIT

Unpacked Size

172 kB

Total Files

23

Last publish

Collaborators

  • octanium