@inneropen/marvin-sdk 2.0.0-next.13 → 2.0.0-next.15

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.js CHANGED
@@ -1,3 +1,19 @@
1
+ import {
2
+ Collection,
3
+ Entry,
4
+ MarvinClient,
5
+ Resource,
6
+ Workspace,
7
+ config_exports,
8
+ createConfigFromEnv,
9
+ init_collection,
10
+ init_config,
11
+ init_entry,
12
+ init_marvin,
13
+ init_resource,
14
+ init_workspace,
15
+ marvin_exports
16
+ } from "./chunk-GJNOYXUQ.js";
1
17
  import {
2
18
  BearerTokenAuth,
3
19
  HttpClient,
@@ -12,892 +28,15 @@ import {
12
28
  MarvinValidationError,
13
29
  NoAuth,
14
30
  SessionAuth,
15
- __esm,
16
- __export,
17
31
  __toCommonJS,
18
32
  createPaginatedResponse,
19
33
  extractData,
20
34
  init_core,
21
- init_errors,
22
35
  isPaginatedResponse,
23
36
  offsetToPage,
24
- pageToOffset
25
- } from "./chunk-DYC2BEA4.js";
26
-
27
- // src/client/config.ts
28
- var config_exports = {};
29
- __export(config_exports, {
30
- createConfigFromEnv: () => createConfigFromEnv,
31
- validateConfig: () => validateConfig
32
- });
33
- function validateConfig(config) {
34
- const receivedKeys = Object.keys(config).join(", ");
35
- if (!config.apiUrl) {
36
- throw new Error(
37
- `Missing required config parameter 'apiUrl'. Received config keys: ${receivedKeys || "(none)"}. Set this to your MARVIN_API_URL environment variable value.`
38
- );
39
- }
40
- if (!config.siteClientToken) {
41
- throw new Error(
42
- `Missing required config parameter 'siteClientToken'. Received config keys: ${receivedKeys}. Set this to your MARVIN_SITE_CLIENT_TOKEN environment variable value.`
43
- );
44
- }
45
- if (!config.workspaceSlug) {
46
- throw new Error(
47
- `Missing required config parameter 'workspaceSlug'. Received config keys: ${receivedKeys}. Set this to your MARVIN_WORKSPACE_SLUG environment variable value.`
48
- );
49
- }
50
- }
51
- function createConfigFromEnv(overrides) {
52
- return {
53
- apiUrl: overrides?.apiUrl || process.env.MARVIN_API_URL || "",
54
- siteClientToken: overrides?.siteClientToken || process.env.MARVIN_SITE_CLIENT_TOKEN || "",
55
- workspaceSlug: overrides?.workspaceSlug || process.env.MARVIN_WORKSPACE_SLUG || "",
56
- autoInitialize: overrides?.autoInitialize ?? false,
57
- cacheDuration: overrides?.cacheDuration ?? 5 * 60 * 1e3,
58
- // 5 minutes
59
- debug: overrides?.debug ?? process.env.MARVIN_DEBUG === "true",
60
- logger: overrides?.logger ?? console
61
- };
62
- }
63
- var init_config = __esm({
64
- "src/client/config.ts"() {
65
- "use strict";
66
- }
67
- });
68
-
69
- // src/client/http.ts
70
- var MarvinHttpClient;
71
- var init_http = __esm({
72
- "src/client/http.ts"() {
73
- "use strict";
74
- init_core();
75
- MarvinHttpClient = class extends HttpClient {
76
- constructor(config) {
77
- super({
78
- baseUrl: config.apiUrl,
79
- auth: new BearerTokenAuth(config.siteClientToken),
80
- credentials: "same-origin",
81
- debug: config.debug,
82
- logger: config.logger
83
- });
84
- }
85
- /**
86
- * Fetch endpoint (backward compatibility)
87
- */
88
- async fetch(endpoint) {
89
- return this.get(endpoint);
90
- }
91
- };
92
- }
93
- });
94
-
95
- // src/entries/entry.ts
96
- var Entry;
97
- var init_entry = __esm({
98
- "src/entries/entry.ts"() {
99
- "use strict";
100
- Entry = class {
101
- constructor(data, http, workspaceSlug) {
102
- this.data = data;
103
- this.http = http;
104
- this.workspaceSlug = workspaceSlug;
105
- }
106
- data;
107
- http;
108
- workspaceSlug;
109
- // Expose all entry data as properties
110
- get id() {
111
- return this.data.id;
112
- }
113
- get title() {
114
- return this.data.title;
115
- }
116
- get slug() {
117
- return this.data.slug;
118
- }
119
- get summary() {
120
- return this.data.summary;
121
- }
122
- get description() {
123
- return this.data.description;
124
- }
125
- /**
126
- * @deprecated Use field('body') or dataJson instead. Will be removed in v3.0.0
127
- */
128
- get contentMarkdown() {
129
- return this.data.contentMarkdown;
130
- }
131
- /**
132
- * Schema-driven content data (replaces contentMarkdown in v2.0.0).
133
- * Access specific fields using the field() helper method.
134
- * @since 2.0.0
135
- */
136
- get dataJson() {
137
- return this.data.dataJson;
138
- }
139
- get metadata() {
140
- return this.data.metadata;
141
- }
142
- get status() {
143
- return this.data.status;
144
- }
145
- get publishedAt() {
146
- return this.data.publishedAt;
147
- }
148
- get createdAt() {
149
- return this.data.createdAt;
150
- }
151
- get updatedAt() {
152
- return this.data.updatedAt;
153
- }
154
- get entryTypeId() {
155
- return this.data.entryTypeId;
156
- }
157
- get entryType() {
158
- return this.data.entryType;
159
- }
160
- /**
161
- * Get entry assets
162
- */
163
- get assets() {
164
- return this.data.assets || [];
165
- }
166
- /**
167
- * Get entry collections
168
- */
169
- get collections() {
170
- return this.data.collections || [];
171
- }
172
- /**
173
- * Get a specific field value from the entry's schema-driven content (dataJson).
174
- *
175
- * @param key - Field key as defined in the entry type's schema
176
- * @returns The field value, or undefined if not present
177
- * @since 2.0.0
178
- *
179
- * @example
180
- * ```typescript
181
- * const entry = await client.entries.get('my-entry');
182
- * const body = entry.field('body'); // Get markdown body
183
- * const difficulty = entry.field('difficulty'); // Get difficulty level
184
- * const heroImage = entry.field('heroImage'); // Get hero image UUID
185
- * ```
186
- */
187
- field(key) {
188
- return this.data.dataJson?.[key];
189
- }
190
- /**
191
- * Get all fields from the entry's schema-driven content.
192
- * @since 2.0.0
193
- */
194
- get fields() {
195
- return this.data.dataJson || {};
196
- }
197
- /**
198
- * Get related entries (future)
199
- */
200
- async relatedEntries() {
201
- throw new Error("Related entries not yet implemented");
202
- }
203
- /**
204
- * Get raw entry data
205
- */
206
- toJSON() {
207
- return this.data;
208
- }
209
- };
210
- }
211
- });
212
-
213
- // src/entries/entries.ts
214
- var EntriesModule;
215
- var init_entries = __esm({
216
- "src/entries/entries.ts"() {
217
- "use strict";
218
- init_entry();
219
- init_errors();
220
- EntriesModule = class {
221
- constructor(http, workspaceSlug) {
222
- this.http = http;
223
- this.workspaceSlug = workspaceSlug;
224
- }
225
- http;
226
- workspaceSlug;
227
- /**
228
- * Get all published entries
229
- */
230
- async list(options = {}) {
231
- const queryString = this.http.buildQueryString({
232
- entry_type: options.entryType,
233
- collection: options.collection,
234
- limit: options.limit,
235
- offset: options.offset
236
- // Don't send status - backend always returns published
237
- });
238
- const endpoint = `/api/publish/${this.workspaceSlug}/entries${queryString}`;
239
- const response = await this.http.fetch(endpoint);
240
- return response.data || [];
241
- }
242
- /**
243
- * Get a single entry by slug
244
- * Returns null if entry is not found (404)
245
- */
246
- async get(slug) {
247
- try {
248
- const endpoint = `/api/publish/${this.workspaceSlug}/entries/${slug}`;
249
- const data = await this.http.fetch(endpoint);
250
- return new Entry(data, this.http, this.workspaceSlug);
251
- } catch (error) {
252
- if (error instanceof MarvinNotFoundError) {
253
- return null;
254
- }
255
- throw error;
256
- }
257
- }
258
- /**
259
- * Convenience: Get all pages
260
- */
261
- async pages(options) {
262
- return this.list({ ...options, entryType: "page" });
263
- }
264
- /**
265
- * Convenience: Get all blog posts
266
- */
267
- async posts(options) {
268
- return this.list({ ...options, entryType: "blog" });
269
- }
270
- /**
271
- * Convenience: Get all projects
272
- */
273
- async projects(options) {
274
- return this.list({ ...options, entryType: "project" });
275
- }
276
- };
277
- }
278
- });
279
-
280
- // src/collections/collection.ts
281
- var Collection;
282
- var init_collection = __esm({
283
- "src/collections/collection.ts"() {
284
- "use strict";
285
- Collection = class {
286
- constructor(data, http, workspaceSlug) {
287
- this.data = data;
288
- this.http = http;
289
- this.workspaceSlug = workspaceSlug;
290
- }
291
- data;
292
- http;
293
- workspaceSlug;
294
- // Expose all collection data as properties
295
- get id() {
296
- return this.data.id;
297
- }
298
- get name() {
299
- return this.data.name;
300
- }
301
- get slug() {
302
- return this.data.slug;
303
- }
304
- get description() {
305
- return this.data.description;
306
- }
307
- get icon() {
308
- return this.data.icon;
309
- }
310
- get color() {
311
- return this.data.color;
312
- }
313
- get sortOrder() {
314
- return this.data.sortOrder;
315
- }
316
- get isSmart() {
317
- return this.data.isSmart;
318
- }
319
- get smartRules() {
320
- return this.data.smartRules;
321
- }
322
- get createdAt() {
323
- return this.data.createdAt;
324
- }
325
- get updatedAt() {
326
- return this.data.updatedAt;
327
- }
328
- /**
329
- * Get all entries in this collection
330
- */
331
- async entries() {
332
- return this.data.entries || [];
333
- }
334
- /**
335
- * Get assets in this collection (future)
336
- */
337
- async assets() {
338
- throw new Error("Collection assets not yet implemented");
339
- }
340
- /**
341
- * Get collection metadata (future)
342
- */
343
- async metadata() {
344
- throw new Error("Collection metadata not yet implemented");
345
- }
346
- /**
347
- * Get raw collection data
348
- */
349
- toJSON() {
350
- return this.data;
351
- }
352
- };
353
- }
354
- });
355
-
356
- // src/collections/collections.ts
357
- var CollectionsModule;
358
- var init_collections = __esm({
359
- "src/collections/collections.ts"() {
360
- "use strict";
361
- init_collection();
362
- init_errors();
363
- CollectionsModule = class {
364
- constructor(http, workspaceSlug) {
365
- this.http = http;
366
- this.workspaceSlug = workspaceSlug;
367
- }
368
- http;
369
- workspaceSlug;
370
- /**
371
- * Get all collections
372
- */
373
- async list() {
374
- const endpoint = `/api/publish/${this.workspaceSlug}/collections`;
375
- const response = await this.http.fetch(endpoint);
376
- return response.data || [];
377
- }
378
- /**
379
- * Get a single collection by slug
380
- * Returns null if collection is not found (404)
381
- */
382
- async get(slug) {
383
- try {
384
- const endpoint = `/api/publish/${this.workspaceSlug}/collections/${slug}`;
385
- const data = await this.http.fetch(endpoint);
386
- return new Collection(data, this.http, this.workspaceSlug);
387
- } catch (error) {
388
- if (error instanceof MarvinNotFoundError) {
389
- return null;
390
- }
391
- throw error;
392
- }
393
- }
394
- /**
395
- * Get entries in a collection
396
- * Returns empty array if collection is not found
397
- */
398
- async entries(slug) {
399
- const collection = await this.get(slug);
400
- if (!collection) {
401
- return [];
402
- }
403
- return collection.entries();
404
- }
405
- /**
406
- * Try multiple collection slugs in fallback order
407
- * Returns the first collection that exists and has entries
408
- *
409
- * @param slugs - Collection slugs to try in order
410
- * @param options - Options for fallback behavior
411
- * @returns Entries from the first matching collection, or empty array
412
- *
413
- * @example
414
- * ```ts
415
- * // Try bench-notes, then journal, then blog
416
- * const entries = await collections.fallback(['bench-notes', 'journal', 'blog']);
417
- * ```
418
- */
419
- async fallback(slugs, options = {}) {
420
- const { requireEntries = true } = options;
421
- for (const slug of slugs) {
422
- try {
423
- const collection = await this.get(slug);
424
- if (!collection) {
425
- continue;
426
- }
427
- const entries = await collection.entries();
428
- if (!requireEntries || entries.length > 0) {
429
- return entries;
430
- }
431
- } catch (error) {
432
- continue;
433
- }
434
- }
435
- return [];
436
- }
437
- };
438
- }
439
- });
440
-
441
- // src/assets/assets.ts
442
- var AssetsModule;
443
- var init_assets = __esm({
444
- "src/assets/assets.ts"() {
445
- "use strict";
446
- AssetsModule = class {
447
- constructor(http, workspaceSlug) {
448
- this.http = http;
449
- this.workspaceSlug = workspaceSlug;
450
- }
451
- http;
452
- workspaceSlug;
453
- /**
454
- * Get all published assets
455
- */
456
- async list(options = {}) {
457
- const queryString = this.http.buildQueryString({
458
- type: options.type,
459
- limit: options.limit,
460
- offset: options.offset
461
- });
462
- const endpoint = `/api/publish/${this.workspaceSlug}/assets${queryString}`;
463
- const response = await this.http.fetch(endpoint);
464
- return response.data || [];
465
- }
466
- /**
467
- * Get a single published asset by slug or ID
468
- */
469
- async get(slugOrId) {
470
- const endpoint = `/api/publish/${this.workspaceSlug}/assets/${slugOrId}`;
471
- return this.http.fetch(endpoint);
472
- }
473
- /**
474
- * Convenience: Get all images
475
- */
476
- async images(options) {
477
- return this.list({ ...options, type: "image" });
478
- }
479
- /**
480
- * Convenience: Get all videos
481
- */
482
- async videos(options) {
483
- return this.list({ ...options, type: "video" });
484
- }
485
- /**
486
- * Convenience: Get all documents
487
- */
488
- async documents(options) {
489
- return this.list({ ...options, type: "document" });
490
- }
491
- };
492
- }
493
- });
494
-
495
- // src/resources/resource.ts
496
- var Resource;
497
- var init_resource = __esm({
498
- "src/resources/resource.ts"() {
499
- "use strict";
500
- Resource = class {
501
- constructor(data, http, workspaceSlug) {
502
- this.data = data;
503
- this.http = http;
504
- this.workspaceSlug = workspaceSlug;
505
- }
506
- data;
507
- http;
508
- workspaceSlug;
509
- // Expose all resource data as properties
510
- get id() {
511
- return this.data.id;
512
- }
513
- get name() {
514
- return this.data.name;
515
- }
516
- get slug() {
517
- return this.data.slug;
518
- }
519
- get resourceType() {
520
- return this.data.resourceType;
521
- }
522
- get description() {
523
- return this.data.description;
524
- }
525
- get externalId() {
526
- return this.data.externalId;
527
- }
528
- get url() {
529
- return this.data.url;
530
- }
531
- get metadata() {
532
- return this.data.metadata;
533
- }
534
- get createdAt() {
535
- return this.data.createdAt;
536
- }
537
- get updatedAt() {
538
- return this.data.updatedAt;
539
- }
540
- /**
541
- * Get all entries that reference this resource
542
- */
543
- async entries() {
544
- const endpoint = `/api/publish/${this.workspaceSlug}/resources/${this.data.slug}/entries`;
545
- return this.http.fetch(endpoint);
546
- }
547
- /**
548
- * Get assets related to this resource (future)
549
- */
550
- async assets() {
551
- throw new Error("Resource assets not yet implemented");
552
- }
553
- /**
554
- * Get raw resource data
555
- */
556
- toJSON() {
557
- return this.data;
558
- }
559
- };
560
- }
561
- });
562
-
563
- // src/resources/resources.ts
564
- var ResourcesModule;
565
- var init_resources = __esm({
566
- "src/resources/resources.ts"() {
567
- "use strict";
568
- init_resource();
569
- ResourcesModule = class {
570
- constructor(http, workspaceSlug) {
571
- this.http = http;
572
- this.workspaceSlug = workspaceSlug;
573
- }
574
- http;
575
- workspaceSlug;
576
- /**
577
- * Get all published resources
578
- */
579
- async list(options = {}) {
580
- const queryString = this.http.buildQueryString({
581
- resource_type: options.resourceType,
582
- limit: options.limit,
583
- offset: options.offset
584
- });
585
- const endpoint = `/api/publish/${this.workspaceSlug}/resources${queryString}`;
586
- const response = await this.http.fetch(endpoint);
587
- return response.data || [];
588
- }
589
- /**
590
- * Get a single resource by slug
591
- */
592
- async get(slug) {
593
- const endpoint = `/api/publish/${this.workspaceSlug}/resources/${slug}`;
594
- const data = await this.http.fetch(endpoint);
595
- return new Resource(data, this.http, this.workspaceSlug);
596
- }
597
- /**
598
- * Get entries that reference this resource
599
- */
600
- async entries(slug) {
601
- const resource = await this.get(slug);
602
- return resource.entries();
603
- }
604
- };
605
- }
606
- });
607
-
608
- // src/workspaces/workspace.ts
609
- var Workspace;
610
- var init_workspace = __esm({
611
- "src/workspaces/workspace.ts"() {
612
- "use strict";
613
- init_entries();
614
- init_collections();
615
- init_assets();
616
- init_resources();
617
- Workspace = class {
618
- constructor(http, slug) {
619
- this.http = http;
620
- this._slug = slug;
621
- this.entries = new EntriesModule(http, slug);
622
- this.collections = new CollectionsModule(http, slug);
623
- this.assets = new AssetsModule(http, slug);
624
- this.resources = new ResourcesModule(http, slug);
625
- }
626
- http;
627
- _site = null;
628
- _slug;
629
- entries;
630
- collections;
631
- assets;
632
- resources;
633
- /**
634
- * Get workspace slug
635
- */
636
- get slug() {
637
- return this._slug;
638
- }
639
- /**
640
- * Get site configuration (cached after first load)
641
- */
642
- get site() {
643
- return this._site;
644
- }
645
- /**
646
- * Load site configuration
647
- */
648
- async loadSite() {
649
- const endpoint = `/api/publish/${this._slug}/site`;
650
- this._site = await this.http.fetch(endpoint);
651
- return this._site;
652
- }
653
- /**
654
- * Get workspace info (name and slug only)
655
- */
656
- async getInfo() {
657
- const endpoint = `/api/publish/${this._slug}`;
658
- return this.http.fetch(endpoint);
659
- }
660
- /**
661
- * Get workspace settings (future)
662
- */
663
- async settings() {
664
- throw new Error("Workspace settings not yet implemented");
665
- }
666
- };
667
- }
668
- });
669
-
670
- // src/client/marvin.ts
671
- var marvin_exports = {};
672
- __export(marvin_exports, {
673
- MarvinClient: () => MarvinClient
674
- });
675
- var MarvinClient;
676
- var init_marvin = __esm({
677
- "src/client/marvin.ts"() {
678
- "use strict";
679
- init_config();
680
- init_http();
681
- init_core();
682
- init_workspace();
683
- MarvinClient = class {
684
- constructor(config) {
685
- this.config = config;
686
- validateConfig(config);
687
- this.http = new MarvinHttpClient(config);
688
- this.cache = new MarvinCache(config.cacheDuration);
689
- this.workspace = new Workspace(this.http, config.workspaceSlug);
690
- if (config.autoInitialize) {
691
- this.initialize();
692
- }
693
- }
694
- config;
695
- http;
696
- cache;
697
- workspace;
698
- initialized = false;
699
- /**
700
- * Initialize the SDK
701
- * Preloads site configuration and metadata
702
- */
703
- async initialize() {
704
- if (this.initialized) return;
705
- try {
706
- await this.workspace.loadSite();
707
- this.initialized = true;
708
- } catch (error) {
709
- console.warn("Marvin SDK initialization warning:", error);
710
- }
711
- }
712
- // ======================
713
- // Workspace-First API
714
- // ======================
715
- /**
716
- * Get the workspace object
717
- */
718
- async getWorkspace() {
719
- if (!this.initialized) {
720
- await this.initialize();
721
- }
722
- return this.workspace;
723
- }
724
- /**
725
- * Get site configuration (cached)
726
- */
727
- get site() {
728
- return this.workspace.site;
729
- }
730
- /**
731
- * Get workspace info (name and slug)
732
- */
733
- async getWorkspaceInfo() {
734
- return this.workspace.getInfo();
735
- }
736
- /**
737
- * Get entries module
738
- */
739
- get entries() {
740
- return this.workspace.entries;
741
- }
742
- /**
743
- * Get collections module
744
- */
745
- get collections() {
746
- return this.workspace.collections;
747
- }
748
- /**
749
- * Get assets module
750
- */
751
- get assets() {
752
- return this.workspace.assets;
753
- }
754
- /**
755
- * Get resources module
756
- */
757
- get resources() {
758
- return this.workspace.resources;
759
- }
760
- // ======================
761
- // Convenience Methods
762
- // ======================
763
- /**
764
- * Get a single entry by slug
765
- */
766
- async entry(slug) {
767
- return this.workspace.entries.get(slug);
768
- }
769
- /**
770
- * Get a single collection by slug
771
- */
772
- async collection(slug) {
773
- return this.workspace.collections.get(slug);
774
- }
775
- /**
776
- * Get all pages
777
- */
778
- async pages(options) {
779
- return this.workspace.entries.pages(options);
780
- }
781
- /**
782
- * Get all blog posts
783
- */
784
- async posts(options) {
785
- return this.workspace.entries.posts(options);
786
- }
787
- /**
788
- * Get all projects
789
- */
790
- async projects(options) {
791
- return this.workspace.entries.projects(options);
792
- }
793
- /**
794
- * Get a single resource by slug
795
- */
796
- async resource(slug) {
797
- return this.workspace.resources.get(slug);
798
- }
799
- /**
800
- * Try multiple collection slugs in fallback order
801
- * Returns entries from the first collection that exists and has content
802
- *
803
- * @param slugs - Collection slugs to try in order
804
- * @param options - Options for fallback behavior
805
- * @returns Entries from the first matching collection, or empty array
806
- *
807
- * @example
808
- * ```ts
809
- * // Try bench-notes, then journal, then blog
810
- * const entries = await client.collectionFallback(['bench-notes', 'journal', 'blog']);
811
- * ```
812
- */
813
- async collectionFallback(slugs, options) {
814
- return this.workspace.collections.fallback(slugs, options);
815
- }
816
- // ======================
817
- // Backwards-Compatible Publishing API
818
- // ======================
819
- /**
820
- * @deprecated Use workspace.site or marvin.site instead
821
- * Get site configuration
822
- */
823
- async getSite() {
824
- return this.workspace.loadSite();
825
- }
826
- /**
827
- * @deprecated Use workspace.entries.list() instead
828
- * Get all published entries
829
- */
830
- async getEntries(options) {
831
- return this.workspace.entries.list(options);
832
- }
833
- /**
834
- * @deprecated Use workspace.entries.get() instead
835
- * Get a single published entry by slug
836
- */
837
- async getEntry(slug) {
838
- const entry = await this.workspace.entries.get(slug);
839
- if (!entry) {
840
- return null;
841
- }
842
- return entry.toJSON();
843
- }
844
- /**
845
- * @deprecated Use workspace.collections.list() instead
846
- * Get all collections
847
- */
848
- async getCollections() {
849
- return this.workspace.collections.list();
850
- }
851
- /**
852
- * @deprecated Use workspace.collections.get() instead
853
- * Get a single collection by slug
854
- */
855
- async getCollection(slug) {
856
- const collection = await this.workspace.collections.get(slug);
857
- if (!collection) {
858
- return null;
859
- }
860
- return collection.toJSON();
861
- }
862
- /**
863
- * @deprecated Use workspace.collections.entries() instead
864
- * Get all entries in a collection
865
- */
866
- async getCollectionEntries(slug) {
867
- return this.workspace.collections.entries(slug);
868
- }
869
- /**
870
- * @deprecated Use workspace.assets.list() instead
871
- * Get all published assets
872
- */
873
- async getAssets(options) {
874
- return this.workspace.assets.list(options);
875
- }
876
- /**
877
- * @deprecated Use workspace.resources.list() instead
878
- * Get all published resources
879
- */
880
- async getResources(options) {
881
- return this.workspace.resources.list(options);
882
- }
883
- /**
884
- * @deprecated Use workspace.resources.get() instead
885
- * Get a single resource by slug
886
- */
887
- async getResource(slug) {
888
- const resource = await this.workspace.resources.get(slug);
889
- return resource.toJSON();
890
- }
891
- /**
892
- * @deprecated Use workspace.resources.entries() instead
893
- * Get entries that reference a resource
894
- */
895
- async getResourceEntries(slug) {
896
- return this.workspace.resources.entries(slug);
897
- }
898
- };
899
- }
900
- });
37
+ pageToOffset,
38
+ validateEmail
39
+ } from "./chunk-WJC4X7TB.js";
901
40
 
902
41
  // src/index.ts
903
42
  init_marvin();
@@ -919,12 +58,14 @@ var AuthClient = class extends HttpClient {
919
58
  * Returns the created user object
920
59
  */
921
60
  async register(data) {
61
+ validateEmail(data.email, "Email");
922
62
  return this.post("/api/users/register", data);
923
63
  }
924
64
  /**
925
65
  * Request password reset (sends email with token)
926
66
  */
927
67
  async forgotPassword(data) {
68
+ validateEmail(data.email, "Email");
928
69
  return this.post("/api/users/forgot-password", data);
929
70
  }
930
71
  /**