@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/dist/index.d.ts CHANGED
@@ -1374,6 +1374,7 @@ declare class EtsyClient {
1374
1374
  deleteListing(listingId: string): Promise<void>;
1375
1375
  updateListingInventory(listingId: string, params: UpdateListingInventoryParams, options?: {
1376
1376
  legacy?: boolean;
1377
+ enableScaleValidation?: boolean;
1377
1378
  }): Promise<EtsyListingInventory>;
1378
1379
  uploadListingImage(shopId: string, listingId: string, imageData: Blob | Buffer, params?: {
1379
1380
  rank?: number;
package/dist/index.esm.js CHANGED
@@ -2018,8 +2018,15 @@ class EtsyClient {
2018
2018
  await this.makeRequest(`/listings/${listingId}`, { method: 'DELETE' }, false);
2019
2019
  }
2020
2020
  async updateListingInventory(listingId, params, options) {
2021
- const legacy = options?.legacy;
2022
- const query = legacy !== undefined ? `?legacy=${legacy}` : '';
2021
+ const searchParams = new URLSearchParams();
2022
+ if (options?.legacy !== undefined) {
2023
+ searchParams.set('legacy', options.legacy.toString());
2024
+ }
2025
+ if (options?.enableScaleValidation !== undefined) {
2026
+ searchParams.set('enable_scale_validation', options.enableScaleValidation.toString());
2027
+ }
2028
+ const queryString = searchParams.toString();
2029
+ const query = queryString ? `?${queryString}` : '';
2023
2030
  if (!Array.isArray(params.products) || params.products.length === 0) {
2024
2031
  throw new TypeError('Inventory update must contain at least one product.');
2025
2032
  }
@@ -2803,7 +2810,7 @@ async function sha256(data) {
2803
2810
  const encoder = new TextEncoder();
2804
2811
  const dataBytes = typeof data === 'string' ? encoder.encode(data) : data;
2805
2812
  if (isBrowser) {
2806
- const hashBuffer = await crypto.subtle.digest('SHA-256', dataBytes);
2813
+ const hashBuffer = await crypto.subtle.digest('SHA-256', new Uint8Array(dataBytes));
2807
2814
  return new Uint8Array(hashBuffer);
2808
2815
  }
2809
2816
  else if (isNode) {