@inneropen/marvin-sdk 2.0.0-next.20 → 2.0.0-next.22

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/README.md CHANGED
@@ -160,10 +160,11 @@ Everything starts with the **Workspace**:
160
160
  const workspace = await marvin.getWorkspace();
161
161
 
162
162
  // Access workspace modules
163
- workspace.entries // Entries module
163
+ workspace.entries // Entries module
164
164
  workspace.collections // Collections module
165
- workspace.assets // Assets module
166
- workspace.site // Site configuration (cached)
165
+ workspace.assets // Assets module
166
+ workspace.renderers // Renderers module (entry type rendering metadata)
167
+ workspace.site // Site configuration (cached)
167
168
  ```
168
169
 
169
170
  ### Modular Structure
@@ -177,6 +178,7 @@ The SDK is organized into focused modules:
177
178
  ├── entries/ → Entries module
178
179
  ├── collections/ → Collections module
179
180
  ├── assets/ → Assets module
181
+ ├── renderers/ → Renderers module (entry type rendering metadata)
180
182
  ├── auth/ → Authentication (future)
181
183
  ├── types/ → TypeScript types
182
184
  └── utils/ → Cache & utilities
@@ -686,6 +688,43 @@ Methods:
686
688
  - `resource.entries()` - Get entries that reference this resource
687
689
  - `resource.toJSON()` - Get raw resource data
688
690
 
691
+ ### Renderers Module
692
+
693
+ #### `renderers.list()`
694
+
695
+ Get all entry types with their rendering and capability metadata.
696
+
697
+ **Returns:** `PublishedEntryType[]`
698
+
699
+ ```ts
700
+ interface PublishedEntryType {
701
+ slug: string;
702
+ name: string;
703
+ isRendered: boolean;
704
+ rendering?: {
705
+ renderer?: string;
706
+ package?: string;
707
+ version?: string;
708
+ config?: Record<string, unknown>;
709
+ };
710
+ capabilities?: {
711
+ publishable?: boolean;
712
+ submittable?: boolean;
713
+ routable?: boolean;
714
+ };
715
+ }
716
+ ```
717
+
718
+ **Example:**
719
+
720
+ ```ts
721
+ const workspace = await marvin.getWorkspace();
722
+ const renderers = await workspace.renderers.list();
723
+
724
+ const rendered = renderers.filter(r => r.isRendered);
725
+ console.log(`${rendered.length} entry types have renderers`);
726
+ ```
727
+
689
728
  ## Backend API Endpoints
690
729
 
691
730
  The SDK uses these Marvin publishing API endpoints:
@@ -704,6 +743,7 @@ The SDK uses these Marvin publishing API endpoints:
704
743
  | `/api/publish/{workspace}/resources` | GET | List resources | ✅ Implemented |
705
744
  | `/api/publish/{workspace}/resources/{slug}` | GET | Get resource | ✅ Implemented |
706
745
  | `/api/publish/{workspace}/resources/{slug}/entries` | GET | Resource entries | ✅ Implemented |
746
+ | `/api/publish/{workspace}/entry-types` | GET | List entry types (renderers) | ✅ Implemented |
707
747
 
708
748
  **Query Parameters:**
709
749
 
@@ -111,15 +111,21 @@ Change to: ${config.apiUrl.replace(url.protocol, "https:")}`
111
111
  }
112
112
  }
113
113
  }
114
+ function getEnv(key) {
115
+ if (typeof process !== "undefined" && process.env) {
116
+ return process.env[key];
117
+ }
118
+ return void 0;
119
+ }
114
120
  function createConfigFromEnv(overrides) {
115
121
  return {
116
- apiUrl: overrides?.apiUrl || process.env.MARVIN_API_URL || "",
117
- siteClientToken: overrides?.siteClientToken || process.env.MARVIN_SITE_CLIENT_TOKEN || "",
118
- workspaceSlug: overrides?.workspaceSlug || process.env.MARVIN_WORKSPACE_SLUG || "",
122
+ apiUrl: overrides?.apiUrl || getEnv("MARVIN_API_URL") || "",
123
+ siteClientToken: overrides?.siteClientToken || getEnv("MARVIN_SITE_CLIENT_TOKEN") || "",
124
+ workspaceSlug: overrides?.workspaceSlug || getEnv("MARVIN_WORKSPACE_SLUG") || "",
119
125
  autoInitialize: overrides?.autoInitialize ?? false,
120
126
  cacheDuration: overrides?.cacheDuration ?? 5 * 60 * 1e3,
121
127
  // 5 minutes
122
- debug: overrides?.debug ?? process.env.MARVIN_DEBUG === "true",
128
+ debug: overrides?.debug ?? getEnv("MARVIN_DEBUG") === "true",
123
129
  logger: overrides?.logger ?? console
124
130
  };
125
131
  }
package/dist/index.cjs CHANGED
@@ -122,15 +122,21 @@ Change to: ${config.apiUrl.replace(url.protocol, "https:")}`
122
122
  }
123
123
  }
124
124
  }
125
+ function getEnv(key) {
126
+ if (typeof process !== "undefined" && process.env) {
127
+ return process.env[key];
128
+ }
129
+ return void 0;
130
+ }
125
131
  function createConfigFromEnv(overrides) {
126
132
  return {
127
- apiUrl: overrides?.apiUrl || process.env.MARVIN_API_URL || "",
128
- siteClientToken: overrides?.siteClientToken || process.env.MARVIN_SITE_CLIENT_TOKEN || "",
129
- workspaceSlug: overrides?.workspaceSlug || process.env.MARVIN_WORKSPACE_SLUG || "",
133
+ apiUrl: overrides?.apiUrl || getEnv("MARVIN_API_URL") || "",
134
+ siteClientToken: overrides?.siteClientToken || getEnv("MARVIN_SITE_CLIENT_TOKEN") || "",
135
+ workspaceSlug: overrides?.workspaceSlug || getEnv("MARVIN_WORKSPACE_SLUG") || "",
130
136
  autoInitialize: overrides?.autoInitialize ?? false,
131
137
  cacheDuration: overrides?.cacheDuration ?? 5 * 60 * 1e3,
132
138
  // 5 minutes
133
- debug: overrides?.debug ?? process.env.MARVIN_DEBUG === "true",
139
+ debug: overrides?.debug ?? getEnv("MARVIN_DEBUG") === "true",
134
140
  logger: overrides?.logger ?? console
135
141
  };
136
142
  }
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-TZ2TZFWP.js";
16
+ } from "./chunk-SGZG7U7V.js";
17
17
  import {
18
18
  BearerTokenAuth,
19
19
  HttpClient,
package/dist/platform.cjs CHANGED
@@ -962,6 +962,12 @@ var WorkspacesModule = class {
962
962
  };
963
963
 
964
964
  // src/platform/invites.ts
965
+ function getEnv(key) {
966
+ if (typeof process !== "undefined" && process.env) {
967
+ return process.env[key];
968
+ }
969
+ return void 0;
970
+ }
965
971
  var InvitesModule = class {
966
972
  constructor(http) {
967
973
  this.http = http;
@@ -1010,16 +1016,18 @@ var InvitesModule = class {
1010
1016
  */
1011
1017
  getInvitationUrl(token, baseUrl) {
1012
1018
  let base = baseUrl;
1013
- if (!base && typeof process !== "undefined" && process.env) {
1014
- base = process.env.MARVIN_FRONTEND_URL;
1015
- if (!base && process.env.MARVIN_API_URL) {
1016
- const apiUrl = process.env.MARVIN_API_URL;
1017
- if (apiUrl.includes(":8080")) {
1018
- base = apiUrl.replace(":8080", ":4321");
1019
- } else if (apiUrl.includes(":3000")) {
1020
- base = apiUrl.replace(":3000", ":4321");
1021
- } else {
1022
- base = apiUrl;
1019
+ if (!base) {
1020
+ base = getEnv("MARVIN_FRONTEND_URL");
1021
+ if (!base) {
1022
+ const apiUrl = getEnv("MARVIN_API_URL");
1023
+ if (apiUrl) {
1024
+ if (apiUrl.includes(":8080")) {
1025
+ base = apiUrl.replace(":8080", ":4321");
1026
+ } else if (apiUrl.includes(":3000")) {
1027
+ base = apiUrl.replace(":3000", ":4321");
1028
+ } else {
1029
+ base = apiUrl;
1030
+ }
1023
1031
  }
1024
1032
  }
1025
1033
  }
@@ -1773,10 +1781,16 @@ var FormsModule = class {
1773
1781
  };
1774
1782
 
1775
1783
  // src/platform/client.ts
1784
+ function getEnv2(key) {
1785
+ if (typeof process !== "undefined" && process.env) {
1786
+ return process.env[key];
1787
+ }
1788
+ return void 0;
1789
+ }
1776
1790
  function createPlatformConfigFromEnv(overrides) {
1777
1791
  return {
1778
- apiUrl: overrides?.apiUrl || process.env.MARVIN_API_URL || "http://localhost:8080",
1779
- userToken: overrides?.userToken || process.env.MARVIN_USER_TOKEN,
1792
+ apiUrl: overrides?.apiUrl || getEnv2("MARVIN_API_URL") || "http://localhost:8080",
1793
+ userToken: overrides?.userToken || getEnv2("MARVIN_USER_TOKEN"),
1780
1794
  credentials: overrides?.credentials || "include"
1781
1795
  };
1782
1796
  }
@@ -4646,9 +4646,6 @@ interface PlatformClientConfig {
4646
4646
  userToken?: string;
4647
4647
  credentials?: RequestCredentials;
4648
4648
  }
4649
- /**
4650
- * Create Platform API config from environment
4651
- */
4652
4649
  declare function createPlatformConfigFromEnv(overrides?: Partial<PlatformClientConfig>): PlatformClientConfig;
4653
4650
  declare class PlatformClient extends HttpClient {
4654
4651
  entries: EntriesModule;
@@ -4646,9 +4646,6 @@ interface PlatformClientConfig {
4646
4646
  userToken?: string;
4647
4647
  credentials?: RequestCredentials;
4648
4648
  }
4649
- /**
4650
- * Create Platform API config from environment
4651
- */
4652
4649
  declare function createPlatformConfigFromEnv(overrides?: Partial<PlatformClientConfig>): PlatformClientConfig;
4653
4650
  declare class PlatformClient extends HttpClient {
4654
4651
  entries: EntriesModule;
package/dist/platform.js CHANGED
@@ -517,6 +517,12 @@ var WorkspacesModule = class {
517
517
  };
518
518
 
519
519
  // src/platform/invites.ts
520
+ function getEnv(key) {
521
+ if (typeof process !== "undefined" && process.env) {
522
+ return process.env[key];
523
+ }
524
+ return void 0;
525
+ }
520
526
  var InvitesModule = class {
521
527
  constructor(http) {
522
528
  this.http = http;
@@ -565,16 +571,18 @@ var InvitesModule = class {
565
571
  */
566
572
  getInvitationUrl(token, baseUrl) {
567
573
  let base = baseUrl;
568
- if (!base && typeof process !== "undefined" && process.env) {
569
- base = process.env.MARVIN_FRONTEND_URL;
570
- if (!base && process.env.MARVIN_API_URL) {
571
- const apiUrl = process.env.MARVIN_API_URL;
572
- if (apiUrl.includes(":8080")) {
573
- base = apiUrl.replace(":8080", ":4321");
574
- } else if (apiUrl.includes(":3000")) {
575
- base = apiUrl.replace(":3000", ":4321");
576
- } else {
577
- base = apiUrl;
574
+ if (!base) {
575
+ base = getEnv("MARVIN_FRONTEND_URL");
576
+ if (!base) {
577
+ const apiUrl = getEnv("MARVIN_API_URL");
578
+ if (apiUrl) {
579
+ if (apiUrl.includes(":8080")) {
580
+ base = apiUrl.replace(":8080", ":4321");
581
+ } else if (apiUrl.includes(":3000")) {
582
+ base = apiUrl.replace(":3000", ":4321");
583
+ } else {
584
+ base = apiUrl;
585
+ }
578
586
  }
579
587
  }
580
588
  }
@@ -1330,10 +1338,16 @@ var FormsModule = class {
1330
1338
  };
1331
1339
 
1332
1340
  // src/platform/client.ts
1341
+ function getEnv2(key) {
1342
+ if (typeof process !== "undefined" && process.env) {
1343
+ return process.env[key];
1344
+ }
1345
+ return void 0;
1346
+ }
1333
1347
  function createPlatformConfigFromEnv(overrides) {
1334
1348
  return {
1335
- apiUrl: overrides?.apiUrl || process.env.MARVIN_API_URL || "http://localhost:8080",
1336
- userToken: overrides?.userToken || process.env.MARVIN_USER_TOKEN,
1349
+ apiUrl: overrides?.apiUrl || getEnv2("MARVIN_API_URL") || "http://localhost:8080",
1350
+ userToken: overrides?.userToken || getEnv2("MARVIN_USER_TOKEN"),
1337
1351
  credentials: overrides?.credentials || "include"
1338
1352
  };
1339
1353
  }
package/dist/publish.cjs CHANGED
@@ -122,15 +122,21 @@ Change to: ${config.apiUrl.replace(url.protocol, "https:")}`
122
122
  }
123
123
  }
124
124
  }
125
+ function getEnv(key) {
126
+ if (typeof process !== "undefined" && process.env) {
127
+ return process.env[key];
128
+ }
129
+ return void 0;
130
+ }
125
131
  function createConfigFromEnv(overrides) {
126
132
  return {
127
- apiUrl: overrides?.apiUrl || process.env.MARVIN_API_URL || "",
128
- siteClientToken: overrides?.siteClientToken || process.env.MARVIN_SITE_CLIENT_TOKEN || "",
129
- workspaceSlug: overrides?.workspaceSlug || process.env.MARVIN_WORKSPACE_SLUG || "",
133
+ apiUrl: overrides?.apiUrl || getEnv("MARVIN_API_URL") || "",
134
+ siteClientToken: overrides?.siteClientToken || getEnv("MARVIN_SITE_CLIENT_TOKEN") || "",
135
+ workspaceSlug: overrides?.workspaceSlug || getEnv("MARVIN_WORKSPACE_SLUG") || "",
130
136
  autoInitialize: overrides?.autoInitialize ?? false,
131
137
  cacheDuration: overrides?.cacheDuration ?? 5 * 60 * 1e3,
132
138
  // 5 minutes
133
- debug: overrides?.debug ?? process.env.MARVIN_DEBUG === "true",
139
+ debug: overrides?.debug ?? getEnv("MARVIN_DEBUG") === "true",
134
140
  logger: overrides?.logger ?? console
135
141
  };
136
142
  }
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-TZ2TZFWP.js";
15
+ } from "./chunk-SGZG7U7V.js";
16
16
  import {
17
17
  BearerTokenAuth,
18
18
  HttpClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneropen/marvin-sdk",
3
- "version": "2.0.0-next.20",
3
+ "version": "2.0.0-next.22",
4
4
  "description": "Official TypeScript SDK for Marvin CMS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",