diff --git a/.changeset/clever-shrimps-leave.md b/.changeset/clever-shrimps-leave.md deleted file mode 100644 index 102de692b..000000000 --- a/.changeset/clever-shrimps-leave.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -'@shopify/shopify-api': major ---- - -⚠️ [Breaking] Return pagination info as part of .all() requests in REST resources, and remove the `[PREV|NEXT]_PAGE_INFO` static, thread unsafe attributes. -Instead of returning a plain array of objects, it will now return an object containing that array, as well as the response headers and pagination info. - -This enables apps to use locally-scoped pagination info, which makes it possible to use pagination in a thread-safe way. - -You'll need to make 2 changes to use this version: - -1. Where you accessed resources from the response, you'll now access the `data` property. -1. Where you accessed pagination data from the static variables, you'll now retrieve it from the response. - -```ts -const response = await shopify.rest.Product.all({ - /* ... */ -}); - -// BEFORE -const products: Product[] = response; -const nextPageInfo = shopify.rest.Product.NEXT_PAGE_INFO; - -// AFTER -const products: Product[] = response.data; -const nextPageInfo = response.pageInfo?.nextPage; -const responseHeaders = response.headers; -``` diff --git a/.changeset/eleven-years-boil.md b/.changeset/eleven-years-boil.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/eleven-years-boil.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/empty-spies-love.md b/.changeset/empty-spies-love.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/empty-spies-love.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/fast-oranges-lick.md b/.changeset/fast-oranges-lick.md deleted file mode 100644 index d296e4afa..000000000 --- a/.changeset/fast-oranges-lick.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -'@shopify/shopify-api': major ---- - -⚠️ [Breaking] Removing deprecated code: - -- The `isPrivateApp` param from `shopifyApi()` was removed in favour of `isCustomStoreApp`. -- The `isOnline` param from `shopify.auth.callback()` was removed, because it's now handled automatically. diff --git a/.changeset/five-carrots-think.md b/.changeset/five-carrots-think.md deleted file mode 100644 index c48340096..000000000 --- a/.changeset/five-carrots-think.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/shopify-api': patch ---- - -Bump jose from 4.11.2 to 4.13.1. See jose [changelog](https://github.com/panva/jose/blob/main/CHANGELOG.md) for details. diff --git a/.changeset/gold-pears-hang.md b/.changeset/gold-pears-hang.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/gold-pears-hang.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/itchy-boxes-smash.md b/.changeset/itchy-boxes-smash.md deleted file mode 100644 index c67e31d0a..000000000 --- a/.changeset/itchy-boxes-smash.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@shopify/shopify-api': major ---- - -Adding support for 2023-04 API version. - -⚠️ [Breaking] Removing support for 2022-04 and 2022-07 API versions. diff --git a/.changeset/large-dancers-compete.md b/.changeset/large-dancers-compete.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/large-dancers-compete.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/late-bugs-yawn.md b/.changeset/late-bugs-yawn.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/late-bugs-yawn.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/nice-olives-worry.md b/.changeset/nice-olives-worry.md deleted file mode 100644 index 2ecaa5015..000000000 --- a/.changeset/nice-olives-worry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/shopify-api': patch ---- - -Bump @shopify/network from 1.5.1 to 3.2.1. See [network changelog](https://github.com/Shopify/quilt/blob/main/packages/network/CHANGELOG.md) for details. diff --git a/.changeset/popular-books-fly.md b/.changeset/popular-books-fly.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/popular-books-fly.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/quick-frogs-tan.md b/.changeset/quick-frogs-tan.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/quick-frogs-tan.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/quick-wombats-run.md b/.changeset/quick-wombats-run.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/quick-wombats-run.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/rude-squids-confess.md b/.changeset/rude-squids-confess.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/rude-squids-confess.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/selfish-boats-bake.md b/.changeset/selfish-boats-bake.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/selfish-boats-bake.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/shiny-poets-raise.md b/.changeset/shiny-poets-raise.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/shiny-poets-raise.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/six-crabs-give.md b/.changeset/six-crabs-give.md deleted file mode 100644 index d44ca8278..000000000 --- a/.changeset/six-crabs-give.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -'@shopify/shopify-api': major ---- - -The logger is now synchronous. This removes unnecessary `await`'s from functions that use the logger but functionally don't need to `await` anything else. `webhooks.addHandlers` is the main impacted public method (it was `async` only because of the logging mechanism). - -Apps that use the default logging methods (which send to `console`) will not be impacted by this change. Apps that implement their own loggers _may_ be impacted; async logging functions can still be used but they need to be handled as promises. - -```ts -// BEFORE -const myLogFunction = async (severity, message) => { - try { - await MyService.log(severity, message); - // After external call - } catch { - // Handle error - } -}; - -// AFTER -const myLogFunction = (severity, message) => { - MyService.log(severity, message) - .then(() => { - // After external call - }) - .catch(() => { - // Handle error - }); -}; -``` - diff --git a/.changeset/stupid-roses-behave.md b/.changeset/stupid-roses-behave.md deleted file mode 100644 index 6bdb0a690..000000000 --- a/.changeset/stupid-roses-behave.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/shopify-api': patch ---- - -Add response headers to `GraphqlQueryError`. Fixes #553 diff --git a/.changeset/tame-llamas-learn.md b/.changeset/tame-llamas-learn.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/tame-llamas-learn.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/unlucky-glasses-fetch.md b/.changeset/unlucky-glasses-fetch.md deleted file mode 100644 index 3faf130bf..000000000 --- a/.changeset/unlucky-glasses-fetch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/shopify-api': patch ---- - -validateHmac will now check for a `hmac` or a `signature` query argument. Fixes #776 diff --git a/.changeset/violet-bottles-greet.md b/.changeset/violet-bottles-greet.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/violet-bottles-greet.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/violet-owls-unite.md b/.changeset/violet-owls-unite.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/violet-owls-unite.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/young-spiders-repair.md b/.changeset/young-spiders-repair.md deleted file mode 100644 index a845151cc..000000000 --- a/.changeset/young-spiders-repair.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/CHANGELOG.md b/CHANGELOG.md index 47d68a311..27ce9bdb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,76 @@ # Changelog -All notable changes to this project will be documented in this file. +## 7.0.0 -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +### Major Changes -## Unreleased +- 5a68e4a5: ⚠️ [Breaking] Return pagination info as part of .all() requests in REST resources, and remove the `[PREV|NEXT]_PAGE_INFO` static, thread unsafe attributes. + Instead of returning a plain array of objects, it will now return an object containing that array, as well as the response headers and pagination info. + + This enables apps to use locally-scoped pagination info, which makes it possible to use pagination in a thread-safe way. + + You'll need to make 2 changes to use this version: + + 1. Where you accessed resources from the response, you'll now access the `data` property. + 1. Where you accessed pagination data from the static variables, you'll now retrieve it from the response. + + ```ts + const response = await shopify.rest.Product.all({ + /* ... */ + }); + + // BEFORE + const products: Product[] = response; + const nextPageInfo = shopify.rest.Product.NEXT_PAGE_INFO; + + // AFTER + const products: Product[] = response.data; + const nextPageInfo = response.pageInfo?.nextPage; + const responseHeaders = response.headers; + ``` + +- fc2692f0: ⚠️ [Breaking] Removing deprecated code: + + - The `isPrivateApp` param from `shopifyApi()` was removed in favour of `isCustomStoreApp`. + - The `isOnline` param from `shopify.auth.callback()` was removed, because it's now handled automatically. + +- 8acc71da: Adding support for 2023-04 API version. + + ⚠️ [Breaking] Removing support for 2022-04 and 2022-07 API versions. + +- 2096f9e4: The logger is now synchronous. This removes unnecessary `await`'s from functions that use the logger but functionally don't need to `await` anything else. `webhooks.addHandlers` is the main impacted public method (it was `async` only because of the logging mechanism). + + Apps that use the default logging methods (which send to `console`) will not be impacted by this change. Apps that implement their own loggers _may_ be impacted; async logging functions can still be used but they need to be handled as promises. + + ```ts + // BEFORE + const myLogFunction = async (severity, message) => { + try { + await MyService.log(severity, message); + // After external call + } catch { + // Handle error + } + }; + + // AFTER + const myLogFunction = (severity, message) => { + MyService.log(severity, message) + .then(() => { + // After external call + }) + .catch(() => { + // Handle error + }); + }; + ``` + +### Patch Changes + +- f06912d3: Bump jose from 4.11.2 to 4.13.1. See jose [changelog](https://github.com/panva/jose/blob/main/CHANGELOG.md) for details. +- 89847cac: Bump @shopify/network from 1.5.1 to 3.2.1. See [network changelog](https://github.com/Shopify/quilt/blob/main/packages/network/CHANGELOG.md) for details. +- 896ef0d8: Add response headers to `GraphqlQueryError`. Fixes #553 +- 97449f9e: validateHmac will now check for a `hmac` or a `signature` query argument. Fixes #776 ## [6.2.0] - 2023-02-15 diff --git a/lib/version.ts b/lib/version.ts index 78f68a0bf..a9c50d92f 100644 --- a/lib/version.ts +++ b/lib/version.ts @@ -1 +1 @@ -export const SHOPIFY_API_LIBRARY_VERSION = '6.2.0'; +export const SHOPIFY_API_LIBRARY_VERSION = '7.0.0'; diff --git a/package.json b/package.json index 4336763f8..428c02e3e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@shopify/shopify-api", - "version": "6.2.0", + "version": "7.0.0", "description": "Shopify API Library for Node - accelerate development with support for authentication, graphql proxy, webhooks", "main": "./lib/index.js", "types": "./lib/index.d.ts",