@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
package/dist/index.cjs
CHANGED
|
@@ -869,14 +869,10 @@ var init_entry = __esm({
|
|
|
869
869
|
"src/entries/entry.ts"() {
|
|
870
870
|
"use strict";
|
|
871
871
|
Entry = class {
|
|
872
|
-
constructor(raw
|
|
872
|
+
constructor(raw) {
|
|
873
873
|
this.raw = raw;
|
|
874
|
-
this.http = http;
|
|
875
|
-
this.workspaceSlug = workspaceSlug;
|
|
876
874
|
}
|
|
877
875
|
raw;
|
|
878
|
-
http;
|
|
879
|
-
workspaceSlug;
|
|
880
876
|
get title() {
|
|
881
877
|
return this.raw.title;
|
|
882
878
|
}
|
|
@@ -919,9 +915,6 @@ var init_entry = __esm({
|
|
|
919
915
|
get fields() {
|
|
920
916
|
return this.raw.data;
|
|
921
917
|
}
|
|
922
|
-
async relatedEntries() {
|
|
923
|
-
throw new Error("Related entries not yet implemented");
|
|
924
|
-
}
|
|
925
918
|
toJSON() {
|
|
926
919
|
return this.raw;
|
|
927
920
|
}
|
|
@@ -952,7 +945,6 @@ var init_entries = __esm({
|
|
|
952
945
|
collection: options.collection,
|
|
953
946
|
limit: options.limit,
|
|
954
947
|
offset: options.offset
|
|
955
|
-
// Don't send status - backend always returns published
|
|
956
948
|
});
|
|
957
949
|
const endpoint = `/api/publish/${this.workspaceSlug}/entries${queryString}`;
|
|
958
950
|
const response = await this.http.fetch(endpoint);
|
|
@@ -966,7 +958,7 @@ var init_entries = __esm({
|
|
|
966
958
|
try {
|
|
967
959
|
const endpoint = `/api/publish/${this.workspaceSlug}/entries/${slug}`;
|
|
968
960
|
const data = await this.http.fetch(endpoint);
|
|
969
|
-
return new Entry(data
|
|
961
|
+
return new Entry(data);
|
|
970
962
|
} catch (error) {
|
|
971
963
|
if (error instanceof MarvinNotFoundError) {
|
|
972
964
|
return null;
|
|
@@ -1002,18 +994,10 @@ var init_collection = __esm({
|
|
|
1002
994
|
"src/collections/collection.ts"() {
|
|
1003
995
|
"use strict";
|
|
1004
996
|
Collection = class {
|
|
1005
|
-
constructor(data
|
|
997
|
+
constructor(data) {
|
|
1006
998
|
this.data = data;
|
|
1007
|
-
this.http = http;
|
|
1008
|
-
this.workspaceSlug = workspaceSlug;
|
|
1009
999
|
}
|
|
1010
1000
|
data;
|
|
1011
|
-
http;
|
|
1012
|
-
workspaceSlug;
|
|
1013
|
-
// Expose all collection data as properties
|
|
1014
|
-
get id() {
|
|
1015
|
-
return this.data.id;
|
|
1016
|
-
}
|
|
1017
1001
|
get name() {
|
|
1018
1002
|
return this.data.name;
|
|
1019
1003
|
}
|
|
@@ -1023,48 +1007,21 @@ var init_collection = __esm({
|
|
|
1023
1007
|
get description() {
|
|
1024
1008
|
return this.data.description;
|
|
1025
1009
|
}
|
|
1026
|
-
get icon() {
|
|
1027
|
-
return this.data.icon;
|
|
1028
|
-
}
|
|
1029
|
-
get color() {
|
|
1030
|
-
return this.data.color;
|
|
1031
|
-
}
|
|
1032
|
-
get sortOrder() {
|
|
1033
|
-
return this.data.sortOrder;
|
|
1034
|
-
}
|
|
1035
1010
|
get isSmart() {
|
|
1036
1011
|
return this.data.isSmart;
|
|
1037
1012
|
}
|
|
1038
1013
|
get smartRules() {
|
|
1039
1014
|
return this.data.smartRules;
|
|
1040
1015
|
}
|
|
1041
|
-
get
|
|
1042
|
-
return this.data.
|
|
1043
|
-
}
|
|
1044
|
-
get updatedAt() {
|
|
1045
|
-
return this.data.updatedAt;
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* Get all entries in this collection
|
|
1049
|
-
*/
|
|
1050
|
-
async entries() {
|
|
1051
|
-
return this.data.entries || [];
|
|
1016
|
+
get metadataJson() {
|
|
1017
|
+
return this.data.metadataJson;
|
|
1052
1018
|
}
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
*/
|
|
1056
|
-
async assets() {
|
|
1057
|
-
throw new Error("Collection assets not yet implemented");
|
|
1019
|
+
get entryCount() {
|
|
1020
|
+
return this.data.entryCount;
|
|
1058
1021
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
*/
|
|
1062
|
-
async metadata() {
|
|
1063
|
-
throw new Error("Collection metadata not yet implemented");
|
|
1022
|
+
get entries() {
|
|
1023
|
+
return this.data.entries;
|
|
1064
1024
|
}
|
|
1065
|
-
/**
|
|
1066
|
-
* Get raw collection data
|
|
1067
|
-
*/
|
|
1068
1025
|
toJSON() {
|
|
1069
1026
|
return this.data;
|
|
1070
1027
|
}
|
|
@@ -1102,7 +1059,7 @@ var init_collections = __esm({
|
|
|
1102
1059
|
try {
|
|
1103
1060
|
const endpoint = `/api/publish/${this.workspaceSlug}/collections/${slug}`;
|
|
1104
1061
|
const data = await this.http.fetch(endpoint);
|
|
1105
|
-
return new Collection(data
|
|
1062
|
+
return new Collection(data);
|
|
1106
1063
|
} catch (error) {
|
|
1107
1064
|
if (error instanceof MarvinNotFoundError) {
|
|
1108
1065
|
return null;
|
|
@@ -1119,21 +1076,11 @@ var init_collections = __esm({
|
|
|
1119
1076
|
if (!collection) {
|
|
1120
1077
|
return [];
|
|
1121
1078
|
}
|
|
1122
|
-
return collection.entries
|
|
1079
|
+
return collection.entries;
|
|
1123
1080
|
}
|
|
1124
1081
|
/**
|
|
1125
1082
|
* Try multiple collection slugs in fallback order
|
|
1126
1083
|
* Returns the first collection that exists and has entries
|
|
1127
|
-
*
|
|
1128
|
-
* @param slugs - Collection slugs to try in order
|
|
1129
|
-
* @param options - Options for fallback behavior
|
|
1130
|
-
* @returns Entries from the first matching collection, or empty array
|
|
1131
|
-
*
|
|
1132
|
-
* @example
|
|
1133
|
-
* ```ts
|
|
1134
|
-
* // Try bench-notes, then journal, then blog
|
|
1135
|
-
* const entries = await collections.fallback(['bench-notes', 'journal', 'blog']);
|
|
1136
|
-
* ```
|
|
1137
1084
|
*/
|
|
1138
1085
|
async fallback(slugs, options = {}) {
|
|
1139
1086
|
const { requireEntries = true } = options;
|
|
@@ -1143,7 +1090,7 @@ var init_collections = __esm({
|
|
|
1143
1090
|
if (!collection) {
|
|
1144
1091
|
continue;
|
|
1145
1092
|
}
|
|
1146
|
-
const entries =
|
|
1093
|
+
const entries = collection.entries;
|
|
1147
1094
|
if (!requireEntries || entries.length > 0) {
|
|
1148
1095
|
return entries;
|
|
1149
1096
|
}
|
|
@@ -1217,18 +1164,10 @@ var init_resource = __esm({
|
|
|
1217
1164
|
"src/resources/resource.ts"() {
|
|
1218
1165
|
"use strict";
|
|
1219
1166
|
Resource = class {
|
|
1220
|
-
constructor(data
|
|
1167
|
+
constructor(data) {
|
|
1221
1168
|
this.data = data;
|
|
1222
|
-
this.http = http;
|
|
1223
|
-
this.workspaceSlug = workspaceSlug;
|
|
1224
1169
|
}
|
|
1225
1170
|
data;
|
|
1226
|
-
http;
|
|
1227
|
-
workspaceSlug;
|
|
1228
|
-
// Expose all resource data as properties
|
|
1229
|
-
get id() {
|
|
1230
|
-
return this.data.id;
|
|
1231
|
-
}
|
|
1232
1171
|
get name() {
|
|
1233
1172
|
return this.data.name;
|
|
1234
1173
|
}
|
|
@@ -1247,31 +1186,12 @@ var init_resource = __esm({
|
|
|
1247
1186
|
get url() {
|
|
1248
1187
|
return this.data.url;
|
|
1249
1188
|
}
|
|
1250
|
-
get
|
|
1251
|
-
return this.data.
|
|
1252
|
-
}
|
|
1253
|
-
get createdAt() {
|
|
1254
|
-
return this.data.createdAt;
|
|
1255
|
-
}
|
|
1256
|
-
get updatedAt() {
|
|
1257
|
-
return this.data.updatedAt;
|
|
1258
|
-
}
|
|
1259
|
-
/**
|
|
1260
|
-
* Get all entries that reference this resource
|
|
1261
|
-
*/
|
|
1262
|
-
async entries() {
|
|
1263
|
-
const endpoint = `/api/publish/${this.workspaceSlug}/resources/${this.data.slug}/entries`;
|
|
1264
|
-
return this.http.fetch(endpoint);
|
|
1189
|
+
get metadataJson() {
|
|
1190
|
+
return this.data.metadataJson;
|
|
1265
1191
|
}
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
*/
|
|
1269
|
-
async assets() {
|
|
1270
|
-
throw new Error("Resource assets not yet implemented");
|
|
1192
|
+
get entries() {
|
|
1193
|
+
return this.data.entries;
|
|
1271
1194
|
}
|
|
1272
|
-
/**
|
|
1273
|
-
* Get raw resource data
|
|
1274
|
-
*/
|
|
1275
1195
|
toJSON() {
|
|
1276
1196
|
return this.data;
|
|
1277
1197
|
}
|
|
@@ -1311,14 +1231,14 @@ var init_resources = __esm({
|
|
|
1311
1231
|
async get(slug) {
|
|
1312
1232
|
const endpoint = `/api/publish/${this.workspaceSlug}/resources/${slug}`;
|
|
1313
1233
|
const data = await this.http.fetch(endpoint);
|
|
1314
|
-
return new Resource(data
|
|
1234
|
+
return new Resource(data);
|
|
1315
1235
|
}
|
|
1316
1236
|
/**
|
|
1317
|
-
* Get
|
|
1237
|
+
* Get entry slugs that reference this resource
|
|
1318
1238
|
*/
|
|
1319
1239
|
async entries(slug) {
|
|
1320
1240
|
const resource = await this.get(slug);
|
|
1321
|
-
return resource.entries
|
|
1241
|
+
return resource.entries;
|
|
1322
1242
|
}
|
|
1323
1243
|
};
|
|
1324
1244
|
}
|
|
@@ -1423,8 +1343,11 @@ var init_marvin = __esm({
|
|
|
1423
1343
|
init_core();
|
|
1424
1344
|
init_workspace();
|
|
1425
1345
|
MarvinClient = class {
|
|
1346
|
+
http;
|
|
1347
|
+
cache;
|
|
1348
|
+
workspace;
|
|
1349
|
+
initialized = false;
|
|
1426
1350
|
constructor(config) {
|
|
1427
|
-
this.config = config;
|
|
1428
1351
|
validateConfig(config);
|
|
1429
1352
|
this.http = new MarvinHttpClient(config);
|
|
1430
1353
|
this.cache = new MarvinCache(config.cacheDuration);
|
|
@@ -1433,11 +1356,6 @@ var init_marvin = __esm({
|
|
|
1433
1356
|
this.initialize();
|
|
1434
1357
|
}
|
|
1435
1358
|
}
|
|
1436
|
-
config;
|
|
1437
|
-
http;
|
|
1438
|
-
cache;
|
|
1439
|
-
workspace;
|
|
1440
|
-
initialized = false;
|
|
1441
1359
|
/**
|
|
1442
1360
|
* Initialize the SDK
|
|
1443
1361
|
* Preloads site configuration and metadata
|
|
@@ -1547,16 +1465,6 @@ var init_marvin = __esm({
|
|
|
1547
1465
|
/**
|
|
1548
1466
|
* Try multiple collection slugs in fallback order
|
|
1549
1467
|
* Returns entries from the first collection that exists and has content
|
|
1550
|
-
*
|
|
1551
|
-
* @param slugs - Collection slugs to try in order
|
|
1552
|
-
* @param options - Options for fallback behavior
|
|
1553
|
-
* @returns Entries from the first matching collection, or empty array
|
|
1554
|
-
*
|
|
1555
|
-
* @example
|
|
1556
|
-
* ```ts
|
|
1557
|
-
* // Try bench-notes, then journal, then blog
|
|
1558
|
-
* const entries = await client.collectionFallback(['bench-notes', 'journal', 'blog']);
|
|
1559
|
-
* ```
|
|
1560
1468
|
*/
|
|
1561
1469
|
async collectionFallback(slugs, options) {
|
|
1562
1470
|
return this.workspace.collections.fallback(slugs, options);
|
|
@@ -1566,21 +1474,18 @@ var init_marvin = __esm({
|
|
|
1566
1474
|
// ======================
|
|
1567
1475
|
/**
|
|
1568
1476
|
* @deprecated Use workspace.site or marvin.site instead
|
|
1569
|
-
* Get site configuration
|
|
1570
1477
|
*/
|
|
1571
1478
|
async getSite() {
|
|
1572
1479
|
return this.workspace.loadSite();
|
|
1573
1480
|
}
|
|
1574
1481
|
/**
|
|
1575
1482
|
* @deprecated Use workspace.entries.list() instead
|
|
1576
|
-
* Get all published entries
|
|
1577
1483
|
*/
|
|
1578
1484
|
async getEntries(options) {
|
|
1579
1485
|
return this.workspace.entries.list(options);
|
|
1580
1486
|
}
|
|
1581
1487
|
/**
|
|
1582
1488
|
* @deprecated Use workspace.entries.get() instead
|
|
1583
|
-
* Get a single published entry by slug
|
|
1584
1489
|
*/
|
|
1585
1490
|
async getEntry(slug) {
|
|
1586
1491
|
const entry = await this.workspace.entries.get(slug);
|
|
@@ -1591,14 +1496,12 @@ var init_marvin = __esm({
|
|
|
1591
1496
|
}
|
|
1592
1497
|
/**
|
|
1593
1498
|
* @deprecated Use workspace.collections.list() instead
|
|
1594
|
-
* Get all collections
|
|
1595
1499
|
*/
|
|
1596
1500
|
async getCollections() {
|
|
1597
1501
|
return this.workspace.collections.list();
|
|
1598
1502
|
}
|
|
1599
1503
|
/**
|
|
1600
1504
|
* @deprecated Use workspace.collections.get() instead
|
|
1601
|
-
* Get a single collection by slug
|
|
1602
1505
|
*/
|
|
1603
1506
|
async getCollection(slug) {
|
|
1604
1507
|
const collection = await this.workspace.collections.get(slug);
|
|
@@ -1609,28 +1512,24 @@ var init_marvin = __esm({
|
|
|
1609
1512
|
}
|
|
1610
1513
|
/**
|
|
1611
1514
|
* @deprecated Use workspace.collections.entries() instead
|
|
1612
|
-
* Get all entries in a collection
|
|
1613
1515
|
*/
|
|
1614
1516
|
async getCollectionEntries(slug) {
|
|
1615
1517
|
return this.workspace.collections.entries(slug);
|
|
1616
1518
|
}
|
|
1617
1519
|
/**
|
|
1618
1520
|
* @deprecated Use workspace.assets.list() instead
|
|
1619
|
-
* Get all published assets
|
|
1620
1521
|
*/
|
|
1621
1522
|
async getAssets(options) {
|
|
1622
1523
|
return this.workspace.assets.list(options);
|
|
1623
1524
|
}
|
|
1624
1525
|
/**
|
|
1625
1526
|
* @deprecated Use workspace.resources.list() instead
|
|
1626
|
-
* Get all published resources
|
|
1627
1527
|
*/
|
|
1628
1528
|
async getResources(options) {
|
|
1629
1529
|
return this.workspace.resources.list(options);
|
|
1630
1530
|
}
|
|
1631
1531
|
/**
|
|
1632
1532
|
* @deprecated Use workspace.resources.get() instead
|
|
1633
|
-
* Get a single resource by slug
|
|
1634
1533
|
*/
|
|
1635
1534
|
async getResource(slug) {
|
|
1636
1535
|
const resource = await this.workspace.resources.get(slug);
|
|
@@ -1638,7 +1537,6 @@ var init_marvin = __esm({
|
|
|
1638
1537
|
}
|
|
1639
1538
|
/**
|
|
1640
1539
|
* @deprecated Use workspace.resources.entries() instead
|
|
1641
|
-
* Get entries that reference a resource
|
|
1642
1540
|
*/
|
|
1643
1541
|
async getResourceEntries(slug) {
|
|
1644
1542
|
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-
|
|
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-
|
|
1
|
+
import { M as MarvinConfig, a as MarvinClient } from './marvin-DcQimSKv.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-DcQimSKv.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 {
|
|
6
|
-
export { GetAssetsOptions, GetEntriesOptions, GetResourcesOptions, MarvinAsset, MarvinCollection, MarvinEntry, MarvinEntryType, MarvinPublishResponse, MarvinResource, MarvinSite, PublishedAssetRead, PublishedCollectionSummary, PublishedEntryType, PublishedResourceRead } from './
|
|
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-
|
|
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-
|
|
1
|
+
import { M as MarvinConfig, a as MarvinClient } from './marvin-DDpwJbmj.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-DDpwJbmj.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 {
|
|
6
|
-
export { GetAssetsOptions, GetEntriesOptions, GetResourcesOptions, MarvinAsset, MarvinCollection, MarvinEntry, MarvinEntryType, MarvinPublishResponse, MarvinResource, MarvinSite, PublishedAssetRead, PublishedCollectionSummary, PublishedEntryType, PublishedResourceRead } from './
|
|
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
|