From 5d624124cb1983adb511e633ac0629c977bdf602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Thu, 16 Jan 2025 14:29:44 +0100 Subject: [PATCH 1/6] feat: pass generic config type down to hooks --- packages/middleware/src/types/common.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/middleware/src/types/common.ts b/packages/middleware/src/types/common.ts index fb72c9b51b..51146db368 100644 --- a/packages/middleware/src/types/common.ts +++ b/packages/middleware/src/types/common.ts @@ -108,7 +108,7 @@ export interface ApiClientExtension { req: AlokaiRequest, res: AlokaiResponse, hooksContext: AlokaiContainer - ) => ApiClientExtensionHooks; + ) => ApiClientExtensionHooks; } export type ErrorHandler = ( @@ -129,7 +129,7 @@ export interface Integration< extensions: ApiClientExtension[] // TODO(IN-4338): There is a bug in the types here // we're not able to verify if the methods are namespaced or not with this implementation. - ) => ApiClientExtension[]; + ) => ApiClientExtension[]; customQueries?: Record; initConfig?: TObject; /** From 82421b5d90ff0382d5bfbbc3e6b5c9de70464540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Thu, 16 Jan 2025 14:30:00 +0100 Subject: [PATCH 2/6] feat: define return type of createMultistoreExtension helper --- packages/multistore/src/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/multistore/src/extension.ts b/packages/multistore/src/extension.ts index f75857f9dd..0a1cc8ed22 100644 --- a/packages/multistore/src/extension.ts +++ b/packages/multistore/src/extension.ts @@ -8,7 +8,7 @@ import { fetchConfigWithCache } from "./cache/fetchConfigWithCache"; export const createMultistoreExtension = ( multistoreConfig: MultistoreExtensionMethods -) => { +): ApiClientExtension => { const cacheManager = multistoreConfig.cacheManagerFactory(); return { From b3a8a2044c371077601994e5af439cf6f882ff6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Thu, 16 Jan 2025 14:47:34 +0100 Subject: [PATCH 3/6] chore: middleware changeset --- .changeset/strong-scissors-accept.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/strong-scissors-accept.md diff --git a/.changeset/strong-scissors-accept.md b/.changeset/strong-scissors-accept.md new file mode 100644 index 0000000000..d199bb57f8 --- /dev/null +++ b/.changeset/strong-scissors-accept.md @@ -0,0 +1,5 @@ +--- +"@vue-storefront/middleware": major +--- + +[CHANGED] Updated the type of the `hooks` property in the `ApiClientExtension` interface so that the hooks' `configuration` param is typed properly. From 8886bfe47284dfb3174701fb7fbfaa6e3eb89e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Thu, 16 Jan 2025 14:47:43 +0100 Subject: [PATCH 4/6] chore: multistore changeset --- .changeset/spotty-students-pump.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/spotty-students-pump.md diff --git a/.changeset/spotty-students-pump.md b/.changeset/spotty-students-pump.md new file mode 100644 index 0000000000..6b0c9074ae --- /dev/null +++ b/.changeset/spotty-students-pump.md @@ -0,0 +1,5 @@ +--- +"@vue-storefront/multistore": patch +--- + +[UPDATED] Set the return type of the createMultistoreExtension helper to `ApiClientExtension`. From c6fbba955d75f0f4e0d5c333d384c11f64303ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Thu, 16 Jan 2025 14:58:51 +0100 Subject: [PATCH 5/6] chore: remove satisfies from createMultistoreExtension --- packages/multistore/src/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/multistore/src/extension.ts b/packages/multistore/src/extension.ts index 0a1cc8ed22..c6ae34a1ff 100644 --- a/packages/multistore/src/extension.ts +++ b/packages/multistore/src/extension.ts @@ -37,5 +37,5 @@ export const createMultistoreExtension = ( }, }; }, - } satisfies ApiClientExtension; + }; }; From 3db4445c6f360a803ea52137a434010a49dcef0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Aliwa?= Date: Thu, 16 Jan 2025 15:16:25 +0100 Subject: [PATCH 6/6] chore: mention reason for breaking change --- .changeset/strong-scissors-accept.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/strong-scissors-accept.md b/.changeset/strong-scissors-accept.md index d199bb57f8..d462589539 100644 --- a/.changeset/strong-scissors-accept.md +++ b/.changeset/strong-scissors-accept.md @@ -2,4 +2,4 @@ "@vue-storefront/middleware": major --- -[CHANGED] Updated the type of the `hooks` property in the `ApiClientExtension` interface so that the hooks' `configuration` param is typed properly. +[CHANGED] Updated the type of the `hooks` property in the `ApiClientExtension` interface so that the hooks' `configuration` param is typed properly. This is a breaking change if you are using `@vue-storefront/middleware` version `4.1.2` or lower.