@lonca/trendyol 0.11.2 → 0.11.3

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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createStatusNormalizer, TokenBucketRateLimiter, ValidationError, TimeoutError, ServerError, createRequester, LoncaError, RateLimitError, NotFoundError, AuthError } from '@lonca/core';
1
+ import { createStatusNormalizer, TokenBucketRateLimiter, ValidationError, TimeoutError, ServerError, createRequester, LoncaError, RateLimitError, NotFoundError, AuthError, normalizeIssueEntries } from '@lonca/core';
2
2
 
3
3
  // src/resources/brands.ts
4
4
  var DEFAULT_PAGE_SIZE = 1e3;
@@ -2753,23 +2753,7 @@ function mapHttpError(status, body, retryAfterMs) {
2753
2753
  }
2754
2754
  function normalizeErrorIssues(body) {
2755
2755
  const errors = extractErrorsArray(body);
2756
- if (!errors) return [];
2757
- const issues = [];
2758
- for (const entry of errors) {
2759
- if (typeof entry === "string") {
2760
- issues.push({ message: entry });
2761
- continue;
2762
- }
2763
- if (entry && typeof entry === "object") {
2764
- const e = entry;
2765
- if (typeof e.message !== "string") continue;
2766
- const issue = { message: e.message };
2767
- if (typeof e.field === "string") issue.field = e.field;
2768
- if (typeof e.code === "string") issue.code = e.code;
2769
- issues.push(issue);
2770
- }
2771
- }
2772
- return issues;
2756
+ return errors ? normalizeIssueEntries(errors) : [];
2773
2757
  }
2774
2758
  function extractErrorsArray(body) {
2775
2759
  if (!body || typeof body !== "object") return void 0;