@riverbankcms/sdk 0.7.3 → 0.7.5

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.
@@ -17728,7 +17728,7 @@ var SimpleCache = class {
17728
17728
  };
17729
17729
 
17730
17730
  // src/version.ts
17731
- var SDK_VERSION = "0.7.3";
17731
+ var SDK_VERSION = "0.7.5";
17732
17732
 
17733
17733
  // src/client/error.ts
17734
17734
  var RiverbankApiError = class _RiverbankApiError extends Error {
@@ -17821,6 +17821,54 @@ var RiverbankApiError = class _RiverbankApiError extends Error {
17821
17821
  isServerError() {
17822
17822
  return this.code.startsWith("server:");
17823
17823
  }
17824
+ /**
17825
+ * Returns a human-readable string representation of the error.
17826
+ * Includes all key details for debugging.
17827
+ *
17828
+ * @example
17829
+ * "RiverbankApiError: Content keys cannot access preview content | Code: auth:forbidden | Status: 401 | RequestId: req-abc123"
17830
+ */
17831
+ toString() {
17832
+ const parts = [`RiverbankApiError: ${this.message}`];
17833
+ if (this.code) parts.push(`Code: ${this.code}`);
17834
+ if (this.status) parts.push(`Status: ${this.status}`);
17835
+ if (this.requestId) parts.push(`RequestId: ${this.requestId}`);
17836
+ return parts.join(" | ");
17837
+ }
17838
+ /**
17839
+ * Custom Node.js inspect output for better console.log display.
17840
+ * This ensures that console.log(error) shows all relevant details
17841
+ * instead of just "[Object]" for nested properties.
17842
+ */
17843
+ [Symbol.for("nodejs.util.inspect.custom")]() {
17844
+ return this.toDetailedString();
17845
+ }
17846
+ /**
17847
+ * Returns a detailed multi-line string for debugging.
17848
+ * Used by the Node.js inspect symbol for console output.
17849
+ */
17850
+ toDetailedString() {
17851
+ const lines = [
17852
+ `RiverbankApiError: ${this.message}`,
17853
+ ` Code: ${this.code}`,
17854
+ ` Status: ${this.status}`,
17855
+ ` RequestId: ${this.requestId}`,
17856
+ ` Timestamp: ${this.timestamp}`
17857
+ ];
17858
+ if (this.isRetryable) {
17859
+ lines.push(` Retryable: true`);
17860
+ if (this.retryAfterMs) {
17861
+ lines.push(` RetryAfter: ${this.retryAfterMs}ms`);
17862
+ }
17863
+ }
17864
+ if (this.fieldErrors && this.fieldErrors.length > 0) {
17865
+ lines.push(" FieldErrors:");
17866
+ this.fieldErrors.forEach((fe) => {
17867
+ lines.push(` - ${fe.field}: ${fe.message}`);
17868
+ });
17869
+ }
17870
+ return lines.join("\n");
17871
+ }
17824
17872
  };
17825
17873
 
17826
17874
  // src/client/resilience.ts
@@ -17978,7 +18026,19 @@ async function fetchWithTimeoutAndRetry(fetcher, config) {
17978
18026
  }
17979
18027
  throw lastError;
17980
18028
  }
18029
+ function isAbortError(error) {
18030
+ if (typeof DOMException !== "undefined" && error instanceof DOMException && error.name === "AbortError") {
18031
+ return true;
18032
+ }
18033
+ if (error instanceof Error && error.name === "AbortError") {
18034
+ return true;
18035
+ }
18036
+ return false;
18037
+ }
17981
18038
  function shouldRetryError(error, customRetryOn) {
18039
+ if (isAbortError(error)) {
18040
+ return false;
18041
+ }
17982
18042
  if (customRetryOn) {
17983
18043
  const statusCode = error instanceof RiverbankApiError ? error.status : void 0;
17984
18044
  return customRetryOn(error, statusCode);
@@ -18022,7 +18082,7 @@ var DEFAULT_SERVER_TIMEOUT_MS = 8e3;
18022
18082
  function generateRequestId2() {
18023
18083
  return `req-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
18024
18084
  }
18025
- function isAbortError(error) {
18085
+ function isAbortError2(error) {
18026
18086
  if (error instanceof DOMException && error.name === "AbortError") {
18027
18087
  return true;
18028
18088
  }
@@ -18060,7 +18120,7 @@ function getNetworkErrorCode(error) {
18060
18120
  return "network:connection_error";
18061
18121
  }
18062
18122
  function convertToTypedError(error) {
18063
- if (isAbortError(error)) {
18123
+ if (isAbortError2(error)) {
18064
18124
  throw error;
18065
18125
  }
18066
18126
  if (error instanceof ApiEnvelopeError) {