@inneropen/marvin-sdk 3.0.0 → 3.0.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.
package/dist/index.cjs CHANGED
@@ -869,113 +869,54 @@ var init_entry = __esm({
869
869
  "src/entries/entry.ts"() {
870
870
  "use strict";
871
871
  Entry = class {
872
- constructor(data, http, workspaceSlug) {
873
- this.data = data;
874
- this.http = http;
875
- this.workspaceSlug = workspaceSlug;
876
- }
877
- data;
878
- http;
879
- workspaceSlug;
880
- // Expose all entry data as properties
881
- get id() {
882
- return this.data.id;
872
+ constructor(raw) {
873
+ this.raw = raw;
883
874
  }
875
+ raw;
884
876
  get title() {
885
- return this.data.title;
877
+ return this.raw.title;
886
878
  }
887
879
  get slug() {
888
- return this.data.slug;
880
+ return this.raw.slug;
889
881
  }
890
882
  get summary() {
891
- return this.data.summary;
892
- }
893
- get description() {
894
- return this.data.description;
883
+ return this.raw.summary;
895
884
  }
896
- /**
897
- * @deprecated Use field('body') or dataJson instead. Will be removed in v3.0.0
898
- */
899
- get contentMarkdown() {
900
- return this.data.contentMarkdown;
885
+ get entryType() {
886
+ return this.raw.entryType;
901
887
  }
902
- /**
903
- * Schema-driven content data (replaces contentMarkdown in v2.0.0).
904
- * Access specific fields using the field() helper method.
905
- * @since 2.0.0
906
- */
907
- get dataJson() {
908
- return this.data.dataJson;
888
+ get entryTypeInfo() {
889
+ return this.raw.entryTypeInfo;
909
890
  }
910
- get metadata() {
911
- return this.data.metadata;
891
+ get data() {
892
+ return this.raw.data;
912
893
  }
913
- get status() {
914
- return this.data.status;
894
+ get metadataJson() {
895
+ return this.raw.metadataJson;
915
896
  }
916
897
  get publishedAt() {
917
- return this.data.publishedAt;
918
- }
919
- get createdAt() {
920
- return this.data.createdAt;
898
+ return this.raw.publishedAt;
921
899
  }
922
- get updatedAt() {
923
- return this.data.updatedAt;
924
- }
925
- get entryTypeId() {
926
- return this.data.entryTypeId;
927
- }
928
- get entryType() {
929
- return this.data.entryType;
900
+ get order() {
901
+ return this.raw.order;
930
902
  }
931
- /**
932
- * Get entry assets
933
- */
934
903
  get assets() {
935
- return this.data.assets || [];
904
+ return this.raw.assets;
936
905
  }
937
- /**
938
- * Get entry collections
939
- */
940
906
  get collections() {
941
- return this.data.collections || [];
907
+ return this.raw.collections;
908
+ }
909
+ get resources() {
910
+ return this.raw.resources;
942
911
  }
943
- /**
944
- * Get a specific field value from the entry's schema-driven content (dataJson).
945
- *
946
- * @param key - Field key as defined in the entry type's schema
947
- * @returns The field value, or undefined if not present
948
- * @since 2.0.0
949
- *
950
- * @example
951
- * ```typescript
952
- * const entry = await client.entries.get('my-entry');
953
- * const body = entry.field('body'); // Get markdown body
954
- * const difficulty = entry.field('difficulty'); // Get difficulty level
955
- * const heroImage = entry.field('heroImage'); // Get hero image UUID
956
- * ```
957
- */
958
912
  field(key) {
959
- return this.data.dataJson?.[key];
913
+ return this.raw.data[key];
960
914
  }
961
- /**
962
- * Get all fields from the entry's schema-driven content.
963
- * @since 2.0.0
964
- */
965
915
  get fields() {
966
- return this.data.dataJson || {};
967
- }
968
- /**
969
- * Get related entries (future)
970
- */
971
- async relatedEntries() {
972
- throw new Error("Related entries not yet implemented");
916
+ return this.raw.data;
973
917
  }
974
- /**
975
- * Get raw entry data
976
- */
977
918
  toJSON() {
978
- return this.data;
919
+ return this.raw;
979
920
  }
980
921
  };
981
922
  }
@@ -1004,7 +945,6 @@ var init_entries = __esm({
1004
945
  collection: options.collection,
1005
946
  limit: options.limit,
1006
947
  offset: options.offset
1007
- // Don't send status - backend always returns published
1008
948
  });
1009
949
  const endpoint = `/api/publish/${this.workspaceSlug}/entries${queryString}`;
1010
950
  const response = await this.http.fetch(endpoint);
@@ -1018,7 +958,7 @@ var init_entries = __esm({
1018
958
  try {
1019
959
  const endpoint = `/api/publish/${this.workspaceSlug}/entries/${slug}`;
1020
960
  const data = await this.http.fetch(endpoint);
1021
- return new Entry(data, this.http, this.workspaceSlug);
961
+ return new Entry(data);
1022
962
  } catch (error) {
1023
963
  if (error instanceof MarvinNotFoundError) {
1024
964
  return null;
@@ -1054,18 +994,10 @@ var init_collection = __esm({
1054
994
  "src/collections/collection.ts"() {
1055
995
  "use strict";
1056
996
  Collection = class {
1057
- constructor(data, http, workspaceSlug) {
997
+ constructor(data) {
1058
998
  this.data = data;
1059
- this.http = http;
1060
- this.workspaceSlug = workspaceSlug;
1061
999
  }
1062
1000
  data;
1063
- http;
1064
- workspaceSlug;
1065
- // Expose all collection data as properties
1066
- get id() {
1067
- return this.data.id;
1068
- }
1069
1001
  get name() {
1070
1002
  return this.data.name;
1071
1003
  }
@@ -1075,48 +1007,21 @@ var init_collection = __esm({
1075
1007
  get description() {
1076
1008
  return this.data.description;
1077
1009
  }
1078
- get icon() {
1079
- return this.data.icon;
1080
- }
1081
- get color() {
1082
- return this.data.color;
1083
- }
1084
- get sortOrder() {
1085
- return this.data.sortOrder;
1086
- }
1087
1010
  get isSmart() {
1088
1011
  return this.data.isSmart;
1089
1012
  }
1090
1013
  get smartRules() {
1091
1014
  return this.data.smartRules;
1092
1015
  }
1093
- get createdAt() {
1094
- return this.data.createdAt;
1016
+ get metadataJson() {
1017
+ return this.data.metadataJson;
1095
1018
  }
1096
- get updatedAt() {
1097
- return this.data.updatedAt;
1019
+ get entryCount() {
1020
+ return this.data.entryCount;
1098
1021
  }
1099
- /**
1100
- * Get all entries in this collection
1101
- */
1102
- async entries() {
1103
- return this.data.entries || [];
1104
- }
1105
- /**
1106
- * Get assets in this collection (future)
1107
- */
1108
- async assets() {
1109
- throw new Error("Collection assets not yet implemented");
1110
- }
1111
- /**
1112
- * Get collection metadata (future)
1113
- */
1114
- async metadata() {
1115
- throw new Error("Collection metadata not yet implemented");
1022
+ get entries() {
1023
+ return this.data.entries;
1116
1024
  }
1117
- /**
1118
- * Get raw collection data
1119
- */
1120
1025
  toJSON() {
1121
1026
  return this.data;
1122
1027
  }
@@ -1154,7 +1059,7 @@ var init_collections = __esm({
1154
1059
  try {
1155
1060
  const endpoint = `/api/publish/${this.workspaceSlug}/collections/${slug}`;
1156
1061
  const data = await this.http.fetch(endpoint);
1157
- return new Collection(data, this.http, this.workspaceSlug);
1062
+ return new Collection(data);
1158
1063
  } catch (error) {
1159
1064
  if (error instanceof MarvinNotFoundError) {
1160
1065
  return null;
@@ -1171,21 +1076,11 @@ var init_collections = __esm({
1171
1076
  if (!collection) {
1172
1077
  return [];
1173
1078
  }
1174
- return collection.entries();
1079
+ return collection.entries;
1175
1080
  }
1176
1081
  /**
1177
1082
  * Try multiple collection slugs in fallback order
1178
1083
  * Returns the first collection that exists and has entries
1179
- *
1180
- * @param slugs - Collection slugs to try in order
1181
- * @param options - Options for fallback behavior
1182
- * @returns Entries from the first matching collection, or empty array
1183
- *
1184
- * @example
1185
- * ```ts
1186
- * // Try bench-notes, then journal, then blog
1187
- * const entries = await collections.fallback(['bench-notes', 'journal', 'blog']);
1188
- * ```
1189
1084
  */
1190
1085
  async fallback(slugs, options = {}) {
1191
1086
  const { requireEntries = true } = options;
@@ -1195,7 +1090,7 @@ var init_collections = __esm({
1195
1090
  if (!collection) {
1196
1091
  continue;
1197
1092
  }
1198
- const entries = await collection.entries();
1093
+ const entries = collection.entries;
1199
1094
  if (!requireEntries || entries.length > 0) {
1200
1095
  return entries;
1201
1096
  }
@@ -1269,18 +1164,10 @@ var init_resource = __esm({
1269
1164
  "src/resources/resource.ts"() {
1270
1165
  "use strict";
1271
1166
  Resource = class {
1272
- constructor(data, http, workspaceSlug) {
1167
+ constructor(data) {
1273
1168
  this.data = data;
1274
- this.http = http;
1275
- this.workspaceSlug = workspaceSlug;
1276
1169
  }
1277
1170
  data;
1278
- http;
1279
- workspaceSlug;
1280
- // Expose all resource data as properties
1281
- get id() {
1282
- return this.data.id;
1283
- }
1284
1171
  get name() {
1285
1172
  return this.data.name;
1286
1173
  }
@@ -1299,31 +1186,12 @@ var init_resource = __esm({
1299
1186
  get url() {
1300
1187
  return this.data.url;
1301
1188
  }
1302
- get metadata() {
1303
- return this.data.metadata;
1304
- }
1305
- get createdAt() {
1306
- return this.data.createdAt;
1189
+ get metadataJson() {
1190
+ return this.data.metadataJson;
1307
1191
  }
1308
- get updatedAt() {
1309
- return this.data.updatedAt;
1310
- }
1311
- /**
1312
- * Get all entries that reference this resource
1313
- */
1314
- async entries() {
1315
- const endpoint = `/api/publish/${this.workspaceSlug}/resources/${this.data.slug}/entries`;
1316
- return this.http.fetch(endpoint);
1317
- }
1318
- /**
1319
- * Get assets related to this resource (future)
1320
- */
1321
- async assets() {
1322
- throw new Error("Resource assets not yet implemented");
1192
+ get entries() {
1193
+ return this.data.entries;
1323
1194
  }
1324
- /**
1325
- * Get raw resource data
1326
- */
1327
1195
  toJSON() {
1328
1196
  return this.data;
1329
1197
  }
@@ -1363,14 +1231,14 @@ var init_resources = __esm({
1363
1231
  async get(slug) {
1364
1232
  const endpoint = `/api/publish/${this.workspaceSlug}/resources/${slug}`;
1365
1233
  const data = await this.http.fetch(endpoint);
1366
- return new Resource(data, this.http, this.workspaceSlug);
1234
+ return new Resource(data);
1367
1235
  }
1368
1236
  /**
1369
- * Get entries that reference this resource
1237
+ * Get entry slugs that reference this resource
1370
1238
  */
1371
1239
  async entries(slug) {
1372
1240
  const resource = await this.get(slug);
1373
- return resource.entries();
1241
+ return resource.entries;
1374
1242
  }
1375
1243
  };
1376
1244
  }
@@ -1451,12 +1319,6 @@ var init_workspace = __esm({
1451
1319
  const endpoint = `/api/publish/${this._slug}`;
1452
1320
  return this.http.fetch(endpoint);
1453
1321
  }
1454
- /**
1455
- * Get workspace settings (future)
1456
- */
1457
- async settings() {
1458
- throw new Error("Workspace settings not yet implemented");
1459
- }
1460
1322
  };
1461
1323
  }
1462
1324
  });
@@ -1475,8 +1337,11 @@ var init_marvin = __esm({
1475
1337
  init_core();
1476
1338
  init_workspace();
1477
1339
  MarvinClient = class {
1340
+ http;
1341
+ cache;
1342
+ workspace;
1343
+ initialized = false;
1478
1344
  constructor(config) {
1479
- this.config = config;
1480
1345
  validateConfig(config);
1481
1346
  this.http = new MarvinHttpClient(config);
1482
1347
  this.cache = new MarvinCache(config.cacheDuration);
@@ -1485,11 +1350,6 @@ var init_marvin = __esm({
1485
1350
  this.initialize();
1486
1351
  }
1487
1352
  }
1488
- config;
1489
- http;
1490
- cache;
1491
- workspace;
1492
- initialized = false;
1493
1353
  /**
1494
1354
  * Initialize the SDK
1495
1355
  * Preloads site configuration and metadata
@@ -1599,16 +1459,6 @@ var init_marvin = __esm({
1599
1459
  /**
1600
1460
  * Try multiple collection slugs in fallback order
1601
1461
  * Returns entries from the first collection that exists and has content
1602
- *
1603
- * @param slugs - Collection slugs to try in order
1604
- * @param options - Options for fallback behavior
1605
- * @returns Entries from the first matching collection, or empty array
1606
- *
1607
- * @example
1608
- * ```ts
1609
- * // Try bench-notes, then journal, then blog
1610
- * const entries = await client.collectionFallback(['bench-notes', 'journal', 'blog']);
1611
- * ```
1612
1462
  */
1613
1463
  async collectionFallback(slugs, options) {
1614
1464
  return this.workspace.collections.fallback(slugs, options);
@@ -1618,21 +1468,18 @@ var init_marvin = __esm({
1618
1468
  // ======================
1619
1469
  /**
1620
1470
  * @deprecated Use workspace.site or marvin.site instead
1621
- * Get site configuration
1622
1471
  */
1623
1472
  async getSite() {
1624
1473
  return this.workspace.loadSite();
1625
1474
  }
1626
1475
  /**
1627
1476
  * @deprecated Use workspace.entries.list() instead
1628
- * Get all published entries
1629
1477
  */
1630
1478
  async getEntries(options) {
1631
1479
  return this.workspace.entries.list(options);
1632
1480
  }
1633
1481
  /**
1634
1482
  * @deprecated Use workspace.entries.get() instead
1635
- * Get a single published entry by slug
1636
1483
  */
1637
1484
  async getEntry(slug) {
1638
1485
  const entry = await this.workspace.entries.get(slug);
@@ -1643,14 +1490,12 @@ var init_marvin = __esm({
1643
1490
  }
1644
1491
  /**
1645
1492
  * @deprecated Use workspace.collections.list() instead
1646
- * Get all collections
1647
1493
  */
1648
1494
  async getCollections() {
1649
1495
  return this.workspace.collections.list();
1650
1496
  }
1651
1497
  /**
1652
1498
  * @deprecated Use workspace.collections.get() instead
1653
- * Get a single collection by slug
1654
1499
  */
1655
1500
  async getCollection(slug) {
1656
1501
  const collection = await this.workspace.collections.get(slug);
@@ -1661,28 +1506,24 @@ var init_marvin = __esm({
1661
1506
  }
1662
1507
  /**
1663
1508
  * @deprecated Use workspace.collections.entries() instead
1664
- * Get all entries in a collection
1665
1509
  */
1666
1510
  async getCollectionEntries(slug) {
1667
1511
  return this.workspace.collections.entries(slug);
1668
1512
  }
1669
1513
  /**
1670
1514
  * @deprecated Use workspace.assets.list() instead
1671
- * Get all published assets
1672
1515
  */
1673
1516
  async getAssets(options) {
1674
1517
  return this.workspace.assets.list(options);
1675
1518
  }
1676
1519
  /**
1677
1520
  * @deprecated Use workspace.resources.list() instead
1678
- * Get all published resources
1679
1521
  */
1680
1522
  async getResources(options) {
1681
1523
  return this.workspace.resources.list(options);
1682
1524
  }
1683
1525
  /**
1684
1526
  * @deprecated Use workspace.resources.get() instead
1685
- * Get a single resource by slug
1686
1527
  */
1687
1528
  async getResource(slug) {
1688
1529
  const resource = await this.workspace.resources.get(slug);
@@ -1690,7 +1531,6 @@ var init_marvin = __esm({
1690
1531
  }
1691
1532
  /**
1692
1533
  * @deprecated Use workspace.resources.entries() instead
1693
- * Get entries that reference a resource
1694
1534
  */
1695
1535
  async getResourceEntries(slug) {
1696
1536
  return this.workspace.resources.entries(slug);
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
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';
1
+ import { M as MarvinConfig, a as MarvinClient } from './marvin-B_gJRxHK.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-B_gJRxHK.cjs';
3
3
  import { H as HttpClient } from './HttpClient-CdF3IHM1.cjs';
4
4
  export { A as AuthStrategy, B as BearerTokenAuth, a as HttpClientConfig, N as NoAuth, S as SessionAuth } from './HttpClient-CdF3IHM1.cjs';
5
- import { AuthToken as AuthToken$1 } from './types/index.cjs';
6
- export { GetAssetsOptions, GetEntriesOptions, GetResourcesOptions, MarvinAsset, MarvinCollection, MarvinEntry, MarvinEntryType, MarvinPublishResponse, MarvinResource, MarvinSite, PublishedEntryType } from './types/index.cjs';
5
+ import { A as AuthToken$1 } from './index-D5zkKa4N.cjs';
6
+ export { G as GetAssetsOptions, a as GetEntriesOptions, b as GetResourcesOptions, M as MarvinAsset, c as MarvinCollection, d as MarvinEntry, e as MarvinEntryListItem, f as MarvinEntryType, g as MarvinPublishResponse, h as MarvinResource, i as MarvinSite, P as PublishedAssetRead, j as PublishedCollectionSummary, k as PublishedEntryType, l as PublishedResourceRead, S as SiteConfiguration, W as WorkspaceInfo } from './index-D5zkKa4N.cjs';
7
7
 
8
8
  /**
9
9
  * Authentication & User Registration
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
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';
1
+ import { M as MarvinConfig, a as MarvinClient } from './marvin-C5tRQ2nD.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-C5tRQ2nD.js';
3
3
  import { H as HttpClient } from './HttpClient-CdF3IHM1.js';
4
4
  export { A as AuthStrategy, B as BearerTokenAuth, a as HttpClientConfig, N as NoAuth, S as SessionAuth } from './HttpClient-CdF3IHM1.js';
5
- import { AuthToken as AuthToken$1 } from './types/index.js';
6
- export { GetAssetsOptions, GetEntriesOptions, GetResourcesOptions, MarvinAsset, MarvinCollection, MarvinEntry, MarvinEntryType, MarvinPublishResponse, MarvinResource, MarvinSite, PublishedEntryType } from './types/index.js';
5
+ import { A as AuthToken$1 } from './index-D5zkKa4N.js';
6
+ export { G as GetAssetsOptions, a as GetEntriesOptions, b as GetResourcesOptions, M as MarvinAsset, c as MarvinCollection, d as MarvinEntry, e as MarvinEntryListItem, f as MarvinEntryType, g as MarvinPublishResponse, h as MarvinResource, i as MarvinSite, P as PublishedAssetRead, j as PublishedCollectionSummary, k as PublishedEntryType, l as PublishedResourceRead, S as SiteConfiguration, W as WorkspaceInfo } from './index-D5zkKa4N.js';
7
7
 
8
8
  /**
9
9
  * Authentication & User Registration
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  init_resource,
14
14
  init_workspace,
15
15
  marvin_exports
16
- } from "./chunk-SGZG7U7V.js";
16
+ } from "./chunk-R3EZI43S.js";
17
17
  import {
18
18
  BearerTokenAuth,
19
19
  HttpClient,