From 268558696713b3ffbfff743688c64c1b4334f8a4 Mon Sep 17 00:00:00 2001 From: Thomas Schoffelen Date: Sat, 21 Oct 2023 14:02:27 +0100 Subject: [PATCH 1/5] feat: increase default body parser size --- packages/shopify-app-express/src/webhooks/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shopify-app-express/src/webhooks/index.ts b/packages/shopify-app-express/src/webhooks/index.ts index d26d572672..5e73ae2f8b 100644 --- a/packages/shopify-app-express/src/webhooks/index.ts +++ b/packages/shopify-app-express/src/webhooks/index.ts @@ -21,7 +21,7 @@ export function processWebhooks({ mountWebhooks(api, config, webhookHandlers); return [ - express.text({type: '*/*'}), + express.text({type: '*/*', limit: '500kb'}), async (req: Request, res: Response) => { await process({ req, From ee3c85263f3e0ea9e16ceafed0747b5aa3e08cb1 Mon Sep 17 00:00:00 2001 From: Thomas Schoffelen Date: Mon, 15 Jan 2024 09:17:58 +0000 Subject: [PATCH 2/5] chore: add changeset --- .changeset/flat-clouds-camp.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/flat-clouds-camp.md diff --git a/.changeset/flat-clouds-camp.md b/.changeset/flat-clouds-camp.md new file mode 100644 index 0000000000..3dbeca084b --- /dev/null +++ b/.changeset/flat-clouds-camp.md @@ -0,0 +1,5 @@ +--- +'@shopify/shopify-app-express': patch +--- + +increase max body size to 500kb From 308ce3296b4d70fe9f1bb3bdfb2f1d2914ee2bea Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 23 Feb 2024 19:02:45 +0000 Subject: [PATCH 3/5] Version Packages --- .changeset/mighty-bikes-sneeze.md | 6 - .changeset/shy-glasses-pump.md | 7 -- packages/shopify-app-express/CHANGELOG.md | 18 ++- packages/shopify-app-express/package.json | 2 +- packages/shopify-app-remix/CHANGELOG.md | 105 ++++++++++-------- packages/shopify-app-remix/package.json | 2 +- .../CHANGELOG.md | 6 + .../package.json | 2 +- 8 files changed, 77 insertions(+), 71 deletions(-) delete mode 100644 .changeset/mighty-bikes-sneeze.md delete mode 100644 .changeset/shy-glasses-pump.md diff --git a/.changeset/mighty-bikes-sneeze.md b/.changeset/mighty-bikes-sneeze.md deleted file mode 100644 index 605960b282..0000000000 --- a/.changeset/mighty-bikes-sneeze.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@shopify/shopify-app-remix": patch ---- - -Update AppConfig type to Readonly. The config should not be modified after it is created. - diff --git a/.changeset/shy-glasses-pump.md b/.changeset/shy-glasses-pump.md deleted file mode 100644 index fc0ad8d405..0000000000 --- a/.changeset/shy-glasses-pump.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@shopify/shopify-app-session-storage-kv": patch -"@shopify/shopify-app-express": patch -"@shopify/shopify-app-remix": patch ---- - -Updated dependency on `semver` diff --git a/packages/shopify-app-express/CHANGELOG.md b/packages/shopify-app-express/CHANGELOG.md index 512eee61d2..cee9ec0492 100644 --- a/packages/shopify-app-express/CHANGELOG.md +++ b/packages/shopify-app-express/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 4.1.2 + +### Patch Changes + +- 6deb1bd: Updated dependency on `semver` + ## 4.1.1 ### Patch Changes @@ -101,9 +107,9 @@ If you need to explicitly set those generics, you'll need to use the `AppConfigP Before: ```ts -import {ShopifyApp} from '@shopify/shopify-app-express'; -import {restResources} from '@shopify/shopify-api/rest/admin/2023-10'; -import {MemorySessionStorage} from '@shopify/shopify-app-session-storage-memory'; +import { ShopifyApp } from "@shopify/shopify-app-express"; +import { restResources } from "@shopify/shopify-api/rest/admin/2023-10"; +import { MemorySessionStorage } from "@shopify/shopify-app-session-storage-memory"; const myVariable: ShopifyApp; ``` @@ -111,9 +117,9 @@ const myVariable: ShopifyApp; After: ```ts -import {ShopifyApp, AppConfigParams} from '@shopify/shopify-app-express'; -import {restResources} from '@shopify/shopify-api/rest/admin/2023-10'; -import {MemorySessionStorage} from '@shopify/shopify-app-session-storage-memory'; +import { ShopifyApp, AppConfigParams } from "@shopify/shopify-app-express"; +import { restResources } from "@shopify/shopify-api/rest/admin/2023-10"; +import { MemorySessionStorage } from "@shopify/shopify-app-session-storage-memory"; const myVariable: ShopifyApp< AppConfigParams diff --git a/packages/shopify-app-express/package.json b/packages/shopify-app-express/package.json index 2418f75847..6e4e83a055 100644 --- a/packages/shopify-app-express/package.json +++ b/packages/shopify-app-express/package.json @@ -1,6 +1,6 @@ { "name": "@shopify/shopify-app-express", - "version": "4.1.1", + "version": "4.1.2", "description": "Shopify Express Middleware - to simplify the building of Shopify Apps with Express", "repository": { "type": "git", diff --git a/packages/shopify-app-remix/CHANGELOG.md b/packages/shopify-app-remix/CHANGELOG.md index 612749457f..357d0a91bf 100644 --- a/packages/shopify-app-remix/CHANGELOG.md +++ b/packages/shopify-app-remix/CHANGELOG.md @@ -1,5 +1,12 @@ # @shopify/shopify-app-remix +## 2.6.1 + +### Patch Changes + +- c95cfdf: Update AppConfig type to Readonly. The config should not be modified after it is created. +- 6deb1bd: Updated dependency on `semver` + ## 2.6.0 ### Minor Changes @@ -199,11 +206,11 @@ When using variables, `data` needs to be an object containing `query` and `variables`. ```ts - import {json, ActionFunctionArgs} from '@remix-run/node'; - import {authenticate} from '../shopify.server'; + import { json, ActionFunctionArgs } from "@remix-run/node"; + import { authenticate } from "../shopify.server"; - export async function action({request}: ActionFunctionArgs) { - const {admin} = await authenticate.webhook(request); + export async function action({ request }: ActionFunctionArgs) { + const { admin } = await authenticate.webhook(request); const response = await admin?.graphql.query({ data: { @@ -215,23 +222,23 @@ } } }`, - variables: {input: {title: 'Product Name'}}, + variables: { input: { title: "Product Name" } }, }, }); const productData = response?.body.data; - return json({data: productData.data}); + return json({ data: productData.data }); } ``` With the `v3_webhookContext` flag enabled, `graphql` _is_ a function that takes in the query string and an optional settings object, including `variables`. ```ts - import {ActionFunctionArgs} from '@remix-run/node'; - import {authenticate} from '../shopify.server'; + import { ActionFunctionArgs } from "@remix-run/node"; + import { authenticate } from "../shopify.server"; - export async function action({request}: ActionFunctionArgs) { - const {admin} = await authenticate.webhook(request); + export async function action({ request }: ActionFunctionArgs) { + const { admin } = await authenticate.webhook(request); const response = await admin?.graphql( `#graphql @@ -242,11 +249,11 @@ } } }`, - {variables: {input: {title: 'Product Name'}}}, + { variables: { input: { title: "Product Name" } } }, ); const productData = await response.json(); - return json({data: productData.data}); + return json({ data: productData.data }); } ``` @@ -272,12 +279,12 @@ App Proxy ```ts - import {json} from '@remix-run/node'; - import {authenticate} from '~/shopify.server'; + import { json } from "@remix-run/node"; + import { authenticate } from "~/shopify.server"; - export async function loader({request}) { - const {storefront} = await authenticate.public.appProxy(request); - const response = await storefront.graphql('{blogs(first: 10) {nodes{id}}}'); + export async function loader({ request }) { + const { storefront } = await authenticate.public.appProxy(request); + const response = await storefront.graphql("{blogs(first: 10) {nodes{id}}}"); return json(await response.json()); } @@ -289,17 +296,17 @@ Unauthenticated Storefront ```ts - import {json} from '@remix-run/node'; - import {unauthenticated} from '~/shopify.server'; - import {customAuthenticateRequest} from '~/helpers'; + import { json } from "@remix-run/node"; + import { unauthenticated } from "~/shopify.server"; + import { customAuthenticateRequest } from "~/helpers"; - export async function loader({request}) { + export async function loader({ request }) { await customAuthenticateRequest(request); - const {storefront} = await unauthenticated.storefront( - 'my-shop.myshopify.com', + const { storefront } = await unauthenticated.storefront( + "my-shop.myshopify.com", ); - const response = await storefront.graphql('{blogs(first: 10) {nodes{id}}}'); + const response = await storefront.graphql("{blogs(first: 10) {nodes{id}}}"); return json(await response.json()); } @@ -315,17 +322,17 @@ Override billing configs when calling request ```ts - import {json} from '@remix-run/node'; - import {authenticate} from '~/shopify.server'; + import { json } from "@remix-run/node"; + import { authenticate } from "~/shopify.server"; - export async function loader({request}) { - const {billing} = await authenticate.admin(request); + export async function loader({ request }) { + const { billing } = await authenticate.admin(request); await billing.require({ - plans: ['plan1', 'plan2'], + plans: ["plan1", "plan2"], onFailure: async () => await billing.request({ - plan: 'plan1', + plan: "plan1", trialDays: 5, // Override the trialDays config value }), }); @@ -357,12 +364,12 @@ ```ts // app/routes/**\/.ts - import {authenticate} from '~/shopify.server'; + import { authenticate } from "~/shopify.server"; - export async function loader({request}) { - const {liquid, admin} = authenticate.public.appProxy(request); + export async function loader({ request }) { + const { liquid, admin } = authenticate.public.appProxy(request); - return liquid('Hello {{shop.name}}'); + return liquid("Hello {{shop.name}}"); } ``` @@ -373,12 +380,12 @@ ```ts // app/routes/**\/.ts - import {authenticate} from '~/shopify.server'; + import { authenticate } from "~/shopify.server"; - export async function loader({request}) { - const {liquid, admin} = authenticate.public.appProxy(request); + export async function loader({ request }) { + const { liquid, admin } = authenticate.public.appProxy(request); - const response = await admin.graphql('QUERY'); + const response = await admin.graphql("QUERY"); const json = await response.json(); return json(json); @@ -415,8 +422,8 @@ ```ts // app/shopify.server.ts - import {shopifyApp} from '@shopify/shopify-app-remix'; - import {restResources} from '@shopify/shopify-api/rest/admin/2023-04'; + import { shopifyApp } from "@shopify/shopify-app-remix"; + import { restResources } from "@shopify/shopify-api/rest/admin/2023-04"; const shopify = shopifyApp({ restResources, @@ -426,15 +433,15 @@ export default shopify; // app/routes/\/.jsx - import {json} from '@remix-run/node'; - import {authenticateExternalRequest} from '~/helpers/authenticate'; - import shopify from '../../shopify.server'; + import { json } from "@remix-run/node"; + import { authenticateExternalRequest } from "~/helpers/authenticate"; + import shopify from "../../shopify.server"; - export async function loader({request}) { + export async function loader({ request }) { const shop = await authenticateExternalRequest(request); - const {admin, session} = await shopify.unauthenticated.admin(shop); + const { admin, session } = await shopify.unauthenticated.admin(shop); - return json(await admin.rest.resources.Product.count({session})); + return json(await admin.rest.resources.Product.count({ session })); } ``` @@ -448,10 +455,10 @@ See an example ```ts - export const loader = async ({request}) => { - const {redirect} = await authenticate.admin(request); + export const loader = async ({ request }) => { + const { redirect } = await authenticate.admin(request); - return redirect('https://www.example.com', {target: '_top'}); + return redirect("https://www.example.com", { target: "_top" }); }; ``` diff --git a/packages/shopify-app-remix/package.json b/packages/shopify-app-remix/package.json index ee6351c2cc..bc9b6babf9 100644 --- a/packages/shopify-app-remix/package.json +++ b/packages/shopify-app-remix/package.json @@ -1,6 +1,6 @@ { "name": "@shopify/shopify-app-remix", - "version": "2.6.0", + "version": "2.6.1", "description": "Shopify Remix - to simplify the building of Shopify Apps with Remix", "repository": { "type": "git", diff --git a/packages/shopify-app-session-storage-kv/CHANGELOG.md b/packages/shopify-app-session-storage-kv/CHANGELOG.md index 198470fc8b..a22f3add4e 100644 --- a/packages/shopify-app-session-storage-kv/CHANGELOG.md +++ b/packages/shopify-app-session-storage-kv/CHANGELOG.md @@ -1,5 +1,11 @@ # @shopify/shopify-app-session-storage-kv +## 3.0.2 + +### Patch Changes + +- 6deb1bd: Updated dependency on `semver` + ## 3.0.1 ### Patch Changes diff --git a/packages/shopify-app-session-storage-kv/package.json b/packages/shopify-app-session-storage-kv/package.json index 2f20857c11..4d8efabf58 100644 --- a/packages/shopify-app-session-storage-kv/package.json +++ b/packages/shopify-app-session-storage-kv/package.json @@ -1,6 +1,6 @@ { "name": "@shopify/shopify-app-session-storage-kv", - "version": "3.0.1", + "version": "3.0.2", "description": "Shopify App Session Storage for KV", "repository": { "type": "git", From 23b034a283e2e87c16f3e03cc78dbaa2b44f8b07 Mon Sep 17 00:00:00 2001 From: Elizabeth Kenyon Date: Fri, 23 Feb 2024 13:47:03 -0600 Subject: [PATCH 4/5] preparing for release --- packages/shopify-app-express/src/version.ts | 2 +- packages/shopify-app-remix/src/server/version.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/shopify-app-express/src/version.ts b/packages/shopify-app-express/src/version.ts index ac3d7a7d23..1460319c53 100644 --- a/packages/shopify-app-express/src/version.ts +++ b/packages/shopify-app-express/src/version.ts @@ -1 +1 @@ -export const SHOPIFY_EXPRESS_LIBRARY_VERSION = '4.1.1'; +export const SHOPIFY_EXPRESS_LIBRARY_VERSION = '4.1.2'; diff --git a/packages/shopify-app-remix/src/server/version.ts b/packages/shopify-app-remix/src/server/version.ts index f1907e6e06..2ce8e3f9ca 100644 --- a/packages/shopify-app-remix/src/server/version.ts +++ b/packages/shopify-app-remix/src/server/version.ts @@ -1 +1 @@ -export const SHOPIFY_REMIX_LIBRARY_VERSION = '2.6.0'; +export const SHOPIFY_REMIX_LIBRARY_VERSION = '2.6.1'; From 9525b3121f36a841633c882cc1aa8506139fb20b Mon Sep 17 00:00:00 2001 From: Elizabeth Kenyon Date: Fri, 23 Feb 2024 13:51:26 -0600 Subject: [PATCH 5/5] lint --- packages/shopify-app-express/CHANGELOG.md | 12 +-- packages/shopify-app-remix/CHANGELOG.md | 98 +++++++++++------------ 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/packages/shopify-app-express/CHANGELOG.md b/packages/shopify-app-express/CHANGELOG.md index cee9ec0492..63097f5b60 100644 --- a/packages/shopify-app-express/CHANGELOG.md +++ b/packages/shopify-app-express/CHANGELOG.md @@ -107,9 +107,9 @@ If you need to explicitly set those generics, you'll need to use the `AppConfigP Before: ```ts -import { ShopifyApp } from "@shopify/shopify-app-express"; -import { restResources } from "@shopify/shopify-api/rest/admin/2023-10"; -import { MemorySessionStorage } from "@shopify/shopify-app-session-storage-memory"; +import {ShopifyApp} from '@shopify/shopify-app-express'; +import {restResources} from '@shopify/shopify-api/rest/admin/2023-10'; +import {MemorySessionStorage} from '@shopify/shopify-app-session-storage-memory'; const myVariable: ShopifyApp; ``` @@ -117,9 +117,9 @@ const myVariable: ShopifyApp; After: ```ts -import { ShopifyApp, AppConfigParams } from "@shopify/shopify-app-express"; -import { restResources } from "@shopify/shopify-api/rest/admin/2023-10"; -import { MemorySessionStorage } from "@shopify/shopify-app-session-storage-memory"; +import {ShopifyApp, AppConfigParams} from '@shopify/shopify-app-express'; +import {restResources} from '@shopify/shopify-api/rest/admin/2023-10'; +import {MemorySessionStorage} from '@shopify/shopify-app-session-storage-memory'; const myVariable: ShopifyApp< AppConfigParams diff --git a/packages/shopify-app-remix/CHANGELOG.md b/packages/shopify-app-remix/CHANGELOG.md index 357d0a91bf..991a947da6 100644 --- a/packages/shopify-app-remix/CHANGELOG.md +++ b/packages/shopify-app-remix/CHANGELOG.md @@ -206,11 +206,11 @@ When using variables, `data` needs to be an object containing `query` and `variables`. ```ts - import { json, ActionFunctionArgs } from "@remix-run/node"; - import { authenticate } from "../shopify.server"; + import {json, ActionFunctionArgs} from '@remix-run/node'; + import {authenticate} from '../shopify.server'; - export async function action({ request }: ActionFunctionArgs) { - const { admin } = await authenticate.webhook(request); + export async function action({request}: ActionFunctionArgs) { + const {admin} = await authenticate.webhook(request); const response = await admin?.graphql.query({ data: { @@ -222,23 +222,23 @@ } } }`, - variables: { input: { title: "Product Name" } }, + variables: {input: {title: 'Product Name'}}, }, }); const productData = response?.body.data; - return json({ data: productData.data }); + return json({data: productData.data}); } ``` With the `v3_webhookContext` flag enabled, `graphql` _is_ a function that takes in the query string and an optional settings object, including `variables`. ```ts - import { ActionFunctionArgs } from "@remix-run/node"; - import { authenticate } from "../shopify.server"; + import {ActionFunctionArgs} from '@remix-run/node'; + import {authenticate} from '../shopify.server'; - export async function action({ request }: ActionFunctionArgs) { - const { admin } = await authenticate.webhook(request); + export async function action({request}: ActionFunctionArgs) { + const {admin} = await authenticate.webhook(request); const response = await admin?.graphql( `#graphql @@ -249,11 +249,11 @@ } } }`, - { variables: { input: { title: "Product Name" } } }, + {variables: {input: {title: 'Product Name'}}}, ); const productData = await response.json(); - return json({ data: productData.data }); + return json({data: productData.data}); } ``` @@ -279,12 +279,12 @@ App Proxy ```ts - import { json } from "@remix-run/node"; - import { authenticate } from "~/shopify.server"; + import {json} from '@remix-run/node'; + import {authenticate} from '~/shopify.server'; - export async function loader({ request }) { - const { storefront } = await authenticate.public.appProxy(request); - const response = await storefront.graphql("{blogs(first: 10) {nodes{id}}}"); + export async function loader({request}) { + const {storefront} = await authenticate.public.appProxy(request); + const response = await storefront.graphql('{blogs(first: 10) {nodes{id}}}'); return json(await response.json()); } @@ -296,17 +296,17 @@ Unauthenticated Storefront ```ts - import { json } from "@remix-run/node"; - import { unauthenticated } from "~/shopify.server"; - import { customAuthenticateRequest } from "~/helpers"; + import {json} from '@remix-run/node'; + import {unauthenticated} from '~/shopify.server'; + import {customAuthenticateRequest} from '~/helpers'; - export async function loader({ request }) { + export async function loader({request}) { await customAuthenticateRequest(request); - const { storefront } = await unauthenticated.storefront( - "my-shop.myshopify.com", + const {storefront} = await unauthenticated.storefront( + 'my-shop.myshopify.com', ); - const response = await storefront.graphql("{blogs(first: 10) {nodes{id}}}"); + const response = await storefront.graphql('{blogs(first: 10) {nodes{id}}}'); return json(await response.json()); } @@ -322,17 +322,17 @@ Override billing configs when calling request ```ts - import { json } from "@remix-run/node"; - import { authenticate } from "~/shopify.server"; + import {json} from '@remix-run/node'; + import {authenticate} from '~/shopify.server'; - export async function loader({ request }) { - const { billing } = await authenticate.admin(request); + export async function loader({request}) { + const {billing} = await authenticate.admin(request); await billing.require({ - plans: ["plan1", "plan2"], + plans: ['plan1', 'plan2'], onFailure: async () => await billing.request({ - plan: "plan1", + plan: 'plan1', trialDays: 5, // Override the trialDays config value }), }); @@ -364,12 +364,12 @@ ```ts // app/routes/**\/.ts - import { authenticate } from "~/shopify.server"; + import {authenticate} from '~/shopify.server'; - export async function loader({ request }) { - const { liquid, admin } = authenticate.public.appProxy(request); + export async function loader({request}) { + const {liquid, admin} = authenticate.public.appProxy(request); - return liquid("Hello {{shop.name}}"); + return liquid('Hello {{shop.name}}'); } ``` @@ -380,12 +380,12 @@ ```ts // app/routes/**\/.ts - import { authenticate } from "~/shopify.server"; + import {authenticate} from '~/shopify.server'; - export async function loader({ request }) { - const { liquid, admin } = authenticate.public.appProxy(request); + export async function loader({request}) { + const {liquid, admin} = authenticate.public.appProxy(request); - const response = await admin.graphql("QUERY"); + const response = await admin.graphql('QUERY'); const json = await response.json(); return json(json); @@ -422,8 +422,8 @@ ```ts // app/shopify.server.ts - import { shopifyApp } from "@shopify/shopify-app-remix"; - import { restResources } from "@shopify/shopify-api/rest/admin/2023-04"; + import {shopifyApp} from '@shopify/shopify-app-remix'; + import {restResources} from '@shopify/shopify-api/rest/admin/2023-04'; const shopify = shopifyApp({ restResources, @@ -433,15 +433,15 @@ export default shopify; // app/routes/\/.jsx - import { json } from "@remix-run/node"; - import { authenticateExternalRequest } from "~/helpers/authenticate"; - import shopify from "../../shopify.server"; + import {json} from '@remix-run/node'; + import {authenticateExternalRequest} from '~/helpers/authenticate'; + import shopify from '../../shopify.server'; - export async function loader({ request }) { + export async function loader({request}) { const shop = await authenticateExternalRequest(request); - const { admin, session } = await shopify.unauthenticated.admin(shop); + const {admin, session} = await shopify.unauthenticated.admin(shop); - return json(await admin.rest.resources.Product.count({ session })); + return json(await admin.rest.resources.Product.count({session})); } ``` @@ -455,10 +455,10 @@ See an example ```ts - export const loader = async ({ request }) => { - const { redirect } = await authenticate.admin(request); + export const loader = async ({request}) => { + const {redirect} = await authenticate.admin(request); - return redirect("https://www.example.com", { target: "_top" }); + return redirect('https://www.example.com', {target: '_top'}); }; ```