@3dverse/api 0.13.1 → 0.14.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.
package/dist/index.mjs CHANGED
@@ -39,6 +39,21 @@ function multipartBody(fields, files) {
39
39
  }
40
40
  return form;
41
41
  }
42
+ function jsonOrMultipartBodyOf(body) {
43
+ if (body === void 0) {
44
+ return void 0;
45
+ }
46
+ const isFile = (value) => value instanceof Blob || Array.isArray(value) && value.length > 0 && value.every((item) => item instanceof Blob);
47
+ const entries = Object.entries(body);
48
+ const files = entries.filter(([, value]) => isFile(value));
49
+ if (files.length === 0) {
50
+ return body;
51
+ }
52
+ return multipartBody(
53
+ Object.fromEntries(entries.filter(([, value]) => !isFile(value))),
54
+ Object.fromEntries(files)
55
+ );
56
+ }
42
57
  function plainHeaders(headers) {
43
58
  return headers instanceof AxiosHeaders ? headers.toJSON() : { ...headers };
44
59
  }
@@ -747,14 +762,15 @@ function listSourceFileAssets({
747
762
  function createImport({
748
763
  folder_id,
749
764
  body
750
- }, headers) {
765
+ }, onUploadProgress, headers) {
751
766
  return axiosInstance({
752
767
  method: "post",
753
768
  url: "/imports",
754
769
  params: {
755
770
  folder_id
756
771
  },
757
- data: body,
772
+ data: jsonOrMultipartBodyOf(body),
773
+ onUploadProgress,
758
774
  headers
759
775
  });
760
776
  }
@@ -783,6 +799,19 @@ function getImport({
783
799
  headers
784
800
  });
785
801
  }
802
+ function updateImport({
803
+ import_id,
804
+ state
805
+ }, headers) {
806
+ return axiosInstance({
807
+ method: "patch",
808
+ url: "/imports/" + encodeURIComponent(import_id),
809
+ data: {
810
+ state
811
+ },
812
+ headers
813
+ });
814
+ }
786
815
  function getConversionLogs({
787
816
  conversion_id,
788
817
  from,
@@ -1674,6 +1703,7 @@ export {
1674
1703
  updateEntity,
1675
1704
  updateFolder,
1676
1705
  updateGroup,
1706
+ updateImport,
1677
1707
  updateSceneSettings,
1678
1708
  updateSourceFile,
1679
1709
  updateUser,