Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/travis-r6s/shopify-bulk-export
A package to help you bulk export data from Shopify's API.
https://github.com/travis-r6s/shopify-bulk-export
Last synced: 16 days ago
JSON representation
A package to help you bulk export data from Shopify's API.
- Host: GitHub
- URL: https://github.com/travis-r6s/shopify-bulk-export
- Owner: travis-r6s
- License: mit
- Created: 2024-03-27T13:51:21.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-11-13T13:24:28.000Z (2 months ago)
- Last Synced: 2024-12-11T19:46:45.151Z (about 1 month ago)
- Language: TypeScript
- Size: 231 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# shopify-data-export
A package to help you bulk export data from Shopify's async [Bulk Operation API](https://shopify.dev/docs/api/usage/bulk-operations/queries).
> [!WARNING]
> Using this package usually results in a long-running task (using `await` to pause until the export has completed), so is not suitable for usage in servers or API's - it is best suited for custom Node.js scripts you may create and run locally, or in background jobs.### Usage
Install the package:
```sh
pnpm install shopify-bulk-export
```Then, import the package and use the default exported function to run a query:
```ts
import bulkExport from 'shopify-bulk-export'interface Product {
id: string
title: string
}// The function accepts a generic, which will be the type of the nodes returned:
const data = await bulkExport({
query: 'query Products { products { edges { node { id title } } } }',
store: {
accessToken: '',
name: ''
}
})
```You can also pass a `TypedDocumentNode` query if you use the GraphQL Code Generator for example:
```ts
import bulkExport from 'shopify-bulk-export'
import { ProductsQueryDoc } from './generated'const data = await bulkExport({
query: ProductsQueryDoc,
store: {
accessToken: '',
name: ''
}
})
```If your query has variables (for example a search query), you can pass these in and they will be replaced in your query:
```ts
import bulkExport from 'shopify-bulk-export'const searchQuery = ``
const data = await bulkExport({
query: 'query Products ($searchQuery: String!) { products (query: $searchQuery) { edges { node { id title } } } }',
store: {
accessToken: '',
name: ''
},
variables: {
searchQuery
}
})
```