@inneropen/marvin-sdk 2.0.0-next.23 → 2.0.0-next.25
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-CIFRKLJS.js → chunk-DCTX4NSF.js} +24 -126
- package/dist/index-D5zkKa4N.d.cts +3394 -0
- package/dist/index-D5zkKa4N.d.ts +3394 -0
- package/dist/index.cjs +24 -126
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/{marvin-B6kWCfmU.d.ts → marvin-DDpwJbmj.d.ts} +83 -104
- package/dist/{marvin-ixVRMtIS.d.cts → marvin-DcQimSKv.d.cts} +83 -104
- package/dist/platform.cjs +1 -14
- package/dist/platform.d.cts +28 -3521
- package/dist/platform.d.ts +28 -3521
- package/dist/platform.js +1 -14
- package/dist/publish.cjs +24 -126
- 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 +1 -218
- package/dist/types/index.d.ts +1 -218
- package/package.json +1 -1
|
@@ -141,14 +141,10 @@ var init_entry = __esm({
|
|
|
141
141
|
"src/entries/entry.ts"() {
|
|
142
142
|
"use strict";
|
|
143
143
|
Entry = class {
|
|
144
|
-
constructor(raw
|
|
144
|
+
constructor(raw) {
|
|
145
145
|
this.raw = raw;
|
|
146
|
-
this.http = http;
|
|
147
|
-
this.workspaceSlug = workspaceSlug;
|
|
148
146
|
}
|
|
149
147
|
raw;
|
|
150
|
-
http;
|
|
151
|
-
workspaceSlug;
|
|
152
148
|
get title() {
|
|
153
149
|
return this.raw.title;
|
|
154
150
|
}
|
|
@@ -191,9 +187,6 @@ var init_entry = __esm({
|
|
|
191
187
|
get fields() {
|
|
192
188
|
return this.raw.data;
|
|
193
189
|
}
|
|
194
|
-
async relatedEntries() {
|
|
195
|
-
throw new Error("Related entries not yet implemented");
|
|
196
|
-
}
|
|
197
190
|
toJSON() {
|
|
198
191
|
return this.raw;
|
|
199
192
|
}
|
|
@@ -207,18 +200,10 @@ var init_collection = __esm({
|
|
|
207
200
|
"src/collections/collection.ts"() {
|
|
208
201
|
"use strict";
|
|
209
202
|
Collection = class {
|
|
210
|
-
constructor(data
|
|
203
|
+
constructor(data) {
|
|
211
204
|
this.data = data;
|
|
212
|
-
this.http = http;
|
|
213
|
-
this.workspaceSlug = workspaceSlug;
|
|
214
205
|
}
|
|
215
206
|
data;
|
|
216
|
-
http;
|
|
217
|
-
workspaceSlug;
|
|
218
|
-
// Expose all collection data as properties
|
|
219
|
-
get id() {
|
|
220
|
-
return this.data.id;
|
|
221
|
-
}
|
|
222
207
|
get name() {
|
|
223
208
|
return this.data.name;
|
|
224
209
|
}
|
|
@@ -228,48 +213,21 @@ var init_collection = __esm({
|
|
|
228
213
|
get description() {
|
|
229
214
|
return this.data.description;
|
|
230
215
|
}
|
|
231
|
-
get icon() {
|
|
232
|
-
return this.data.icon;
|
|
233
|
-
}
|
|
234
|
-
get color() {
|
|
235
|
-
return this.data.color;
|
|
236
|
-
}
|
|
237
|
-
get sortOrder() {
|
|
238
|
-
return this.data.sortOrder;
|
|
239
|
-
}
|
|
240
216
|
get isSmart() {
|
|
241
217
|
return this.data.isSmart;
|
|
242
218
|
}
|
|
243
219
|
get smartRules() {
|
|
244
220
|
return this.data.smartRules;
|
|
245
221
|
}
|
|
246
|
-
get
|
|
247
|
-
return this.data.
|
|
248
|
-
}
|
|
249
|
-
get updatedAt() {
|
|
250
|
-
return this.data.updatedAt;
|
|
222
|
+
get metadataJson() {
|
|
223
|
+
return this.data.metadataJson;
|
|
251
224
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
*/
|
|
255
|
-
async entries() {
|
|
256
|
-
return this.data.entries || [];
|
|
225
|
+
get entryCount() {
|
|
226
|
+
return this.data.entryCount;
|
|
257
227
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
*/
|
|
261
|
-
async assets() {
|
|
262
|
-
throw new Error("Collection assets not yet implemented");
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Get collection metadata (future)
|
|
266
|
-
*/
|
|
267
|
-
async metadata() {
|
|
268
|
-
throw new Error("Collection metadata not yet implemented");
|
|
228
|
+
get entries() {
|
|
229
|
+
return this.data.entries;
|
|
269
230
|
}
|
|
270
|
-
/**
|
|
271
|
-
* Get raw collection data
|
|
272
|
-
*/
|
|
273
231
|
toJSON() {
|
|
274
232
|
return this.data;
|
|
275
233
|
}
|
|
@@ -283,18 +241,10 @@ var init_resource = __esm({
|
|
|
283
241
|
"src/resources/resource.ts"() {
|
|
284
242
|
"use strict";
|
|
285
243
|
Resource = class {
|
|
286
|
-
constructor(data
|
|
244
|
+
constructor(data) {
|
|
287
245
|
this.data = data;
|
|
288
|
-
this.http = http;
|
|
289
|
-
this.workspaceSlug = workspaceSlug;
|
|
290
246
|
}
|
|
291
247
|
data;
|
|
292
|
-
http;
|
|
293
|
-
workspaceSlug;
|
|
294
|
-
// Expose all resource data as properties
|
|
295
|
-
get id() {
|
|
296
|
-
return this.data.id;
|
|
297
|
-
}
|
|
298
248
|
get name() {
|
|
299
249
|
return this.data.name;
|
|
300
250
|
}
|
|
@@ -313,31 +263,12 @@ var init_resource = __esm({
|
|
|
313
263
|
get url() {
|
|
314
264
|
return this.data.url;
|
|
315
265
|
}
|
|
316
|
-
get
|
|
317
|
-
return this.data.
|
|
318
|
-
}
|
|
319
|
-
get createdAt() {
|
|
320
|
-
return this.data.createdAt;
|
|
321
|
-
}
|
|
322
|
-
get updatedAt() {
|
|
323
|
-
return this.data.updatedAt;
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Get all entries that reference this resource
|
|
327
|
-
*/
|
|
328
|
-
async entries() {
|
|
329
|
-
const endpoint = `/api/publish/${this.workspaceSlug}/resources/${this.data.slug}/entries`;
|
|
330
|
-
return this.http.fetch(endpoint);
|
|
266
|
+
get metadataJson() {
|
|
267
|
+
return this.data.metadataJson;
|
|
331
268
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
*/
|
|
335
|
-
async assets() {
|
|
336
|
-
throw new Error("Resource assets not yet implemented");
|
|
269
|
+
get entries() {
|
|
270
|
+
return this.data.entries;
|
|
337
271
|
}
|
|
338
|
-
/**
|
|
339
|
-
* Get raw resource data
|
|
340
|
-
*/
|
|
341
272
|
toJSON() {
|
|
342
273
|
return this.data;
|
|
343
274
|
}
|
|
@@ -368,7 +299,6 @@ var init_entries = __esm({
|
|
|
368
299
|
collection: options.collection,
|
|
369
300
|
limit: options.limit,
|
|
370
301
|
offset: options.offset
|
|
371
|
-
// Don't send status - backend always returns published
|
|
372
302
|
});
|
|
373
303
|
const endpoint = `/api/publish/${this.workspaceSlug}/entries${queryString}`;
|
|
374
304
|
const response = await this.http.fetch(endpoint);
|
|
@@ -382,7 +312,7 @@ var init_entries = __esm({
|
|
|
382
312
|
try {
|
|
383
313
|
const endpoint = `/api/publish/${this.workspaceSlug}/entries/${slug}`;
|
|
384
314
|
const data = await this.http.fetch(endpoint);
|
|
385
|
-
return new Entry(data
|
|
315
|
+
return new Entry(data);
|
|
386
316
|
} catch (error) {
|
|
387
317
|
if (error instanceof MarvinNotFoundError) {
|
|
388
318
|
return null;
|
|
@@ -442,7 +372,7 @@ var init_collections = __esm({
|
|
|
442
372
|
try {
|
|
443
373
|
const endpoint = `/api/publish/${this.workspaceSlug}/collections/${slug}`;
|
|
444
374
|
const data = await this.http.fetch(endpoint);
|
|
445
|
-
return new Collection(data
|
|
375
|
+
return new Collection(data);
|
|
446
376
|
} catch (error) {
|
|
447
377
|
if (error instanceof MarvinNotFoundError) {
|
|
448
378
|
return null;
|
|
@@ -459,21 +389,11 @@ var init_collections = __esm({
|
|
|
459
389
|
if (!collection) {
|
|
460
390
|
return [];
|
|
461
391
|
}
|
|
462
|
-
return collection.entries
|
|
392
|
+
return collection.entries;
|
|
463
393
|
}
|
|
464
394
|
/**
|
|
465
395
|
* Try multiple collection slugs in fallback order
|
|
466
396
|
* Returns the first collection that exists and has entries
|
|
467
|
-
*
|
|
468
|
-
* @param slugs - Collection slugs to try in order
|
|
469
|
-
* @param options - Options for fallback behavior
|
|
470
|
-
* @returns Entries from the first matching collection, or empty array
|
|
471
|
-
*
|
|
472
|
-
* @example
|
|
473
|
-
* ```ts
|
|
474
|
-
* // Try bench-notes, then journal, then blog
|
|
475
|
-
* const entries = await collections.fallback(['bench-notes', 'journal', 'blog']);
|
|
476
|
-
* ```
|
|
477
397
|
*/
|
|
478
398
|
async fallback(slugs, options = {}) {
|
|
479
399
|
const { requireEntries = true } = options;
|
|
@@ -483,7 +403,7 @@ var init_collections = __esm({
|
|
|
483
403
|
if (!collection) {
|
|
484
404
|
continue;
|
|
485
405
|
}
|
|
486
|
-
const entries =
|
|
406
|
+
const entries = collection.entries;
|
|
487
407
|
if (!requireEntries || entries.length > 0) {
|
|
488
408
|
return entries;
|
|
489
409
|
}
|
|
@@ -583,14 +503,14 @@ var init_resources = __esm({
|
|
|
583
503
|
async get(slug) {
|
|
584
504
|
const endpoint = `/api/publish/${this.workspaceSlug}/resources/${slug}`;
|
|
585
505
|
const data = await this.http.fetch(endpoint);
|
|
586
|
-
return new Resource(data
|
|
506
|
+
return new Resource(data);
|
|
587
507
|
}
|
|
588
508
|
/**
|
|
589
|
-
* Get
|
|
509
|
+
* Get entry slugs that reference this resource
|
|
590
510
|
*/
|
|
591
511
|
async entries(slug) {
|
|
592
512
|
const resource = await this.get(slug);
|
|
593
|
-
return resource.entries
|
|
513
|
+
return resource.entries;
|
|
594
514
|
}
|
|
595
515
|
};
|
|
596
516
|
}
|
|
@@ -721,8 +641,11 @@ var init_marvin = __esm({
|
|
|
721
641
|
init_core();
|
|
722
642
|
init_workspace();
|
|
723
643
|
MarvinClient = class {
|
|
644
|
+
http;
|
|
645
|
+
cache;
|
|
646
|
+
workspace;
|
|
647
|
+
initialized = false;
|
|
724
648
|
constructor(config) {
|
|
725
|
-
this.config = config;
|
|
726
649
|
validateConfig(config);
|
|
727
650
|
this.http = new MarvinHttpClient(config);
|
|
728
651
|
this.cache = new MarvinCache(config.cacheDuration);
|
|
@@ -731,11 +654,6 @@ var init_marvin = __esm({
|
|
|
731
654
|
this.initialize();
|
|
732
655
|
}
|
|
733
656
|
}
|
|
734
|
-
config;
|
|
735
|
-
http;
|
|
736
|
-
cache;
|
|
737
|
-
workspace;
|
|
738
|
-
initialized = false;
|
|
739
657
|
/**
|
|
740
658
|
* Initialize the SDK
|
|
741
659
|
* Preloads site configuration and metadata
|
|
@@ -845,16 +763,6 @@ var init_marvin = __esm({
|
|
|
845
763
|
/**
|
|
846
764
|
* Try multiple collection slugs in fallback order
|
|
847
765
|
* Returns entries from the first collection that exists and has content
|
|
848
|
-
*
|
|
849
|
-
* @param slugs - Collection slugs to try in order
|
|
850
|
-
* @param options - Options for fallback behavior
|
|
851
|
-
* @returns Entries from the first matching collection, or empty array
|
|
852
|
-
*
|
|
853
|
-
* @example
|
|
854
|
-
* ```ts
|
|
855
|
-
* // Try bench-notes, then journal, then blog
|
|
856
|
-
* const entries = await client.collectionFallback(['bench-notes', 'journal', 'blog']);
|
|
857
|
-
* ```
|
|
858
766
|
*/
|
|
859
767
|
async collectionFallback(slugs, options) {
|
|
860
768
|
return this.workspace.collections.fallback(slugs, options);
|
|
@@ -864,21 +772,18 @@ var init_marvin = __esm({
|
|
|
864
772
|
// ======================
|
|
865
773
|
/**
|
|
866
774
|
* @deprecated Use workspace.site or marvin.site instead
|
|
867
|
-
* Get site configuration
|
|
868
775
|
*/
|
|
869
776
|
async getSite() {
|
|
870
777
|
return this.workspace.loadSite();
|
|
871
778
|
}
|
|
872
779
|
/**
|
|
873
780
|
* @deprecated Use workspace.entries.list() instead
|
|
874
|
-
* Get all published entries
|
|
875
781
|
*/
|
|
876
782
|
async getEntries(options) {
|
|
877
783
|
return this.workspace.entries.list(options);
|
|
878
784
|
}
|
|
879
785
|
/**
|
|
880
786
|
* @deprecated Use workspace.entries.get() instead
|
|
881
|
-
* Get a single published entry by slug
|
|
882
787
|
*/
|
|
883
788
|
async getEntry(slug) {
|
|
884
789
|
const entry = await this.workspace.entries.get(slug);
|
|
@@ -889,14 +794,12 @@ var init_marvin = __esm({
|
|
|
889
794
|
}
|
|
890
795
|
/**
|
|
891
796
|
* @deprecated Use workspace.collections.list() instead
|
|
892
|
-
* Get all collections
|
|
893
797
|
*/
|
|
894
798
|
async getCollections() {
|
|
895
799
|
return this.workspace.collections.list();
|
|
896
800
|
}
|
|
897
801
|
/**
|
|
898
802
|
* @deprecated Use workspace.collections.get() instead
|
|
899
|
-
* Get a single collection by slug
|
|
900
803
|
*/
|
|
901
804
|
async getCollection(slug) {
|
|
902
805
|
const collection = await this.workspace.collections.get(slug);
|
|
@@ -907,28 +810,24 @@ var init_marvin = __esm({
|
|
|
907
810
|
}
|
|
908
811
|
/**
|
|
909
812
|
* @deprecated Use workspace.collections.entries() instead
|
|
910
|
-
* Get all entries in a collection
|
|
911
813
|
*/
|
|
912
814
|
async getCollectionEntries(slug) {
|
|
913
815
|
return this.workspace.collections.entries(slug);
|
|
914
816
|
}
|
|
915
817
|
/**
|
|
916
818
|
* @deprecated Use workspace.assets.list() instead
|
|
917
|
-
* Get all published assets
|
|
918
819
|
*/
|
|
919
820
|
async getAssets(options) {
|
|
920
821
|
return this.workspace.assets.list(options);
|
|
921
822
|
}
|
|
922
823
|
/**
|
|
923
824
|
* @deprecated Use workspace.resources.list() instead
|
|
924
|
-
* Get all published resources
|
|
925
825
|
*/
|
|
926
826
|
async getResources(options) {
|
|
927
827
|
return this.workspace.resources.list(options);
|
|
928
828
|
}
|
|
929
829
|
/**
|
|
930
830
|
* @deprecated Use workspace.resources.get() instead
|
|
931
|
-
* Get a single resource by slug
|
|
932
831
|
*/
|
|
933
832
|
async getResource(slug) {
|
|
934
833
|
const resource = await this.workspace.resources.get(slug);
|
|
@@ -936,7 +835,6 @@ var init_marvin = __esm({
|
|
|
936
835
|
}
|
|
937
836
|
/**
|
|
938
837
|
* @deprecated Use workspace.resources.entries() instead
|
|
939
|
-
* Get entries that reference a resource
|
|
940
838
|
*/
|
|
941
839
|
async getResourceEntries(slug) {
|
|
942
840
|
return this.workspace.resources.entries(slug);
|