@acromedia/gesso-shopware-middleware
8.1.0
Minor Changes
-
0d108e1: GESSO-2429-feat: add Shopware 6 API-middleware plugin
New
@acromedia/gesso-shopware-middlewarepackage implementing theProvidercontract from@acromedia/gesso-api-middleware. It is the server-side companion to the browser-side@acromedia/gesso-shopwarecommerce plugin — anything that needs a secret or a privileged lookup lives here, not in the bundle that ships to the browser.- Routes
/api/middleware/shopware/{action}to Shopware's REST Store API (/store-api) and, for elevated operations, its Admin API (/api). Storefront, customer-scoped actions (address,customer,orders) authenticate with the sales-channelsw-access-keyplus the logged-in customer'ssw-context-token; admin-scoped actions (customers,payments) authenticate the integration itself via the Admin API OAuth2client_credentialsgrant. - Reads the customer's
sw-context-tokenfrom the next-auth session JWT (a forwardedsw-context-tokenrequest header is honoured as a fallback), echoes Shopware's rotated token back in answ-context-tokenresponse header so the client can persist it. - Talks to both APIs through the official
@shopware/api-clientSDK (pinned), wrapped in a thinStoreApiClient/AdminApiClientinsrc/rest.ts— mirroring how@acromedia/gesso-shopwarewraps the same SDK. The admin client memoizes one OAuth2 client per host + integration id so the bearer is cached and auto-refreshed across requests, staying within Shopware SaaS's token rate limit. - Ships as a dual ESM + CJS package built with
tsup; unit-tested with Vitest (Store API and Admin API mocked with MSW).
- Routes