@inneropen/marvin-sdk 5.11.0 → 5.11.1

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.
@@ -6,7 +6,7 @@ import {
6
6
  __export,
7
7
  init_core,
8
8
  init_errors
9
- } from "./chunk-LTX3MAUE.js";
9
+ } from "./chunk-UQLDSSZ4.js";
10
10
 
11
11
  // src/client/config.ts
12
12
  var config_exports = {};
@@ -95,13 +95,15 @@ ${body}` : ""}`;
95
95
  originalError;
96
96
  };
97
97
  MarvinServerError = class _MarvinServerError extends MarvinError {
98
- constructor(message, statusCode, endpoint) {
98
+ constructor(message, statusCode, endpoint, body) {
99
99
  super(message, "SERVER_ERROR", statusCode);
100
100
  this.endpoint = endpoint;
101
+ this.body = body;
101
102
  this.name = "MarvinServerError";
102
103
  Object.setPrototypeOf(this, _MarvinServerError.prototype);
103
104
  }
104
105
  endpoint;
106
+ body;
105
107
  };
106
108
  }
107
109
  });
@@ -115,6 +117,15 @@ var init_errors = __esm({
115
117
  });
116
118
 
117
119
  // src/core/http/HttpClient.ts
120
+ function errorDetail(body) {
121
+ if (!body) return null;
122
+ try {
123
+ const parsed = JSON.parse(body);
124
+ return typeof parsed?.detail === "string" && parsed.detail.trim() ? parsed.detail.trim() : null;
125
+ } catch {
126
+ return null;
127
+ }
128
+ }
118
129
  var IDEMPOTENT_METHODS, SAFE_METHODS, MAX_RETRY_AFTER_MS, HttpClient;
119
130
  var init_HttpClient = __esm({
120
131
  "src/core/http/HttpClient.ts"() {
@@ -370,10 +381,12 @@ var init_HttpClient = __esm({
370
381
  );
371
382
  }
372
383
  if (response.status >= 500) {
384
+ const detail = errorDetail(errorText);
373
385
  throw new MarvinServerError(
374
- `Server error: ${response.status} ${response.statusText}`,
386
+ detail ? `${detail} (${response.status})` : `Server error: ${response.status} ${response.statusText}`,
375
387
  response.status,
376
- endpoint
388
+ endpoint,
389
+ errorText
377
390
  );
378
391
  }
379
392
  throw MarvinApiError.fromResponse(
package/dist/index.cjs CHANGED
@@ -222,13 +222,15 @@ ${body}` : ""}`;
222
222
  originalError;
223
223
  };
224
224
  MarvinServerError = class _MarvinServerError extends MarvinError {
225
- constructor(message, statusCode, endpoint) {
225
+ constructor(message, statusCode, endpoint, body) {
226
226
  super(message, "SERVER_ERROR", statusCode);
227
227
  this.endpoint = endpoint;
228
+ this.body = body;
228
229
  this.name = "MarvinServerError";
229
230
  Object.setPrototypeOf(this, _MarvinServerError.prototype);
230
231
  }
231
232
  endpoint;
233
+ body;
232
234
  };
233
235
  }
234
236
  });
@@ -242,6 +244,15 @@ var init_errors = __esm({
242
244
  });
243
245
 
244
246
  // src/core/http/HttpClient.ts
247
+ function errorDetail(body) {
248
+ if (!body) return null;
249
+ try {
250
+ const parsed = JSON.parse(body);
251
+ return typeof parsed?.detail === "string" && parsed.detail.trim() ? parsed.detail.trim() : null;
252
+ } catch {
253
+ return null;
254
+ }
255
+ }
245
256
  var IDEMPOTENT_METHODS, SAFE_METHODS, MAX_RETRY_AFTER_MS, HttpClient;
246
257
  var init_HttpClient = __esm({
247
258
  "src/core/http/HttpClient.ts"() {
@@ -497,10 +508,12 @@ var init_HttpClient = __esm({
497
508
  );
498
509
  }
499
510
  if (response.status >= 500) {
511
+ const detail = errorDetail(errorText);
500
512
  throw new MarvinServerError(
501
- `Server error: ${response.status} ${response.statusText}`,
513
+ detail ? `${detail} (${response.status})` : `Server error: ${response.status} ${response.statusText}`,
502
514
  response.status,
503
- endpoint
515
+ endpoint,
516
+ errorText
504
517
  );
505
518
  }
506
519
  throw MarvinApiError.fromResponse(
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MarvinConfig, a as MarvinClient } from './marvin-CnsjrIMG.cjs';
2
- export { C as Collection, E as Entry, b as MarvinApiError, c as MarvinAuthError, d as MarvinCache, e as MarvinConfigError, f as MarvinError, g as MarvinNetworkError, h as MarvinNotFoundError, i as MarvinServerError, j as MarvinValidationError, P as PaginatedResponse, k as PaginationMeta, l as PaginationParams, R as Resource, W as Workspace, m as createConfigFromEnv, n as createPaginatedResponse, o as extractData, p as isFullEntryData, q as isPaginatedResponse, r as offsetToPage, s as pageToOffset } from './marvin-CnsjrIMG.cjs';
1
+ import { M as MarvinConfig, a as MarvinClient } from './marvin-D-ej4jFr.cjs';
2
+ export { C as Collection, E as Entry, b as MarvinApiError, c as MarvinAuthError, d as MarvinCache, e as MarvinConfigError, f as MarvinError, g as MarvinNetworkError, h as MarvinNotFoundError, i as MarvinServerError, j as MarvinValidationError, P as PaginatedResponse, k as PaginationMeta, l as PaginationParams, R as Resource, W as Workspace, m as createConfigFromEnv, n as createPaginatedResponse, o as extractData, p as isFullEntryData, q as isPaginatedResponse, r as offsetToPage, s as pageToOffset } from './marvin-D-ej4jFr.cjs';
3
3
  import { H as HttpClient } from './HttpClient-DXMNOPqu.cjs';
4
4
  export { A as AuthStrategy, B as BearerTokenAuth, a as BinaryResponse, b as HttpClientConfig, N as NoAuth, S as SessionAuth } from './HttpClient-DXMNOPqu.cjs';
5
5
  import { A as AuthToken$1 } from './index-CoXik4eV.cjs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MarvinConfig, a as MarvinClient } from './marvin-BZ15GgEi.js';
2
- export { C as Collection, E as Entry, b as MarvinApiError, c as MarvinAuthError, d as MarvinCache, e as MarvinConfigError, f as MarvinError, g as MarvinNetworkError, h as MarvinNotFoundError, i as MarvinServerError, j as MarvinValidationError, P as PaginatedResponse, k as PaginationMeta, l as PaginationParams, R as Resource, W as Workspace, m as createConfigFromEnv, n as createPaginatedResponse, o as extractData, p as isFullEntryData, q as isPaginatedResponse, r as offsetToPage, s as pageToOffset } from './marvin-BZ15GgEi.js';
1
+ import { M as MarvinConfig, a as MarvinClient } from './marvin-CXsLDS3M.js';
2
+ export { C as Collection, E as Entry, b as MarvinApiError, c as MarvinAuthError, d as MarvinCache, e as MarvinConfigError, f as MarvinError, g as MarvinNetworkError, h as MarvinNotFoundError, i as MarvinServerError, j as MarvinValidationError, P as PaginatedResponse, k as PaginationMeta, l as PaginationParams, R as Resource, W as Workspace, m as createConfigFromEnv, n as createPaginatedResponse, o as extractData, p as isFullEntryData, q as isPaginatedResponse, r as offsetToPage, s as pageToOffset } from './marvin-CXsLDS3M.js';
3
3
  import { H as HttpClient } from './HttpClient-DXMNOPqu.js';
4
4
  export { A as AuthStrategy, B as BearerTokenAuth, a as BinaryResponse, b as HttpClientConfig, N as NoAuth, S as SessionAuth } from './HttpClient-DXMNOPqu.js';
5
5
  import { A as AuthToken$1 } from './index-CoXik4eV.js';
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  init_workspace,
15
15
  isFullEntryData,
16
16
  marvin_exports
17
- } from "./chunk-KXI2FQSO.js";
17
+ } from "./chunk-KNYBYXNV.js";
18
18
  import {
19
19
  BearerTokenAuth,
20
20
  HttpClient,
@@ -37,7 +37,7 @@ import {
37
37
  offsetToPage,
38
38
  pageToOffset,
39
39
  validateEmail
40
- } from "./chunk-LTX3MAUE.js";
40
+ } from "./chunk-UQLDSSZ4.js";
41
41
 
42
42
  // src/index.ts
43
43
  init_marvin();
@@ -79,7 +79,11 @@ declare class MarvinNetworkError extends MarvinError {
79
79
  */
80
80
  declare class MarvinServerError extends MarvinError {
81
81
  readonly endpoint: string;
82
- constructor(message: string, statusCode: number, endpoint: string);
82
+ /** The raw response body, when the server sent one. */
83
+ readonly body?: string | undefined;
84
+ constructor(message: string, statusCode: number, endpoint: string,
85
+ /** The raw response body, when the server sent one. */
86
+ body?: string | undefined);
83
87
  }
84
88
 
85
89
  /**
@@ -79,7 +79,11 @@ declare class MarvinNetworkError extends MarvinError {
79
79
  */
80
80
  declare class MarvinServerError extends MarvinError {
81
81
  readonly endpoint: string;
82
- constructor(message: string, statusCode: number, endpoint: string);
82
+ /** The raw response body, when the server sent one. */
83
+ readonly body?: string | undefined;
84
+ constructor(message: string, statusCode: number, endpoint: string,
85
+ /** The raw response body, when the server sent one. */
86
+ body?: string | undefined);
83
87
  }
84
88
 
85
89
  /**
package/dist/platform.cjs CHANGED
@@ -131,16 +131,27 @@ var MarvinNetworkError = class _MarvinNetworkError extends MarvinError {
131
131
  originalError;
132
132
  };
133
133
  var MarvinServerError = class _MarvinServerError extends MarvinError {
134
- constructor(message, statusCode, endpoint) {
134
+ constructor(message, statusCode, endpoint, body) {
135
135
  super(message, "SERVER_ERROR", statusCode);
136
136
  this.endpoint = endpoint;
137
+ this.body = body;
137
138
  this.name = "MarvinServerError";
138
139
  Object.setPrototypeOf(this, _MarvinServerError.prototype);
139
140
  }
140
141
  endpoint;
142
+ body;
141
143
  };
142
144
 
143
145
  // src/core/http/HttpClient.ts
146
+ function errorDetail(body) {
147
+ if (!body) return null;
148
+ try {
149
+ const parsed = JSON.parse(body);
150
+ return typeof parsed?.detail === "string" && parsed.detail.trim() ? parsed.detail.trim() : null;
151
+ } catch {
152
+ return null;
153
+ }
154
+ }
144
155
  var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS", "PUT", "DELETE"]);
145
156
  var SAFE_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
146
157
  var MAX_RETRY_AFTER_MS = 6e4;
@@ -391,10 +402,12 @@ var HttpClient = class _HttpClient {
391
402
  );
392
403
  }
393
404
  if (response.status >= 500) {
405
+ const detail = errorDetail(errorText);
394
406
  throw new MarvinServerError(
395
- `Server error: ${response.status} ${response.statusText}`,
407
+ detail ? `${detail} (${response.status})` : `Server error: ${response.status} ${response.statusText}`,
396
408
  response.status,
397
- endpoint
409
+ endpoint,
410
+ errorText
398
411
  );
399
412
  }
400
413
  throw MarvinApiError.fromResponse(
package/dist/platform.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  MarvinValidationError,
4
4
  SessionAuth,
5
5
  init_core
6
- } from "./chunk-LTX3MAUE.js";
6
+ } from "./chunk-UQLDSSZ4.js";
7
7
 
8
8
  // src/platform/client.ts
9
9
  init_core();
package/dist/publish.cjs CHANGED
@@ -251,16 +251,27 @@ var MarvinNetworkError = class _MarvinNetworkError extends MarvinError {
251
251
  originalError;
252
252
  };
253
253
  var MarvinServerError = class _MarvinServerError extends MarvinError {
254
- constructor(message, statusCode, endpoint) {
254
+ constructor(message, statusCode, endpoint, body) {
255
255
  super(message, "SERVER_ERROR", statusCode);
256
256
  this.endpoint = endpoint;
257
+ this.body = body;
257
258
  this.name = "MarvinServerError";
258
259
  Object.setPrototypeOf(this, _MarvinServerError.prototype);
259
260
  }
260
261
  endpoint;
262
+ body;
261
263
  };
262
264
 
263
265
  // src/core/http/HttpClient.ts
266
+ function errorDetail(body) {
267
+ if (!body) return null;
268
+ try {
269
+ const parsed = JSON.parse(body);
270
+ return typeof parsed?.detail === "string" && parsed.detail.trim() ? parsed.detail.trim() : null;
271
+ } catch {
272
+ return null;
273
+ }
274
+ }
264
275
  var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS", "PUT", "DELETE"]);
265
276
  var SAFE_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
266
277
  var MAX_RETRY_AFTER_MS = 6e4;
@@ -511,10 +522,12 @@ var HttpClient = class _HttpClient {
511
522
  );
512
523
  }
513
524
  if (response.status >= 500) {
525
+ const detail = errorDetail(errorText);
514
526
  throw new MarvinServerError(
515
- `Server error: ${response.status} ${response.statusText}`,
527
+ detail ? `${detail} (${response.status})` : `Server error: ${response.status} ${response.statusText}`,
516
528
  response.status,
517
- endpoint
529
+ endpoint,
530
+ errorText
518
531
  );
519
532
  }
520
533
  throw MarvinApiError.fromResponse(
@@ -1,5 +1,5 @@
1
- import { M as MarvinConfig, a as MarvinClient } from './marvin-CnsjrIMG.cjs';
2
- export { C as Collection, E as Entry, b as MarvinApiError, c as MarvinAuthError, d as MarvinCache, e as MarvinConfigError, f as MarvinError, g as MarvinNetworkError, h as MarvinNotFoundError, i as MarvinServerError, j as MarvinValidationError, P as PaginatedResponse, k as PaginationMeta, l as PaginationParams, R as Resource, W as Workspace, m as createConfigFromEnv, n as createPaginatedResponse, o as extractData, p as isFullEntryData, q as isPaginatedResponse, r as offsetToPage, s as pageToOffset } from './marvin-CnsjrIMG.cjs';
1
+ import { M as MarvinConfig, a as MarvinClient } from './marvin-D-ej4jFr.cjs';
2
+ export { C as Collection, E as Entry, b as MarvinApiError, c as MarvinAuthError, d as MarvinCache, e as MarvinConfigError, f as MarvinError, g as MarvinNetworkError, h as MarvinNotFoundError, i as MarvinServerError, j as MarvinValidationError, P as PaginatedResponse, k as PaginationMeta, l as PaginationParams, R as Resource, W as Workspace, m as createConfigFromEnv, n as createPaginatedResponse, o as extractData, p as isFullEntryData, q as isPaginatedResponse, r as offsetToPage, s as pageToOffset } from './marvin-D-ej4jFr.cjs';
3
3
  export { e as ExpandOptions, G as GetAssetsOptions, f as GetEntriesOptions, g as GetResourcesOptions, M as MarvinAsset, h as MarvinCollection, i as MarvinCollectionExpanded, j as MarvinEntry, k as MarvinEntryListItem, l as MarvinEntryType, m as MarvinPublishResponse, n as MarvinResource, o as MarvinSite, P as PublishedAssetRead, p as PublishedCollectionSummary, q as PublishedEntryAsset, r as PublishedEntryResource, S as SiteConfiguration, W as WorkspaceInfo } from './index-CoXik4eV.cjs';
4
4
  export { A as AuthStrategy, B as BearerTokenAuth, H as HttpClient, b as HttpClientConfig } from './HttpClient-DXMNOPqu.cjs';
5
5
 
package/dist/publish.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MarvinConfig, a as MarvinClient } from './marvin-BZ15GgEi.js';
2
- export { C as Collection, E as Entry, b as MarvinApiError, c as MarvinAuthError, d as MarvinCache, e as MarvinConfigError, f as MarvinError, g as MarvinNetworkError, h as MarvinNotFoundError, i as MarvinServerError, j as MarvinValidationError, P as PaginatedResponse, k as PaginationMeta, l as PaginationParams, R as Resource, W as Workspace, m as createConfigFromEnv, n as createPaginatedResponse, o as extractData, p as isFullEntryData, q as isPaginatedResponse, r as offsetToPage, s as pageToOffset } from './marvin-BZ15GgEi.js';
1
+ import { M as MarvinConfig, a as MarvinClient } from './marvin-CXsLDS3M.js';
2
+ export { C as Collection, E as Entry, b as MarvinApiError, c as MarvinAuthError, d as MarvinCache, e as MarvinConfigError, f as MarvinError, g as MarvinNetworkError, h as MarvinNotFoundError, i as MarvinServerError, j as MarvinValidationError, P as PaginatedResponse, k as PaginationMeta, l as PaginationParams, R as Resource, W as Workspace, m as createConfigFromEnv, n as createPaginatedResponse, o as extractData, p as isFullEntryData, q as isPaginatedResponse, r as offsetToPage, s as pageToOffset } from './marvin-CXsLDS3M.js';
3
3
  export { e as ExpandOptions, G as GetAssetsOptions, f as GetEntriesOptions, g as GetResourcesOptions, M as MarvinAsset, h as MarvinCollection, i as MarvinCollectionExpanded, j as MarvinEntry, k as MarvinEntryListItem, l as MarvinEntryType, m as MarvinPublishResponse, n as MarvinResource, o as MarvinSite, P as PublishedAssetRead, p as PublishedCollectionSummary, q as PublishedEntryAsset, r as PublishedEntryResource, S as SiteConfiguration, W as WorkspaceInfo } from './index-CoXik4eV.js';
4
4
  export { A as AuthStrategy, B as BearerTokenAuth, H as HttpClient, b as HttpClientConfig } from './HttpClient-DXMNOPqu.js';
5
5
 
package/dist/publish.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  init_resource,
14
14
  init_workspace,
15
15
  isFullEntryData
16
- } from "./chunk-KXI2FQSO.js";
16
+ } from "./chunk-KNYBYXNV.js";
17
17
  import {
18
18
  BearerTokenAuth,
19
19
  HttpClient,
@@ -33,7 +33,7 @@ import {
33
33
  isPaginatedResponse,
34
34
  offsetToPage,
35
35
  pageToOffset
36
- } from "./chunk-LTX3MAUE.js";
36
+ } from "./chunk-UQLDSSZ4.js";
37
37
 
38
38
  // src/publish.ts
39
39
  init_marvin();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneropen/marvin-sdk",
3
- "version": "5.11.0",
3
+ "version": "5.11.1",
4
4
  "description": "Official TypeScript SDK for Marvin CMS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",