@inneropen/marvin-sdk 1.9.5 → 1.10.0

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.
@@ -117,9 +117,13 @@ var init_HttpClient = __esm({
117
117
  /**
118
118
  * Build headers for request
119
119
  */
120
- buildHeaders(additionalHeaders) {
120
+ buildHeaders(additionalHeaders, isFormData = false) {
121
+ const headerInit = {};
122
+ if (!isFormData) {
123
+ headerInit["Content-Type"] = "application/json";
124
+ }
121
125
  const headers = new Headers({
122
- "Content-Type": "application/json",
126
+ ...headerInit,
123
127
  ...this.defaultHeaders,
124
128
  ...additionalHeaders
125
129
  });
@@ -138,14 +142,15 @@ var init_HttpClient = __esm({
138
142
  */
139
143
  async request(method, endpoint, options) {
140
144
  const url = this.buildUrl(endpoint) + (options?.params ? this.buildQueryString(options.params) : "");
141
- const headers = this.buildHeaders(options?.headers);
145
+ const isFormData = options?.body instanceof FormData;
146
+ const headers = this.buildHeaders(options?.headers, isFormData);
142
147
  const controller = new AbortController();
143
148
  const timeoutId = setTimeout(() => controller.abort(), this.timeout);
144
149
  try {
145
150
  const response = await fetch(url, {
146
151
  method,
147
152
  headers,
148
- body: options?.body ? JSON.stringify(options.body) : void 0,
153
+ body: isFormData ? options.body : options?.body ? JSON.stringify(options.body) : void 0,
149
154
  credentials: this.credentials,
150
155
  signal: controller.signal
151
156
  });
package/dist/index.cjs CHANGED
@@ -151,9 +151,13 @@ var init_HttpClient = __esm({
151
151
  /**
152
152
  * Build headers for request
153
153
  */
154
- buildHeaders(additionalHeaders) {
154
+ buildHeaders(additionalHeaders, isFormData = false) {
155
+ const headerInit = {};
156
+ if (!isFormData) {
157
+ headerInit["Content-Type"] = "application/json";
158
+ }
155
159
  const headers = new Headers({
156
- "Content-Type": "application/json",
160
+ ...headerInit,
157
161
  ...this.defaultHeaders,
158
162
  ...additionalHeaders
159
163
  });
@@ -172,14 +176,15 @@ var init_HttpClient = __esm({
172
176
  */
173
177
  async request(method, endpoint, options) {
174
178
  const url = this.buildUrl(endpoint) + (options?.params ? this.buildQueryString(options.params) : "");
175
- const headers = this.buildHeaders(options?.headers);
179
+ const isFormData = options?.body instanceof FormData;
180
+ const headers = this.buildHeaders(options?.headers, isFormData);
176
181
  const controller = new AbortController();
177
182
  const timeoutId = setTimeout(() => controller.abort(), this.timeout);
178
183
  try {
179
184
  const response = await fetch(url, {
180
185
  method,
181
186
  headers,
182
- body: options?.body ? JSON.stringify(options.body) : void 0,
187
+ body: isFormData ? options.body : options?.body ? JSON.stringify(options.body) : void 0,
183
188
  credentials: this.credentials,
184
189
  signal: controller.signal
185
190
  });
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  isPaginatedResponse,
19
19
  offsetToPage,
20
20
  pageToOffset
21
- } from "./chunk-LQOFJMRJ.js";
21
+ } from "./chunk-25F3IF6S.js";
22
22
 
23
23
  // src/client/config.ts
24
24
  var config_exports = {};
package/dist/platform.cjs CHANGED
@@ -99,9 +99,13 @@ var HttpClient = class {
99
99
  /**
100
100
  * Build headers for request
101
101
  */
102
- buildHeaders(additionalHeaders) {
102
+ buildHeaders(additionalHeaders, isFormData = false) {
103
+ const headerInit = {};
104
+ if (!isFormData) {
105
+ headerInit["Content-Type"] = "application/json";
106
+ }
103
107
  const headers = new Headers({
104
- "Content-Type": "application/json",
108
+ ...headerInit,
105
109
  ...this.defaultHeaders,
106
110
  ...additionalHeaders
107
111
  });
@@ -120,14 +124,15 @@ var HttpClient = class {
120
124
  */
121
125
  async request(method, endpoint, options) {
122
126
  const url = this.buildUrl(endpoint) + (options?.params ? this.buildQueryString(options.params) : "");
123
- const headers = this.buildHeaders(options?.headers);
127
+ const isFormData = options?.body instanceof FormData;
128
+ const headers = this.buildHeaders(options?.headers, isFormData);
124
129
  const controller = new AbortController();
125
130
  const timeoutId = setTimeout(() => controller.abort(), this.timeout);
126
131
  try {
127
132
  const response = await fetch(url, {
128
133
  method,
129
134
  headers,
130
- body: options?.body ? JSON.stringify(options.body) : void 0,
135
+ body: isFormData ? options.body : options?.body ? JSON.stringify(options.body) : void 0,
131
136
  credentials: this.credentials,
132
137
  signal: controller.signal
133
138
  });
@@ -410,12 +415,6 @@ var AssetsModule = class {
410
415
  }
411
416
  return this.http.post("/api/platform/assets/upload", formData);
412
417
  }
413
- /**
414
- * Create a new asset (legacy metadata-only method)
415
- */
416
- async create(data) {
417
- return this.http.post("/api/platform/assets", data);
418
- }
419
418
  /**
420
419
  * Update an asset (editable fields only: slug, name, altText, description, metadata)
421
420
  */
@@ -2654,10 +2654,6 @@ declare class AssetsModule {
2654
2654
  * @returns The created asset with extracted metadata
2655
2655
  */
2656
2656
  upload(file: File | Blob, metadata: PlatformAssetUpload): Promise<PlatformAsset>;
2657
- /**
2658
- * Create a new asset (legacy metadata-only method)
2659
- */
2660
- create(data: PlatformAssetCreate): Promise<PlatformAsset>;
2661
2657
  /**
2662
2658
  * Update an asset (editable fields only: slug, name, altText, description, metadata)
2663
2659
  */
@@ -2654,10 +2654,6 @@ declare class AssetsModule {
2654
2654
  * @returns The created asset with extracted metadata
2655
2655
  */
2656
2656
  upload(file: File | Blob, metadata: PlatformAssetUpload): Promise<PlatformAsset>;
2657
- /**
2658
- * Create a new asset (legacy metadata-only method)
2659
- */
2660
- create(data: PlatformAssetCreate): Promise<PlatformAsset>;
2661
2657
  /**
2662
2658
  * Update an asset (editable fields only: slug, name, altText, description, metadata)
2663
2659
  */
package/dist/platform.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  HttpClient,
3
3
  SessionAuth,
4
4
  init_core
5
- } from "./chunk-LQOFJMRJ.js";
5
+ } from "./chunk-25F3IF6S.js";
6
6
 
7
7
  // src/platform/client.ts
8
8
  init_core();
@@ -195,12 +195,6 @@ var AssetsModule = class {
195
195
  }
196
196
  return this.http.post("/api/platform/assets/upload", formData);
197
197
  }
198
- /**
199
- * Create a new asset (legacy metadata-only method)
200
- */
201
- async create(data) {
202
- return this.http.post("/api/platform/assets", data);
203
- }
204
198
  /**
205
199
  * Update an asset (editable fields only: slug, name, altText, description, metadata)
206
200
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneropen/marvin-sdk",
3
- "version": "1.9.5",
3
+ "version": "1.10.0",
4
4
  "description": "Official TypeScript SDK for Marvin CMS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",