@medialane/sdk 0.128.0 → 0.129.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.
@@ -1057,9 +1057,8 @@ declare class MedialaneApiError extends Error {
1057
1057
  readonly status: number;
1058
1058
  readonly retryAfterMs?: number | undefined;
1059
1059
  readonly details?: unknown | undefined;
1060
- readonly isAuthored: boolean;
1061
1060
  readonly code: MedialaneErrorCode;
1062
- constructor(status: number, message: string, retryAfterMs?: number | undefined, details?: unknown | undefined, isAuthored?: boolean);
1061
+ constructor(status: number, message: string, retryAfterMs?: number | undefined, details?: unknown | undefined);
1063
1062
  }
1064
1063
  declare class ApiClient {
1065
1064
  private readonly baseUrl;
@@ -1057,9 +1057,8 @@ declare class MedialaneApiError extends Error {
1057
1057
  readonly status: number;
1058
1058
  readonly retryAfterMs?: number | undefined;
1059
1059
  readonly details?: unknown | undefined;
1060
- readonly isAuthored: boolean;
1061
1060
  readonly code: MedialaneErrorCode;
1062
- constructor(status: number, message: string, retryAfterMs?: number | undefined, details?: unknown | undefined, isAuthored?: boolean);
1061
+ constructor(status: number, message: string, retryAfterMs?: number | undefined, details?: unknown | undefined);
1063
1062
  }
1064
1063
  declare class ApiClient {
1065
1064
  private readonly baseUrl;
package/dist/index.cjs CHANGED
@@ -275,12 +275,11 @@ function deriveErrorCode(status) {
275
275
  return "UNKNOWN";
276
276
  }
277
277
  var MedialaneApiError = class extends Error {
278
- constructor(status, message, retryAfterMs, details, isAuthored = false) {
278
+ constructor(status, message, retryAfterMs, details) {
279
279
  super(message);
280
280
  this.status = status;
281
281
  this.retryAfterMs = retryAfterMs;
282
282
  this.details = details;
283
- this.isAuthored = isAuthored;
284
283
  this.name = "MedialaneApiError";
285
284
  this.code = deriveErrorCode(status);
286
285
  }
@@ -317,14 +316,12 @@ var ApiClient = class {
317
316
  });
318
317
  if (!response.ok && !allowed(response.status)) {
319
318
  const text = await response.text().catch(() => response.statusText);
320
- let message = text;
321
- let details;
322
- let isAuthored = false;
319
+ let message = `Request failed with status ${response.status}`;
320
+ let details = text;
323
321
  try {
324
322
  const body = JSON.parse(text);
325
323
  if (typeof body.error === "string" && body.error.trim() !== "") {
326
324
  message = body.error;
327
- isAuthored = true;
328
325
  }
329
326
  details = body;
330
327
  } catch {
@@ -333,8 +330,7 @@ var ApiClient = class {
333
330
  response.status,
334
331
  message,
335
332
  parseRetryAfter(response.headers.get("retry-after")),
336
- details,
337
- isAuthored
333
+ details
338
334
  );
339
335
  }
340
336
  return response;