@uploadcare/upload-client 6.0.0 → 6.0.1-alpha.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.
@@ -264,7 +264,8 @@ const isFileData = (data) => {
264
264
  return (data !== undefined &&
265
265
  ((typeof Blob !== 'undefined' && data instanceof Blob) ||
266
266
  (typeof File !== 'undefined' && data instanceof File) ||
267
- (typeof Buffer !== 'undefined' && data instanceof Buffer)));
267
+ (typeof Buffer !== 'undefined' && data instanceof Buffer) ||
268
+ (typeof data === 'string' && data.startsWith('file:'))));
268
269
  };
269
270
  /**
270
271
  * Uuid type guard.
@@ -326,9 +327,9 @@ function buildFormData(options) {
326
327
  const formData = getFormData();
327
328
  const paramsList = getFormDataParams(options);
328
329
  for (const params of paramsList) {
329
- const [key, value, ...options] = params;
330
+ const [key, value, ...rest] = params;
330
331
  // node form-data has another signature for append
331
- formData.append(key, value, ...options);
332
+ formData.append(key, value, ...rest);
332
333
  }
333
334
  return formData;
334
335
  }
@@ -292,7 +292,8 @@ const isFileData = (data) => {
292
292
  return (data !== undefined &&
293
293
  ((typeof Blob !== 'undefined' && data instanceof Blob) ||
294
294
  (typeof File !== 'undefined' && data instanceof File) ||
295
- (typeof Buffer !== 'undefined' && data instanceof Buffer)));
295
+ (typeof Buffer !== 'undefined' && data instanceof Buffer) ||
296
+ (typeof data === 'string' && data.startsWith('file:'))));
296
297
  };
297
298
  /**
298
299
  * Uuid type guard.
@@ -354,9 +355,9 @@ function buildFormData(options) {
354
355
  const formData = getFormData();
355
356
  const paramsList = getFormDataParams(options);
356
357
  for (const params of paramsList) {
357
- const [key, value, ...options] = params;
358
+ const [key, value, ...rest] = params;
358
359
  // node form-data has another signature for append
359
- formData.append(key, value, ...options);
360
+ formData.append(key, value, ...rest);
360
361
  }
361
362
  return formData;
362
363
  }
@@ -251,8 +251,8 @@ const request = ({ method, url, data, headers = {}, signal, onProgress }) => new
251
251
 
252
252
  const getFileOptions = ({ name }) => name ? [name] : [];
253
253
  const transformFile = (file, name) => {
254
- if (!file) {
255
- return file;
254
+ if (typeof file === 'string' && file.startsWith('file:')) {
255
+ return { uri: file, name };
256
256
  }
257
257
  const uri = URL.createObjectURL(file);
258
258
  const type = file.type;
@@ -267,7 +267,8 @@ const isFileData = (data) => {
267
267
  return (data !== undefined &&
268
268
  ((typeof Blob !== 'undefined' && data instanceof Blob) ||
269
269
  (typeof File !== 'undefined' && data instanceof File) ||
270
- (typeof Buffer !== 'undefined' && data instanceof Buffer)));
270
+ (typeof Buffer !== 'undefined' && data instanceof Buffer) ||
271
+ (typeof data === 'string' && data.startsWith('file:'))));
271
272
  };
272
273
  /**
273
274
  * Uuid type guard.
@@ -329,9 +330,9 @@ function buildFormData(options) {
329
330
  const formData = getFormData();
330
331
  const paramsList = getFormDataParams(options);
331
332
  for (const params of paramsList) {
332
- const [key, value, ...options] = params;
333
+ const [key, value, ...rest] = params;
333
334
  // node form-data has another signature for append
334
- formData.append(key, value, ...options);
335
+ formData.append(key, value, ...rest);
335
336
  }
336
337
  return formData;
337
338
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uploadcare/upload-client",
3
- "version": "6.0.0",
3
+ "version": "6.0.1-alpha.0",
4
4
  "description": "Library for work with Uploadcare Upload API",
5
5
  "type": "module",
6
6
  "module": "./dist/index.node.js",