@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/publish.cjs CHANGED
@@ -724,113 +724,54 @@ var MarvinHttpClient = class extends HttpClient {
724
724
 
725
725
  // src/entries/entry.ts
726
726
  var Entry = class {
727
- constructor(data, http, workspaceSlug) {
728
- this.data = data;
729
- this.http = http;
730
- this.workspaceSlug = workspaceSlug;
731
- }
732
- data;
733
- http;
734
- workspaceSlug;
735
- // Expose all entry data as properties
736
- get id() {
737
- return this.data.id;
727
+ constructor(raw) {
728
+ this.raw = raw;
738
729
  }
730
+ raw;
739
731
  get title() {
740
- return this.data.title;
732
+ return this.raw.title;
741
733
  }
742
734
  get slug() {
743
- return this.data.slug;
735
+ return this.raw.slug;
744
736
  }
745
737
  get summary() {
746
- return this.data.summary;
747
- }
748
- get description() {
749
- return this.data.description;
738
+ return this.raw.summary;
750
739
  }
751
- /**
752
- * @deprecated Use field('body') or dataJson instead. Will be removed in v3.0.0
753
- */
754
- get contentMarkdown() {
755
- return this.data.contentMarkdown;
740
+ get entryType() {
741
+ return this.raw.entryType;
756
742
  }
757
- /**
758
- * Schema-driven content data (replaces contentMarkdown in v2.0.0).
759
- * Access specific fields using the field() helper method.
760
- * @since 2.0.0
761
- */
762
- get dataJson() {
763
- return this.data.dataJson;
743
+ get entryTypeInfo() {
744
+ return this.raw.entryTypeInfo;
764
745
  }
765
- get metadata() {
766
- return this.data.metadata;
746
+ get data() {
747
+ return this.raw.data;
767
748
  }
768
- get status() {
769
- return this.data.status;
749
+ get metadataJson() {
750
+ return this.raw.metadataJson;
770
751
  }
771
752
  get publishedAt() {
772
- return this.data.publishedAt;
773
- }
774
- get createdAt() {
775
- return this.data.createdAt;
776
- }
777
- get updatedAt() {
778
- return this.data.updatedAt;
779
- }
780
- get entryTypeId() {
781
- return this.data.entryTypeId;
753
+ return this.raw.publishedAt;
782
754
  }
783
- get entryType() {
784
- return this.data.entryType;
755
+ get order() {
756
+ return this.raw.order;
785
757
  }
786
- /**
787
- * Get entry assets
788
- */
789
758
  get assets() {
790
- return this.data.assets || [];
759
+ return this.raw.assets;
791
760
  }
792
- /**
793
- * Get entry collections
794
- */
795
761
  get collections() {
796
- return this.data.collections || [];
762
+ return this.raw.collections;
763
+ }
764
+ get resources() {
765
+ return this.raw.resources;
797
766
  }
798
- /**
799
- * Get a specific field value from the entry's schema-driven content (dataJson).
800
- *
801
- * @param key - Field key as defined in the entry type's schema
802
- * @returns The field value, or undefined if not present
803
- * @since 2.0.0
804
- *
805
- * @example
806
- * ```typescript
807
- * const entry = await client.entries.get('my-entry');
808
- * const body = entry.field('body'); // Get markdown body
809
- * const difficulty = entry.field('difficulty'); // Get difficulty level
810
- * const heroImage = entry.field('heroImage'); // Get hero image UUID
811
- * ```
812
- */
813
767
  field(key) {
814
- return this.data.dataJson?.[key];
768
+ return this.raw.data[key];
815
769
  }
816
- /**
817
- * Get all fields from the entry's schema-driven content.
818
- * @since 2.0.0
819
- */
820
770
  get fields() {
821
- return this.data.dataJson || {};
822
- }
823
- /**
824
- * Get related entries (future)
825
- */
826
- async relatedEntries() {
827
- throw new Error("Related entries not yet implemented");
771
+ return this.raw.data;
828
772
  }
829
- /**
830
- * Get raw entry data
831
- */
832
773
  toJSON() {
833
- return this.data;
774
+ return this.raw;
834
775
  }
835
776
  };
836
777
 
@@ -851,7 +792,6 @@ var EntriesModule = class {
851
792
  collection: options.collection,
852
793
  limit: options.limit,
853
794
  offset: options.offset
854
- // Don't send status - backend always returns published
855
795
  });
856
796
  const endpoint = `/api/publish/${this.workspaceSlug}/entries${queryString}`;
857
797
  const response = await this.http.fetch(endpoint);
@@ -865,7 +805,7 @@ var EntriesModule = class {
865
805
  try {
866
806
  const endpoint = `/api/publish/${this.workspaceSlug}/entries/${slug}`;
867
807
  const data = await this.http.fetch(endpoint);
868
- return new Entry(data, this.http, this.workspaceSlug);
808
+ return new Entry(data);
869
809
  } catch (error) {
870
810
  if (error instanceof MarvinNotFoundError) {
871
811
  return null;
@@ -895,18 +835,10 @@ var EntriesModule = class {
895
835
 
896
836
  // src/collections/collection.ts
897
837
  var Collection = class {
898
- constructor(data, http, workspaceSlug) {
838
+ constructor(data) {
899
839
  this.data = data;
900
- this.http = http;
901
- this.workspaceSlug = workspaceSlug;
902
840
  }
903
841
  data;
904
- http;
905
- workspaceSlug;
906
- // Expose all collection data as properties
907
- get id() {
908
- return this.data.id;
909
- }
910
842
  get name() {
911
843
  return this.data.name;
912
844
  }
@@ -916,48 +848,21 @@ var Collection = class {
916
848
  get description() {
917
849
  return this.data.description;
918
850
  }
919
- get icon() {
920
- return this.data.icon;
921
- }
922
- get color() {
923
- return this.data.color;
924
- }
925
- get sortOrder() {
926
- return this.data.sortOrder;
927
- }
928
851
  get isSmart() {
929
852
  return this.data.isSmart;
930
853
  }
931
854
  get smartRules() {
932
855
  return this.data.smartRules;
933
856
  }
934
- get createdAt() {
935
- return this.data.createdAt;
857
+ get metadataJson() {
858
+ return this.data.metadataJson;
936
859
  }
937
- get updatedAt() {
938
- return this.data.updatedAt;
860
+ get entryCount() {
861
+ return this.data.entryCount;
939
862
  }
940
- /**
941
- * Get all entries in this collection
942
- */
943
- async entries() {
944
- return this.data.entries || [];
945
- }
946
- /**
947
- * Get assets in this collection (future)
948
- */
949
- async assets() {
950
- throw new Error("Collection assets not yet implemented");
951
- }
952
- /**
953
- * Get collection metadata (future)
954
- */
955
- async metadata() {
956
- throw new Error("Collection metadata not yet implemented");
863
+ get entries() {
864
+ return this.data.entries;
957
865
  }
958
- /**
959
- * Get raw collection data
960
- */
961
866
  toJSON() {
962
867
  return this.data;
963
868
  }
@@ -987,7 +892,7 @@ var CollectionsModule = class {
987
892
  try {
988
893
  const endpoint = `/api/publish/${this.workspaceSlug}/collections/${slug}`;
989
894
  const data = await this.http.fetch(endpoint);
990
- return new Collection(data, this.http, this.workspaceSlug);
895
+ return new Collection(data);
991
896
  } catch (error) {
992
897
  if (error instanceof MarvinNotFoundError) {
993
898
  return null;
@@ -1004,21 +909,11 @@ var CollectionsModule = class {
1004
909
  if (!collection) {
1005
910
  return [];
1006
911
  }
1007
- return collection.entries();
912
+ return collection.entries;
1008
913
  }
1009
914
  /**
1010
915
  * Try multiple collection slugs in fallback order
1011
916
  * Returns the first collection that exists and has entries
1012
- *
1013
- * @param slugs - Collection slugs to try in order
1014
- * @param options - Options for fallback behavior
1015
- * @returns Entries from the first matching collection, or empty array
1016
- *
1017
- * @example
1018
- * ```ts
1019
- * // Try bench-notes, then journal, then blog
1020
- * const entries = await collections.fallback(['bench-notes', 'journal', 'blog']);
1021
- * ```
1022
917
  */
1023
918
  async fallback(slugs, options = {}) {
1024
919
  const { requireEntries = true } = options;
@@ -1028,7 +923,7 @@ var CollectionsModule = class {
1028
923
  if (!collection) {
1029
924
  continue;
1030
925
  }
1031
- const entries = await collection.entries();
926
+ const entries = collection.entries;
1032
927
  if (!requireEntries || entries.length > 0) {
1033
928
  return entries;
1034
929
  }
@@ -1090,18 +985,10 @@ var AssetsModule = class {
1090
985
 
1091
986
  // src/resources/resource.ts
1092
987
  var Resource = class {
1093
- constructor(data, http, workspaceSlug) {
988
+ constructor(data) {
1094
989
  this.data = data;
1095
- this.http = http;
1096
- this.workspaceSlug = workspaceSlug;
1097
990
  }
1098
991
  data;
1099
- http;
1100
- workspaceSlug;
1101
- // Expose all resource data as properties
1102
- get id() {
1103
- return this.data.id;
1104
- }
1105
992
  get name() {
1106
993
  return this.data.name;
1107
994
  }
@@ -1120,31 +1007,12 @@ var Resource = class {
1120
1007
  get url() {
1121
1008
  return this.data.url;
1122
1009
  }
1123
- get metadata() {
1124
- return this.data.metadata;
1125
- }
1126
- get createdAt() {
1127
- return this.data.createdAt;
1128
- }
1129
- get updatedAt() {
1130
- return this.data.updatedAt;
1010
+ get metadataJson() {
1011
+ return this.data.metadataJson;
1131
1012
  }
1132
- /**
1133
- * Get all entries that reference this resource
1134
- */
1135
- async entries() {
1136
- const endpoint = `/api/publish/${this.workspaceSlug}/resources/${this.data.slug}/entries`;
1137
- return this.http.fetch(endpoint);
1138
- }
1139
- /**
1140
- * Get assets related to this resource (future)
1141
- */
1142
- async assets() {
1143
- throw new Error("Resource assets not yet implemented");
1013
+ get entries() {
1014
+ return this.data.entries;
1144
1015
  }
1145
- /**
1146
- * Get raw resource data
1147
- */
1148
1016
  toJSON() {
1149
1017
  return this.data;
1150
1018
  }
@@ -1177,14 +1045,14 @@ var ResourcesModule = class {
1177
1045
  async get(slug) {
1178
1046
  const endpoint = `/api/publish/${this.workspaceSlug}/resources/${slug}`;
1179
1047
  const data = await this.http.fetch(endpoint);
1180
- return new Resource(data, this.http, this.workspaceSlug);
1048
+ return new Resource(data);
1181
1049
  }
1182
1050
  /**
1183
- * Get entries that reference this resource
1051
+ * Get entry slugs that reference this resource
1184
1052
  */
1185
1053
  async entries(slug) {
1186
1054
  const resource = await this.get(slug);
1187
- return resource.entries();
1055
+ return resource.entries;
1188
1056
  }
1189
1057
  };
1190
1058
 
@@ -1258,8 +1126,11 @@ var Workspace = class {
1258
1126
 
1259
1127
  // src/client/marvin.ts
1260
1128
  var MarvinClient = class {
1129
+ http;
1130
+ cache;
1131
+ workspace;
1132
+ initialized = false;
1261
1133
  constructor(config) {
1262
- this.config = config;
1263
1134
  validateConfig(config);
1264
1135
  this.http = new MarvinHttpClient(config);
1265
1136
  this.cache = new MarvinCache(config.cacheDuration);
@@ -1268,11 +1139,6 @@ var MarvinClient = class {
1268
1139
  this.initialize();
1269
1140
  }
1270
1141
  }
1271
- config;
1272
- http;
1273
- cache;
1274
- workspace;
1275
- initialized = false;
1276
1142
  /**
1277
1143
  * Initialize the SDK
1278
1144
  * Preloads site configuration and metadata
@@ -1382,16 +1248,6 @@ var MarvinClient = class {
1382
1248
  /**
1383
1249
  * Try multiple collection slugs in fallback order
1384
1250
  * Returns entries from the first collection that exists and has content
1385
- *
1386
- * @param slugs - Collection slugs to try in order
1387
- * @param options - Options for fallback behavior
1388
- * @returns Entries from the first matching collection, or empty array
1389
- *
1390
- * @example
1391
- * ```ts
1392
- * // Try bench-notes, then journal, then blog
1393
- * const entries = await client.collectionFallback(['bench-notes', 'journal', 'blog']);
1394
- * ```
1395
1251
  */
1396
1252
  async collectionFallback(slugs, options) {
1397
1253
  return this.workspace.collections.fallback(slugs, options);
@@ -1401,21 +1257,18 @@ var MarvinClient = class {
1401
1257
  // ======================
1402
1258
  /**
1403
1259
  * @deprecated Use workspace.site or marvin.site instead
1404
- * Get site configuration
1405
1260
  */
1406
1261
  async getSite() {
1407
1262
  return this.workspace.loadSite();
1408
1263
  }
1409
1264
  /**
1410
1265
  * @deprecated Use workspace.entries.list() instead
1411
- * Get all published entries
1412
1266
  */
1413
1267
  async getEntries(options) {
1414
1268
  return this.workspace.entries.list(options);
1415
1269
  }
1416
1270
  /**
1417
1271
  * @deprecated Use workspace.entries.get() instead
1418
- * Get a single published entry by slug
1419
1272
  */
1420
1273
  async getEntry(slug) {
1421
1274
  const entry = await this.workspace.entries.get(slug);
@@ -1426,14 +1279,12 @@ var MarvinClient = class {
1426
1279
  }
1427
1280
  /**
1428
1281
  * @deprecated Use workspace.collections.list() instead
1429
- * Get all collections
1430
1282
  */
1431
1283
  async getCollections() {
1432
1284
  return this.workspace.collections.list();
1433
1285
  }
1434
1286
  /**
1435
1287
  * @deprecated Use workspace.collections.get() instead
1436
- * Get a single collection by slug
1437
1288
  */
1438
1289
  async getCollection(slug) {
1439
1290
  const collection = await this.workspace.collections.get(slug);
@@ -1444,28 +1295,24 @@ var MarvinClient = class {
1444
1295
  }
1445
1296
  /**
1446
1297
  * @deprecated Use workspace.collections.entries() instead
1447
- * Get all entries in a collection
1448
1298
  */
1449
1299
  async getCollectionEntries(slug) {
1450
1300
  return this.workspace.collections.entries(slug);
1451
1301
  }
1452
1302
  /**
1453
1303
  * @deprecated Use workspace.assets.list() instead
1454
- * Get all published assets
1455
1304
  */
1456
1305
  async getAssets(options) {
1457
1306
  return this.workspace.assets.list(options);
1458
1307
  }
1459
1308
  /**
1460
1309
  * @deprecated Use workspace.resources.list() instead
1461
- * Get all published resources
1462
1310
  */
1463
1311
  async getResources(options) {
1464
1312
  return this.workspace.resources.list(options);
1465
1313
  }
1466
1314
  /**
1467
1315
  * @deprecated Use workspace.resources.get() instead
1468
- * Get a single resource by slug
1469
1316
  */
1470
1317
  async getResource(slug) {
1471
1318
  const resource = await this.workspace.resources.get(slug);
@@ -1473,7 +1320,6 @@ var MarvinClient = class {
1473
1320
  }
1474
1321
  /**
1475
1322
  * @deprecated Use workspace.resources.entries() instead
1476
- * Get entries that reference a resource
1477
1323
  */
1478
1324
  async getResourceEntries(slug) {
1479
1325
  return this.workspace.resources.entries(slug);
@@ -1,6 +1,6 @@
1
- import { M as MarvinConfig, a as MarvinClient } from './marvin-BAslemIz.cjs';
2
- export { C as Collection, E as Entry, b as MarvinApiError, c as MarvinAuthError, d as MarvinCache, e as MarvinConfigError, f as MarvinError, g as MarvinNetworkError, h as MarvinNotFoundError, i as MarvinServerError, j as MarvinValidationError, P as PaginatedResponse, k as PaginationMeta, l as PaginationParams, R as Resource, W as Workspace, m as createConfigFromEnv, n as createPaginatedResponse, o as extractData, p as isPaginatedResponse, q as offsetToPage, r as pageToOffset } from './marvin-BAslemIz.cjs';
3
- export { GetAssetsOptions, GetEntriesOptions, GetResourcesOptions, MarvinAsset, MarvinCollection, MarvinEntry, MarvinEntryType, MarvinPublishResponse, MarvinResource, MarvinSite } from './types/index.cjs';
1
+ import { M as MarvinConfig, a as MarvinClient } from './marvin-CwB9ybc8.cjs';
2
+ export { C as Collection, E as Entry, b as MarvinApiError, c as MarvinAuthError, d as MarvinCache, e as MarvinConfigError, f as MarvinError, g as MarvinNetworkError, h as MarvinNotFoundError, i as MarvinServerError, j as MarvinValidationError, P as PaginatedResponse, k as PaginationMeta, l as PaginationParams, R as Resource, W as Workspace, m as createConfigFromEnv, n as createPaginatedResponse, o as extractData, p as isPaginatedResponse, q as offsetToPage, r as pageToOffset } from './marvin-CwB9ybc8.cjs';
3
+ export { GetAssetsOptions, GetEntriesOptions, GetResourcesOptions, MarvinAsset, MarvinCollection, MarvinEntry, MarvinEntryListItem, MarvinEntryType, MarvinPublishResponse, MarvinResource, MarvinSite, PublishedAssetRead, PublishedCollectionSummary, PublishedResourceRead } from './types/index.cjs';
4
4
  export { A as AuthStrategy, B as BearerTokenAuth, H as HttpClient, a as HttpClientConfig } from './HttpClient-CdF3IHM1.cjs';
5
5
 
6
6
  /**
package/dist/publish.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { M as MarvinConfig, a as MarvinClient } from './marvin-BmbMUJXh.js';
2
- export { C as Collection, E as Entry, b as MarvinApiError, c as MarvinAuthError, d as MarvinCache, e as MarvinConfigError, f as MarvinError, g as MarvinNetworkError, h as MarvinNotFoundError, i as MarvinServerError, j as MarvinValidationError, P as PaginatedResponse, k as PaginationMeta, l as PaginationParams, R as Resource, W as Workspace, m as createConfigFromEnv, n as createPaginatedResponse, o as extractData, p as isPaginatedResponse, q as offsetToPage, r as pageToOffset } from './marvin-BmbMUJXh.js';
3
- export { GetAssetsOptions, GetEntriesOptions, GetResourcesOptions, MarvinAsset, MarvinCollection, MarvinEntry, MarvinEntryType, MarvinPublishResponse, MarvinResource, MarvinSite } from './types/index.js';
1
+ import { M as MarvinConfig, a as MarvinClient } from './marvin-KVTEthgH.js';
2
+ export { C as Collection, E as Entry, b as MarvinApiError, c as MarvinAuthError, d as MarvinCache, e as MarvinConfigError, f as MarvinError, g as MarvinNetworkError, h as MarvinNotFoundError, i as MarvinServerError, j as MarvinValidationError, P as PaginatedResponse, k as PaginationMeta, l as PaginationParams, R as Resource, W as Workspace, m as createConfigFromEnv, n as createPaginatedResponse, o as extractData, p as isPaginatedResponse, q as offsetToPage, r as pageToOffset } from './marvin-KVTEthgH.js';
3
+ export { GetAssetsOptions, GetEntriesOptions, GetResourcesOptions, MarvinAsset, MarvinCollection, MarvinEntry, MarvinEntryListItem, MarvinEntryType, MarvinPublishResponse, MarvinResource, MarvinSite, PublishedAssetRead, PublishedCollectionSummary, PublishedResourceRead } from './types/index.js';
4
4
  export { A as AuthStrategy, B as BearerTokenAuth, H as HttpClient, a as HttpClientConfig } from './HttpClient-CdF3IHM1.js';
5
5
 
6
6
  /**
package/dist/publish.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  init_marvin,
13
13
  init_resource,
14
14
  init_workspace
15
- } from "./chunk-SGZG7U7V.js";
15
+ } from "./chunk-DCTX4NSF.js";
16
16
  import {
17
17
  BearerTokenAuth,
18
18
  HttpClient,