@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/platform.js CHANGED
@@ -1124,53 +1124,40 @@ var EmailTemplatesClient = class {
1124
1124
  http;
1125
1125
  /**
1126
1126
  * List all email templates for the workspace
1127
- * @param groupId - Workspace ID
1128
1127
  */
1129
1128
  async list(groupId) {
1130
1129
  return this.http.get(`/api/platform/workspaces/${groupId}/email-templates`);
1131
1130
  }
1132
1131
  /**
1133
1132
  * Get a specific email template
1134
- * @param groupId - Workspace ID
1135
- * @param templateId - Template ID
1136
1133
  */
1137
1134
  async get(groupId, templateId) {
1138
1135
  return this.http.get(`/api/platform/workspaces/${groupId}/email-templates/${templateId}`);
1139
1136
  }
1140
1137
  /**
1141
1138
  * Create a new email template
1142
- * @param groupId - Workspace ID
1143
- * @param data - Template data
1144
1139
  */
1145
1140
  async create(groupId, data) {
1146
1141
  return this.http.post(`/api/platform/workspaces/${groupId}/email-templates`, data);
1147
1142
  }
1148
1143
  /**
1149
1144
  * Update an email template
1150
- * @param groupId - Workspace ID
1151
- * @param templateId - Template ID
1152
- * @param data - Updated template data
1153
1145
  */
1154
1146
  async update(groupId, templateId, data) {
1155
1147
  return this.http.patch(`/api/platform/workspaces/${groupId}/email-templates/${templateId}`, data);
1156
1148
  }
1157
1149
  /**
1158
1150
  * Delete an email template
1159
- * @param groupId - Workspace ID
1160
- * @param templateId - Template ID
1161
1151
  */
1162
1152
  async delete(groupId, templateId) {
1163
1153
  await this.http.delete(`/api/platform/workspaces/${groupId}/email-templates/${templateId}`);
1164
1154
  }
1165
1155
  /**
1166
1156
  * Send a test email using a template
1167
- * @param groupId - Workspace ID
1168
- * @param templateId - Template ID
1169
- * @param recipientEmail - Test recipient email address
1170
1157
  */
1171
1158
  async sendTest(groupId, templateId, recipientEmail) {
1172
1159
  return this.http.post(`/api/platform/workspaces/${groupId}/email-templates/${templateId}/test`, {
1173
- recipient_email: recipientEmail
1160
+ email: recipientEmail
1174
1161
  });
1175
1162
  }
1176
1163
  };
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;
753
+ return this.raw.publishedAt;
776
754
  }
777
- get updatedAt() {
778
- return this.data.updatedAt;
779
- }
780
- get entryTypeId() {
781
- return this.data.entryTypeId;
782
- }
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;
1010
+ get metadataJson() {
1011
+ return this.data.metadataJson;
1128
1012
  }
1129
- get updatedAt() {
1130
- return this.data.updatedAt;
1131
- }
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
 
@@ -1248,18 +1116,15 @@ var Workspace = class {
1248
1116
  const endpoint = `/api/publish/${this._slug}`;
1249
1117
  return this.http.fetch(endpoint);
1250
1118
  }
1251
- /**
1252
- * Get workspace settings (future)
1253
- */
1254
- async settings() {
1255
- throw new Error("Workspace settings not yet implemented");
1256
- }
1257
1119
  };
1258
1120
 
1259
1121
  // src/client/marvin.ts
1260
1122
  var MarvinClient = class {
1123
+ http;
1124
+ cache;
1125
+ workspace;
1126
+ initialized = false;
1261
1127
  constructor(config) {
1262
- this.config = config;
1263
1128
  validateConfig(config);
1264
1129
  this.http = new MarvinHttpClient(config);
1265
1130
  this.cache = new MarvinCache(config.cacheDuration);
@@ -1268,11 +1133,6 @@ var MarvinClient = class {
1268
1133
  this.initialize();
1269
1134
  }
1270
1135
  }
1271
- config;
1272
- http;
1273
- cache;
1274
- workspace;
1275
- initialized = false;
1276
1136
  /**
1277
1137
  * Initialize the SDK
1278
1138
  * Preloads site configuration and metadata
@@ -1382,16 +1242,6 @@ var MarvinClient = class {
1382
1242
  /**
1383
1243
  * Try multiple collection slugs in fallback order
1384
1244
  * 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
1245
  */
1396
1246
  async collectionFallback(slugs, options) {
1397
1247
  return this.workspace.collections.fallback(slugs, options);
@@ -1401,21 +1251,18 @@ var MarvinClient = class {
1401
1251
  // ======================
1402
1252
  /**
1403
1253
  * @deprecated Use workspace.site or marvin.site instead
1404
- * Get site configuration
1405
1254
  */
1406
1255
  async getSite() {
1407
1256
  return this.workspace.loadSite();
1408
1257
  }
1409
1258
  /**
1410
1259
  * @deprecated Use workspace.entries.list() instead
1411
- * Get all published entries
1412
1260
  */
1413
1261
  async getEntries(options) {
1414
1262
  return this.workspace.entries.list(options);
1415
1263
  }
1416
1264
  /**
1417
1265
  * @deprecated Use workspace.entries.get() instead
1418
- * Get a single published entry by slug
1419
1266
  */
1420
1267
  async getEntry(slug) {
1421
1268
  const entry = await this.workspace.entries.get(slug);
@@ -1426,14 +1273,12 @@ var MarvinClient = class {
1426
1273
  }
1427
1274
  /**
1428
1275
  * @deprecated Use workspace.collections.list() instead
1429
- * Get all collections
1430
1276
  */
1431
1277
  async getCollections() {
1432
1278
  return this.workspace.collections.list();
1433
1279
  }
1434
1280
  /**
1435
1281
  * @deprecated Use workspace.collections.get() instead
1436
- * Get a single collection by slug
1437
1282
  */
1438
1283
  async getCollection(slug) {
1439
1284
  const collection = await this.workspace.collections.get(slug);
@@ -1444,28 +1289,24 @@ var MarvinClient = class {
1444
1289
  }
1445
1290
  /**
1446
1291
  * @deprecated Use workspace.collections.entries() instead
1447
- * Get all entries in a collection
1448
1292
  */
1449
1293
  async getCollectionEntries(slug) {
1450
1294
  return this.workspace.collections.entries(slug);
1451
1295
  }
1452
1296
  /**
1453
1297
  * @deprecated Use workspace.assets.list() instead
1454
- * Get all published assets
1455
1298
  */
1456
1299
  async getAssets(options) {
1457
1300
  return this.workspace.assets.list(options);
1458
1301
  }
1459
1302
  /**
1460
1303
  * @deprecated Use workspace.resources.list() instead
1461
- * Get all published resources
1462
1304
  */
1463
1305
  async getResources(options) {
1464
1306
  return this.workspace.resources.list(options);
1465
1307
  }
1466
1308
  /**
1467
1309
  * @deprecated Use workspace.resources.get() instead
1468
- * Get a single resource by slug
1469
1310
  */
1470
1311
  async getResource(slug) {
1471
1312
  const resource = await this.workspace.resources.get(slug);
@@ -1473,7 +1314,6 @@ var MarvinClient = class {
1473
1314
  }
1474
1315
  /**
1475
1316
  * @deprecated Use workspace.resources.entries() instead
1476
- * Get entries that reference a resource
1477
1317
  */
1478
1318
  async getResourceEntries(slug) {
1479
1319
  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-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
+ 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, l as PublishedResourceRead, S as SiteConfiguration, W as WorkspaceInfo } from './index-D5zkKa4N.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-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
+ 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, l as PublishedResourceRead, S as SiteConfiguration, W as WorkspaceInfo } from './index-D5zkKa4N.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-R3EZI43S.js";
16
16
  import {
17
17
  BearerTokenAuth,
18
18
  HttpClient,