@inneropen/marvin-sdk 3.0.0 → 3.0.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.
@@ -1,4 +1,4 @@
1
- import { PublishedEntryType, MarvinResource, MarvinEntry, MarvinAsset, MarvinCollection, MarvinEntryType, MarvinSite, GetResourcesOptions as GetResourcesOptions$1 } from './types/index.cjs';
1
+ import { k as PublishedEntryType, h as MarvinResource, M as MarvinAsset, c as MarvinCollection, e as MarvinEntryListItem, j as PublishedCollectionSummary, d as MarvinEntry, P as PublishedAssetRead, l as PublishedResourceRead, i as MarvinSite, m as components, b as GetResourcesOptions$1 } from './index-D5zkKa4N.cjs';
2
2
  import { H as HttpClient } from './HttpClient-CdF3IHM1.cjs';
3
3
 
4
4
  /**
@@ -212,30 +212,17 @@ declare class RenderersModule {
212
212
 
213
213
  declare class Resource {
214
214
  private data;
215
- private http;
216
- private workspaceSlug;
217
- constructor(data: MarvinResource, http: MarvinHttpClient, workspaceSlug: string);
218
- get id(): string;
215
+ constructor(data: MarvinResource);
219
216
  get name(): string;
220
217
  get slug(): string;
221
- get resourceType(): string | undefined;
222
- get description(): string | undefined;
223
- get externalId(): string | undefined;
224
- get url(): string | undefined;
225
- get metadata(): Record<string, unknown> | undefined;
226
- get createdAt(): string;
227
- get updatedAt(): string;
228
- /**
229
- * Get all entries that reference this resource
230
- */
231
- entries(): Promise<MarvinEntry[]>;
232
- /**
233
- * Get assets related to this resource (future)
234
- */
235
- assets(): Promise<MarvinAsset[]>;
236
- /**
237
- * Get raw resource data
238
- */
218
+ get resourceType(): string;
219
+ get description(): string | null | undefined;
220
+ get externalId(): string | null | undefined;
221
+ get url(): string | null | undefined;
222
+ get metadataJson(): {
223
+ [key: string]: unknown;
224
+ } | null | undefined;
225
+ get entries(): string[];
239
226
  toJSON(): MarvinResource;
240
227
  }
241
228
 
@@ -261,9 +248,9 @@ declare class ResourcesModule {
261
248
  */
262
249
  get(slug: string): Promise<Resource>;
263
250
  /**
264
- * Get entries that reference this resource
251
+ * Get entry slugs that reference this resource
265
252
  */
266
- entries(slug: string): Promise<MarvinEntry[]>;
253
+ entries(slug: string): Promise<string[]>;
267
254
  }
268
255
 
269
256
  /**
@@ -307,35 +294,19 @@ declare class AssetsModule {
307
294
 
308
295
  declare class Collection {
309
296
  private data;
310
- private http;
311
- private workspaceSlug;
312
- constructor(data: MarvinCollection, http: MarvinHttpClient, workspaceSlug: string);
313
- get id(): string;
297
+ constructor(data: MarvinCollection);
314
298
  get name(): string;
315
299
  get slug(): string;
316
- get description(): string | undefined;
317
- get icon(): string | undefined;
318
- get color(): string | undefined;
319
- get sortOrder(): number;
300
+ get description(): string | null | undefined;
320
301
  get isSmart(): boolean;
321
- get smartRules(): Record<string, unknown> | undefined;
322
- get createdAt(): string;
323
- get updatedAt(): string;
324
- /**
325
- * Get all entries in this collection
326
- */
327
- entries(): Promise<MarvinEntry[]>;
328
- /**
329
- * Get assets in this collection (future)
330
- */
331
- assets(): Promise<MarvinAsset[]>;
332
- /**
333
- * Get collection metadata (future)
334
- */
335
- metadata(): Promise<any>;
336
- /**
337
- * Get raw collection data
338
- */
302
+ get smartRules(): {
303
+ [key: string]: unknown;
304
+ } | null | undefined;
305
+ get metadataJson(): {
306
+ [key: string]: unknown;
307
+ } | null | undefined;
308
+ get entryCount(): number;
309
+ get entries(): MarvinEntryListItem[];
339
310
  toJSON(): MarvinCollection;
340
311
  }
341
312
 
@@ -350,7 +321,7 @@ declare class CollectionsModule {
350
321
  /**
351
322
  * Get all collections
352
323
  */
353
- list(): Promise<MarvinCollection[]>;
324
+ list(): Promise<PublishedCollectionSummary[]>;
354
325
  /**
355
326
  * Get a single collection by slug
356
327
  * Returns null if collection is not found (404)
@@ -360,89 +331,52 @@ declare class CollectionsModule {
360
331
  * Get entries in a collection
361
332
  * Returns empty array if collection is not found
362
333
  */
363
- entries(slug: string): Promise<MarvinEntry[]>;
334
+ entries(slug: string): Promise<MarvinEntryListItem[]>;
364
335
  /**
365
336
  * Try multiple collection slugs in fallback order
366
337
  * Returns the first collection that exists and has entries
367
- *
368
- * @param slugs - Collection slugs to try in order
369
- * @param options - Options for fallback behavior
370
- * @returns Entries from the first matching collection, or empty array
371
- *
372
- * @example
373
- * ```ts
374
- * // Try bench-notes, then journal, then blog
375
- * const entries = await collections.fallback(['bench-notes', 'journal', 'blog']);
376
- * ```
377
338
  */
378
339
  fallback(slugs: string[], options?: {
379
340
  requireEntries?: boolean;
380
- }): Promise<MarvinEntry[]>;
341
+ }): Promise<MarvinEntryListItem[]>;
381
342
  }
382
343
 
344
+ /**
345
+ * Entry - Rich object representing a single entry
346
+ */
347
+
383
348
  declare class Entry {
384
- private data;
385
- private http;
386
- private workspaceSlug;
387
- constructor(data: MarvinEntry, http: MarvinHttpClient, workspaceSlug: string);
388
- get id(): string;
349
+ private raw;
350
+ constructor(raw: MarvinEntry);
389
351
  get title(): string;
390
352
  get slug(): string;
391
- get summary(): string | undefined;
392
- get description(): string | undefined;
393
- /**
394
- * @deprecated Use field('body') or dataJson instead. Will be removed in v3.0.0
395
- */
396
- get contentMarkdown(): string | undefined;
397
- /**
398
- * Schema-driven content data (replaces contentMarkdown in v2.0.0).
399
- * Access specific fields using the field() helper method.
400
- * @since 2.0.0
401
- */
402
- get dataJson(): Record<string, unknown> | undefined;
403
- get metadata(): Record<string, unknown> | undefined;
404
- get status(): string;
405
- get publishedAt(): string | undefined;
406
- get createdAt(): string;
407
- get updatedAt(): string;
408
- get entryTypeId(): string;
409
- get entryType(): MarvinEntryType | undefined;
410
- /**
411
- * Get entry assets
412
- */
413
- get assets(): MarvinAsset[];
414
- /**
415
- * Get entry collections
416
- */
417
- get collections(): MarvinCollection[];
418
- /**
419
- * Get a specific field value from the entry's schema-driven content (dataJson).
420
- *
421
- * @param key - Field key as defined in the entry type's schema
422
- * @returns The field value, or undefined if not present
423
- * @since 2.0.0
424
- *
425
- * @example
426
- * ```typescript
427
- * const entry = await client.entries.get('my-entry');
428
- * const body = entry.field('body'); // Get markdown body
429
- * const difficulty = entry.field('difficulty'); // Get difficulty level
430
- * const heroImage = entry.field('heroImage'); // Get hero image UUID
431
- * ```
432
- */
353
+ get summary(): string | null | undefined;
354
+ get entryType(): string;
355
+ get entryTypeInfo(): {
356
+ slug: string;
357
+ renderer?: string | null;
358
+ package?: string | null;
359
+ version?: string | null;
360
+ config?: {
361
+ [key: string]: unknown;
362
+ } | null;
363
+ publishable: boolean;
364
+ submittable: boolean;
365
+ routable: boolean;
366
+ } | null | undefined;
367
+ get data(): {
368
+ [key: string]: unknown;
369
+ };
370
+ get metadataJson(): {
371
+ [key: string]: unknown;
372
+ } | null | undefined;
373
+ get publishedAt(): string | null | undefined;
374
+ get order(): number | null | undefined;
375
+ get assets(): PublishedAssetRead[];
376
+ get collections(): PublishedCollectionSummary[];
377
+ get resources(): PublishedResourceRead[];
433
378
  field<T = unknown>(key: string): T | undefined;
434
- /**
435
- * Get all fields from the entry's schema-driven content.
436
- * @since 2.0.0
437
- */
438
379
  get fields(): Record<string, unknown>;
439
- /**
440
- * Get related entries (future)
441
- */
442
- relatedEntries(): Promise<MarvinEntry[]>;
443
- /**
444
- * Get raw entry data
445
- */
446
380
  toJSON(): MarvinEntry;
447
381
  }
448
382
 
@@ -464,7 +398,7 @@ declare class EntriesModule {
464
398
  /**
465
399
  * Get all published entries
466
400
  */
467
- list(options?: GetEntriesOptions): Promise<MarvinEntry[]>;
401
+ list(options?: GetEntriesOptions): Promise<MarvinEntryListItem[]>;
468
402
  /**
469
403
  * Get a single entry by slug
470
404
  * Returns null if entry is not found (404)
@@ -473,15 +407,15 @@ declare class EntriesModule {
473
407
  /**
474
408
  * Convenience: Get all pages
475
409
  */
476
- pages(options?: Omit<GetEntriesOptions, 'entryType'>): Promise<MarvinEntry[]>;
410
+ pages(options?: Omit<GetEntriesOptions, 'entryType'>): Promise<MarvinEntryListItem[]>;
477
411
  /**
478
412
  * Convenience: Get all blog posts
479
413
  */
480
- posts(options?: Omit<GetEntriesOptions, 'entryType'>): Promise<MarvinEntry[]>;
414
+ posts(options?: Omit<GetEntriesOptions, 'entryType'>): Promise<MarvinEntryListItem[]>;
481
415
  /**
482
416
  * Convenience: Get all projects
483
417
  */
484
- projects(options?: Omit<GetEntriesOptions, 'entryType'>): Promise<MarvinEntry[]>;
418
+ projects(options?: Omit<GetEntriesOptions, 'entryType'>): Promise<MarvinEntryListItem[]>;
485
419
  }
486
420
 
487
421
  /**
@@ -517,14 +451,9 @@ declare class Workspace {
517
451
  slug: string;
518
452
  name: string;
519
453
  }>;
520
- /**
521
- * Get workspace settings (future)
522
- */
523
- settings(): Promise<any>;
524
454
  }
525
455
 
526
456
  declare class MarvinClient {
527
- private config;
528
457
  private http;
529
458
  private cache;
530
459
  private workspace;
@@ -581,15 +510,51 @@ declare class MarvinClient {
581
510
  /**
582
511
  * Get all pages
583
512
  */
584
- pages(options?: GetEntriesOptions): Promise<MarvinEntry[]>;
513
+ pages(options?: GetEntriesOptions): Promise<{
514
+ slug: string;
515
+ title: string;
516
+ entryType: string;
517
+ entryTypeInfo?: components["schemas"]["PublishedEntryTypeInfo"] | null;
518
+ summary?: string | null;
519
+ publishedAt?: string | null;
520
+ status: string;
521
+ collections: string[];
522
+ assetSlugs: string[];
523
+ resourceSlugs: string[];
524
+ order?: number | null;
525
+ }[]>;
585
526
  /**
586
527
  * Get all blog posts
587
528
  */
588
- posts(options?: GetEntriesOptions): Promise<MarvinEntry[]>;
529
+ posts(options?: GetEntriesOptions): Promise<{
530
+ slug: string;
531
+ title: string;
532
+ entryType: string;
533
+ entryTypeInfo?: components["schemas"]["PublishedEntryTypeInfo"] | null;
534
+ summary?: string | null;
535
+ publishedAt?: string | null;
536
+ status: string;
537
+ collections: string[];
538
+ assetSlugs: string[];
539
+ resourceSlugs: string[];
540
+ order?: number | null;
541
+ }[]>;
589
542
  /**
590
543
  * Get all projects
591
544
  */
592
- projects(options?: GetEntriesOptions): Promise<MarvinEntry[]>;
545
+ projects(options?: GetEntriesOptions): Promise<{
546
+ slug: string;
547
+ title: string;
548
+ entryType: string;
549
+ entryTypeInfo?: components["schemas"]["PublishedEntryTypeInfo"] | null;
550
+ summary?: string | null;
551
+ publishedAt?: string | null;
552
+ status: string;
553
+ collections: string[];
554
+ assetSlugs: string[];
555
+ resourceSlugs: string[];
556
+ order?: number | null;
557
+ }[]>;
593
558
  /**
594
559
  * Get a single resource by slug
595
560
  */
@@ -597,70 +562,50 @@ declare class MarvinClient {
597
562
  /**
598
563
  * Try multiple collection slugs in fallback order
599
564
  * Returns entries from the first collection that exists and has content
600
- *
601
- * @param slugs - Collection slugs to try in order
602
- * @param options - Options for fallback behavior
603
- * @returns Entries from the first matching collection, or empty array
604
- *
605
- * @example
606
- * ```ts
607
- * // Try bench-notes, then journal, then blog
608
- * const entries = await client.collectionFallback(['bench-notes', 'journal', 'blog']);
609
- * ```
610
565
  */
611
566
  collectionFallback(slugs: string[], options?: {
612
567
  requireEntries?: boolean;
613
- }): Promise<MarvinEntry[]>;
568
+ }): Promise<MarvinEntryListItem[]>;
614
569
  /**
615
570
  * @deprecated Use workspace.site or marvin.site instead
616
- * Get site configuration
617
571
  */
618
572
  getSite(): Promise<MarvinSite>;
619
573
  /**
620
574
  * @deprecated Use workspace.entries.list() instead
621
- * Get all published entries
622
575
  */
623
- getEntries(options?: GetEntriesOptions): Promise<MarvinEntry[]>;
576
+ getEntries(options?: GetEntriesOptions): Promise<MarvinEntryListItem[]>;
624
577
  /**
625
578
  * @deprecated Use workspace.entries.get() instead
626
- * Get a single published entry by slug
627
579
  */
628
580
  getEntry(slug: string): Promise<MarvinEntry | null>;
629
581
  /**
630
582
  * @deprecated Use workspace.collections.list() instead
631
- * Get all collections
632
583
  */
633
- getCollections(): Promise<MarvinCollection[]>;
584
+ getCollections(): Promise<PublishedCollectionSummary[]>;
634
585
  /**
635
586
  * @deprecated Use workspace.collections.get() instead
636
- * Get a single collection by slug
637
587
  */
638
588
  getCollection(slug: string): Promise<MarvinCollection | null>;
639
589
  /**
640
590
  * @deprecated Use workspace.collections.entries() instead
641
- * Get all entries in a collection
642
591
  */
643
- getCollectionEntries(slug: string): Promise<MarvinEntry[]>;
592
+ getCollectionEntries(slug: string): Promise<MarvinEntryListItem[]>;
644
593
  /**
645
594
  * @deprecated Use workspace.assets.list() instead
646
- * Get all published assets
647
595
  */
648
596
  getAssets(options?: GetAssetsOptions): Promise<MarvinAsset[]>;
649
597
  /**
650
598
  * @deprecated Use workspace.resources.list() instead
651
- * Get all published resources
652
599
  */
653
600
  getResources(options?: GetResourcesOptions$1): Promise<MarvinResource[]>;
654
601
  /**
655
602
  * @deprecated Use workspace.resources.get() instead
656
- * Get a single resource by slug
657
603
  */
658
604
  getResource(slug: string): Promise<MarvinResource>;
659
605
  /**
660
606
  * @deprecated Use workspace.resources.entries() instead
661
- * Get entries that reference a resource
662
607
  */
663
- getResourceEntries(slug: string): Promise<MarvinEntry[]>;
608
+ getResourceEntries(slug: string): Promise<string[]>;
664
609
  }
665
610
 
666
611
  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 };