@profplum700/etsy-v3-api-client 4.0.0 → 4.1.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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f285f3f: Add an `enableScaleValidation` option to `updateListingInventory`, sent as Etsy's temporary `enable_scale_validation` query parameter. Etsy makes scale validation mandatory on 1 January 2027; opting in now surfaces payloads whose scaled properties lack a valid, consistent `scale_id`.
8
+
3
9
  ## 4.0.0
4
10
 
5
11
  ### Major Changes
@@ -1981,8 +1981,15 @@ class EtsyClient {
1981
1981
  await this.makeRequest(`/listings/${listingId}`, { method: 'DELETE' }, false);
1982
1982
  }
1983
1983
  async updateListingInventory(listingId, params, options) {
1984
- const legacy = options?.legacy;
1985
- const query = legacy !== undefined ? `?legacy=${legacy}` : '';
1984
+ const searchParams = new URLSearchParams();
1985
+ if (options?.legacy !== undefined) {
1986
+ searchParams.set('legacy', options.legacy.toString());
1987
+ }
1988
+ if (options?.enableScaleValidation !== undefined) {
1989
+ searchParams.set('enable_scale_validation', options.enableScaleValidation.toString());
1990
+ }
1991
+ const queryString = searchParams.toString();
1992
+ const query = queryString ? `?${queryString}` : '';
1986
1993
  if (!Array.isArray(params.products) || params.products.length === 0) {
1987
1994
  throw new TypeError('Inventory update must contain at least one product.');
1988
1995
  }
@@ -2756,7 +2763,7 @@ async function sha256(data) {
2756
2763
  const encoder = new TextEncoder();
2757
2764
  const dataBytes = typeof data === 'string' ? encoder.encode(data) : data;
2758
2765
  if (isBrowser) {
2759
- const hashBuffer = await crypto.subtle.digest('SHA-256', dataBytes);
2766
+ const hashBuffer = await crypto.subtle.digest('SHA-256', new Uint8Array(dataBytes));
2760
2767
  return new Uint8Array(hashBuffer);
2761
2768
  }
2762
2769
  else {