@inneropen/marvin-sdk 2.0.1 → 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.
@@ -0,0 +1,49 @@
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
+ export { A as AuthStrategy, B as BearerTokenAuth, H as HttpClient, a as HttpClientConfig } from './HttpClient-CdF3IHM1.cjs';
5
+
6
+ /**
7
+ * Publishing API Entry Point
8
+ *
9
+ * Read-only API for published content using site client tokens.
10
+ * Import via: import { createMarvinClient } from '@inneropen/marvin-sdk/publish'
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { createMarvinClient } from '@inneropen/marvin-sdk/publish';
15
+ *
16
+ * // Uses MARVIN_SITE_CLIENT_TOKEN from environment
17
+ * const marvin = createMarvinClient();
18
+ *
19
+ * // Or provide token explicitly
20
+ * const marvin = createMarvinClient({
21
+ * siteClientToken: 'your-token-here'
22
+ * });
23
+ *
24
+ * const entry = await marvin.entry('about');
25
+ * const projects = await marvin.projects();
26
+ * ```
27
+ */
28
+
29
+ /**
30
+ * Create a Marvin Publishing API client from environment variables
31
+ *
32
+ * @param config - Optional configuration overrides
33
+ * @returns Configured Marvin client for read-only publishing API
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * // From environment variables (MARVIN_SITE_CLIENT_TOKEN)
38
+ * const marvin = createMarvinClient();
39
+ *
40
+ * // With overrides
41
+ * const marvin = createMarvinClient({
42
+ * apiUrl: 'https://marvin.example.com',
43
+ * siteClientToken: 'your-token-here'
44
+ * });
45
+ * ```
46
+ */
47
+ declare function createMarvinClient(config?: Partial<MarvinConfig>): MarvinClient;
48
+
49
+ export { MarvinClient, MarvinConfig, createMarvinClient };
@@ -0,0 +1,49 @@
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
+ export { A as AuthStrategy, B as BearerTokenAuth, H as HttpClient, a as HttpClientConfig } from './HttpClient-CdF3IHM1.js';
5
+
6
+ /**
7
+ * Publishing API Entry Point
8
+ *
9
+ * Read-only API for published content using site client tokens.
10
+ * Import via: import { createMarvinClient } from '@inneropen/marvin-sdk/publish'
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { createMarvinClient } from '@inneropen/marvin-sdk/publish';
15
+ *
16
+ * // Uses MARVIN_SITE_CLIENT_TOKEN from environment
17
+ * const marvin = createMarvinClient();
18
+ *
19
+ * // Or provide token explicitly
20
+ * const marvin = createMarvinClient({
21
+ * siteClientToken: 'your-token-here'
22
+ * });
23
+ *
24
+ * const entry = await marvin.entry('about');
25
+ * const projects = await marvin.projects();
26
+ * ```
27
+ */
28
+
29
+ /**
30
+ * Create a Marvin Publishing API client from environment variables
31
+ *
32
+ * @param config - Optional configuration overrides
33
+ * @returns Configured Marvin client for read-only publishing API
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * // From environment variables (MARVIN_SITE_CLIENT_TOKEN)
38
+ * const marvin = createMarvinClient();
39
+ *
40
+ * // With overrides
41
+ * const marvin = createMarvinClient({
42
+ * apiUrl: 'https://marvin.example.com',
43
+ * siteClientToken: 'your-token-here'
44
+ * });
45
+ * ```
46
+ */
47
+ declare function createMarvinClient(config?: Partial<MarvinConfig>): MarvinClient;
48
+
49
+ export { MarvinClient, MarvinConfig, createMarvinClient };
@@ -0,0 +1,75 @@
1
+ import {
2
+ Collection,
3
+ Entry,
4
+ MarvinClient,
5
+ Resource,
6
+ Workspace,
7
+ config_exports,
8
+ createConfigFromEnv,
9
+ init_collection,
10
+ init_config,
11
+ init_entry,
12
+ init_marvin,
13
+ init_resource,
14
+ init_workspace
15
+ } from "./chunk-R3EZI43S.js";
16
+ import {
17
+ BearerTokenAuth,
18
+ HttpClient,
19
+ MarvinApiError,
20
+ MarvinAuthError,
21
+ MarvinCache,
22
+ MarvinConfigError,
23
+ MarvinError,
24
+ MarvinNetworkError,
25
+ MarvinNotFoundError,
26
+ MarvinServerError,
27
+ MarvinValidationError,
28
+ __toCommonJS,
29
+ createPaginatedResponse,
30
+ extractData,
31
+ init_core,
32
+ isPaginatedResponse,
33
+ offsetToPage,
34
+ pageToOffset
35
+ } from "./chunk-WJC4X7TB.js";
36
+
37
+ // src/publish.ts
38
+ init_marvin();
39
+ init_config();
40
+ init_marvin();
41
+ init_workspace();
42
+ init_entry();
43
+ init_collection();
44
+ init_resource();
45
+ init_core();
46
+ function createMarvinClient(config) {
47
+ const { createConfigFromEnv: createConfigFromEnv2 } = (init_config(), __toCommonJS(config_exports));
48
+ const finalConfig = createConfigFromEnv2(config);
49
+ return new MarvinClient(finalConfig);
50
+ }
51
+ export {
52
+ BearerTokenAuth,
53
+ Collection,
54
+ Entry,
55
+ HttpClient,
56
+ MarvinApiError,
57
+ MarvinAuthError,
58
+ MarvinCache,
59
+ MarvinClient,
60
+ MarvinConfigError,
61
+ MarvinError,
62
+ MarvinNetworkError,
63
+ MarvinNotFoundError,
64
+ MarvinServerError,
65
+ MarvinValidationError,
66
+ Resource,
67
+ Workspace,
68
+ createConfigFromEnv,
69
+ createMarvinClient,
70
+ createPaginatedResponse,
71
+ extractData,
72
+ isPaginatedResponse,
73
+ offsetToPage,
74
+ pageToOffset
75
+ };
@@ -1,168 +1 @@
1
- /**
2
- * Marvin Publishing Client Types
3
- *
4
- * TypeScript types for the Marvin publishing API responses.
5
- */
6
- interface MarvinSite {
7
- id: string;
8
- name: string;
9
- slug: string;
10
- title?: string;
11
- tagline?: string;
12
- description?: string;
13
- canonicalUrl?: string;
14
- logo?: string;
15
- favicon?: string;
16
- locale?: string;
17
- timezone?: string;
18
- metadata?: Record<string, unknown>;
19
- }
20
- interface MarvinEntryType {
21
- id: string;
22
- name: string;
23
- slug: string;
24
- icon?: string;
25
- color?: string;
26
- description?: string;
27
- sortOrder: number;
28
- isSystem: boolean;
29
- /**
30
- * Schema definition for this entry type (schema-driven content model).
31
- * Defines what fields exist, their types, and validation rules.
32
- * @since 2.0.0
33
- */
34
- schemaJson?: Record<string, unknown>;
35
- }
36
- interface MarvinAsset {
37
- id: string;
38
- slug: string;
39
- name: string;
40
- originalFilename: string;
41
- filename: string;
42
- extension: string;
43
- mimeType: string;
44
- assetType: 'image' | 'document' | 'video' | 'audio' | 'archive' | 'svg' | 'other';
45
- fileSize: number;
46
- checksum: string;
47
- width?: number;
48
- height?: number;
49
- orientation?: number;
50
- storageProvider: string;
51
- storageKey: string;
52
- publicUrl?: string;
53
- altText?: string;
54
- description?: string;
55
- metadata?: Record<string, unknown>;
56
- uploadedBy: string;
57
- createdAt: string;
58
- updatedAt: string;
59
- }
60
- interface PublishedAsset {
61
- slug: string;
62
- name: string;
63
- mimeType: string;
64
- assetType: string;
65
- fileSize: number;
66
- width?: number;
67
- height?: number;
68
- altText?: string;
69
- description?: string;
70
- publicUrl: string;
71
- }
72
- interface AssetUploadRequest {
73
- slug: string;
74
- name: string;
75
- altText?: string;
76
- description?: string;
77
- metadata?: Record<string, unknown>;
78
- }
79
- interface MarvinCollection {
80
- id: string;
81
- name: string;
82
- slug: string;
83
- description?: string;
84
- icon?: string;
85
- color?: string;
86
- sortOrder: number;
87
- isSmart: boolean;
88
- smartRules?: Record<string, unknown>;
89
- createdAt: string;
90
- updatedAt: string;
91
- entryCount?: number;
92
- entries?: MarvinEntry[];
93
- }
94
- interface MarvinResource {
95
- id: string;
96
- name: string;
97
- slug: string;
98
- resourceType?: string;
99
- description?: string;
100
- externalId?: string;
101
- url?: string;
102
- metadata?: Record<string, unknown>;
103
- createdAt: string;
104
- updatedAt: string;
105
- }
106
- interface MarvinEntry {
107
- id: string;
108
- title: string;
109
- slug: string;
110
- summary?: string;
111
- description?: string;
112
- /**
113
- * Schema-driven content data structured according to entry type's schemaJson.
114
- * @since 2.0.0
115
- */
116
- dataJson?: Record<string, unknown>;
117
- /**
118
- * @deprecated Use dataJson instead. Will be removed in v3.0.0
119
- * @since 1.x
120
- */
121
- contentMarkdown?: string;
122
- /**
123
- * Custom non-schema metadata (API keys, external IDs, CMS-specific config).
124
- * For content fields, use dataJson instead.
125
- */
126
- metadata?: Record<string, unknown>;
127
- status: string;
128
- publishedAt?: string;
129
- createdAt: string;
130
- updatedAt: string;
131
- entryTypeId: string;
132
- entryType?: MarvinEntryType;
133
- collections?: MarvinCollection[];
134
- assets?: MarvinAsset[];
135
- resources?: MarvinResource[];
136
- }
137
- interface MarvinPublishResponse<T> {
138
- data: T;
139
- meta?: {
140
- total?: number;
141
- page?: number;
142
- limit?: number;
143
- };
144
- }
145
- interface MarvinClientConfig {
146
- apiUrl: string;
147
- siteClientToken: string;
148
- workspaceSlug: string;
149
- }
150
- interface GetEntriesOptions {
151
- entryType?: string;
152
- collection?: string;
153
- limit?: number;
154
- offset?: number;
155
- status?: string;
156
- }
157
- interface GetAssetsOptions {
158
- type?: string;
159
- limit?: number;
160
- offset?: number;
161
- }
162
- interface GetResourcesOptions {
163
- resourceType?: string;
164
- limit?: number;
165
- offset?: number;
166
- }
167
-
168
- export type { AssetUploadRequest, GetAssetsOptions, GetEntriesOptions, GetResourcesOptions, MarvinAsset, MarvinClientConfig, MarvinCollection, MarvinEntry, MarvinEntryType, MarvinPublishResponse, MarvinResource, MarvinSite, PublishedAsset };
1
+ export { n as AssetUploadRequest, A as AuthToken, G as GetAssetsOptions, a as GetEntriesOptions, b as GetResourcesOptions, M as MarvinAsset, o as MarvinClientConfig, 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';
@@ -1,168 +1 @@
1
- /**
2
- * Marvin Publishing Client Types
3
- *
4
- * TypeScript types for the Marvin publishing API responses.
5
- */
6
- interface MarvinSite {
7
- id: string;
8
- name: string;
9
- slug: string;
10
- title?: string;
11
- tagline?: string;
12
- description?: string;
13
- canonicalUrl?: string;
14
- logo?: string;
15
- favicon?: string;
16
- locale?: string;
17
- timezone?: string;
18
- metadata?: Record<string, unknown>;
19
- }
20
- interface MarvinEntryType {
21
- id: string;
22
- name: string;
23
- slug: string;
24
- icon?: string;
25
- color?: string;
26
- description?: string;
27
- sortOrder: number;
28
- isSystem: boolean;
29
- /**
30
- * Schema definition for this entry type (schema-driven content model).
31
- * Defines what fields exist, their types, and validation rules.
32
- * @since 2.0.0
33
- */
34
- schemaJson?: Record<string, unknown>;
35
- }
36
- interface MarvinAsset {
37
- id: string;
38
- slug: string;
39
- name: string;
40
- originalFilename: string;
41
- filename: string;
42
- extension: string;
43
- mimeType: string;
44
- assetType: 'image' | 'document' | 'video' | 'audio' | 'archive' | 'svg' | 'other';
45
- fileSize: number;
46
- checksum: string;
47
- width?: number;
48
- height?: number;
49
- orientation?: number;
50
- storageProvider: string;
51
- storageKey: string;
52
- publicUrl?: string;
53
- altText?: string;
54
- description?: string;
55
- metadata?: Record<string, unknown>;
56
- uploadedBy: string;
57
- createdAt: string;
58
- updatedAt: string;
59
- }
60
- interface PublishedAsset {
61
- slug: string;
62
- name: string;
63
- mimeType: string;
64
- assetType: string;
65
- fileSize: number;
66
- width?: number;
67
- height?: number;
68
- altText?: string;
69
- description?: string;
70
- publicUrl: string;
71
- }
72
- interface AssetUploadRequest {
73
- slug: string;
74
- name: string;
75
- altText?: string;
76
- description?: string;
77
- metadata?: Record<string, unknown>;
78
- }
79
- interface MarvinCollection {
80
- id: string;
81
- name: string;
82
- slug: string;
83
- description?: string;
84
- icon?: string;
85
- color?: string;
86
- sortOrder: number;
87
- isSmart: boolean;
88
- smartRules?: Record<string, unknown>;
89
- createdAt: string;
90
- updatedAt: string;
91
- entryCount?: number;
92
- entries?: MarvinEntry[];
93
- }
94
- interface MarvinResource {
95
- id: string;
96
- name: string;
97
- slug: string;
98
- resourceType?: string;
99
- description?: string;
100
- externalId?: string;
101
- url?: string;
102
- metadata?: Record<string, unknown>;
103
- createdAt: string;
104
- updatedAt: string;
105
- }
106
- interface MarvinEntry {
107
- id: string;
108
- title: string;
109
- slug: string;
110
- summary?: string;
111
- description?: string;
112
- /**
113
- * Schema-driven content data structured according to entry type's schemaJson.
114
- * @since 2.0.0
115
- */
116
- dataJson?: Record<string, unknown>;
117
- /**
118
- * @deprecated Use dataJson instead. Will be removed in v3.0.0
119
- * @since 1.x
120
- */
121
- contentMarkdown?: string;
122
- /**
123
- * Custom non-schema metadata (API keys, external IDs, CMS-specific config).
124
- * For content fields, use dataJson instead.
125
- */
126
- metadata?: Record<string, unknown>;
127
- status: string;
128
- publishedAt?: string;
129
- createdAt: string;
130
- updatedAt: string;
131
- entryTypeId: string;
132
- entryType?: MarvinEntryType;
133
- collections?: MarvinCollection[];
134
- assets?: MarvinAsset[];
135
- resources?: MarvinResource[];
136
- }
137
- interface MarvinPublishResponse<T> {
138
- data: T;
139
- meta?: {
140
- total?: number;
141
- page?: number;
142
- limit?: number;
143
- };
144
- }
145
- interface MarvinClientConfig {
146
- apiUrl: string;
147
- siteClientToken: string;
148
- workspaceSlug: string;
149
- }
150
- interface GetEntriesOptions {
151
- entryType?: string;
152
- collection?: string;
153
- limit?: number;
154
- offset?: number;
155
- status?: string;
156
- }
157
- interface GetAssetsOptions {
158
- type?: string;
159
- limit?: number;
160
- offset?: number;
161
- }
162
- interface GetResourcesOptions {
163
- resourceType?: string;
164
- limit?: number;
165
- offset?: number;
166
- }
167
-
168
- export type { AssetUploadRequest, GetAssetsOptions, GetEntriesOptions, GetResourcesOptions, MarvinAsset, MarvinClientConfig, MarvinCollection, MarvinEntry, MarvinEntryType, MarvinPublishResponse, MarvinResource, MarvinSite, PublishedAsset };
1
+ export { n as AssetUploadRequest, A as AuthToken, G as GetAssetsOptions, a as GetEntriesOptions, b as GetResourcesOptions, M as MarvinAsset, o as MarvinClientConfig, 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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneropen/marvin-sdk",
3
- "version": "2.0.1",
3
+ "version": "3.0.1",
4
4
  "description": "Official TypeScript SDK for Marvin CMS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -13,15 +13,20 @@
13
13
  "require": "./dist/index.cjs"
14
14
  },
15
15
  "./publish": {
16
- "types": "./dist/index.d.ts",
17
- "import": "./dist/index.js",
18
- "require": "./dist/index.cjs"
16
+ "types": "./dist/publish.d.ts",
17
+ "import": "./dist/publish.js",
18
+ "require": "./dist/publish.cjs"
19
19
  },
20
20
  "./platform": {
21
21
  "types": "./dist/platform.d.ts",
22
22
  "import": "./dist/platform.js",
23
23
  "require": "./dist/platform.cjs"
24
24
  },
25
+ "./core": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js",
28
+ "require": "./dist/index.cjs"
29
+ },
25
30
  "./types": {
26
31
  "types": "./dist/types/index.d.ts",
27
32
  "import": "./dist/types/index.js",
@@ -60,8 +65,8 @@
60
65
  },
61
66
  "homepage": "https://github.com/inneropen/marvin-sdk#readme",
62
67
  "scripts": {
63
- "build": "tsup src/index.ts src/platform.ts src/types/index.ts --format esm,cjs --dts --clean",
64
- "dev": "tsup src/index.ts src/platform.ts src/types/index.ts --format esm,cjs --dts --watch",
68
+ "build": "tsup src/index.ts src/publish.ts src/platform.ts src/types/index.ts --format esm,cjs --dts --clean",
69
+ "dev": "tsup src/index.ts src/publish.ts src/platform.ts src/types/index.ts --format esm,cjs --dts --watch",
65
70
  "generate:types": "openapi-typescript http://localhost:8080/openapi.json -o src/generated/schema.ts",
66
71
  "typecheck": "tsc --noEmit",
67
72
  "prepare": "npm run build",