@riverbankcms/sdk 0.7.4 → 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.
@@ -17764,7 +17764,7 @@ var SimpleCache = class {
17764
17764
  };
17765
17765
 
17766
17766
  // src/version.ts
17767
- var SDK_VERSION = "0.7.4";
17767
+ var SDK_VERSION = "0.7.5";
17768
17768
 
17769
17769
  // src/client/error.ts
17770
17770
  var RiverbankApiError = class _RiverbankApiError extends Error {
@@ -17857,6 +17857,54 @@ var RiverbankApiError = class _RiverbankApiError extends Error {
17857
17857
  isServerError() {
17858
17858
  return this.code.startsWith("server:");
17859
17859
  }
17860
+ /**
17861
+ * Returns a human-readable string representation of the error.
17862
+ * Includes all key details for debugging.
17863
+ *
17864
+ * @example
17865
+ * "RiverbankApiError: Content keys cannot access preview content | Code: auth:forbidden | Status: 401 | RequestId: req-abc123"
17866
+ */
17867
+ toString() {
17868
+ const parts = [`RiverbankApiError: ${this.message}`];
17869
+ if (this.code) parts.push(`Code: ${this.code}`);
17870
+ if (this.status) parts.push(`Status: ${this.status}`);
17871
+ if (this.requestId) parts.push(`RequestId: ${this.requestId}`);
17872
+ return parts.join(" | ");
17873
+ }
17874
+ /**
17875
+ * Custom Node.js inspect output for better console.log display.
17876
+ * This ensures that console.log(error) shows all relevant details
17877
+ * instead of just "[Object]" for nested properties.
17878
+ */
17879
+ [Symbol.for("nodejs.util.inspect.custom")]() {
17880
+ return this.toDetailedString();
17881
+ }
17882
+ /**
17883
+ * Returns a detailed multi-line string for debugging.
17884
+ * Used by the Node.js inspect symbol for console output.
17885
+ */
17886
+ toDetailedString() {
17887
+ const lines = [
17888
+ `RiverbankApiError: ${this.message}`,
17889
+ ` Code: ${this.code}`,
17890
+ ` Status: ${this.status}`,
17891
+ ` RequestId: ${this.requestId}`,
17892
+ ` Timestamp: ${this.timestamp}`
17893
+ ];
17894
+ if (this.isRetryable) {
17895
+ lines.push(` Retryable: true`);
17896
+ if (this.retryAfterMs) {
17897
+ lines.push(` RetryAfter: ${this.retryAfterMs}ms`);
17898
+ }
17899
+ }
17900
+ if (this.fieldErrors && this.fieldErrors.length > 0) {
17901
+ lines.push(" FieldErrors:");
17902
+ this.fieldErrors.forEach((fe) => {
17903
+ lines.push(` - ${fe.field}: ${fe.message}`);
17904
+ });
17905
+ }
17906
+ return lines.join("\n");
17907
+ }
17860
17908
  };
17861
17909
 
17862
17910
  // src/client/resilience.ts
@@ -18014,7 +18062,19 @@ async function fetchWithTimeoutAndRetry(fetcher, config) {
18014
18062
  }
18015
18063
  throw lastError;
18016
18064
  }
18065
+ function isAbortError(error) {
18066
+ if (typeof DOMException !== "undefined" && error instanceof DOMException && error.name === "AbortError") {
18067
+ return true;
18068
+ }
18069
+ if (error instanceof Error && error.name === "AbortError") {
18070
+ return true;
18071
+ }
18072
+ return false;
18073
+ }
18017
18074
  function shouldRetryError(error, customRetryOn) {
18075
+ if (isAbortError(error)) {
18076
+ return false;
18077
+ }
18018
18078
  if (customRetryOn) {
18019
18079
  const statusCode = error instanceof RiverbankApiError ? error.status : void 0;
18020
18080
  return customRetryOn(error, statusCode);
@@ -18058,7 +18118,7 @@ var DEFAULT_SERVER_TIMEOUT_MS = 8e3;
18058
18118
  function generateRequestId2() {
18059
18119
  return `req-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
18060
18120
  }
18061
- function isAbortError(error) {
18121
+ function isAbortError2(error) {
18062
18122
  if (error instanceof DOMException && error.name === "AbortError") {
18063
18123
  return true;
18064
18124
  }
@@ -18096,7 +18156,7 @@ function getNetworkErrorCode(error) {
18096
18156
  return "network:connection_error";
18097
18157
  }
18098
18158
  function convertToTypedError(error) {
18099
- if (isAbortError(error)) {
18159
+ if (isAbortError2(error)) {
18100
18160
  throw error;
18101
18161
  }
18102
18162
  if (error instanceof ApiEnvelopeError) {