@inneropen/marvin-sdk 3.2.0-next.1 → 3.2.0-next.11
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/{chunk-WJC4X7TB.js → chunk-SVH7AMMY.js} +6 -6
- package/dist/{chunk-R3EZI43S.js → chunk-YHBF2SB3.js} +65 -18
- package/dist/{index-D4PQGrOK.d.cts → index-BVm5dIcw.d.cts} +150 -35
- package/dist/{index-D4PQGrOK.d.ts → index-BVm5dIcw.d.ts} +150 -35
- package/dist/index.cjs +70 -23
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/{marvin-DWlYHd6f.d.ts → marvin-BZ4meaB-.d.ts} +32 -73
- package/dist/{marvin-BLhk8ZKO.d.cts → marvin-RZZj02LS.d.cts} +32 -73
- package/dist/platform.cjs +28 -6
- package/dist/platform.d.cts +14 -1
- package/dist/platform.d.ts +14 -1
- package/dist/platform.js +23 -1
- package/dist/publish.cjs +70 -23
- package/dist/publish.d.cts +3 -3
- package/dist/publish.d.ts +3 -3
- package/dist/publish.js +2 -2
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -250,10 +250,6 @@ interface components {
|
|
|
250
250
|
role?: string | null;
|
|
251
251
|
/** Position */
|
|
252
252
|
position?: number | null;
|
|
253
|
-
/** Caption */
|
|
254
|
-
caption?: string | null;
|
|
255
|
-
/** Focal Point */
|
|
256
|
-
focal_point?: string | null;
|
|
257
253
|
/** Metadata */
|
|
258
254
|
metadata?: {
|
|
259
255
|
[key: string]: unknown;
|
|
@@ -306,8 +302,8 @@ interface components {
|
|
|
306
302
|
publicUrl?: string | null;
|
|
307
303
|
/** Description */
|
|
308
304
|
description?: string | null;
|
|
309
|
-
/**
|
|
310
|
-
|
|
305
|
+
/** Metadatajson */
|
|
306
|
+
metadataJson?: {
|
|
311
307
|
[key: string]: unknown;
|
|
312
308
|
} | null;
|
|
313
309
|
/**
|
|
@@ -411,6 +407,20 @@ interface components {
|
|
|
411
407
|
/** Isuptodate */
|
|
412
408
|
isUpToDate: boolean;
|
|
413
409
|
};
|
|
410
|
+
/** CollectionAttachment */
|
|
411
|
+
CollectionAttachment: {
|
|
412
|
+
/**
|
|
413
|
+
* Collection Id
|
|
414
|
+
* Format: uuid4
|
|
415
|
+
*/
|
|
416
|
+
collection_id: string;
|
|
417
|
+
/** Role */
|
|
418
|
+
role?: string | null;
|
|
419
|
+
/** Metadata */
|
|
420
|
+
metadata?: {
|
|
421
|
+
[key: string]: unknown;
|
|
422
|
+
} | null;
|
|
423
|
+
};
|
|
414
424
|
/**
|
|
415
425
|
* CollectionCreate
|
|
416
426
|
* @description Schema for creating a new collection.
|
|
@@ -744,10 +754,6 @@ interface components {
|
|
|
744
754
|
* @default 0
|
|
745
755
|
*/
|
|
746
756
|
position: number;
|
|
747
|
-
/** Focalpoint */
|
|
748
|
-
focalPoint?: string | null;
|
|
749
|
-
/** Caption */
|
|
750
|
-
caption?: string | null;
|
|
751
757
|
/** Placementmetadata */
|
|
752
758
|
placementMetadata?: {
|
|
753
759
|
[key: string]: unknown;
|
|
@@ -794,8 +800,8 @@ interface components {
|
|
|
794
800
|
publicUrl?: string | null;
|
|
795
801
|
/** Description */
|
|
796
802
|
description?: string | null;
|
|
797
|
-
/**
|
|
798
|
-
|
|
803
|
+
/** Metadatajson */
|
|
804
|
+
metadataJson?: {
|
|
799
805
|
[key: string]: unknown;
|
|
800
806
|
} | null;
|
|
801
807
|
/**
|
|
@@ -804,6 +810,36 @@ interface components {
|
|
|
804
810
|
*/
|
|
805
811
|
uploadedBy: string;
|
|
806
812
|
};
|
|
813
|
+
/**
|
|
814
|
+
* EntryCollectionRead
|
|
815
|
+
* @description Collection summary with entry-specific placement details.
|
|
816
|
+
*/
|
|
817
|
+
EntryCollectionRead: {
|
|
818
|
+
/**
|
|
819
|
+
* Id
|
|
820
|
+
* Format: uuid4
|
|
821
|
+
*/
|
|
822
|
+
id: string;
|
|
823
|
+
/** Name */
|
|
824
|
+
name: string;
|
|
825
|
+
/** Slug */
|
|
826
|
+
slug: string;
|
|
827
|
+
/** Icon */
|
|
828
|
+
icon?: string | null;
|
|
829
|
+
/** Color */
|
|
830
|
+
color?: string | null;
|
|
831
|
+
/** Role */
|
|
832
|
+
role?: string | null;
|
|
833
|
+
/** Placementmetadata */
|
|
834
|
+
placementMetadata?: {
|
|
835
|
+
[key: string]: unknown;
|
|
836
|
+
} | null;
|
|
837
|
+
/**
|
|
838
|
+
* Sortorder
|
|
839
|
+
* @default 0
|
|
840
|
+
*/
|
|
841
|
+
sortOrder: number;
|
|
842
|
+
};
|
|
807
843
|
/**
|
|
808
844
|
* EntryCreate
|
|
809
845
|
* @description Schema for creating an entry.
|
|
@@ -852,6 +888,8 @@ interface components {
|
|
|
852
888
|
} | null;
|
|
853
889
|
/** Collectionids */
|
|
854
890
|
collectionIds?: string[] | null;
|
|
891
|
+
/** Collectionattachments */
|
|
892
|
+
collectionAttachments?: components["schemas"]["CollectionAttachment"][] | null;
|
|
855
893
|
/** Assetids */
|
|
856
894
|
assetIds?: string[] | null;
|
|
857
895
|
/** Resourceids */
|
|
@@ -947,7 +985,7 @@ interface components {
|
|
|
947
985
|
* Collections
|
|
948
986
|
* @default []
|
|
949
987
|
*/
|
|
950
|
-
collections:
|
|
988
|
+
collections: components["schemas"]["EntryCollectionRead"][];
|
|
951
989
|
/** Order */
|
|
952
990
|
order?: number | null;
|
|
953
991
|
};
|
|
@@ -958,10 +996,6 @@ interface components {
|
|
|
958
996
|
EntryResourceRead: {
|
|
959
997
|
/** Role */
|
|
960
998
|
role?: string | null;
|
|
961
|
-
/** Quantity */
|
|
962
|
-
quantity?: string | null;
|
|
963
|
-
/** Unit */
|
|
964
|
-
unit?: string | null;
|
|
965
999
|
/**
|
|
966
1000
|
* Position
|
|
967
1001
|
* @default 0
|
|
@@ -1225,6 +1259,8 @@ interface components {
|
|
|
1225
1259
|
} | null;
|
|
1226
1260
|
/** Collection Ids */
|
|
1227
1261
|
collection_ids?: string[] | null;
|
|
1262
|
+
/** Collection Attachments */
|
|
1263
|
+
collection_attachments?: components["schemas"]["CollectionAttachment"][] | null;
|
|
1228
1264
|
/** Asset Ids */
|
|
1229
1265
|
asset_ids?: string[] | null;
|
|
1230
1266
|
/** Resource Ids */
|
|
@@ -2226,6 +2262,8 @@ interface components {
|
|
|
2226
2262
|
slug: string;
|
|
2227
2263
|
/** Name */
|
|
2228
2264
|
name: string;
|
|
2265
|
+
/** Description */
|
|
2266
|
+
description?: string | null;
|
|
2229
2267
|
/** Metadatajson */
|
|
2230
2268
|
metadataJson?: {
|
|
2231
2269
|
[key: string]: unknown;
|
|
@@ -2263,16 +2301,30 @@ interface components {
|
|
|
2263
2301
|
* @default 0
|
|
2264
2302
|
*/
|
|
2265
2303
|
position: number;
|
|
2266
|
-
/** Focalpoint */
|
|
2267
|
-
focalPoint?: string | null;
|
|
2268
|
-
/** Caption */
|
|
2269
|
-
caption?: string | null;
|
|
2270
2304
|
/** Metadatajson */
|
|
2271
2305
|
metadataJson?: {
|
|
2272
2306
|
[key: string]: unknown;
|
|
2273
2307
|
} | null;
|
|
2274
2308
|
asset: components["schemas"]["PublishedAssetRead"];
|
|
2275
2309
|
};
|
|
2310
|
+
/**
|
|
2311
|
+
* PublishedEntryCollection
|
|
2312
|
+
* @description A collection as used by a specific entry — relationship context + collection data.
|
|
2313
|
+
*/
|
|
2314
|
+
PublishedEntryCollection: {
|
|
2315
|
+
/** Role */
|
|
2316
|
+
role?: string | null;
|
|
2317
|
+
/**
|
|
2318
|
+
* Position
|
|
2319
|
+
* @default 0
|
|
2320
|
+
*/
|
|
2321
|
+
position: number;
|
|
2322
|
+
/** Metadatajson */
|
|
2323
|
+
metadataJson?: {
|
|
2324
|
+
[key: string]: unknown;
|
|
2325
|
+
} | null;
|
|
2326
|
+
collection: components["schemas"]["PublishedCollectionSummary"];
|
|
2327
|
+
};
|
|
2276
2328
|
/**
|
|
2277
2329
|
* PublishedEntryListItem
|
|
2278
2330
|
* @description Minimal entry schema for list responses.
|
|
@@ -2298,7 +2350,7 @@ interface components {
|
|
|
2298
2350
|
* Collections
|
|
2299
2351
|
* @default []
|
|
2300
2352
|
*/
|
|
2301
|
-
collections:
|
|
2353
|
+
collections: components["schemas"]["PublishedEntryCollection"][];
|
|
2302
2354
|
/**
|
|
2303
2355
|
* Assetslugs
|
|
2304
2356
|
* @default []
|
|
@@ -2351,7 +2403,7 @@ interface components {
|
|
|
2351
2403
|
* Collections
|
|
2352
2404
|
* @default []
|
|
2353
2405
|
*/
|
|
2354
|
-
collections: components["schemas"]["
|
|
2406
|
+
collections: components["schemas"]["PublishedEntryCollection"][];
|
|
2355
2407
|
/**
|
|
2356
2408
|
* Resources
|
|
2357
2409
|
* @default []
|
|
@@ -2372,10 +2424,6 @@ interface components {
|
|
|
2372
2424
|
PublishedEntryResource: {
|
|
2373
2425
|
/** Role */
|
|
2374
2426
|
role?: string | null;
|
|
2375
|
-
/** Quantity */
|
|
2376
|
-
quantity?: string | null;
|
|
2377
|
-
/** Unit */
|
|
2378
|
-
unit?: string | null;
|
|
2379
2427
|
/**
|
|
2380
2428
|
* Position
|
|
2381
2429
|
* @default 0
|
|
@@ -2533,10 +2581,6 @@ interface components {
|
|
|
2533
2581
|
resource_id: string;
|
|
2534
2582
|
/** Role */
|
|
2535
2583
|
role?: string | null;
|
|
2536
|
-
/** Quantity */
|
|
2537
|
-
quantity?: string | null;
|
|
2538
|
-
/** Unit */
|
|
2539
|
-
unit?: string | null;
|
|
2540
2584
|
/** Position */
|
|
2541
2585
|
position?: number | null;
|
|
2542
2586
|
/** Metadata */
|
|
@@ -2588,8 +2632,8 @@ interface components {
|
|
|
2588
2632
|
url?: string | null;
|
|
2589
2633
|
/** Externalid */
|
|
2590
2634
|
externalId?: string | null;
|
|
2591
|
-
/**
|
|
2592
|
-
|
|
2635
|
+
/** Metadatajson */
|
|
2636
|
+
metadataJson?: {
|
|
2593
2637
|
[key: string]: unknown;
|
|
2594
2638
|
} | null;
|
|
2595
2639
|
/**
|
|
@@ -2889,6 +2933,18 @@ interface components {
|
|
|
2889
2933
|
*/
|
|
2890
2934
|
unlocked: number;
|
|
2891
2935
|
};
|
|
2936
|
+
/**
|
|
2937
|
+
* UpdateEntryCollectionRequest
|
|
2938
|
+
* @description Schema for updating junction fields on an entry-collection relationship.
|
|
2939
|
+
*/
|
|
2940
|
+
UpdateEntryCollectionRequest: {
|
|
2941
|
+
/** Role */
|
|
2942
|
+
role?: string | null;
|
|
2943
|
+
/** Metadatajson */
|
|
2944
|
+
metadataJson?: {
|
|
2945
|
+
[key: string]: unknown;
|
|
2946
|
+
} | null;
|
|
2947
|
+
};
|
|
2892
2948
|
/**
|
|
2893
2949
|
* UserCreate
|
|
2894
2950
|
* @description Schema for creating a new user.
|
|
@@ -3445,15 +3501,74 @@ type MarvinEntryListItem = components['schemas']['PublishedEntryListItem'];
|
|
|
3445
3501
|
type PublishedEntryType = components['schemas']['PublishedEntryTypeRead'];
|
|
3446
3502
|
type MarvinCollection = components['schemas']['PublishedCollectionRead'];
|
|
3447
3503
|
type PublishedCollectionSummary = components['schemas']['PublishedCollectionSummary'];
|
|
3504
|
+
type PublishedEntryCollection = components['schemas']['PublishedEntryCollection'];
|
|
3448
3505
|
type MarvinAsset = components['schemas']['PublishedAssetRead'];
|
|
3449
3506
|
type PublishedAssetRead = components['schemas']['PublishedAssetRead'];
|
|
3450
3507
|
type PublishedEntryAsset = components['schemas']['PublishedEntryAsset'];
|
|
3451
3508
|
type MarvinResource = components['schemas']['PublishedResourceSummary'];
|
|
3509
|
+
type PublishedResourceSummary = components['schemas']['PublishedResourceSummary'];
|
|
3452
3510
|
type PublishedEntryResource = components['schemas']['PublishedEntryResource'];
|
|
3453
3511
|
type AssetAttachment = components['schemas']['AssetAttachment'];
|
|
3512
|
+
type CollectionAttachment = components['schemas']['CollectionAttachment'];
|
|
3454
3513
|
type ResourceAttachment = components['schemas']['ResourceAttachment'];
|
|
3455
|
-
type
|
|
3514
|
+
type EntryCollectionRead = components['schemas']['EntryCollectionRead'];
|
|
3456
3515
|
type MarvinEntryType = components['schemas']['EntryTypeRead'];
|
|
3516
|
+
/** Entry-specific relationship data within a collection */
|
|
3517
|
+
interface CollectionEntryMetadata {
|
|
3518
|
+
role: string | null;
|
|
3519
|
+
position: number;
|
|
3520
|
+
metadataJson: Record<string, unknown> | null;
|
|
3521
|
+
}
|
|
3522
|
+
/** The collection context when an entry is fetched through a specific collection */
|
|
3523
|
+
interface CollectionContext {
|
|
3524
|
+
slug: string;
|
|
3525
|
+
name: string;
|
|
3526
|
+
description?: string | null;
|
|
3527
|
+
metadataJson?: Record<string, unknown> | null;
|
|
3528
|
+
/** This entry's relationship to the collection (role, position, junction metadata) */
|
|
3529
|
+
entryMetadata: CollectionEntryMetadata;
|
|
3530
|
+
}
|
|
3531
|
+
/**
|
|
3532
|
+
* An entry as returned when fetched through a specific collection.
|
|
3533
|
+
* - `collection`: the collection you queried through, with its junction context
|
|
3534
|
+
* - `collectionSlugs`: slugs of other collections this entry also belongs to
|
|
3535
|
+
*/
|
|
3536
|
+
interface CollectionEntry extends Omit<MarvinEntryListItem, 'collections'> {
|
|
3537
|
+
collection: CollectionContext;
|
|
3538
|
+
/** All collection slugs this entry belongs to, including the one queried through */
|
|
3539
|
+
collectionSlugs: string[];
|
|
3540
|
+
}
|
|
3541
|
+
/**
|
|
3542
|
+
* A collection membership as it appears on an entry.
|
|
3543
|
+
* - `collection`: the collection's own fields (slug, name, description, metadataJson, sortOrder)
|
|
3544
|
+
* - `entryMetadata`: the entry's relationship to this collection (role, position, metadataJson)
|
|
3545
|
+
*/
|
|
3546
|
+
interface EntryCollectionContext {
|
|
3547
|
+
collection: PublishedCollectionSummary;
|
|
3548
|
+
entryMetadata: CollectionEntryMetadata;
|
|
3549
|
+
}
|
|
3550
|
+
/**
|
|
3551
|
+
* An entry as returned from the general entries list.
|
|
3552
|
+
* Same as MarvinEntryListItem but with collections transformed to EntryCollectionContext[]
|
|
3553
|
+
* so the entryMetadata naming convention is consistent across all entry contexts.
|
|
3554
|
+
*/
|
|
3555
|
+
interface ListEntry extends Omit<MarvinEntryListItem, 'collections'> {
|
|
3556
|
+
collections: EntryCollectionContext[];
|
|
3557
|
+
}
|
|
3558
|
+
/**
|
|
3559
|
+
* An asset as it appears on an entry — includes the asset's own fields
|
|
3560
|
+
* plus `entryMetadata` for the entry's relationship to this asset.
|
|
3561
|
+
*/
|
|
3562
|
+
interface EntryAsset extends PublishedAssetRead {
|
|
3563
|
+
entryMetadata: CollectionEntryMetadata;
|
|
3564
|
+
}
|
|
3565
|
+
/**
|
|
3566
|
+
* A resource as it appears on an entry — includes the resource's own fields
|
|
3567
|
+
* plus `entryMetadata` for the entry's relationship to this resource.
|
|
3568
|
+
*/
|
|
3569
|
+
interface EntryResource extends PublishedResourceSummary {
|
|
3570
|
+
entryMetadata: CollectionEntryMetadata;
|
|
3571
|
+
}
|
|
3457
3572
|
interface AssetUploadRequest {
|
|
3458
3573
|
slug: string;
|
|
3459
3574
|
name: string;
|
|
@@ -3496,4 +3611,4 @@ interface AuthToken {
|
|
|
3496
3611
|
tokenType: string;
|
|
3497
3612
|
}
|
|
3498
3613
|
|
|
3499
|
-
export type { AuthToken as A,
|
|
3614
|
+
export type { AuthToken as A, CollectionContext as C, EntryAsset as E, GetAssetsOptions as G, ListEntry as L, MarvinAsset as M, PublishedAssetRead as P, ResourceAttachment as R, SiteConfiguration as S, WorkspaceInfo as W, CollectionEntry as a, CollectionEntryMetadata as b, EntryCollectionContext as c, EntryResource as d, GetEntriesOptions as e, GetResourcesOptions as f, MarvinCollection as g, MarvinEntry as h, MarvinEntryListItem as i, MarvinEntryType as j, MarvinPublishResponse as k, MarvinResource as l, MarvinSite as m, PublishedCollectionSummary as n, PublishedEntryAsset as o, PublishedEntryResource as p, PublishedEntryType as q, components as r, AssetAttachment as s, AssetUploadRequest as t, CollectionAttachment as u, EntryCollectionRead as v, MarvinClientConfig as w, PublishedEntryCollection as x, PublishedResourceSummary as y };
|
package/dist/index.cjs
CHANGED
|
@@ -397,7 +397,7 @@ var init_HttpClient = __esm({
|
|
|
397
397
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
398
398
|
const startTime = Date.now();
|
|
399
399
|
if (this.debug) {
|
|
400
|
-
this.logger.log(`[Marvin] ${method} ${url}`);
|
|
400
|
+
this.logger.log(`[Marvin SDK] ${method} ${url}`);
|
|
401
401
|
}
|
|
402
402
|
try {
|
|
403
403
|
const response = await fetch(url, {
|
|
@@ -411,7 +411,7 @@ var init_HttpClient = __esm({
|
|
|
411
411
|
const duration = Date.now() - startTime;
|
|
412
412
|
if (this.debug) {
|
|
413
413
|
this.logger.log(
|
|
414
|
-
`[Marvin] ${response.status} ${response.statusText} (${duration}ms)`
|
|
414
|
+
`[Marvin SDK] ${response.status} ${response.statusText} (${duration}ms)`
|
|
415
415
|
);
|
|
416
416
|
}
|
|
417
417
|
if (response.status === 401 && this.auth.handleUnauthorized) {
|
|
@@ -421,7 +421,7 @@ var init_HttpClient = __esm({
|
|
|
421
421
|
const errorText = await response.text().catch(() => "");
|
|
422
422
|
if (this.debug) {
|
|
423
423
|
this.logger.error(
|
|
424
|
-
`[Marvin] Error response: ${response.status} ${response.statusText}`,
|
|
424
|
+
`[Marvin SDK] Error response: ${response.status} ${response.statusText}`,
|
|
425
425
|
errorText ? `Body: ${errorText}` : ""
|
|
426
426
|
);
|
|
427
427
|
}
|
|
@@ -431,7 +431,7 @@ var init_HttpClient = __esm({
|
|
|
431
431
|
const delay = this.calculateRetryDelay(retryAttempt);
|
|
432
432
|
if (this.debug) {
|
|
433
433
|
this.logger.warn(
|
|
434
|
-
`[Marvin] Retry ${retryAttempt + 1}/${this.retryConfig.maxRetries} after ${delay}ms (status: ${response.status})`
|
|
434
|
+
`[Marvin SDK] Retry ${retryAttempt + 1}/${this.retryConfig.maxRetries} after ${delay}ms (status: ${response.status})`
|
|
435
435
|
);
|
|
436
436
|
}
|
|
437
437
|
await this.sleep(delay);
|
|
@@ -470,7 +470,7 @@ var init_HttpClient = __esm({
|
|
|
470
470
|
const data = await response.json();
|
|
471
471
|
if (this.debug) {
|
|
472
472
|
const sanitized = this.sanitizeForLogging(data);
|
|
473
|
-
this.logger.log("[Marvin] Response:", JSON.stringify(sanitized, null, 2));
|
|
473
|
+
this.logger.log("[Marvin SDK] Response:", JSON.stringify(sanitized, null, 2));
|
|
474
474
|
}
|
|
475
475
|
return data;
|
|
476
476
|
} catch (error) {
|
|
@@ -484,7 +484,7 @@ var init_HttpClient = __esm({
|
|
|
484
484
|
const delay = this.calculateRetryDelay(retryAttempt);
|
|
485
485
|
if (this.debug) {
|
|
486
486
|
this.logger.warn(
|
|
487
|
-
`[Marvin] Retry ${retryAttempt + 1}/${this.retryConfig.maxRetries} after ${delay}ms (network error)`
|
|
487
|
+
`[Marvin SDK] Retry ${retryAttempt + 1}/${this.retryConfig.maxRetries} after ${delay}ms (network error)`
|
|
488
488
|
);
|
|
489
489
|
}
|
|
490
490
|
await this.sleep(delay);
|
|
@@ -901,13 +901,22 @@ var init_entry = __esm({
|
|
|
901
901
|
return this.raw.order;
|
|
902
902
|
}
|
|
903
903
|
get assets() {
|
|
904
|
-
return this.raw.assets
|
|
904
|
+
return (this.raw.assets ?? []).map(({ asset, role, position, metadataJson }) => ({
|
|
905
|
+
...asset,
|
|
906
|
+
entryMetadata: { role: role ?? null, position, metadataJson: metadataJson ?? null }
|
|
907
|
+
}));
|
|
905
908
|
}
|
|
906
909
|
get collections() {
|
|
907
|
-
return this.raw.collections
|
|
910
|
+
return (this.raw.collections ?? []).map(({ collection, role, position, metadataJson }) => ({
|
|
911
|
+
collection,
|
|
912
|
+
entryMetadata: { role: role ?? null, position, metadataJson: metadataJson ?? null }
|
|
913
|
+
}));
|
|
908
914
|
}
|
|
909
915
|
get resources() {
|
|
910
|
-
return this.raw.resources
|
|
916
|
+
return (this.raw.resources ?? []).map(({ resource, role, position, metadataJson }) => ({
|
|
917
|
+
...resource,
|
|
918
|
+
entryMetadata: { role: role ?? null, position, metadataJson: metadataJson ?? null }
|
|
919
|
+
}));
|
|
911
920
|
}
|
|
912
921
|
field(key) {
|
|
913
922
|
return this.raw.data[key];
|
|
@@ -923,6 +932,16 @@ var init_entry = __esm({
|
|
|
923
932
|
});
|
|
924
933
|
|
|
925
934
|
// src/entries/entries.ts
|
|
935
|
+
function toListEntry(raw) {
|
|
936
|
+
const { collections, ...rest } = raw;
|
|
937
|
+
return {
|
|
938
|
+
...rest,
|
|
939
|
+
collections: (collections ?? []).map(({ collection, role, position, metadataJson }) => ({
|
|
940
|
+
collection,
|
|
941
|
+
entryMetadata: { role: role ?? null, position, metadataJson: metadataJson ?? null }
|
|
942
|
+
}))
|
|
943
|
+
};
|
|
944
|
+
}
|
|
926
945
|
var EntriesModule;
|
|
927
946
|
var init_entries = __esm({
|
|
928
947
|
"src/entries/entries.ts"() {
|
|
@@ -948,7 +967,7 @@ var init_entries = __esm({
|
|
|
948
967
|
});
|
|
949
968
|
const endpoint = `/api/publish/${this.workspaceSlug}/entries${queryString}`;
|
|
950
969
|
const response = await this.http.fetch(endpoint);
|
|
951
|
-
return response.data || [];
|
|
970
|
+
return (response.data || []).map(toListEntry);
|
|
952
971
|
}
|
|
953
972
|
/**
|
|
954
973
|
* Get a single entry by slug
|
|
@@ -1019,8 +1038,33 @@ var init_collection = __esm({
|
|
|
1019
1038
|
get entryCount() {
|
|
1020
1039
|
return this.data.entryCount;
|
|
1021
1040
|
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Entries with junction context for this collection surfaced directly.
|
|
1043
|
+
* - role, position, junctionMetadata: from this collection's junction record
|
|
1044
|
+
* - collections: slugs of other collections the entry belongs to
|
|
1045
|
+
*/
|
|
1022
1046
|
get entries() {
|
|
1023
|
-
return this.data.entries
|
|
1047
|
+
return this.data.entries.map((entry) => {
|
|
1048
|
+
const { collections, ...rest } = entry;
|
|
1049
|
+
const junction = collections.find((ec) => ec.collection.slug === this.data.slug);
|
|
1050
|
+
const entryMetadata = {
|
|
1051
|
+
role: junction?.role ?? null,
|
|
1052
|
+
position: junction?.position ?? 0,
|
|
1053
|
+
metadataJson: junction?.metadataJson ?? null
|
|
1054
|
+
};
|
|
1055
|
+
const collection = {
|
|
1056
|
+
slug: this.data.slug,
|
|
1057
|
+
name: this.data.name,
|
|
1058
|
+
description: this.data.description,
|
|
1059
|
+
metadataJson: this.data.metadataJson,
|
|
1060
|
+
entryMetadata
|
|
1061
|
+
};
|
|
1062
|
+
return {
|
|
1063
|
+
...rest,
|
|
1064
|
+
collection,
|
|
1065
|
+
collectionSlugs: collections.map((ec) => ec.collection.slug)
|
|
1066
|
+
};
|
|
1067
|
+
});
|
|
1024
1068
|
}
|
|
1025
1069
|
toJSON() {
|
|
1026
1070
|
return this.data;
|
|
@@ -1052,8 +1096,8 @@ var init_collections = __esm({
|
|
|
1052
1096
|
return response.data || [];
|
|
1053
1097
|
}
|
|
1054
1098
|
/**
|
|
1055
|
-
* Get a single collection by slug
|
|
1056
|
-
* Returns
|
|
1099
|
+
* Get a single collection by slug.
|
|
1100
|
+
* Returns an empty array if the collection is not found (404).
|
|
1057
1101
|
*/
|
|
1058
1102
|
async get(slug) {
|
|
1059
1103
|
try {
|
|
@@ -1062,32 +1106,34 @@ var init_collections = __esm({
|
|
|
1062
1106
|
return new Collection(data);
|
|
1063
1107
|
} catch (error) {
|
|
1064
1108
|
if (error instanceof MarvinNotFoundError) {
|
|
1065
|
-
return
|
|
1109
|
+
return [];
|
|
1066
1110
|
}
|
|
1067
1111
|
throw error;
|
|
1068
1112
|
}
|
|
1069
1113
|
}
|
|
1070
1114
|
/**
|
|
1071
|
-
* Get entries in a collection
|
|
1072
|
-
*
|
|
1115
|
+
* Get entries in a collection with junction context surfaced directly.
|
|
1116
|
+
* Each entry has role/position/junctionMetadata from this collection's junction,
|
|
1117
|
+
* and collections reduced to slugs of other memberships.
|
|
1118
|
+
* Returns empty array if collection is not found.
|
|
1073
1119
|
*/
|
|
1074
1120
|
async entries(slug) {
|
|
1075
1121
|
const collection = await this.get(slug);
|
|
1076
|
-
if (
|
|
1077
|
-
return
|
|
1122
|
+
if (Array.isArray(collection)) {
|
|
1123
|
+
return collection;
|
|
1078
1124
|
}
|
|
1079
1125
|
return collection.entries;
|
|
1080
1126
|
}
|
|
1081
1127
|
/**
|
|
1082
|
-
* Try multiple collection slugs in fallback order
|
|
1083
|
-
* Returns the first collection that exists and has entries
|
|
1128
|
+
* Try multiple collection slugs in fallback order.
|
|
1129
|
+
* Returns entries from the first collection that exists and has entries.
|
|
1084
1130
|
*/
|
|
1085
1131
|
async fallback(slugs, options = {}) {
|
|
1086
1132
|
const { requireEntries = true } = options;
|
|
1087
1133
|
for (const slug of slugs) {
|
|
1088
1134
|
try {
|
|
1089
1135
|
const collection = await this.get(slug);
|
|
1090
|
-
if (
|
|
1136
|
+
if (Array.isArray(collection)) {
|
|
1091
1137
|
continue;
|
|
1092
1138
|
}
|
|
1093
1139
|
const entries = collection.entries;
|
|
@@ -1258,7 +1304,8 @@ var init_renderers = __esm({
|
|
|
1258
1304
|
workspaceSlug;
|
|
1259
1305
|
async list() {
|
|
1260
1306
|
const endpoint = `/api/publish/${this.workspaceSlug}/entry-types`;
|
|
1261
|
-
|
|
1307
|
+
const all = await this.http.fetch(endpoint);
|
|
1308
|
+
return all.filter((et) => et.isRendered);
|
|
1262
1309
|
}
|
|
1263
1310
|
};
|
|
1264
1311
|
}
|
|
@@ -1499,7 +1546,7 @@ var init_marvin = __esm({
|
|
|
1499
1546
|
*/
|
|
1500
1547
|
async getCollection(slug) {
|
|
1501
1548
|
const collection = await this.workspace.collections.get(slug);
|
|
1502
|
-
if (
|
|
1549
|
+
if (Array.isArray(collection)) {
|
|
1503
1550
|
return null;
|
|
1504
1551
|
}
|
|
1505
1552
|
return collection.toJSON();
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { M as MarvinConfig, a as MarvinClient } from './marvin-
|
|
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-
|
|
1
|
+
import { M as MarvinConfig, a as MarvinClient } from './marvin-RZZj02LS.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-RZZj02LS.cjs';
|
|
3
3
|
import { H as HttpClient } from './HttpClient-CdF3IHM1.cjs';
|
|
4
4
|
export { A as AuthStrategy, B as BearerTokenAuth, a as HttpClientConfig, N as NoAuth, S as SessionAuth } from './HttpClient-CdF3IHM1.cjs';
|
|
5
|
-
import { A as AuthToken$1 } from './index-
|
|
6
|
-
export { G as GetAssetsOptions,
|
|
5
|
+
import { A as AuthToken$1 } from './index-BVm5dIcw.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-BVm5dIcw.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-
|
|
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-
|
|
1
|
+
import { M as MarvinConfig, a as MarvinClient } from './marvin-BZ4meaB-.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-BZ4meaB-.js';
|
|
3
3
|
import { H as HttpClient } from './HttpClient-CdF3IHM1.js';
|
|
4
4
|
export { A as AuthStrategy, B as BearerTokenAuth, a as HttpClientConfig, N as NoAuth, S as SessionAuth } from './HttpClient-CdF3IHM1.js';
|
|
5
|
-
import { A as AuthToken$1 } from './index-
|
|
6
|
-
export { G as GetAssetsOptions,
|
|
5
|
+
import { A as AuthToken$1 } from './index-BVm5dIcw.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-BVm5dIcw.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Authentication & User Registration
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
init_resource,
|
|
14
14
|
init_workspace,
|
|
15
15
|
marvin_exports
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-YHBF2SB3.js";
|
|
17
17
|
import {
|
|
18
18
|
BearerTokenAuth,
|
|
19
19
|
HttpClient,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
offsetToPage,
|
|
37
37
|
pageToOffset,
|
|
38
38
|
validateEmail
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-SVH7AMMY.js";
|
|
40
40
|
|
|
41
41
|
// src/index.ts
|
|
42
42
|
init_marvin();
|