From d601eaeafe06f62d7dd71ec10fc770bbb9b21828 Mon Sep 17 00:00:00 2001 From: Bartosz Herba Date: Thu, 5 Dec 2024 10:20:44 +0100 Subject: [PATCH 1/2] chore: update changelog for a multistore - add more verbose information about latest patches changes --- .../content/3.middleware/4.reference/multistore/change-log.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/3.middleware/4.reference/multistore/change-log.md b/docs/content/3.middleware/4.reference/multistore/change-log.md index 3dfbfb5399..60fe9a2150 100644 --- a/docs/content/3.middleware/4.reference/multistore/change-log.md +++ b/docs/content/3.middleware/4.reference/multistore/change-log.md @@ -5,14 +5,14 @@ ### Patch Changes - Updated dependencies: - - @vue-storefront/middleware@5.1.0 + - @vue-storefront/middleware@5.1.0 - Please refer to the [middleware changelog](https://docs.alokai.com/middleware/reference/change-log#_510) for more details. ## 4.1.1 ### Patch Changes - Updated dependencies: - - @vue-storefront/middleware@5.0.0 + - @vue-storefront/middleware@5.0.0 - Please refer to the [middleware changelog](https://docs.alokai.com/middleware/reference/change-log#_500) for more details. ## 4.1.0 From 3092e3e86fc4accebe0cdaae46162d628ac32f3b Mon Sep 17 00:00:00 2001 From: Bartosz Herba Date: Thu, 5 Dec 2024 11:33:38 +0100 Subject: [PATCH 2/2] chore: update missing changelog description --- docs/content/3.middleware/2.guides/4.federation.md | 6 +++--- docs/content/3.middleware/4.reference/change-log.md | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/content/3.middleware/2.guides/4.federation.md b/docs/content/3.middleware/2.guides/4.federation.md index 141580c34d..04d06b7912 100644 --- a/docs/content/3.middleware/2.guides/4.federation.md +++ b/docs/content/3.middleware/2.guides/4.federation.md @@ -17,7 +17,7 @@ If you want to retrieve a loaded integration within the context of another, you Usage: ```javascript -const sapcc = context.getApiClient("sapcc"); +const sapcc = await context.getApiClient("sapcc"); ``` The `getApiClient` method takes a single argument, which is the key of the api client you wish to retrieve. This is the key you would define in the `middleware.config.js` file for the integration you wish to retrieve. The key is essentially an identifier for the integration. @@ -38,7 +38,7 @@ export const integrations = { extendApiMethods: { getPDP: async (context, params: { id: string }) => { const sapccApi = context.api; // You can access integration methods directly - const contentful = context.getApiClient("contentful"); // You can access other integrations using getApiClient + const contentful = await context.getApiClient("contentful"); // You can access other integrations using getApiClient const [product, content] = Promise.all( sapccApi.getProduct({ id: params.id }), @@ -99,7 +99,7 @@ export const integrations = { extendApiMethods: { enrichedSearch: async (context, params: { productId: string }) => { const sapccApi = context.api; - const legacyCustomSystem = context.getApiClient("legacyCustomSystem"); + const legacyCustomSystem = await context.getApiClient("legacyCustomSystem"); const [prouctStock, product] = await Promise.all([ legacyCustomSystem.api.getProductStock({ diff --git a/docs/content/3.middleware/4.reference/change-log.md b/docs/content/3.middleware/4.reference/change-log.md index 553170782f..e3cb572acf 100644 --- a/docs/content/3.middleware/4.reference/change-log.md +++ b/docs/content/3.middleware/4.reference/change-log.md @@ -170,6 +170,12 @@ const { createApiClient } = apiClientFactory({ export { createApiClient }; ``` +- **[CHANGED]** - Middleware `getApiClient` is now an asynchronous function. Please, read the [data federation](https://docs.alokai.com/middleware/guides/federation#using-getapiclient-method-to-access-different-api-client) guide to get more information. + +:::warning +This change may introduce breaking changes in some projects. Please ensure to update your project accordingly if necessary. +::: + ## 4.0.1 ### Patch Changes