@inneropen/marvin-sdk 3.0.0 → 3.1.0-next.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.js';
1
+ import { m as PublishedEntryType, h as MarvinResource, M as MarvinAsset, c as MarvinCollection, e as MarvinEntryListItem, j as PublishedCollectionSummary, d as MarvinEntry, k as PublishedEntryAsset, l as PublishedEntryResource, i as MarvinSite, n as components, b as GetResourcesOptions$1 } from './index-BLIrbIHf.js';
2
2
  import { H as HttpClient } from './HttpClient-CdF3IHM1.js';
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,56 @@ 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(): PublishedEntryAsset[];
376
+ get collections(): PublishedCollectionSummary[];
377
+ get resources(): PublishedEntryResource[];
378
+ asset(role: string): PublishedEntryAsset | undefined;
379
+ assetsByRole(role: string): PublishedEntryAsset[];
380
+ resource(role: string): PublishedEntryResource | undefined;
381
+ resourcesByRole(role: string): PublishedEntryResource[];
433
382
  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
383
  get fields(): Record<string, unknown>;
439
- /**
440
- * Get related entries (future)
441
- */
442
- relatedEntries(): Promise<MarvinEntry[]>;
443
- /**
444
- * Get raw entry data
445
- */
446
384
  toJSON(): MarvinEntry;
447
385
  }
448
386
 
@@ -464,7 +402,7 @@ declare class EntriesModule {
464
402
  /**
465
403
  * Get all published entries
466
404
  */
467
- list(options?: GetEntriesOptions): Promise<MarvinEntry[]>;
405
+ list(options?: GetEntriesOptions): Promise<MarvinEntryListItem[]>;
468
406
  /**
469
407
  * Get a single entry by slug
470
408
  * Returns null if entry is not found (404)
@@ -473,15 +411,15 @@ declare class EntriesModule {
473
411
  /**
474
412
  * Convenience: Get all pages
475
413
  */
476
- pages(options?: Omit<GetEntriesOptions, 'entryType'>): Promise<MarvinEntry[]>;
414
+ pages(options?: Omit<GetEntriesOptions, 'entryType'>): Promise<MarvinEntryListItem[]>;
477
415
  /**
478
416
  * Convenience: Get all blog posts
479
417
  */
480
- posts(options?: Omit<GetEntriesOptions, 'entryType'>): Promise<MarvinEntry[]>;
418
+ posts(options?: Omit<GetEntriesOptions, 'entryType'>): Promise<MarvinEntryListItem[]>;
481
419
  /**
482
420
  * Convenience: Get all projects
483
421
  */
484
- projects(options?: Omit<GetEntriesOptions, 'entryType'>): Promise<MarvinEntry[]>;
422
+ projects(options?: Omit<GetEntriesOptions, 'entryType'>): Promise<MarvinEntryListItem[]>;
485
423
  }
486
424
 
487
425
  /**
@@ -517,14 +455,9 @@ declare class Workspace {
517
455
  slug: string;
518
456
  name: string;
519
457
  }>;
520
- /**
521
- * Get workspace settings (future)
522
- */
523
- settings(): Promise<any>;
524
458
  }
525
459
 
526
460
  declare class MarvinClient {
527
- private config;
528
461
  private http;
529
462
  private cache;
530
463
  private workspace;
@@ -581,15 +514,63 @@ declare class MarvinClient {
581
514
  /**
582
515
  * Get all pages
583
516
  */
584
- pages(options?: GetEntriesOptions): Promise<MarvinEntry[]>;
517
+ pages(options?: GetEntriesOptions): Promise<{
518
+ slug: string;
519
+ title: string;
520
+ entryType: string;
521
+ entryTypeInfo?: components["schemas"]["PublishedEntryTypeInfo"] | null;
522
+ summary?: string | null;
523
+ publishedAt?: string | null;
524
+ status: string;
525
+ collections: string[];
526
+ assetSlugs: string[];
527
+ resourceSlugs: string[];
528
+ metadataJson?: {
529
+ [key: string]: unknown;
530
+ } | null;
531
+ featuredAsset?: components["schemas"]["PublishedAssetRead"] | null;
532
+ order?: number | null;
533
+ }[]>;
585
534
  /**
586
535
  * Get all blog posts
587
536
  */
588
- posts(options?: GetEntriesOptions): Promise<MarvinEntry[]>;
537
+ posts(options?: GetEntriesOptions): Promise<{
538
+ slug: string;
539
+ title: string;
540
+ entryType: string;
541
+ entryTypeInfo?: components["schemas"]["PublishedEntryTypeInfo"] | null;
542
+ summary?: string | null;
543
+ publishedAt?: string | null;
544
+ status: string;
545
+ collections: string[];
546
+ assetSlugs: string[];
547
+ resourceSlugs: string[];
548
+ metadataJson?: {
549
+ [key: string]: unknown;
550
+ } | null;
551
+ featuredAsset?: components["schemas"]["PublishedAssetRead"] | null;
552
+ order?: number | null;
553
+ }[]>;
589
554
  /**
590
555
  * Get all projects
591
556
  */
592
- projects(options?: GetEntriesOptions): Promise<MarvinEntry[]>;
557
+ projects(options?: GetEntriesOptions): Promise<{
558
+ slug: string;
559
+ title: string;
560
+ entryType: string;
561
+ entryTypeInfo?: components["schemas"]["PublishedEntryTypeInfo"] | null;
562
+ summary?: string | null;
563
+ publishedAt?: string | null;
564
+ status: string;
565
+ collections: string[];
566
+ assetSlugs: string[];
567
+ resourceSlugs: string[];
568
+ metadataJson?: {
569
+ [key: string]: unknown;
570
+ } | null;
571
+ featuredAsset?: components["schemas"]["PublishedAssetRead"] | null;
572
+ order?: number | null;
573
+ }[]>;
593
574
  /**
594
575
  * Get a single resource by slug
595
576
  */
@@ -597,70 +578,50 @@ declare class MarvinClient {
597
578
  /**
598
579
  * Try multiple collection slugs in fallback order
599
580
  * 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
581
  */
611
582
  collectionFallback(slugs: string[], options?: {
612
583
  requireEntries?: boolean;
613
- }): Promise<MarvinEntry[]>;
584
+ }): Promise<MarvinEntryListItem[]>;
614
585
  /**
615
586
  * @deprecated Use workspace.site or marvin.site instead
616
- * Get site configuration
617
587
  */
618
588
  getSite(): Promise<MarvinSite>;
619
589
  /**
620
590
  * @deprecated Use workspace.entries.list() instead
621
- * Get all published entries
622
591
  */
623
- getEntries(options?: GetEntriesOptions): Promise<MarvinEntry[]>;
592
+ getEntries(options?: GetEntriesOptions): Promise<MarvinEntryListItem[]>;
624
593
  /**
625
594
  * @deprecated Use workspace.entries.get() instead
626
- * Get a single published entry by slug
627
595
  */
628
596
  getEntry(slug: string): Promise<MarvinEntry | null>;
629
597
  /**
630
598
  * @deprecated Use workspace.collections.list() instead
631
- * Get all collections
632
599
  */
633
- getCollections(): Promise<MarvinCollection[]>;
600
+ getCollections(): Promise<PublishedCollectionSummary[]>;
634
601
  /**
635
602
  * @deprecated Use workspace.collections.get() instead
636
- * Get a single collection by slug
637
603
  */
638
604
  getCollection(slug: string): Promise<MarvinCollection | null>;
639
605
  /**
640
606
  * @deprecated Use workspace.collections.entries() instead
641
- * Get all entries in a collection
642
607
  */
643
- getCollectionEntries(slug: string): Promise<MarvinEntry[]>;
608
+ getCollectionEntries(slug: string): Promise<MarvinEntryListItem[]>;
644
609
  /**
645
610
  * @deprecated Use workspace.assets.list() instead
646
- * Get all published assets
647
611
  */
648
612
  getAssets(options?: GetAssetsOptions): Promise<MarvinAsset[]>;
649
613
  /**
650
614
  * @deprecated Use workspace.resources.list() instead
651
- * Get all published resources
652
615
  */
653
616
  getResources(options?: GetResourcesOptions$1): Promise<MarvinResource[]>;
654
617
  /**
655
618
  * @deprecated Use workspace.resources.get() instead
656
- * Get a single resource by slug
657
619
  */
658
620
  getResource(slug: string): Promise<MarvinResource>;
659
621
  /**
660
622
  * @deprecated Use workspace.resources.entries() instead
661
- * Get entries that reference a resource
662
623
  */
663
- getResourceEntries(slug: string): Promise<MarvinEntry[]>;
624
+ getResourceEntries(slug: string): Promise<string[]>;
664
625
  }
665
626
 
666
627
  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 };
package/dist/platform.cjs CHANGED
@@ -1568,53 +1568,40 @@ var EmailTemplatesClient = class {
1568
1568
  http;
1569
1569
  /**
1570
1570
  * List all email templates for the workspace
1571
- * @param groupId - Workspace ID
1572
1571
  */
1573
1572
  async list(groupId) {
1574
1573
  return this.http.get(`/api/platform/workspaces/${groupId}/email-templates`);
1575
1574
  }
1576
1575
  /**
1577
1576
  * Get a specific email template
1578
- * @param groupId - Workspace ID
1579
- * @param templateId - Template ID
1580
1577
  */
1581
1578
  async get(groupId, templateId) {
1582
1579
  return this.http.get(`/api/platform/workspaces/${groupId}/email-templates/${templateId}`);
1583
1580
  }
1584
1581
  /**
1585
1582
  * Create a new email template
1586
- * @param groupId - Workspace ID
1587
- * @param data - Template data
1588
1583
  */
1589
1584
  async create(groupId, data) {
1590
1585
  return this.http.post(`/api/platform/workspaces/${groupId}/email-templates`, data);
1591
1586
  }
1592
1587
  /**
1593
1588
  * Update an email template
1594
- * @param groupId - Workspace ID
1595
- * @param templateId - Template ID
1596
- * @param data - Updated template data
1597
1589
  */
1598
1590
  async update(groupId, templateId, data) {
1599
1591
  return this.http.patch(`/api/platform/workspaces/${groupId}/email-templates/${templateId}`, data);
1600
1592
  }
1601
1593
  /**
1602
1594
  * Delete an email template
1603
- * @param groupId - Workspace ID
1604
- * @param templateId - Template ID
1605
1595
  */
1606
1596
  async delete(groupId, templateId) {
1607
1597
  await this.http.delete(`/api/platform/workspaces/${groupId}/email-templates/${templateId}`);
1608
1598
  }
1609
1599
  /**
1610
1600
  * Send a test email using a template
1611
- * @param groupId - Workspace ID
1612
- * @param templateId - Template ID
1613
- * @param recipientEmail - Test recipient email address
1614
1601
  */
1615
1602
  async sendTest(groupId, templateId, recipientEmail) {
1616
1603
  return this.http.post(`/api/platform/workspaces/${groupId}/email-templates/${templateId}/test`, {
1617
- recipient_email: recipientEmail
1604
+ email: recipientEmail
1618
1605
  });
1619
1606
  }
1620
1607
  };