@inneropen/marvin-sdk 2.0.0-next.22 → 2.0.0-next.24
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-SGZG7U7V.js → chunk-DCTX4NSF.js} +49 -203
- package/dist/index.cjs +48 -202
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/{marvin-BAslemIz.d.cts → marvin-CwB9ybc8.d.cts} +56 -155
- package/dist/{marvin-BmbMUJXh.d.ts → marvin-KVTEthgH.d.ts} +56 -155
- package/dist/platform.cjs +1 -14
- package/dist/platform.d.cts +27 -188
- package/dist/platform.d.ts +27 -188
- package/dist/platform.js +1 -14
- package/dist/publish.cjs +48 -202
- package/dist/publish.d.cts +3 -3
- package/dist/publish.d.ts +3 -3
- package/dist/publish.js +1 -1
- package/dist/types/index.d.cts +122 -124
- package/dist/types/index.d.ts +122 -124
- package/package.json +1 -1
|
@@ -141,113 +141,54 @@ var init_entry = __esm({
|
|
|
141
141
|
"src/entries/entry.ts"() {
|
|
142
142
|
"use strict";
|
|
143
143
|
Entry = class {
|
|
144
|
-
constructor(
|
|
145
|
-
this.
|
|
146
|
-
this.http = http;
|
|
147
|
-
this.workspaceSlug = workspaceSlug;
|
|
148
|
-
}
|
|
149
|
-
data;
|
|
150
|
-
http;
|
|
151
|
-
workspaceSlug;
|
|
152
|
-
// Expose all entry data as properties
|
|
153
|
-
get id() {
|
|
154
|
-
return this.data.id;
|
|
144
|
+
constructor(raw) {
|
|
145
|
+
this.raw = raw;
|
|
155
146
|
}
|
|
147
|
+
raw;
|
|
156
148
|
get title() {
|
|
157
|
-
return this.
|
|
149
|
+
return this.raw.title;
|
|
158
150
|
}
|
|
159
151
|
get slug() {
|
|
160
|
-
return this.
|
|
152
|
+
return this.raw.slug;
|
|
161
153
|
}
|
|
162
154
|
get summary() {
|
|
163
|
-
return this.
|
|
164
|
-
}
|
|
165
|
-
get description() {
|
|
166
|
-
return this.data.description;
|
|
155
|
+
return this.raw.summary;
|
|
167
156
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
*/
|
|
171
|
-
get contentMarkdown() {
|
|
172
|
-
return this.data.contentMarkdown;
|
|
157
|
+
get entryType() {
|
|
158
|
+
return this.raw.entryType;
|
|
173
159
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
* Access specific fields using the field() helper method.
|
|
177
|
-
* @since 2.0.0
|
|
178
|
-
*/
|
|
179
|
-
get dataJson() {
|
|
180
|
-
return this.data.dataJson;
|
|
160
|
+
get entryTypeInfo() {
|
|
161
|
+
return this.raw.entryTypeInfo;
|
|
181
162
|
}
|
|
182
|
-
get
|
|
183
|
-
return this.data
|
|
163
|
+
get data() {
|
|
164
|
+
return this.raw.data;
|
|
184
165
|
}
|
|
185
|
-
get
|
|
186
|
-
return this.
|
|
166
|
+
get metadataJson() {
|
|
167
|
+
return this.raw.metadataJson;
|
|
187
168
|
}
|
|
188
169
|
get publishedAt() {
|
|
189
|
-
return this.
|
|
190
|
-
}
|
|
191
|
-
get createdAt() {
|
|
192
|
-
return this.data.createdAt;
|
|
170
|
+
return this.raw.publishedAt;
|
|
193
171
|
}
|
|
194
|
-
get
|
|
195
|
-
return this.
|
|
172
|
+
get order() {
|
|
173
|
+
return this.raw.order;
|
|
196
174
|
}
|
|
197
|
-
get entryTypeId() {
|
|
198
|
-
return this.data.entryTypeId;
|
|
199
|
-
}
|
|
200
|
-
get entryType() {
|
|
201
|
-
return this.data.entryType;
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Get entry assets
|
|
205
|
-
*/
|
|
206
175
|
get assets() {
|
|
207
|
-
return this.
|
|
176
|
+
return this.raw.assets;
|
|
208
177
|
}
|
|
209
|
-
/**
|
|
210
|
-
* Get entry collections
|
|
211
|
-
*/
|
|
212
178
|
get collections() {
|
|
213
|
-
return this.
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
* @param key - Field key as defined in the entry type's schema
|
|
219
|
-
* @returns The field value, or undefined if not present
|
|
220
|
-
* @since 2.0.0
|
|
221
|
-
*
|
|
222
|
-
* @example
|
|
223
|
-
* ```typescript
|
|
224
|
-
* const entry = await client.entries.get('my-entry');
|
|
225
|
-
* const body = entry.field('body'); // Get markdown body
|
|
226
|
-
* const difficulty = entry.field('difficulty'); // Get difficulty level
|
|
227
|
-
* const heroImage = entry.field('heroImage'); // Get hero image UUID
|
|
228
|
-
* ```
|
|
229
|
-
*/
|
|
179
|
+
return this.raw.collections;
|
|
180
|
+
}
|
|
181
|
+
get resources() {
|
|
182
|
+
return this.raw.resources;
|
|
183
|
+
}
|
|
230
184
|
field(key) {
|
|
231
|
-
return this.data
|
|
185
|
+
return this.raw.data[key];
|
|
232
186
|
}
|
|
233
|
-
/**
|
|
234
|
-
* Get all fields from the entry's schema-driven content.
|
|
235
|
-
* @since 2.0.0
|
|
236
|
-
*/
|
|
237
187
|
get fields() {
|
|
238
|
-
return this.data
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Get related entries (future)
|
|
242
|
-
*/
|
|
243
|
-
async relatedEntries() {
|
|
244
|
-
throw new Error("Related entries not yet implemented");
|
|
188
|
+
return this.raw.data;
|
|
245
189
|
}
|
|
246
|
-
/**
|
|
247
|
-
* Get raw entry data
|
|
248
|
-
*/
|
|
249
190
|
toJSON() {
|
|
250
|
-
return this.
|
|
191
|
+
return this.raw;
|
|
251
192
|
}
|
|
252
193
|
};
|
|
253
194
|
}
|
|
@@ -259,18 +200,10 @@ var init_collection = __esm({
|
|
|
259
200
|
"src/collections/collection.ts"() {
|
|
260
201
|
"use strict";
|
|
261
202
|
Collection = class {
|
|
262
|
-
constructor(data
|
|
203
|
+
constructor(data) {
|
|
263
204
|
this.data = data;
|
|
264
|
-
this.http = http;
|
|
265
|
-
this.workspaceSlug = workspaceSlug;
|
|
266
205
|
}
|
|
267
206
|
data;
|
|
268
|
-
http;
|
|
269
|
-
workspaceSlug;
|
|
270
|
-
// Expose all collection data as properties
|
|
271
|
-
get id() {
|
|
272
|
-
return this.data.id;
|
|
273
|
-
}
|
|
274
207
|
get name() {
|
|
275
208
|
return this.data.name;
|
|
276
209
|
}
|
|
@@ -280,48 +213,21 @@ var init_collection = __esm({
|
|
|
280
213
|
get description() {
|
|
281
214
|
return this.data.description;
|
|
282
215
|
}
|
|
283
|
-
get icon() {
|
|
284
|
-
return this.data.icon;
|
|
285
|
-
}
|
|
286
|
-
get color() {
|
|
287
|
-
return this.data.color;
|
|
288
|
-
}
|
|
289
|
-
get sortOrder() {
|
|
290
|
-
return this.data.sortOrder;
|
|
291
|
-
}
|
|
292
216
|
get isSmart() {
|
|
293
217
|
return this.data.isSmart;
|
|
294
218
|
}
|
|
295
219
|
get smartRules() {
|
|
296
220
|
return this.data.smartRules;
|
|
297
221
|
}
|
|
298
|
-
get
|
|
299
|
-
return this.data.
|
|
300
|
-
}
|
|
301
|
-
get updatedAt() {
|
|
302
|
-
return this.data.updatedAt;
|
|
222
|
+
get metadataJson() {
|
|
223
|
+
return this.data.metadataJson;
|
|
303
224
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
*/
|
|
307
|
-
async entries() {
|
|
308
|
-
return this.data.entries || [];
|
|
225
|
+
get entryCount() {
|
|
226
|
+
return this.data.entryCount;
|
|
309
227
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
*/
|
|
313
|
-
async assets() {
|
|
314
|
-
throw new Error("Collection assets not yet implemented");
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Get collection metadata (future)
|
|
318
|
-
*/
|
|
319
|
-
async metadata() {
|
|
320
|
-
throw new Error("Collection metadata not yet implemented");
|
|
228
|
+
get entries() {
|
|
229
|
+
return this.data.entries;
|
|
321
230
|
}
|
|
322
|
-
/**
|
|
323
|
-
* Get raw collection data
|
|
324
|
-
*/
|
|
325
231
|
toJSON() {
|
|
326
232
|
return this.data;
|
|
327
233
|
}
|
|
@@ -335,18 +241,10 @@ var init_resource = __esm({
|
|
|
335
241
|
"src/resources/resource.ts"() {
|
|
336
242
|
"use strict";
|
|
337
243
|
Resource = class {
|
|
338
|
-
constructor(data
|
|
244
|
+
constructor(data) {
|
|
339
245
|
this.data = data;
|
|
340
|
-
this.http = http;
|
|
341
|
-
this.workspaceSlug = workspaceSlug;
|
|
342
246
|
}
|
|
343
247
|
data;
|
|
344
|
-
http;
|
|
345
|
-
workspaceSlug;
|
|
346
|
-
// Expose all resource data as properties
|
|
347
|
-
get id() {
|
|
348
|
-
return this.data.id;
|
|
349
|
-
}
|
|
350
248
|
get name() {
|
|
351
249
|
return this.data.name;
|
|
352
250
|
}
|
|
@@ -365,31 +263,12 @@ var init_resource = __esm({
|
|
|
365
263
|
get url() {
|
|
366
264
|
return this.data.url;
|
|
367
265
|
}
|
|
368
|
-
get
|
|
369
|
-
return this.data.
|
|
370
|
-
}
|
|
371
|
-
get createdAt() {
|
|
372
|
-
return this.data.createdAt;
|
|
373
|
-
}
|
|
374
|
-
get updatedAt() {
|
|
375
|
-
return this.data.updatedAt;
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Get all entries that reference this resource
|
|
379
|
-
*/
|
|
380
|
-
async entries() {
|
|
381
|
-
const endpoint = `/api/publish/${this.workspaceSlug}/resources/${this.data.slug}/entries`;
|
|
382
|
-
return this.http.fetch(endpoint);
|
|
266
|
+
get metadataJson() {
|
|
267
|
+
return this.data.metadataJson;
|
|
383
268
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
*/
|
|
387
|
-
async assets() {
|
|
388
|
-
throw new Error("Resource assets not yet implemented");
|
|
269
|
+
get entries() {
|
|
270
|
+
return this.data.entries;
|
|
389
271
|
}
|
|
390
|
-
/**
|
|
391
|
-
* Get raw resource data
|
|
392
|
-
*/
|
|
393
272
|
toJSON() {
|
|
394
273
|
return this.data;
|
|
395
274
|
}
|
|
@@ -420,7 +299,6 @@ var init_entries = __esm({
|
|
|
420
299
|
collection: options.collection,
|
|
421
300
|
limit: options.limit,
|
|
422
301
|
offset: options.offset
|
|
423
|
-
// Don't send status - backend always returns published
|
|
424
302
|
});
|
|
425
303
|
const endpoint = `/api/publish/${this.workspaceSlug}/entries${queryString}`;
|
|
426
304
|
const response = await this.http.fetch(endpoint);
|
|
@@ -434,7 +312,7 @@ var init_entries = __esm({
|
|
|
434
312
|
try {
|
|
435
313
|
const endpoint = `/api/publish/${this.workspaceSlug}/entries/${slug}`;
|
|
436
314
|
const data = await this.http.fetch(endpoint);
|
|
437
|
-
return new Entry(data
|
|
315
|
+
return new Entry(data);
|
|
438
316
|
} catch (error) {
|
|
439
317
|
if (error instanceof MarvinNotFoundError) {
|
|
440
318
|
return null;
|
|
@@ -494,7 +372,7 @@ var init_collections = __esm({
|
|
|
494
372
|
try {
|
|
495
373
|
const endpoint = `/api/publish/${this.workspaceSlug}/collections/${slug}`;
|
|
496
374
|
const data = await this.http.fetch(endpoint);
|
|
497
|
-
return new Collection(data
|
|
375
|
+
return new Collection(data);
|
|
498
376
|
} catch (error) {
|
|
499
377
|
if (error instanceof MarvinNotFoundError) {
|
|
500
378
|
return null;
|
|
@@ -511,21 +389,11 @@ var init_collections = __esm({
|
|
|
511
389
|
if (!collection) {
|
|
512
390
|
return [];
|
|
513
391
|
}
|
|
514
|
-
return collection.entries
|
|
392
|
+
return collection.entries;
|
|
515
393
|
}
|
|
516
394
|
/**
|
|
517
395
|
* Try multiple collection slugs in fallback order
|
|
518
396
|
* Returns the first collection that exists and has entries
|
|
519
|
-
*
|
|
520
|
-
* @param slugs - Collection slugs to try in order
|
|
521
|
-
* @param options - Options for fallback behavior
|
|
522
|
-
* @returns Entries from the first matching collection, or empty array
|
|
523
|
-
*
|
|
524
|
-
* @example
|
|
525
|
-
* ```ts
|
|
526
|
-
* // Try bench-notes, then journal, then blog
|
|
527
|
-
* const entries = await collections.fallback(['bench-notes', 'journal', 'blog']);
|
|
528
|
-
* ```
|
|
529
397
|
*/
|
|
530
398
|
async fallback(slugs, options = {}) {
|
|
531
399
|
const { requireEntries = true } = options;
|
|
@@ -535,7 +403,7 @@ var init_collections = __esm({
|
|
|
535
403
|
if (!collection) {
|
|
536
404
|
continue;
|
|
537
405
|
}
|
|
538
|
-
const entries =
|
|
406
|
+
const entries = collection.entries;
|
|
539
407
|
if (!requireEntries || entries.length > 0) {
|
|
540
408
|
return entries;
|
|
541
409
|
}
|
|
@@ -635,14 +503,14 @@ var init_resources = __esm({
|
|
|
635
503
|
async get(slug) {
|
|
636
504
|
const endpoint = `/api/publish/${this.workspaceSlug}/resources/${slug}`;
|
|
637
505
|
const data = await this.http.fetch(endpoint);
|
|
638
|
-
return new Resource(data
|
|
506
|
+
return new Resource(data);
|
|
639
507
|
}
|
|
640
508
|
/**
|
|
641
|
-
* Get
|
|
509
|
+
* Get entry slugs that reference this resource
|
|
642
510
|
*/
|
|
643
511
|
async entries(slug) {
|
|
644
512
|
const resource = await this.get(slug);
|
|
645
|
-
return resource.entries
|
|
513
|
+
return resource.entries;
|
|
646
514
|
}
|
|
647
515
|
};
|
|
648
516
|
}
|
|
@@ -773,8 +641,11 @@ var init_marvin = __esm({
|
|
|
773
641
|
init_core();
|
|
774
642
|
init_workspace();
|
|
775
643
|
MarvinClient = class {
|
|
644
|
+
http;
|
|
645
|
+
cache;
|
|
646
|
+
workspace;
|
|
647
|
+
initialized = false;
|
|
776
648
|
constructor(config) {
|
|
777
|
-
this.config = config;
|
|
778
649
|
validateConfig(config);
|
|
779
650
|
this.http = new MarvinHttpClient(config);
|
|
780
651
|
this.cache = new MarvinCache(config.cacheDuration);
|
|
@@ -783,11 +654,6 @@ var init_marvin = __esm({
|
|
|
783
654
|
this.initialize();
|
|
784
655
|
}
|
|
785
656
|
}
|
|
786
|
-
config;
|
|
787
|
-
http;
|
|
788
|
-
cache;
|
|
789
|
-
workspace;
|
|
790
|
-
initialized = false;
|
|
791
657
|
/**
|
|
792
658
|
* Initialize the SDK
|
|
793
659
|
* Preloads site configuration and metadata
|
|
@@ -897,16 +763,6 @@ var init_marvin = __esm({
|
|
|
897
763
|
/**
|
|
898
764
|
* Try multiple collection slugs in fallback order
|
|
899
765
|
* Returns entries from the first collection that exists and has content
|
|
900
|
-
*
|
|
901
|
-
* @param slugs - Collection slugs to try in order
|
|
902
|
-
* @param options - Options for fallback behavior
|
|
903
|
-
* @returns Entries from the first matching collection, or empty array
|
|
904
|
-
*
|
|
905
|
-
* @example
|
|
906
|
-
* ```ts
|
|
907
|
-
* // Try bench-notes, then journal, then blog
|
|
908
|
-
* const entries = await client.collectionFallback(['bench-notes', 'journal', 'blog']);
|
|
909
|
-
* ```
|
|
910
766
|
*/
|
|
911
767
|
async collectionFallback(slugs, options) {
|
|
912
768
|
return this.workspace.collections.fallback(slugs, options);
|
|
@@ -916,21 +772,18 @@ var init_marvin = __esm({
|
|
|
916
772
|
// ======================
|
|
917
773
|
/**
|
|
918
774
|
* @deprecated Use workspace.site or marvin.site instead
|
|
919
|
-
* Get site configuration
|
|
920
775
|
*/
|
|
921
776
|
async getSite() {
|
|
922
777
|
return this.workspace.loadSite();
|
|
923
778
|
}
|
|
924
779
|
/**
|
|
925
780
|
* @deprecated Use workspace.entries.list() instead
|
|
926
|
-
* Get all published entries
|
|
927
781
|
*/
|
|
928
782
|
async getEntries(options) {
|
|
929
783
|
return this.workspace.entries.list(options);
|
|
930
784
|
}
|
|
931
785
|
/**
|
|
932
786
|
* @deprecated Use workspace.entries.get() instead
|
|
933
|
-
* Get a single published entry by slug
|
|
934
787
|
*/
|
|
935
788
|
async getEntry(slug) {
|
|
936
789
|
const entry = await this.workspace.entries.get(slug);
|
|
@@ -941,14 +794,12 @@ var init_marvin = __esm({
|
|
|
941
794
|
}
|
|
942
795
|
/**
|
|
943
796
|
* @deprecated Use workspace.collections.list() instead
|
|
944
|
-
* Get all collections
|
|
945
797
|
*/
|
|
946
798
|
async getCollections() {
|
|
947
799
|
return this.workspace.collections.list();
|
|
948
800
|
}
|
|
949
801
|
/**
|
|
950
802
|
* @deprecated Use workspace.collections.get() instead
|
|
951
|
-
* Get a single collection by slug
|
|
952
803
|
*/
|
|
953
804
|
async getCollection(slug) {
|
|
954
805
|
const collection = await this.workspace.collections.get(slug);
|
|
@@ -959,28 +810,24 @@ var init_marvin = __esm({
|
|
|
959
810
|
}
|
|
960
811
|
/**
|
|
961
812
|
* @deprecated Use workspace.collections.entries() instead
|
|
962
|
-
* Get all entries in a collection
|
|
963
813
|
*/
|
|
964
814
|
async getCollectionEntries(slug) {
|
|
965
815
|
return this.workspace.collections.entries(slug);
|
|
966
816
|
}
|
|
967
817
|
/**
|
|
968
818
|
* @deprecated Use workspace.assets.list() instead
|
|
969
|
-
* Get all published assets
|
|
970
819
|
*/
|
|
971
820
|
async getAssets(options) {
|
|
972
821
|
return this.workspace.assets.list(options);
|
|
973
822
|
}
|
|
974
823
|
/**
|
|
975
824
|
* @deprecated Use workspace.resources.list() instead
|
|
976
|
-
* Get all published resources
|
|
977
825
|
*/
|
|
978
826
|
async getResources(options) {
|
|
979
827
|
return this.workspace.resources.list(options);
|
|
980
828
|
}
|
|
981
829
|
/**
|
|
982
830
|
* @deprecated Use workspace.resources.get() instead
|
|
983
|
-
* Get a single resource by slug
|
|
984
831
|
*/
|
|
985
832
|
async getResource(slug) {
|
|
986
833
|
const resource = await this.workspace.resources.get(slug);
|
|
@@ -988,7 +835,6 @@ var init_marvin = __esm({
|
|
|
988
835
|
}
|
|
989
836
|
/**
|
|
990
837
|
* @deprecated Use workspace.resources.entries() instead
|
|
991
|
-
* Get entries that reference a resource
|
|
992
838
|
*/
|
|
993
839
|
async getResourceEntries(slug) {
|
|
994
840
|
return this.workspace.resources.entries(slug);
|