diff --git a/.changeset/violet-fishes-eat.md b/.changeset/violet-fishes-eat.md deleted file mode 100644 index 7525c92011..0000000000 --- a/.changeset/violet-fishes-eat.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -"@vue-storefront/sdk": minor ---- - -[ADDED] a way to specify the default request configuration for each method. - -Example: Set the `getProducts` method to be a `GET` request by default and use custom headers. - -```typescript -import { initSDK, buildModule, middlewareModule } from "@vue-storefront/sdk"; -import { Endpoints } from "@vsf-enterprise/sapcc-api"; - -const sdk = initSDK({ - commerce: buildModule(middlewareModule, { - apiUrl: "http://localhost:8181/commerce", - methodsRequestConfig: { - getProduct: { - method: "GET", - headers: { - "X-Header-Name": "Header-Value", - }, - }, - }, - }), -}); -``` diff --git a/docs/content/4.sdk/4.api/sdk.api.json b/docs/content/4.sdk/4.api/sdk.api.json index b8ab38b75d..696d4b457f 100644 --- a/docs/content/4.sdk/4.api/sdk.api.json +++ b/docs/content/4.sdk/4.api/sdk.api.json @@ -2330,6 +2330,10 @@ "text": "Options", "canonicalReference": "@vue-storefront/sdk!Options:type" }, + { + "kind": "Content", + "text": "" + }, { "kind": "Content", "text": ") => " @@ -2359,8 +2363,8 @@ ], "fileUrlPath": "src/modules/middlewareModule/module.ts", "returnTypeTokenRange": { - "startIndex": 5, - "endIndex": 10 + "startIndex": 6, + "endIndex": 11 }, "releaseTag": "Public", "overloadIndex": 1, @@ -2369,7 +2373,7 @@ "parameterName": "options", "parameterTypeTokenRange": { "startIndex": 3, - "endIndex": 4 + "endIndex": 5 }, "isOptional": false } @@ -2625,7 +2629,25 @@ "excerptTokens": [ { "kind": "Content", - "text": "export type Options = " + "text": "export type Options = " }, { "kind": "Content", @@ -2647,7 +2669,34 @@ }, { "kind": "Content", - "text": ";\n errorHandler?: " + "text": ";\n methodsRequestConfig?: " + }, + { + "kind": "Reference", + "text": "Partial", + "canonicalReference": "!Partial:type" + }, + { + "kind": "Content", + "text": "<" + }, + { + "kind": "Reference", + "text": "Record", + "canonicalReference": "!Record:type" + }, + { + "kind": "Content", + "text": ">;\n errorHandler?: " }, { "kind": "Reference", @@ -2666,9 +2715,22 @@ "fileUrlPath": "src/modules/middlewareModule/types.ts", "releaseTag": "Public", "name": "Options", + "typeParameters": [ + { + "typeParameterName": "Endpoints", + "constraintTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "defaultTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + } + } + ], "typeTokenRange": { - "startIndex": 1, - "endIndex": 8 + "startIndex": 5, + "endIndex": 18 } }, { diff --git a/docs/content/4.sdk/5.reference/change-log.md b/docs/content/4.sdk/5.reference/change-log.md index d46038df76..b008bdb63c 100644 --- a/docs/content/4.sdk/5.reference/change-log.md +++ b/docs/content/4.sdk/5.reference/change-log.md @@ -1,5 +1,32 @@ # Change log +## 1.5.0 + +### Minor Changes + +- **[ADDED]** a way to specify the default request configuration for each method. + +Example: Set the `getProducts` method to be a `GET` request by default and use custom headers. + +```typescript +import { initSDK, buildModule, middlewareModule } from "@vue-storefront/sdk"; +import { Endpoints } from "@vsf-enterprise/sapcc-api"; + +const sdk = initSDK({ + commerce: buildModule(middlewareModule, { + apiUrl: "http://localhost:8181/commerce", + methodsRequestConfig: { + getProduct: { + method: "GET", + headers: { + "X-Header-Name": "Header-Value", + }, + }, + }, + }), +}); +``` + ## 1.4.4 ### Patch Changes diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index d46038df76..b008bdb63c 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,32 @@ # Change log +## 1.5.0 + +### Minor Changes + +- **[ADDED]** a way to specify the default request configuration for each method. + +Example: Set the `getProducts` method to be a `GET` request by default and use custom headers. + +```typescript +import { initSDK, buildModule, middlewareModule } from "@vue-storefront/sdk"; +import { Endpoints } from "@vsf-enterprise/sapcc-api"; + +const sdk = initSDK({ + commerce: buildModule(middlewareModule, { + apiUrl: "http://localhost:8181/commerce", + methodsRequestConfig: { + getProduct: { + method: "GET", + headers: { + "X-Header-Name": "Header-Value", + }, + }, + }, + }), +}); +``` + ## 1.4.4 ### Patch Changes diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 61a548df7a..5e82912fe5 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,7 +1,7 @@ { "name": "@vue-storefront/sdk", "license": "MIT", - "version": "1.4.4", + "version": "1.5.0", "main": "lib/index.cjs.js", "module": "lib/index.es.js", "types": "lib/index.d.ts",