@inneropen/marvin-sdk 4.1.0 → 4.2.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.
package/dist/index.cjs CHANGED
@@ -915,6 +915,12 @@ var init_http2 = __esm({
915
915
  });
916
916
 
917
917
  // src/entries/entry.ts
918
+ function isFullEntryData(raw) {
919
+ if (!raw || typeof raw !== "object") return false;
920
+ const record = raw;
921
+ if ("assetSlugs" in record || "resourceSlugs" in record) return false;
922
+ return Array.isArray(record.assets) || Array.isArray(record.resources);
923
+ }
918
924
  var Entry;
919
925
  var init_entry = __esm({
920
926
  "src/entries/entry.ts"() {
@@ -1010,19 +1016,21 @@ var init_entries = __esm({
1010
1016
  }
1011
1017
  http;
1012
1018
  workspaceSlug;
1013
- /**
1014
- * Get all published entries
1015
- */
1016
1019
  async list(options = {}) {
1017
1020
  const queryString = this.http.buildQueryString({
1018
1021
  entry_type: options.entryType,
1019
1022
  collection: options.collection,
1020
1023
  limit: options.limit,
1021
- offset: options.offset
1024
+ offset: options.offset,
1025
+ expand: options.expand
1022
1026
  });
1023
1027
  const endpoint = `/api/publish/${this.workspaceSlug}/entries${queryString}`;
1024
1028
  const response = await this.http.fetch(endpoint);
1025
- return (response.data || []).map(toListEntry);
1029
+ const data = response.data || [];
1030
+ if (options.expand === "full" && data.every(isFullEntryData)) {
1031
+ return data.map((entry) => new Entry(entry));
1032
+ }
1033
+ return data.map(toListEntry);
1026
1034
  }
1027
1035
  /**
1028
1036
  * Get a single entry by slug
@@ -1134,6 +1142,7 @@ var init_collections = __esm({
1134
1142
  "src/collections/collections.ts"() {
1135
1143
  "use strict";
1136
1144
  init_collection();
1145
+ init_entry();
1137
1146
  init_errors();
1138
1147
  CollectionsModule = class {
1139
1148
  constructor(http, workspaceSlug) {
@@ -1166,18 +1175,25 @@ var init_collections = __esm({
1166
1175
  throw error;
1167
1176
  }
1168
1177
  }
1169
- /**
1170
- * Get entries in a collection with junction context surfaced directly.
1171
- * Each entry has role/position/junctionMetadata from this collection's junction,
1172
- * and collections reduced to slugs of other memberships.
1173
- * Returns empty array if collection is not found.
1174
- */
1175
- async entries(slug) {
1176
- const collection = await this.get(slug);
1177
- if (Array.isArray(collection)) {
1178
- return collection;
1178
+ async entries(slug, options = {}) {
1179
+ if (options.expand !== "full") {
1180
+ const collection = await this.get(slug);
1181
+ return Array.isArray(collection) ? collection : collection.entries;
1182
+ }
1183
+ let data;
1184
+ try {
1185
+ data = await this.http.fetch(
1186
+ `/api/publish/${this.workspaceSlug}/collections/${slug}?expand=full`
1187
+ );
1188
+ } catch (error) {
1189
+ if (error instanceof MarvinNotFoundError) return [];
1190
+ throw error;
1191
+ }
1192
+ const entries = data.entries ?? [];
1193
+ if (entries.every(isFullEntryData)) {
1194
+ return data.entries.map((entry) => new Entry(entry));
1179
1195
  }
1180
- return collection.entries;
1196
+ return new Collection(data).entries;
1181
1197
  }
1182
1198
  /**
1183
1199
  * Try multiple collection slugs in fallback order.
@@ -1665,6 +1681,7 @@ __export(index_exports, {
1665
1681
  createMarvinClient: () => createMarvinClient,
1666
1682
  createPaginatedResponse: () => createPaginatedResponse,
1667
1683
  extractData: () => extractData,
1684
+ isFullEntryData: () => isFullEntryData,
1668
1685
  isPaginatedResponse: () => isPaginatedResponse,
1669
1686
  offsetToPage: () => offsetToPage,
1670
1687
  pageToOffset: () => pageToOffset
@@ -1766,6 +1783,7 @@ function createMarvinClient(config) {
1766
1783
  createMarvinClient,
1767
1784
  createPaginatedResponse,
1768
1785
  extractData,
1786
+ isFullEntryData,
1769
1787
  isPaginatedResponse,
1770
1788
  offsetToPage,
1771
1789
  pageToOffset
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { M as MarvinConfig, a as MarvinClient } from './marvin-6keK-yvS.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 isPaginatedResponse, q as offsetToPage, r as pageToOffset } from './marvin-6keK-yvS.cjs';
1
+ import { M as MarvinConfig, a as MarvinClient } from './marvin-BiXcixLB.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-BiXcixLB.cjs';
3
3
  import { H as HttpClient } from './HttpClient-B_rEmJuO.cjs';
4
4
  export { A as AuthStrategy, B as BearerTokenAuth, a as HttpClientConfig, N as NoAuth, S as SessionAuth } from './HttpClient-B_rEmJuO.cjs';
5
- import { A as AuthToken$1 } from './index-CX4jvPAA.cjs';
6
- export { C as CollectionContext, a as CollectionEntry, b as CollectionEntryMetadata, E as EntryAsset, c as EntryCollectionContext, d as EntryResource, G as GetAssetsOptions, e as GetEntriesOptions, f as GetResourcesOptions, L as ListEntry, M as MarvinAsset, g as MarvinCollection, h as MarvinEntry, i as MarvinEntryListItem, j as MarvinEntryType, k as MarvinPublishResponse, l as MarvinResource, m as MarvinSite, P as PublishedAssetRead, n as PublishedCollectionSummary, o as PublishedEntryAsset, p as PublishedEntryResource, q as PublishedEntryType, S as SiteConfiguration, W as WorkspaceInfo } from './index-CX4jvPAA.cjs';
5
+ import { A as AuthToken$1 } from './index-BEEbnrXV.cjs';
6
+ export { C as CollectionContext, a as CollectionEntry, b as CollectionEntryMetadata, E as EntryAsset, c as EntryCollectionContext, d as EntryResource, e as ExpandOptions, G as GetAssetsOptions, f as GetEntriesOptions, g as GetResourcesOptions, L as ListEntry, 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 PublishedEntryType, S as SiteConfiguration, W as WorkspaceInfo } from './index-BEEbnrXV.cjs';
7
7
 
8
8
  /**
9
9
  * Authentication & User Registration
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { M as MarvinConfig, a as MarvinClient } from './marvin-Cndwz82G.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 isPaginatedResponse, q as offsetToPage, r as pageToOffset } from './marvin-Cndwz82G.js';
1
+ import { M as MarvinConfig, a as MarvinClient } from './marvin-BjJXe-YT.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-BjJXe-YT.js';
3
3
  import { H as HttpClient } from './HttpClient-B_rEmJuO.js';
4
4
  export { A as AuthStrategy, B as BearerTokenAuth, a as HttpClientConfig, N as NoAuth, S as SessionAuth } from './HttpClient-B_rEmJuO.js';
5
- import { A as AuthToken$1 } from './index-CX4jvPAA.js';
6
- export { C as CollectionContext, a as CollectionEntry, b as CollectionEntryMetadata, E as EntryAsset, c as EntryCollectionContext, d as EntryResource, G as GetAssetsOptions, e as GetEntriesOptions, f as GetResourcesOptions, L as ListEntry, M as MarvinAsset, g as MarvinCollection, h as MarvinEntry, i as MarvinEntryListItem, j as MarvinEntryType, k as MarvinPublishResponse, l as MarvinResource, m as MarvinSite, P as PublishedAssetRead, n as PublishedCollectionSummary, o as PublishedEntryAsset, p as PublishedEntryResource, q as PublishedEntryType, S as SiteConfiguration, W as WorkspaceInfo } from './index-CX4jvPAA.js';
5
+ import { A as AuthToken$1 } from './index-BEEbnrXV.js';
6
+ export { C as CollectionContext, a as CollectionEntry, b as CollectionEntryMetadata, E as EntryAsset, c as EntryCollectionContext, d as EntryResource, e as ExpandOptions, G as GetAssetsOptions, f as GetEntriesOptions, g as GetResourcesOptions, L as ListEntry, 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 PublishedEntryType, S as SiteConfiguration, W as WorkspaceInfo } from './index-BEEbnrXV.js';
7
7
 
8
8
  /**
9
9
  * Authentication & User Registration
package/dist/index.js CHANGED
@@ -12,8 +12,9 @@ import {
12
12
  init_marvin,
13
13
  init_resource,
14
14
  init_workspace,
15
+ isFullEntryData,
15
16
  marvin_exports
16
- } from "./chunk-VS6R3V3K.js";
17
+ } from "./chunk-HFNIFS2A.js";
17
18
  import {
18
19
  BearerTokenAuth,
19
20
  HttpClient,
@@ -134,6 +135,7 @@ export {
134
135
  createMarvinClient,
135
136
  createPaginatedResponse,
136
137
  extractData,
138
+ isFullEntryData,
137
139
  isPaginatedResponse,
138
140
  offsetToPage,
139
141
  pageToOffset
@@ -1,4 +1,4 @@
1
- import { q as PublishedEntryType, l as MarvinResource, M as MarvinAsset, g as MarvinCollection, a as CollectionEntry, n as PublishedCollectionSummary, h as MarvinEntry, E as EntryAsset, c as EntryCollectionContext, d as EntryResource, L as ListEntry, m as MarvinSite, f as GetResourcesOptions$1 } from './index-CX4jvPAA.cjs';
1
+ import { s as PublishedEntryType, n as MarvinResource, M as MarvinAsset, h as MarvinCollection, a as CollectionEntry, j as MarvinEntry, E as EntryAsset, c as EntryCollectionContext, d as EntryResource, p as PublishedCollectionSummary, e as ExpandOptions, L as ListEntry, o as MarvinSite, g as GetResourcesOptions$1 } from './index-BEEbnrXV.cjs';
2
2
  import { H as HttpClient } from './HttpClient-B_rEmJuO.cjs';
3
3
 
4
4
  /**
@@ -316,42 +316,15 @@ declare class Collection {
316
316
  }
317
317
 
318
318
  /**
319
- * Collections Module - Manage collections
319
+ * Entry - Rich object representing a single entry
320
320
  */
321
321
 
322
- declare class CollectionsModule {
323
- private http;
324
- private workspaceSlug;
325
- constructor(http: MarvinHttpClient, workspaceSlug: string);
326
- /**
327
- * Get all collections
328
- */
329
- list(): Promise<PublishedCollectionSummary[]>;
330
- /**
331
- * Get a single collection by slug.
332
- * Returns an empty array if the collection is not found (404).
333
- */
334
- get(slug: string): Promise<Collection | []>;
335
- /**
336
- * Get entries in a collection with junction context surfaced directly.
337
- * Each entry has role/position/junctionMetadata from this collection's junction,
338
- * and collections reduced to slugs of other memberships.
339
- * Returns empty array if collection is not found.
340
- */
341
- entries(slug: string): Promise<CollectionEntry[]>;
342
- /**
343
- * Try multiple collection slugs in fallback order.
344
- * Returns entries from the first collection that exists and has entries.
345
- */
346
- fallback(slugs: string[], options?: {
347
- requireEntries?: boolean;
348
- }): Promise<CollectionEntry[]>;
349
- }
350
-
351
322
  /**
352
- * Entry - Rich object representing a single entry
323
+ * True for a full entry as the API sends it (`PublishedEntryRead`): `assets[]` placements and no
324
+ * `assetSlugs`/`resourceSlugs`. A list item (`PublishedEntryListItem`) has only the slugs. Lets an
325
+ * `expand: 'full'` read tell an expanded response from an older server's list items.
353
326
  */
354
-
327
+ declare function isFullEntryData(raw: unknown): raw is MarvinEntry;
355
328
  declare class Entry {
356
329
  private raw;
357
330
  constructor(raw: MarvinEntry);
@@ -389,6 +362,46 @@ declare class Entry {
389
362
  toJSON(): MarvinEntry;
390
363
  }
391
364
 
365
+ /**
366
+ * Collections Module - Manage collections
367
+ */
368
+
369
+ declare class CollectionsModule {
370
+ private http;
371
+ private workspaceSlug;
372
+ constructor(http: MarvinHttpClient, workspaceSlug: string);
373
+ /**
374
+ * Get all collections
375
+ */
376
+ list(): Promise<PublishedCollectionSummary[]>;
377
+ /**
378
+ * Get a single collection by slug.
379
+ * Returns an empty array if the collection is not found (404).
380
+ */
381
+ get(slug: string): Promise<Collection | []>;
382
+ /**
383
+ * Get entries in a collection with junction context surfaced directly.
384
+ * Each entry has role/position/junctionMetadata from this collection's junction,
385
+ * and collections reduced to slugs of other memberships.
386
+ * Returns empty array if collection is not found.
387
+ *
388
+ * With `{ expand: 'full' }` the whole collection comes back as full entries in one request:
389
+ * `Entry` objects, the same as `entry(slug)` returns, each with its `order` in this collection
390
+ * and every membership under `collections`. A server without `expand` support (or a collection
391
+ * past the server's expand cap) returns list items instead; those come back as
392
+ * `CollectionEntry[]`, exactly as without the option, so check with `instanceof Entry`.
393
+ */
394
+ entries(slug: string): Promise<CollectionEntry[]>;
395
+ entries(slug: string, options?: ExpandOptions): Promise<Entry[] | CollectionEntry[]>;
396
+ /**
397
+ * Try multiple collection slugs in fallback order.
398
+ * Returns entries from the first collection that exists and has entries.
399
+ */
400
+ fallback(slugs: string[], options?: {
401
+ requireEntries?: boolean;
402
+ }): Promise<CollectionEntry[]>;
403
+ }
404
+
392
405
  /**
393
406
  * Entries Module - Manage entries
394
407
  */
@@ -406,8 +419,13 @@ declare class EntriesModule {
406
419
  constructor(http: MarvinHttpClient, workspaceSlug: string);
407
420
  /**
408
421
  * Get all published entries
422
+ *
423
+ * With `{ expand: 'full' }` each entry on the page comes back as a full `Entry` (the
424
+ * single-entry read), so no per-entry reads are needed. A server without `expand` support
425
+ * returns list items instead; those come back as `ListEntry[]`, as without the option.
409
426
  */
410
427
  list(options?: GetEntriesOptions): Promise<ListEntry[]>;
428
+ list(options: GetEntriesOptions & ExpandOptions): Promise<Entry[] | ListEntry[]>;
411
429
  /**
412
430
  * Get a single entry by slug
413
431
  * Returns null if entry is not found (404)
@@ -580,4 +598,4 @@ declare class MarvinClient {
580
598
  getResourceEntries(slug: string): Promise<string[]>;
581
599
  }
582
600
 
583
- export { Collection as C, Entry as E, type MarvinConfig as M, type PaginatedResponse as P, Resource as R, Workspace as W, MarvinClient as a, MarvinApiError as b, MarvinAuthError as c, MarvinCache as d, MarvinConfigError as e, MarvinError as f, MarvinNetworkError as g, MarvinNotFoundError as h, MarvinServerError as i, MarvinValidationError as j, type PaginationMeta as k, type PaginationParams as l, createConfigFromEnv as m, createPaginatedResponse as n, extractData as o, isPaginatedResponse as p, offsetToPage as q, pageToOffset as r };
601
+ export { Collection as C, Entry as E, type MarvinConfig as M, type PaginatedResponse as P, Resource as R, Workspace as W, MarvinClient as a, MarvinApiError as b, MarvinAuthError as c, MarvinCache as d, MarvinConfigError as e, MarvinError as f, MarvinNetworkError as g, MarvinNotFoundError as h, MarvinServerError as i, MarvinValidationError as j, type PaginationMeta as k, type PaginationParams as l, createConfigFromEnv as m, createPaginatedResponse as n, extractData as o, isFullEntryData as p, isPaginatedResponse as q, offsetToPage as r, pageToOffset as s };
@@ -1,4 +1,4 @@
1
- import { q as PublishedEntryType, l as MarvinResource, M as MarvinAsset, g as MarvinCollection, a as CollectionEntry, n as PublishedCollectionSummary, h as MarvinEntry, E as EntryAsset, c as EntryCollectionContext, d as EntryResource, L as ListEntry, m as MarvinSite, f as GetResourcesOptions$1 } from './index-CX4jvPAA.js';
1
+ import { s as PublishedEntryType, n as MarvinResource, M as MarvinAsset, h as MarvinCollection, a as CollectionEntry, j as MarvinEntry, E as EntryAsset, c as EntryCollectionContext, d as EntryResource, p as PublishedCollectionSummary, e as ExpandOptions, L as ListEntry, o as MarvinSite, g as GetResourcesOptions$1 } from './index-BEEbnrXV.js';
2
2
  import { H as HttpClient } from './HttpClient-B_rEmJuO.js';
3
3
 
4
4
  /**
@@ -316,42 +316,15 @@ declare class Collection {
316
316
  }
317
317
 
318
318
  /**
319
- * Collections Module - Manage collections
319
+ * Entry - Rich object representing a single entry
320
320
  */
321
321
 
322
- declare class CollectionsModule {
323
- private http;
324
- private workspaceSlug;
325
- constructor(http: MarvinHttpClient, workspaceSlug: string);
326
- /**
327
- * Get all collections
328
- */
329
- list(): Promise<PublishedCollectionSummary[]>;
330
- /**
331
- * Get a single collection by slug.
332
- * Returns an empty array if the collection is not found (404).
333
- */
334
- get(slug: string): Promise<Collection | []>;
335
- /**
336
- * Get entries in a collection with junction context surfaced directly.
337
- * Each entry has role/position/junctionMetadata from this collection's junction,
338
- * and collections reduced to slugs of other memberships.
339
- * Returns empty array if collection is not found.
340
- */
341
- entries(slug: string): Promise<CollectionEntry[]>;
342
- /**
343
- * Try multiple collection slugs in fallback order.
344
- * Returns entries from the first collection that exists and has entries.
345
- */
346
- fallback(slugs: string[], options?: {
347
- requireEntries?: boolean;
348
- }): Promise<CollectionEntry[]>;
349
- }
350
-
351
322
  /**
352
- * Entry - Rich object representing a single entry
323
+ * True for a full entry as the API sends it (`PublishedEntryRead`): `assets[]` placements and no
324
+ * `assetSlugs`/`resourceSlugs`. A list item (`PublishedEntryListItem`) has only the slugs. Lets an
325
+ * `expand: 'full'` read tell an expanded response from an older server's list items.
353
326
  */
354
-
327
+ declare function isFullEntryData(raw: unknown): raw is MarvinEntry;
355
328
  declare class Entry {
356
329
  private raw;
357
330
  constructor(raw: MarvinEntry);
@@ -389,6 +362,46 @@ declare class Entry {
389
362
  toJSON(): MarvinEntry;
390
363
  }
391
364
 
365
+ /**
366
+ * Collections Module - Manage collections
367
+ */
368
+
369
+ declare class CollectionsModule {
370
+ private http;
371
+ private workspaceSlug;
372
+ constructor(http: MarvinHttpClient, workspaceSlug: string);
373
+ /**
374
+ * Get all collections
375
+ */
376
+ list(): Promise<PublishedCollectionSummary[]>;
377
+ /**
378
+ * Get a single collection by slug.
379
+ * Returns an empty array if the collection is not found (404).
380
+ */
381
+ get(slug: string): Promise<Collection | []>;
382
+ /**
383
+ * Get entries in a collection with junction context surfaced directly.
384
+ * Each entry has role/position/junctionMetadata from this collection's junction,
385
+ * and collections reduced to slugs of other memberships.
386
+ * Returns empty array if collection is not found.
387
+ *
388
+ * With `{ expand: 'full' }` the whole collection comes back as full entries in one request:
389
+ * `Entry` objects, the same as `entry(slug)` returns, each with its `order` in this collection
390
+ * and every membership under `collections`. A server without `expand` support (or a collection
391
+ * past the server's expand cap) returns list items instead; those come back as
392
+ * `CollectionEntry[]`, exactly as without the option, so check with `instanceof Entry`.
393
+ */
394
+ entries(slug: string): Promise<CollectionEntry[]>;
395
+ entries(slug: string, options?: ExpandOptions): Promise<Entry[] | CollectionEntry[]>;
396
+ /**
397
+ * Try multiple collection slugs in fallback order.
398
+ * Returns entries from the first collection that exists and has entries.
399
+ */
400
+ fallback(slugs: string[], options?: {
401
+ requireEntries?: boolean;
402
+ }): Promise<CollectionEntry[]>;
403
+ }
404
+
392
405
  /**
393
406
  * Entries Module - Manage entries
394
407
  */
@@ -406,8 +419,13 @@ declare class EntriesModule {
406
419
  constructor(http: MarvinHttpClient, workspaceSlug: string);
407
420
  /**
408
421
  * Get all published entries
422
+ *
423
+ * With `{ expand: 'full' }` each entry on the page comes back as a full `Entry` (the
424
+ * single-entry read), so no per-entry reads are needed. A server without `expand` support
425
+ * returns list items instead; those come back as `ListEntry[]`, as without the option.
409
426
  */
410
427
  list(options?: GetEntriesOptions): Promise<ListEntry[]>;
428
+ list(options: GetEntriesOptions & ExpandOptions): Promise<Entry[] | ListEntry[]>;
411
429
  /**
412
430
  * Get a single entry by slug
413
431
  * Returns null if entry is not found (404)
@@ -580,4 +598,4 @@ declare class MarvinClient {
580
598
  getResourceEntries(slug: string): Promise<string[]>;
581
599
  }
582
600
 
583
- export { Collection as C, Entry as E, type MarvinConfig as M, type PaginatedResponse as P, Resource as R, Workspace as W, MarvinClient as a, MarvinApiError as b, MarvinAuthError as c, MarvinCache as d, MarvinConfigError as e, MarvinError as f, MarvinNetworkError as g, MarvinNotFoundError as h, MarvinServerError as i, MarvinValidationError as j, type PaginationMeta as k, type PaginationParams as l, createConfigFromEnv as m, createPaginatedResponse as n, extractData as o, isPaginatedResponse as p, offsetToPage as q, pageToOffset as r };
601
+ export { Collection as C, Entry as E, type MarvinConfig as M, type PaginatedResponse as P, Resource as R, Workspace as W, MarvinClient as a, MarvinApiError as b, MarvinAuthError as c, MarvinCache as d, MarvinConfigError as e, MarvinError as f, MarvinNetworkError as g, MarvinNotFoundError as h, MarvinServerError as i, MarvinValidationError as j, type PaginationMeta as k, type PaginationParams as l, createConfigFromEnv as m, createPaginatedResponse as n, extractData as o, isFullEntryData as p, isPaginatedResponse as q, offsetToPage as r, pageToOffset as s };
@@ -1,5 +1,5 @@
1
1
  import { H as HttpClient } from './HttpClient-B_rEmJuO.cjs';
2
- import { r as components, A as AuthToken } from './index-CX4jvPAA.cjs';
2
+ import { t as components, A as AuthToken } from './index-BEEbnrXV.cjs';
3
3
 
4
4
  /**
5
5
  * Platform API Types
@@ -1,5 +1,5 @@
1
1
  import { H as HttpClient } from './HttpClient-B_rEmJuO.js';
2
- import { r as components, A as AuthToken } from './index-CX4jvPAA.js';
2
+ import { t as components, A as AuthToken } from './index-BEEbnrXV.js';
3
3
 
4
4
  /**
5
5
  * Platform API Types
package/dist/publish.cjs CHANGED
@@ -169,6 +169,7 @@ __export(publish_exports, {
169
169
  createMarvinClient: () => createMarvinClient,
170
170
  createPaginatedResponse: () => createPaginatedResponse,
171
171
  extractData: () => extractData,
172
+ isFullEntryData: () => isFullEntryData,
172
173
  isPaginatedResponse: () => isPaginatedResponse,
173
174
  offsetToPage: () => offsetToPage,
174
175
  pageToOffset: () => pageToOffset
@@ -774,6 +775,12 @@ var MarvinHttpClient = class extends HttpClient {
774
775
  };
775
776
 
776
777
  // src/entries/entry.ts
778
+ function isFullEntryData(raw) {
779
+ if (!raw || typeof raw !== "object") return false;
780
+ const record = raw;
781
+ if ("assetSlugs" in record || "resourceSlugs" in record) return false;
782
+ return Array.isArray(record.assets) || Array.isArray(record.resources);
783
+ }
777
784
  var Entry = class {
778
785
  constructor(raw) {
779
786
  this.raw = raw;
@@ -857,19 +864,21 @@ var EntriesModule = class {
857
864
  }
858
865
  http;
859
866
  workspaceSlug;
860
- /**
861
- * Get all published entries
862
- */
863
867
  async list(options = {}) {
864
868
  const queryString = this.http.buildQueryString({
865
869
  entry_type: options.entryType,
866
870
  collection: options.collection,
867
871
  limit: options.limit,
868
- offset: options.offset
872
+ offset: options.offset,
873
+ expand: options.expand
869
874
  });
870
875
  const endpoint = `/api/publish/${this.workspaceSlug}/entries${queryString}`;
871
876
  const response = await this.http.fetch(endpoint);
872
- return (response.data || []).map(toListEntry);
877
+ const data = response.data || [];
878
+ if (options.expand === "full" && data.every(isFullEntryData)) {
879
+ return data.map((entry) => new Entry(entry));
880
+ }
881
+ return data.map(toListEntry);
873
882
  }
874
883
  /**
875
884
  * Get a single entry by slug
@@ -999,18 +1008,25 @@ var CollectionsModule = class {
999
1008
  throw error;
1000
1009
  }
1001
1010
  }
1002
- /**
1003
- * Get entries in a collection with junction context surfaced directly.
1004
- * Each entry has role/position/junctionMetadata from this collection's junction,
1005
- * and collections reduced to slugs of other memberships.
1006
- * Returns empty array if collection is not found.
1007
- */
1008
- async entries(slug) {
1009
- const collection = await this.get(slug);
1010
- if (Array.isArray(collection)) {
1011
- return collection;
1011
+ async entries(slug, options = {}) {
1012
+ if (options.expand !== "full") {
1013
+ const collection = await this.get(slug);
1014
+ return Array.isArray(collection) ? collection : collection.entries;
1015
+ }
1016
+ let data;
1017
+ try {
1018
+ data = await this.http.fetch(
1019
+ `/api/publish/${this.workspaceSlug}/collections/${slug}?expand=full`
1020
+ );
1021
+ } catch (error) {
1022
+ if (error instanceof MarvinNotFoundError) return [];
1023
+ throw error;
1024
+ }
1025
+ const entries = data.entries ?? [];
1026
+ if (entries.every(isFullEntryData)) {
1027
+ return data.entries.map((entry) => new Entry(entry));
1012
1028
  }
1013
- return collection.entries;
1029
+ return new Collection(data).entries;
1014
1030
  }
1015
1031
  /**
1016
1032
  * Try multiple collection slugs in fallback order.
@@ -1449,6 +1465,7 @@ function createMarvinClient(config) {
1449
1465
  createMarvinClient,
1450
1466
  createPaginatedResponse,
1451
1467
  extractData,
1468
+ isFullEntryData,
1452
1469
  isPaginatedResponse,
1453
1470
  offsetToPage,
1454
1471
  pageToOffset
@@ -1,6 +1,6 @@
1
- import { M as MarvinConfig, a as MarvinClient } from './marvin-6keK-yvS.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 isPaginatedResponse, q as offsetToPage, r as pageToOffset } from './marvin-6keK-yvS.cjs';
3
- export { G as GetAssetsOptions, e as GetEntriesOptions, f as GetResourcesOptions, M as MarvinAsset, g as MarvinCollection, h as MarvinEntry, i as MarvinEntryListItem, j as MarvinEntryType, k as MarvinPublishResponse, l as MarvinResource, m as MarvinSite, P as PublishedAssetRead, n as PublishedCollectionSummary, o as PublishedEntryAsset, p as PublishedEntryResource, S as SiteConfiguration, W as WorkspaceInfo } from './index-CX4jvPAA.cjs';
1
+ import { M as MarvinConfig, a as MarvinClient } from './marvin-BiXcixLB.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-BiXcixLB.cjs';
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-BEEbnrXV.cjs';
4
4
  export { A as AuthStrategy, B as BearerTokenAuth, H as HttpClient, a as HttpClientConfig } from './HttpClient-B_rEmJuO.cjs';
5
5
 
6
6
  /**
package/dist/publish.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { M as MarvinConfig, a as MarvinClient } from './marvin-Cndwz82G.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 isPaginatedResponse, q as offsetToPage, r as pageToOffset } from './marvin-Cndwz82G.js';
3
- export { G as GetAssetsOptions, e as GetEntriesOptions, f as GetResourcesOptions, M as MarvinAsset, g as MarvinCollection, h as MarvinEntry, i as MarvinEntryListItem, j as MarvinEntryType, k as MarvinPublishResponse, l as MarvinResource, m as MarvinSite, P as PublishedAssetRead, n as PublishedCollectionSummary, o as PublishedEntryAsset, p as PublishedEntryResource, S as SiteConfiguration, W as WorkspaceInfo } from './index-CX4jvPAA.js';
1
+ import { M as MarvinConfig, a as MarvinClient } from './marvin-BjJXe-YT.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-BjJXe-YT.js';
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-BEEbnrXV.js';
4
4
  export { A as AuthStrategy, B as BearerTokenAuth, H as HttpClient, a as HttpClientConfig } from './HttpClient-B_rEmJuO.js';
5
5
 
6
6
  /**
package/dist/publish.js CHANGED
@@ -11,8 +11,9 @@ import {
11
11
  init_entry,
12
12
  init_marvin,
13
13
  init_resource,
14
- init_workspace
15
- } from "./chunk-VS6R3V3K.js";
14
+ init_workspace,
15
+ isFullEntryData
16
+ } from "./chunk-HFNIFS2A.js";
16
17
  import {
17
18
  BearerTokenAuth,
18
19
  HttpClient,
@@ -69,6 +70,7 @@ export {
69
70
  createMarvinClient,
70
71
  createPaginatedResponse,
71
72
  extractData,
73
+ isFullEntryData,
72
74
  isPaginatedResponse,
73
75
  offsetToPage,
74
76
  pageToOffset
@@ -1 +1 @@
1
- export { s as AssetAttachment, t as AssetUploadRequest, A as AuthToken, u as CollectionAttachment, C as CollectionContext, a as CollectionEntry, b as CollectionEntryMetadata, E as EntryAsset, c as EntryCollectionContext, v as EntryCollectionRead, d as EntryResource, G as GetAssetsOptions, e as GetEntriesOptions, f as GetResourcesOptions, L as ListEntry, M as MarvinAsset, w as MarvinClientConfig, g as MarvinCollection, h as MarvinEntry, i as MarvinEntryListItem, j as MarvinEntryType, k as MarvinPublishResponse, l as MarvinResource, m as MarvinSite, P as PublishedAssetRead, n as PublishedCollectionSummary, o as PublishedEntryAsset, x as PublishedEntryCollection, p as PublishedEntryResource, q as PublishedEntryType, y as PublishedResourceSummary, R as ResourceAttachment, S as SiteConfiguration, z as SiteSeo, B as SiteSeoVerification, W as WorkspaceInfo } from '../index-CX4jvPAA.cjs';
1
+ export { u as AssetAttachment, v as AssetUploadRequest, A as AuthToken, w as CollectionAttachment, C as CollectionContext, a as CollectionEntry, b as CollectionEntryMetadata, E as EntryAsset, c as EntryCollectionContext, x as EntryCollectionRead, d as EntryResource, e as ExpandOptions, G as GetAssetsOptions, f as GetEntriesOptions, g as GetResourcesOptions, L as ListEntry, M as MarvinAsset, y as MarvinClientConfig, 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, z as PublishedEntryCollection, r as PublishedEntryResource, s as PublishedEntryType, B as PublishedResourceSummary, R as ResourceAttachment, S as SiteConfiguration, D as SiteSeo, F as SiteSeoVerification, W as WorkspaceInfo } from '../index-BEEbnrXV.cjs';
@@ -1 +1 @@
1
- export { s as AssetAttachment, t as AssetUploadRequest, A as AuthToken, u as CollectionAttachment, C as CollectionContext, a as CollectionEntry, b as CollectionEntryMetadata, E as EntryAsset, c as EntryCollectionContext, v as EntryCollectionRead, d as EntryResource, G as GetAssetsOptions, e as GetEntriesOptions, f as GetResourcesOptions, L as ListEntry, M as MarvinAsset, w as MarvinClientConfig, g as MarvinCollection, h as MarvinEntry, i as MarvinEntryListItem, j as MarvinEntryType, k as MarvinPublishResponse, l as MarvinResource, m as MarvinSite, P as PublishedAssetRead, n as PublishedCollectionSummary, o as PublishedEntryAsset, x as PublishedEntryCollection, p as PublishedEntryResource, q as PublishedEntryType, y as PublishedResourceSummary, R as ResourceAttachment, S as SiteConfiguration, z as SiteSeo, B as SiteSeoVerification, W as WorkspaceInfo } from '../index-CX4jvPAA.js';
1
+ export { u as AssetAttachment, v as AssetUploadRequest, A as AuthToken, w as CollectionAttachment, C as CollectionContext, a as CollectionEntry, b as CollectionEntryMetadata, E as EntryAsset, c as EntryCollectionContext, x as EntryCollectionRead, d as EntryResource, e as ExpandOptions, G as GetAssetsOptions, f as GetEntriesOptions, g as GetResourcesOptions, L as ListEntry, M as MarvinAsset, y as MarvinClientConfig, 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, z as PublishedEntryCollection, r as PublishedEntryResource, s as PublishedEntryType, B as PublishedResourceSummary, R as ResourceAttachment, S as SiteConfiguration, D as SiteSeo, F as SiteSeoVerification, W as WorkspaceInfo } from '../index-BEEbnrXV.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneropen/marvin-sdk",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "Official TypeScript SDK for Marvin CMS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",