@devite/shopware-client 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -12092,7 +12092,7 @@ class CartClient extends Client {
12092
12092
  async getOrCreateCart() {
12093
12093
  const response = await this.get(
12094
12094
  "/checkout/cart",
12095
- this.client.withContextToken()
12095
+ this.client.authStore.getEntry(AuthenticationType.CONTEXT_TOKEN) ? this.client.withContextToken() : void 0
12096
12096
  );
12097
12097
  if (response.statusCode === 200)
12098
12098
  return response.body.data;
@@ -12642,8 +12642,8 @@ class SystemClient extends Client {
12642
12642
  /**
12643
12643
  * @throws {Error} if the request failed
12644
12644
  */
12645
- async getShippingMethods(request = {}) {
12646
- const response = await this.post(`/shipping-method`, {
12645
+ async getShippingMethods(request = {}, onlyAvailable = false) {
12646
+ const response = await this.post(`/shipping-method?onlyAvailable=${onlyAvailable ? 1 : 0}`, {
12647
12647
  body: new JsonPayload(request)
12648
12648
  });
12649
12649
  if (response.statusCode === 200)
@@ -12653,8 +12653,8 @@ class SystemClient extends Client {
12653
12653
  /**
12654
12654
  * @throws {Error} if the request failed
12655
12655
  */
12656
- async getPaymentMethods(request = {}) {
12657
- const response = await this.post(`/payment-method`, {
12656
+ async getPaymentMethods(request = {}, onlyAvailable = false) {
12657
+ const response = await this.post(`/payment-method?onlyAvailable=${onlyAvailable ? 1 : 0}`, {
12658
12658
  body: new JsonPayload(request)
12659
12659
  });
12660
12660
  if (response.statusCode === 200)
@@ -12738,11 +12738,7 @@ class StoreShopwareClient extends ShopwareClient {
12738
12738
  });
12739
12739
  }
12740
12740
  setContextToken(token) {
12741
- this.authStore.getOrCreateEntry(new ContextTokenEntry()).save({
12742
- statusCode: 200,
12743
- statusMessage: "OK",
12744
- headers: new Headers({ "sw-context-token": token })
12745
- });
12741
+ this.authStore.getOrCreateEntry(new ContextTokenEntry()).token = token;
12746
12742
  }
12747
12743
  withContextToken(options = {}) {
12748
12744
  const entry = this.authStore.getEntry(
@@ -12805,10 +12801,13 @@ class StoreShopwareClient extends ShopwareClient {
12805
12801
  }
12806
12802
 
12807
12803
  exports.AdminShopwareClient = AdminShopwareClient;
12804
+ exports.AuthenticationType = AuthenticationType;
12808
12805
  exports.BinaryPayload = BinaryPayload;
12806
+ exports.ContextTokenEntry = ContextTokenEntry;
12809
12807
  exports.HTTPRequestMethod = HTTPRequestMethod;
12810
12808
  exports.HtmlPayload = HtmlPayload;
12811
12809
  exports.JsonPayload = JsonPayload;
12810
+ exports.OAuthEntry = OAuthEntry;
12812
12811
  exports.Payload = Payload;
12813
12812
  exports.ShopwareClient = ShopwareClient;
12814
12813
  exports.ShopwareError = ShopwareError;
package/dist/index.d.cts CHANGED
@@ -6501,11 +6501,11 @@ declare class SystemClient extends Client {
6501
6501
  /**
6502
6502
  * @throws {Error} if the request failed
6503
6503
  */
6504
- getShippingMethods(request?: ShippingMethodListRequest): Promise<ShippingMethodListResponse$2>;
6504
+ getShippingMethods(request?: ShippingMethodListRequest, onlyAvailable?: boolean): Promise<ShippingMethodListResponse$2>;
6505
6505
  /**
6506
6506
  * @throws {Error} if the request failed
6507
6507
  */
6508
- getPaymentMethods(request?: PaymentMethodListRequest): Promise<PaymentMethodListResponse$2>;
6508
+ getPaymentMethods(request?: PaymentMethodListRequest, onlyAvailable?: boolean): Promise<PaymentMethodListResponse$2>;
6509
6509
  }
6510
6510
 
6511
6511
  declare class WishlistClient extends Client {
@@ -6556,6 +6556,29 @@ declare class ShopwareError extends Error {
6556
6556
  constructor(message: string, response: ClientResponse);
6557
6557
  }
6558
6558
 
6559
+ declare class ContextTokenEntry implements AuthenticationEntry {
6560
+ token: string | null;
6561
+ constructor(token?: string | null);
6562
+ getType(): AuthenticationType;
6563
+ isSaved(): boolean;
6564
+ save(response: ClientResponse): void;
6565
+ clear(): void;
6566
+ load(): ClientRequestOptions;
6567
+ }
6568
+
6569
+ declare class OAuthEntry implements AuthenticationEntry {
6570
+ accessToken: string | null;
6571
+ refreshToken: string | null;
6572
+ expiresAt: number | null;
6573
+ constructor(accessToken?: string | null, refreshToken?: string | null, expiresAt?: number | null);
6574
+ getType(): AuthenticationType;
6575
+ isSaved(): boolean;
6576
+ save(response: ClientResponse): void;
6577
+ clear(): void;
6578
+ /** @throws {ExpiredError} if the authentication data has expired */
6579
+ load(): any;
6580
+ }
6581
+
6559
6582
  declare abstract class Payload<T> {
6560
6583
  abstract contentType(): string;
6561
6584
  abstract deserialize(data: Blob): Promise<void>;
@@ -6598,4 +6621,5 @@ declare class JsonPayload extends Payload<string> {
6598
6621
  serialize(): string | undefined;
6599
6622
  }
6600
6623
 
6601
- export { AdminShopwareClient, BinaryPayload, HTTPRequestMethod, HtmlPayload, JsonPayload, Payload, ShopwareClient, ShopwareError, StoreShopwareClient };
6624
+ export { AdminShopwareClient, AuthenticationType, BinaryPayload, ContextTokenEntry, HTTPRequestMethod, HtmlPayload, JsonPayload, OAuthEntry, Payload, ShopwareClient, ShopwareError, StoreShopwareClient };
6625
+ export type { AuthenticationEntry };
package/dist/index.d.mts CHANGED
@@ -6501,11 +6501,11 @@ declare class SystemClient extends Client {
6501
6501
  /**
6502
6502
  * @throws {Error} if the request failed
6503
6503
  */
6504
- getShippingMethods(request?: ShippingMethodListRequest): Promise<ShippingMethodListResponse$2>;
6504
+ getShippingMethods(request?: ShippingMethodListRequest, onlyAvailable?: boolean): Promise<ShippingMethodListResponse$2>;
6505
6505
  /**
6506
6506
  * @throws {Error} if the request failed
6507
6507
  */
6508
- getPaymentMethods(request?: PaymentMethodListRequest): Promise<PaymentMethodListResponse$2>;
6508
+ getPaymentMethods(request?: PaymentMethodListRequest, onlyAvailable?: boolean): Promise<PaymentMethodListResponse$2>;
6509
6509
  }
6510
6510
 
6511
6511
  declare class WishlistClient extends Client {
@@ -6556,6 +6556,29 @@ declare class ShopwareError extends Error {
6556
6556
  constructor(message: string, response: ClientResponse);
6557
6557
  }
6558
6558
 
6559
+ declare class ContextTokenEntry implements AuthenticationEntry {
6560
+ token: string | null;
6561
+ constructor(token?: string | null);
6562
+ getType(): AuthenticationType;
6563
+ isSaved(): boolean;
6564
+ save(response: ClientResponse): void;
6565
+ clear(): void;
6566
+ load(): ClientRequestOptions;
6567
+ }
6568
+
6569
+ declare class OAuthEntry implements AuthenticationEntry {
6570
+ accessToken: string | null;
6571
+ refreshToken: string | null;
6572
+ expiresAt: number | null;
6573
+ constructor(accessToken?: string | null, refreshToken?: string | null, expiresAt?: number | null);
6574
+ getType(): AuthenticationType;
6575
+ isSaved(): boolean;
6576
+ save(response: ClientResponse): void;
6577
+ clear(): void;
6578
+ /** @throws {ExpiredError} if the authentication data has expired */
6579
+ load(): any;
6580
+ }
6581
+
6559
6582
  declare abstract class Payload<T> {
6560
6583
  abstract contentType(): string;
6561
6584
  abstract deserialize(data: Blob): Promise<void>;
@@ -6598,4 +6621,5 @@ declare class JsonPayload extends Payload<string> {
6598
6621
  serialize(): string | undefined;
6599
6622
  }
6600
6623
 
6601
- export { AdminShopwareClient, BinaryPayload, HTTPRequestMethod, HtmlPayload, JsonPayload, Payload, ShopwareClient, ShopwareError, StoreShopwareClient };
6624
+ export { AdminShopwareClient, AuthenticationType, BinaryPayload, ContextTokenEntry, HTTPRequestMethod, HtmlPayload, JsonPayload, OAuthEntry, Payload, ShopwareClient, ShopwareError, StoreShopwareClient };
6625
+ export type { AuthenticationEntry };
package/dist/index.d.ts CHANGED
@@ -6501,11 +6501,11 @@ declare class SystemClient extends Client {
6501
6501
  /**
6502
6502
  * @throws {Error} if the request failed
6503
6503
  */
6504
- getShippingMethods(request?: ShippingMethodListRequest): Promise<ShippingMethodListResponse$2>;
6504
+ getShippingMethods(request?: ShippingMethodListRequest, onlyAvailable?: boolean): Promise<ShippingMethodListResponse$2>;
6505
6505
  /**
6506
6506
  * @throws {Error} if the request failed
6507
6507
  */
6508
- getPaymentMethods(request?: PaymentMethodListRequest): Promise<PaymentMethodListResponse$2>;
6508
+ getPaymentMethods(request?: PaymentMethodListRequest, onlyAvailable?: boolean): Promise<PaymentMethodListResponse$2>;
6509
6509
  }
6510
6510
 
6511
6511
  declare class WishlistClient extends Client {
@@ -6556,6 +6556,29 @@ declare class ShopwareError extends Error {
6556
6556
  constructor(message: string, response: ClientResponse);
6557
6557
  }
6558
6558
 
6559
+ declare class ContextTokenEntry implements AuthenticationEntry {
6560
+ token: string | null;
6561
+ constructor(token?: string | null);
6562
+ getType(): AuthenticationType;
6563
+ isSaved(): boolean;
6564
+ save(response: ClientResponse): void;
6565
+ clear(): void;
6566
+ load(): ClientRequestOptions;
6567
+ }
6568
+
6569
+ declare class OAuthEntry implements AuthenticationEntry {
6570
+ accessToken: string | null;
6571
+ refreshToken: string | null;
6572
+ expiresAt: number | null;
6573
+ constructor(accessToken?: string | null, refreshToken?: string | null, expiresAt?: number | null);
6574
+ getType(): AuthenticationType;
6575
+ isSaved(): boolean;
6576
+ save(response: ClientResponse): void;
6577
+ clear(): void;
6578
+ /** @throws {ExpiredError} if the authentication data has expired */
6579
+ load(): any;
6580
+ }
6581
+
6559
6582
  declare abstract class Payload<T> {
6560
6583
  abstract contentType(): string;
6561
6584
  abstract deserialize(data: Blob): Promise<void>;
@@ -6598,4 +6621,5 @@ declare class JsonPayload extends Payload<string> {
6598
6621
  serialize(): string | undefined;
6599
6622
  }
6600
6623
 
6601
- export { AdminShopwareClient, BinaryPayload, HTTPRequestMethod, HtmlPayload, JsonPayload, Payload, ShopwareClient, ShopwareError, StoreShopwareClient };
6624
+ export { AdminShopwareClient, AuthenticationType, BinaryPayload, ContextTokenEntry, HTTPRequestMethod, HtmlPayload, JsonPayload, OAuthEntry, Payload, ShopwareClient, ShopwareError, StoreShopwareClient };
6625
+ export type { AuthenticationEntry };
package/dist/index.mjs CHANGED
@@ -12090,7 +12090,7 @@ class CartClient extends Client {
12090
12090
  async getOrCreateCart() {
12091
12091
  const response = await this.get(
12092
12092
  "/checkout/cart",
12093
- this.client.withContextToken()
12093
+ this.client.authStore.getEntry(AuthenticationType.CONTEXT_TOKEN) ? this.client.withContextToken() : void 0
12094
12094
  );
12095
12095
  if (response.statusCode === 200)
12096
12096
  return response.body.data;
@@ -12640,8 +12640,8 @@ class SystemClient extends Client {
12640
12640
  /**
12641
12641
  * @throws {Error} if the request failed
12642
12642
  */
12643
- async getShippingMethods(request = {}) {
12644
- const response = await this.post(`/shipping-method`, {
12643
+ async getShippingMethods(request = {}, onlyAvailable = false) {
12644
+ const response = await this.post(`/shipping-method?onlyAvailable=${onlyAvailable ? 1 : 0}`, {
12645
12645
  body: new JsonPayload(request)
12646
12646
  });
12647
12647
  if (response.statusCode === 200)
@@ -12651,8 +12651,8 @@ class SystemClient extends Client {
12651
12651
  /**
12652
12652
  * @throws {Error} if the request failed
12653
12653
  */
12654
- async getPaymentMethods(request = {}) {
12655
- const response = await this.post(`/payment-method`, {
12654
+ async getPaymentMethods(request = {}, onlyAvailable = false) {
12655
+ const response = await this.post(`/payment-method?onlyAvailable=${onlyAvailable ? 1 : 0}`, {
12656
12656
  body: new JsonPayload(request)
12657
12657
  });
12658
12658
  if (response.statusCode === 200)
@@ -12736,11 +12736,7 @@ class StoreShopwareClient extends ShopwareClient {
12736
12736
  });
12737
12737
  }
12738
12738
  setContextToken(token) {
12739
- this.authStore.getOrCreateEntry(new ContextTokenEntry()).save({
12740
- statusCode: 200,
12741
- statusMessage: "OK",
12742
- headers: new Headers({ "sw-context-token": token })
12743
- });
12739
+ this.authStore.getOrCreateEntry(new ContextTokenEntry()).token = token;
12744
12740
  }
12745
12741
  withContextToken(options = {}) {
12746
12742
  const entry = this.authStore.getEntry(
@@ -12802,4 +12798,4 @@ class StoreShopwareClient extends ShopwareClient {
12802
12798
  }
12803
12799
  }
12804
12800
 
12805
- export { AdminShopwareClient, BinaryPayload, HTTPRequestMethod, HtmlPayload, JsonPayload, Payload, ShopwareClient, ShopwareError, StoreShopwareClient };
12801
+ export { AdminShopwareClient, AuthenticationType, BinaryPayload, ContextTokenEntry, HTTPRequestMethod, HtmlPayload, JsonPayload, OAuthEntry, Payload, ShopwareClient, ShopwareError, StoreShopwareClient };
@@ -1,5 +1,5 @@
1
1
  export interface SimpleFilter {
2
2
  type: "contains" | "equalsAny" | "prefix" | "suffix";
3
3
  field: string;
4
- value: string;
4
+ value: string | string[];
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devite/shopware-client",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Third party API client for Shopware 6.",
5
5
  "repository": "devite-io/shopware-client",
6
6
  "license": "MIT",
@@ -41,12 +41,12 @@
41
41
  "dist"
42
42
  ],
43
43
  "devDependencies": {
44
- "@types/node": "^22.13.10",
44
+ "@types/node": "^22.14.0",
45
45
  "changelogen": "^0.5.7",
46
- "eslint": "^9.22.0",
46
+ "eslint": "^9.24.0",
47
47
  "prettier": "^3.5.3",
48
- "typescript": "^5.8.2",
49
- "typescript-eslint": "^8.26.1",
48
+ "typescript": "^5.8.3",
49
+ "typescript-eslint": "^8.29.1",
50
50
  "unbuild": "^3.5.0",
51
51
  "vitest": "^2.1.9"
52
52
  },