@scayle/storefront-core 7.30.0 → 7.31.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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 7.31.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Update SAPI SDK to v16
8
+
9
+ ### Patch Changes
10
+
11
+ - Fix filter helper to not return null values
12
+
3
13
  ## 7.30.0
4
14
 
5
15
  ### Minor Changes
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.BAPIError = void 0;
6
+ exports.BAPIFetchError = exports.BAPIError = void 0;
7
+ var _backbone = require("@aboutyou/backbone");
7
8
  var _constants = require("../constants/index.cjs");
8
9
  var _baseError = require("./baseError.cjs");
9
10
  class BAPIError extends _baseError.BaseError {
@@ -13,4 +14,5 @@ class BAPIError extends _baseError.BaseError {
13
14
  this.url = url;
14
15
  }
15
16
  }
16
- exports.BAPIError = BAPIError;
17
+ exports.BAPIError = BAPIError;
18
+ const BAPIFetchError = exports.BAPIFetchError = _backbone.FetchError;
@@ -1,6 +1,8 @@
1
+ import { FetchError } from '@aboutyou/backbone';
1
2
  import { HttpStatusCode, HttpStatusMessage } from '../constants';
2
3
  import { BaseError } from './baseError';
3
4
  export declare class BAPIError extends BaseError {
4
5
  url?: string;
5
6
  constructor(name?: HttpStatusMessage | string, statusCode?: HttpStatusCode, description?: string, url?: string);
6
7
  }
8
+ export declare const BAPIFetchError: typeof FetchError;
@@ -1,3 +1,4 @@
1
+ import { FetchError } from "@aboutyou/backbone";
1
2
  import { HttpStatusCode, HttpStatusMessage } from "../constants/index.mjs";
2
3
  import { BaseError } from "./baseError.mjs";
3
4
  export class BAPIError extends BaseError {
@@ -7,3 +8,4 @@ export class BAPIError extends BaseError {
7
8
  this.url = url;
8
9
  }
9
10
  }
11
+ export const BAPIFetchError = FetchError;
@@ -136,9 +136,19 @@ const serializeFilters = filter => {
136
136
  if ((0, _radash.isEmpty)(filter)) {
137
137
  return void 0;
138
138
  }
139
- return Object.assign({}, ...Object.entries(filter).map(([filterName, filterValue]) => ({
140
- [filterName]: Array.isArray(filterValue) ? filterValue.join(",") : String(filterValue)
141
- })));
139
+ return Object.assign({}, ...Object.entries(filter).map(([filterName, filterValue]) => {
140
+ if (Array.isArray(filterValue)) {
141
+ return {
142
+ [filterName]: filterValue.join(",")
143
+ };
144
+ }
145
+ if (filterValue === null || filterValue === void 0) {
146
+ return {};
147
+ }
148
+ return {
149
+ [filterName]: String(filterValue)
150
+ };
151
+ }));
142
152
  };
143
153
  exports.serializeFilters = serializeFilters;
144
154
  const deserializeFilters = serializedFilter => {
@@ -125,9 +125,15 @@ export const serializeFilters = (filter) => {
125
125
  }
126
126
  return Object.assign(
127
127
  {},
128
- ...Object.entries(filter).map(([filterName, filterValue]) => ({
129
- [filterName]: Array.isArray(filterValue) ? filterValue.join(",") : String(filterValue)
130
- }))
128
+ ...Object.entries(filter).map(([filterName, filterValue]) => {
129
+ if (Array.isArray(filterValue)) {
130
+ return { [filterName]: filterValue.join(",") };
131
+ }
132
+ if (filterValue === null || filterValue === void 0) {
133
+ return {};
134
+ }
135
+ return { [filterName]: String(filterValue) };
136
+ })
131
137
  );
132
138
  };
133
139
  export const deserializeFilters = (serializedFilter) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "7.30.0",
3
+ "version": "7.31.0",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -56,7 +56,7 @@
56
56
  "test:ci": "jest --passWithNoTests --runInBand --coverage --reporters=default --reporters=jest-junit"
57
57
  },
58
58
  "dependencies": {
59
- "@aboutyou/backbone": "15.14.3",
59
+ "@aboutyou/backbone": "16.0.1",
60
60
  "crypto-js": "4.2.0",
61
61
  "jose": "^4.14.4",
62
62
  "radash": "^11.0.0",