diff --git a/.changeset/brave-ligers-do.md b/.changeset/brave-ligers-do.md deleted file mode 100644 index 44bd136a08..0000000000 --- a/.changeset/brave-ligers-do.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -"@vue-storefront/middleware": minor ---- - -[ADDED] Provided easy access to methods added by middleware extensions via the `context.extendedApi` property. - -```ts -const extensionA = { - name: 'extensionA', - extendApiMethods: { - methodA: async () => { ... } - } -} - -const extensionB = { - name: 'extensionB', - extendApiMethods: { - methodB: async () => { ... } - } -} - -const extensionC = { - name: 'extensionC', - extendApiMethods: { - methodC: async (context) => { - context.extendedApi.methodA(); - context.extendedApi.extensionB.methodB(); - } - } -} -``` diff --git a/docs/content/3.middleware/3.api/middleware.api.json b/docs/content/3.middleware/3.api/middleware.api.json index 60ff692bc1..a9aa53256f 100644 --- a/docs/content/3.middleware/3.api/middleware.api.json +++ b/docs/content/3.middleware/3.api/middleware.api.json @@ -2940,6 +2940,14 @@ "kind": "Content", "text": "any" }, + { + "kind": "Content", + "text": ", EXTENDED_API = " + }, + { + "kind": "Content", + "text": "any" + }, { "kind": "Content", "text": "> " @@ -2980,6 +2988,17 @@ "startIndex": 5, "endIndex": 6 } + }, + { + "typeParameterName": "EXTENDED_API", + "constraintTokenRange": { + "startIndex": 0, + "endIndex": 0 + }, + "defaultTypeTokenRange": { + "startIndex": 7, + "endIndex": 8 + } } ], "name": "Context", @@ -3009,7 +3028,7 @@ }, { "kind": "Content", - "text": " | any" + "text": " | any" }, { "kind": "Content", @@ -4739,6 +4758,14 @@ "kind": "Content", "text": "any" }, + { + "kind": "Content", + "text": ", EXTENDED_API = " + }, + { + "kind": "Content", + "text": "any" + }, { "kind": "Content", "text": "> extends " @@ -4788,6 +4815,17 @@ "startIndex": 5, "endIndex": 6 } + }, + { + "typeParameterName": "EXTENDED_API", + "constraintTokenRange": { + "startIndex": 0, + "endIndex": 0 + }, + "defaultTypeTokenRange": { + "startIndex": 7, + "endIndex": 8 + } } ], "name": "IntegrationContext", @@ -4917,12 +4955,39 @@ "startIndex": 1, "endIndex": 2 } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@vue-storefront/middleware!IntegrationContext#extendedApi:member", + "docComment": "", + "excerptTokens": [ + { + "kind": "Content", + "text": "extendedApi: " + }, + { + "kind": "Content", + "text": "EXTENDED_API" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": false, + "releaseTag": "Public", + "name": "extendedApi", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } } ], "extendsTokenRanges": [ { - "startIndex": 7, - "endIndex": 8 + "startIndex": 9, + "endIndex": 10 } ] }, diff --git a/docs/content/3.middleware/4.reference/change-log.md b/docs/content/3.middleware/4.reference/change-log.md index 13ccd6a91a..73c9ee4f6a 100644 --- a/docs/content/3.middleware/4.reference/change-log.md +++ b/docs/content/3.middleware/4.reference/change-log.md @@ -1,5 +1,37 @@ # Change log +## 4.2.0 + +### Minor Changes + +- **[ADDED]** Provided easy access to methods added by middleware extensions via the `context.extendedApi` property. + +```ts +const extensionA = { + name: 'extensionA', + extendApiMethods: { + methodA: async () => { ... } + } +} + +const extensionB = { + name: 'extensionB', + extendApiMethods: { + methodB: async () => { ... } + } +} + +const extensionC = { + name: 'extensionC', + extendApiMethods: { + methodC: async (context) => { + context.extendedApi.methodA(); + context.extendedApi.extensionB.methodB(); + } + } +} +``` + ## 4.1.0 ### Minor Changes diff --git a/packages/middleware/CHANGELOG.md b/packages/middleware/CHANGELOG.md index 13ccd6a91a..73c9ee4f6a 100644 --- a/packages/middleware/CHANGELOG.md +++ b/packages/middleware/CHANGELOG.md @@ -1,5 +1,37 @@ # Change log +## 4.2.0 + +### Minor Changes + +- **[ADDED]** Provided easy access to methods added by middleware extensions via the `context.extendedApi` property. + +```ts +const extensionA = { + name: 'extensionA', + extendApiMethods: { + methodA: async () => { ... } + } +} + +const extensionB = { + name: 'extensionB', + extendApiMethods: { + methodB: async () => { ... } + } +} + +const extensionC = { + name: 'extensionC', + extendApiMethods: { + methodC: async (context) => { + context.extendedApi.methodA(); + context.extendedApi.extensionB.methodB(); + } + } +} +``` + ## 4.1.0 ### Minor Changes diff --git a/packages/middleware/package.json b/packages/middleware/package.json index 7872a6f252..2634c3fccc 100644 --- a/packages/middleware/package.json +++ b/packages/middleware/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/middleware", - "version": "4.1.0", + "version": "4.2.0", "main": "lib/index.cjs.js", "module": "lib/index.es.js", "types": "lib/index.d.ts",