@3dverse/api 0.13.1 → 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 +9 -2
- package/dist/index.js +18 -2
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +18 -2
- package/dist/index.mjs.map +2 -2
- package/package.json +2 -2
|
@@ -8908,8 +8908,15 @@ export declare function createImport({ folder_id, body, }: {
|
|
|
8908
8908
|
}) & {
|
|
8909
8909
|
/** The name of the asset generated */
|
|
8910
8910
|
name: string;
|
|
8911
|
-
})
|
|
8912
|
-
|
|
8911
|
+
})> | {
|
|
8912
|
+
files?: Array<Blob>;
|
|
8913
|
+
conversion_pipeline: ConversionPipeline;
|
|
8914
|
+
remote_files?: Array<RemoteFile>;
|
|
8915
|
+
options?: {
|
|
8916
|
+
[_additionalproperties_: string]: any;
|
|
8917
|
+
};
|
|
8918
|
+
};
|
|
8919
|
+
}, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void, headers?: RawAxiosRequestHeaders | AxiosRequestHeaders): AxiosPromise<{
|
|
8913
8920
|
import_id: ImportId;
|
|
8914
8921
|
}>;
|
|
8915
8922
|
/**
|
package/dist/index.js
CHANGED
|
@@ -180,6 +180,21 @@ function multipartBody(fields, files) {
|
|
|
180
180
|
}
|
|
181
181
|
return form;
|
|
182
182
|
}
|
|
183
|
+
function jsonOrMultipartBodyOf(body) {
|
|
184
|
+
if (body === void 0) {
|
|
185
|
+
return void 0;
|
|
186
|
+
}
|
|
187
|
+
const isFile = (value) => value instanceof Blob || Array.isArray(value) && value.length > 0 && value.every((item) => item instanceof Blob);
|
|
188
|
+
const entries = Object.entries(body);
|
|
189
|
+
const files = entries.filter(([, value]) => isFile(value));
|
|
190
|
+
if (files.length === 0) {
|
|
191
|
+
return body;
|
|
192
|
+
}
|
|
193
|
+
return multipartBody(
|
|
194
|
+
Object.fromEntries(entries.filter(([, value]) => !isFile(value))),
|
|
195
|
+
Object.fromEntries(files)
|
|
196
|
+
);
|
|
197
|
+
}
|
|
183
198
|
function plainHeaders(headers) {
|
|
184
199
|
return headers instanceof import_axios.AxiosHeaders ? headers.toJSON() : { ...headers };
|
|
185
200
|
}
|
|
@@ -888,14 +903,15 @@ function listSourceFileAssets({
|
|
|
888
903
|
function createImport({
|
|
889
904
|
folder_id,
|
|
890
905
|
body
|
|
891
|
-
}, headers) {
|
|
906
|
+
}, onUploadProgress, headers) {
|
|
892
907
|
return axiosInstance({
|
|
893
908
|
method: "post",
|
|
894
909
|
url: "/imports",
|
|
895
910
|
params: {
|
|
896
911
|
folder_id
|
|
897
912
|
},
|
|
898
|
-
data: body,
|
|
913
|
+
data: jsonOrMultipartBodyOf(body),
|
|
914
|
+
onUploadProgress,
|
|
899
915
|
headers
|
|
900
916
|
});
|
|
901
917
|
}
|