@3dverse/api 0.11.1 → 0.13.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/README.md +6 -3
- package/dist/_prebuild/wrapper.d.ts +221 -12
- package/dist/index.js +124 -7
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +117 -7
- package/dist/index.mjs.map +2 -2
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -39,6 +39,13 @@ function multipartBody(fields, files) {
|
|
|
39
39
|
}
|
|
40
40
|
return form;
|
|
41
41
|
}
|
|
42
|
+
function jsonOrMultipartBody(fields, files) {
|
|
43
|
+
const hasFile = Object.values(files).some((value) => Array.isArray(value) ? value.length > 0 : value !== void 0);
|
|
44
|
+
if (hasFile) {
|
|
45
|
+
return multipartBody(fields, files);
|
|
46
|
+
}
|
|
47
|
+
return Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== void 0));
|
|
48
|
+
}
|
|
42
49
|
function plainHeaders(headers) {
|
|
43
50
|
return headers instanceof AxiosHeaders ? headers.toJSON() : { ...headers };
|
|
44
51
|
}
|
|
@@ -126,17 +133,17 @@ var UploadAborted = class extends ServiceErrorResponse {
|
|
|
126
133
|
Object.assign(this, serviceError);
|
|
127
134
|
}
|
|
128
135
|
};
|
|
129
|
-
var
|
|
130
|
-
static ERROR_CODE =
|
|
136
|
+
var ImportNotFound = class extends ServiceErrorResponse {
|
|
137
|
+
static ERROR_CODE = 1022;
|
|
131
138
|
constructor(serviceError) {
|
|
132
|
-
super(
|
|
139
|
+
super(1022, 404, "Import not found", serviceError);
|
|
133
140
|
Object.assign(this, serviceError);
|
|
134
141
|
}
|
|
135
142
|
};
|
|
136
|
-
var
|
|
137
|
-
static ERROR_CODE =
|
|
143
|
+
var ConversionNotFound = class extends ServiceErrorResponse {
|
|
144
|
+
static ERROR_CODE = 1023;
|
|
138
145
|
constructor(serviceError) {
|
|
139
|
-
super(
|
|
146
|
+
super(1023, 404, "Conversion not found", serviceError);
|
|
140
147
|
Object.assign(this, serviceError);
|
|
141
148
|
}
|
|
142
149
|
};
|
|
@@ -147,6 +154,20 @@ var LogsUnavailable = class extends ServiceErrorResponse {
|
|
|
147
154
|
Object.assign(this, serviceError);
|
|
148
155
|
}
|
|
149
156
|
};
|
|
157
|
+
var UploadTaskNotFound = class extends ServiceErrorResponse {
|
|
158
|
+
static ERROR_CODE = 1010;
|
|
159
|
+
constructor(serviceError) {
|
|
160
|
+
super(1010, 404, "Upload task not found", serviceError);
|
|
161
|
+
Object.assign(this, serviceError);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
var ConversionTaskNotFound = class extends ServiceErrorResponse {
|
|
165
|
+
static ERROR_CODE = 1015;
|
|
166
|
+
constructor(serviceError) {
|
|
167
|
+
super(1015, 404, "Conversion task not found", serviceError);
|
|
168
|
+
Object.assign(this, serviceError);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
150
171
|
var InvalidGuestToken = class extends ServiceErrorResponse {
|
|
151
172
|
static ERROR_CODE = 1016;
|
|
152
173
|
constructor(serviceError) {
|
|
@@ -194,9 +215,11 @@ var declaredErrors = {
|
|
|
194
215
|
1007: UploadedPayloadTooLarge,
|
|
195
216
|
1008: NoFileUploaded,
|
|
196
217
|
1009: UploadAborted,
|
|
218
|
+
1022: ImportNotFound,
|
|
219
|
+
1023: ConversionNotFound,
|
|
220
|
+
1019: LogsUnavailable,
|
|
197
221
|
1010: UploadTaskNotFound,
|
|
198
222
|
1015: ConversionTaskNotFound,
|
|
199
|
-
1019: LogsUnavailable,
|
|
200
223
|
1016: InvalidGuestToken,
|
|
201
224
|
1005: Unauthorized,
|
|
202
225
|
1011: MissingAuthorizationHeader,
|
|
@@ -728,6 +751,86 @@ function listSourceFileAssets({
|
|
|
728
751
|
headers
|
|
729
752
|
});
|
|
730
753
|
}
|
|
754
|
+
function createImport({
|
|
755
|
+
folder_id,
|
|
756
|
+
files,
|
|
757
|
+
conversion_pipeline = "auto-detect",
|
|
758
|
+
remote_files,
|
|
759
|
+
options
|
|
760
|
+
}, onUploadProgress, headers) {
|
|
761
|
+
return axiosInstance({
|
|
762
|
+
method: "post",
|
|
763
|
+
url: "/imports",
|
|
764
|
+
params: {
|
|
765
|
+
folder_id
|
|
766
|
+
},
|
|
767
|
+
data: jsonOrMultipartBody(
|
|
768
|
+
{
|
|
769
|
+
conversion_pipeline,
|
|
770
|
+
remote_files,
|
|
771
|
+
options
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
files
|
|
775
|
+
}
|
|
776
|
+
),
|
|
777
|
+
onUploadProgress,
|
|
778
|
+
headers
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
function listImports({
|
|
782
|
+
offset = 0,
|
|
783
|
+
limit = 10,
|
|
784
|
+
filters
|
|
785
|
+
}, headers) {
|
|
786
|
+
return axiosInstance({
|
|
787
|
+
method: "get",
|
|
788
|
+
url: "/imports",
|
|
789
|
+
params: {
|
|
790
|
+
offset,
|
|
791
|
+
limit,
|
|
792
|
+
filters
|
|
793
|
+
},
|
|
794
|
+
headers
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
function getImport({
|
|
798
|
+
import_id
|
|
799
|
+
}, headers) {
|
|
800
|
+
return axiosInstance({
|
|
801
|
+
method: "get",
|
|
802
|
+
url: "/imports/" + encodeURIComponent(import_id),
|
|
803
|
+
headers
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
function getConversionLogs({
|
|
807
|
+
conversion_id,
|
|
808
|
+
from,
|
|
809
|
+
to,
|
|
810
|
+
limit
|
|
811
|
+
}, headers) {
|
|
812
|
+
return axiosInstance({
|
|
813
|
+
method: "get",
|
|
814
|
+
url: "/conversions/" + encodeURIComponent(conversion_id) + "/logs",
|
|
815
|
+
params: {
|
|
816
|
+
from,
|
|
817
|
+
to,
|
|
818
|
+
limit
|
|
819
|
+
},
|
|
820
|
+
headers
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
function getConversionMetadata({
|
|
824
|
+
conversion_id,
|
|
825
|
+
filename
|
|
826
|
+
}, headers, responseType) {
|
|
827
|
+
return axiosInstance({
|
|
828
|
+
method: "get",
|
|
829
|
+
url: "/conversions/" + encodeURIComponent(conversion_id) + "/metadata/" + encodeURIComponent(filename),
|
|
830
|
+
headers,
|
|
831
|
+
responseType: responseType || "arraybuffer"
|
|
832
|
+
});
|
|
833
|
+
}
|
|
731
834
|
function listUploadTasks({
|
|
732
835
|
offset = 0,
|
|
733
836
|
limit = 10,
|
|
@@ -1485,7 +1588,9 @@ function shouldRetryRequest(error) {
|
|
|
1485
1588
|
installInterceptors();
|
|
1486
1589
|
export {
|
|
1487
1590
|
ApiError,
|
|
1591
|
+
ConversionNotFound,
|
|
1488
1592
|
ConversionTaskNotFound,
|
|
1593
|
+
ImportNotFound,
|
|
1489
1594
|
InsufficientPermissions,
|
|
1490
1595
|
InsufficientSecurityScope,
|
|
1491
1596
|
InvalidApiKey,
|
|
@@ -1511,6 +1616,7 @@ export {
|
|
|
1511
1616
|
createEntity,
|
|
1512
1617
|
createFolder,
|
|
1513
1618
|
createGroup,
|
|
1619
|
+
createImport,
|
|
1514
1620
|
createSession,
|
|
1515
1621
|
createSubfolder,
|
|
1516
1622
|
deleteAsset,
|
|
@@ -1532,6 +1638,8 @@ export {
|
|
|
1532
1638
|
getAssetPayload,
|
|
1533
1639
|
getAssetThumbnail,
|
|
1534
1640
|
getClient,
|
|
1641
|
+
getConversionLogs,
|
|
1642
|
+
getConversionMetadata,
|
|
1535
1643
|
getConversionTaskLogs,
|
|
1536
1644
|
getConversionTaskMetadata,
|
|
1537
1645
|
getCurrentUser,
|
|
@@ -1539,6 +1647,7 @@ export {
|
|
|
1539
1647
|
getEntity,
|
|
1540
1648
|
getFolder,
|
|
1541
1649
|
getGroup,
|
|
1650
|
+
getImport,
|
|
1542
1651
|
getSceneAABB,
|
|
1543
1652
|
getSceneSettings,
|
|
1544
1653
|
getSession,
|
|
@@ -1561,6 +1670,7 @@ export {
|
|
|
1561
1670
|
listFolderSubfolders,
|
|
1562
1671
|
listFolderUploadTasks,
|
|
1563
1672
|
listFolders,
|
|
1673
|
+
listImports,
|
|
1564
1674
|
listRunningSessions,
|
|
1565
1675
|
listSourceFileAssets,
|
|
1566
1676
|
listSourceFiles,
|