@3dverse/api 0.13.0 → 0.13.2
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/_prebuild/wrapper.d.ts +157 -18
- package/dist/index.js +15 -19
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +15 -19
- package/dist/index.mjs.map +2 -2
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -39,12 +39,20 @@ function multipartBody(fields, files) {
|
|
|
39
39
|
}
|
|
40
40
|
return form;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return multipartBody(fields, files);
|
|
42
|
+
function jsonOrMultipartBodyOf(body) {
|
|
43
|
+
if (body === void 0) {
|
|
44
|
+
return void 0;
|
|
46
45
|
}
|
|
47
|
-
|
|
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
|
+
);
|
|
48
56
|
}
|
|
49
57
|
function plainHeaders(headers) {
|
|
50
58
|
return headers instanceof AxiosHeaders ? headers.toJSON() : { ...headers };
|
|
@@ -753,10 +761,7 @@ function listSourceFileAssets({
|
|
|
753
761
|
}
|
|
754
762
|
function createImport({
|
|
755
763
|
folder_id,
|
|
756
|
-
|
|
757
|
-
conversion_pipeline = "auto-detect",
|
|
758
|
-
remote_files,
|
|
759
|
-
options
|
|
764
|
+
body
|
|
760
765
|
}, onUploadProgress, headers) {
|
|
761
766
|
return axiosInstance({
|
|
762
767
|
method: "post",
|
|
@@ -764,16 +769,7 @@ function createImport({
|
|
|
764
769
|
params: {
|
|
765
770
|
folder_id
|
|
766
771
|
},
|
|
767
|
-
data:
|
|
768
|
-
{
|
|
769
|
-
conversion_pipeline,
|
|
770
|
-
remote_files,
|
|
771
|
-
options
|
|
772
|
-
},
|
|
773
|
-
{
|
|
774
|
-
files
|
|
775
|
-
}
|
|
776
|
-
),
|
|
772
|
+
data: jsonOrMultipartBodyOf(body),
|
|
777
773
|
onUploadProgress,
|
|
778
774
|
headers
|
|
779
775
|
});
|