@3dverse/api 0.2.4 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -86,20 +86,21 @@ export declare function getUserGroups({ user_id }: {
86
86
  user_id: string;
87
87
  }): AxiosPromise<Array<GetUserGroups_Group_GroupInfo>>;
88
88
  export type GetUserUploadTasks_UploadTask = {
89
- upload_task_id?: string;
90
- folder_id?: string;
91
- uploaded_at?: string;
92
- uploaded_by?: string;
93
- progress?: number;
94
- status?: "waiting" | "pending" | "converting" | "error";
95
- conversion_tasks?: Array<GetUserUploadTasks_ConversionTask>;
89
+ upload_task_id: string;
90
+ folder_id: string;
91
+ uploaded_at: string;
92
+ uploaded_by: string;
93
+ progress: number;
94
+ downloadProgress?: number;
95
+ status: "waiting" | "downloading" | "pending" | "converting" | "error";
96
+ conversion_tasks: Array<GetUserUploadTasks_ConversionTask>;
96
97
  };
97
98
  export type GetUserUploadTasks_ConversionTask = {
98
99
  asset_id?: string;
99
100
  source_file_id?: string;
100
101
  conversion_pipeline?: "auto-detect" | "volume" | "scene" | "texture" | "animation";
101
102
  progress?: number;
102
- status?: "waiting" | "pending" | "converting" | "error";
103
+ status?: "waiting" | "downloading" | "pending" | "converting" | "error";
103
104
  };
104
105
  export declare function getUserUploadTasks({ user_id, offset, limit }: {
105
106
  user_id: string;
@@ -331,20 +332,21 @@ export declare function moveSourceFiles({ folder_id, sourceFileIds }: {
331
332
  sourceFileIds: Array<string>;
332
333
  }): Promise<import("axios").AxiosResponse<any, any>>;
333
334
  export type GetUploadTasksInFolder_UploadTask = {
334
- upload_task_id?: string;
335
- folder_id?: string;
336
- uploaded_at?: string;
337
- uploaded_by?: string;
338
- progress?: number;
339
- status?: "waiting" | "pending" | "converting" | "error";
340
- conversion_tasks?: Array<GetUploadTasksInFolder_ConversionTask>;
335
+ upload_task_id: string;
336
+ folder_id: string;
337
+ uploaded_at: string;
338
+ uploaded_by: string;
339
+ progress: number;
340
+ downloadProgress?: number;
341
+ status: "waiting" | "downloading" | "pending" | "converting" | "error";
342
+ conversion_tasks: Array<GetUploadTasksInFolder_ConversionTask>;
341
343
  };
342
344
  export type GetUploadTasksInFolder_ConversionTask = {
343
345
  asset_id?: string;
344
346
  source_file_id?: string;
345
347
  conversion_pipeline?: "auto-detect" | "volume" | "scene" | "texture" | "animation";
346
348
  progress?: number;
347
- status?: "waiting" | "pending" | "converting" | "error";
349
+ status?: "waiting" | "downloading" | "pending" | "converting" | "error";
348
350
  };
349
351
  export declare function getUploadTasksInFolder({ folder_id, offset, limit }: {
350
352
  folder_id: string;
@@ -483,20 +485,21 @@ export declare function getSourceFileAssets({ source_file_id }: {
483
485
  source_file_id: string;
484
486
  }): AxiosPromise<GetSourceFileAssets_asset_list>;
485
487
  export type GetUploadTask_UploadTask = {
486
- upload_task_id?: string;
487
- folder_id?: string;
488
- uploaded_at?: string;
489
- uploaded_by?: string;
490
- progress?: number;
491
- status?: "waiting" | "pending" | "converting" | "error";
492
- conversion_tasks?: Array<GetUploadTask_ConversionTask>;
488
+ upload_task_id: string;
489
+ folder_id: string;
490
+ uploaded_at: string;
491
+ uploaded_by: string;
492
+ progress: number;
493
+ downloadProgress?: number;
494
+ status: "waiting" | "downloading" | "pending" | "converting" | "error";
495
+ conversion_tasks: Array<GetUploadTask_ConversionTask>;
493
496
  };
494
497
  export type GetUploadTask_ConversionTask = {
495
498
  asset_id?: string;
496
499
  source_file_id?: string;
497
500
  conversion_pipeline?: "auto-detect" | "volume" | "scene" | "texture" | "animation";
498
501
  progress?: number;
499
- status?: "waiting" | "pending" | "converting" | "error";
502
+ status?: "waiting" | "downloading" | "pending" | "converting" | "error";
500
503
  };
501
504
  export declare function getUploadTask({ upload_task_id }: {
502
505
  upload_task_id: string;
@@ -863,12 +866,19 @@ export type GetAssetDescription_VkPipelineColorBlendAttachmentState = {
863
866
  colorWriteMask?: GetAssetDescription_Object;
864
867
  };
865
868
  export type GetAssetDescription_Scene = {
866
- boundingBox?: GetAssetDescription_Object;
867
- entities?: Array<GetAssetDescription_Object>;
868
- triangleCount?: number;
869
+ aabb: GetAssetDescription_Aabb;
870
+ entities: Array<GetAssetDescription_Entity>;
871
+ triangleCount: number;
869
872
  settings?: GetAssetDescription_Object;
870
873
  animationSequenceInstances?: Array<GetAssetDescription_animation_sequence_instance>;
871
874
  };
875
+ export type GetAssetDescription_Aabb = {
876
+ min: Array<number>;
877
+ max: Array<number>;
878
+ };
879
+ export type GetAssetDescription_Entity = {
880
+ entity: GetAssetDescription_Entity;
881
+ };
872
882
  export type GetAssetDescription_animation_sequence_instance = {
873
883
  ref?: string;
874
884
  entities?: Array<string>;
@@ -1190,12 +1200,19 @@ export type UpdateAssetDescription_VkPipelineColorBlendAttachmentState = {
1190
1200
  colorWriteMask?: UpdateAssetDescription_Object;
1191
1201
  };
1192
1202
  export type UpdateAssetDescription_Scene = {
1193
- boundingBox?: UpdateAssetDescription_Object;
1194
- entities?: Array<UpdateAssetDescription_Object>;
1195
- triangleCount?: number;
1203
+ aabb: UpdateAssetDescription_Aabb;
1204
+ entities: Array<UpdateAssetDescription_Entity>;
1205
+ triangleCount: number;
1196
1206
  settings?: UpdateAssetDescription_Object;
1197
1207
  animationSequenceInstances?: Array<UpdateAssetDescription_animation_sequence_instance>;
1198
1208
  };
1209
+ export type UpdateAssetDescription_Aabb = {
1210
+ min: Array<number>;
1211
+ max: Array<number>;
1212
+ };
1213
+ export type UpdateAssetDescription_Entity = {
1214
+ entity: UpdateAssetDescription_Entity;
1215
+ };
1199
1216
  export type UpdateAssetDescription_animation_sequence_instance = {
1200
1217
  ref?: string;
1201
1218
  entities?: Array<string>;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export declare function setApiKey(apiKey: string): void;
2
2
  export declare function setUserToken(userToken: string): void;
3
- export declare function setBaseUrl(url: string): void;
4
3
  declare abstract class ServiceError extends Error {
5
4
  errorCode: number;
6
5
  httpCode: number;
package/dist/index.js CHANGED
@@ -98,7 +98,6 @@ __export(library_exports, {
98
98
  setApiKey: () => setApiKey,
99
99
  setAssetThumbnail: () => setAssetThumbnail,
100
100
  setBaseURL: () => setBaseURL,
101
- setBaseUrl: () => setBaseUrl,
102
101
  setUserToken: () => setUserToken,
103
102
  updateAssetDescription: () => updateAssetDescription,
104
103
  updateEntity: () => updateEntity,
@@ -109,6 +108,7 @@ __export(library_exports, {
109
108
  uploadSourceFiles: () => uploadSourceFiles
110
109
  });
111
110
  module.exports = __toCommonJS(library_exports);
111
+ var import_axios_retry = __toESM(require("axios-retry"));
112
112
 
113
113
  // _prebuild/wrapper.ts
114
114
  var import_axios = __toESM(require("axios"));
@@ -956,9 +956,6 @@ function setUserToken(userToken) {
956
956
  axiosInstance.defaults.headers.common["user_token"] = userToken;
957
957
  delete axiosInstance.defaults.headers.common["api_key"];
958
958
  }
959
- function setBaseUrl(url) {
960
- axiosInstance.defaults.baseURL = url;
961
- }
962
959
  var ServiceError = class extends Error {
963
960
  errorCode;
964
961
  httpCode;
@@ -988,6 +985,11 @@ var UnexpectedServiceError = class extends ServiceError {
988
985
  function installInterceptors() {
989
986
  const CLIENT_ERROR = 400;
990
987
  const INTERNAL_SERVER_ERROR = 500;
988
+ (0, import_axios_retry.default)(axiosInstance, {
989
+ retries: 5,
990
+ retryDelay: import_axios_retry.default.exponentialDelay,
991
+ retryCondition: shouldRetryRequest
992
+ });
991
993
  axiosInstance.interceptors.response.use(
992
994
  (successFulResponse) => {
993
995
  if (successFulResponse.config.responseType === "stream") {
@@ -1005,14 +1007,24 @@ function installInterceptors() {
1005
1007
  if (!errorData && axiosError.request.method === "HEAD" && status >= CLIENT_ERROR && status < INTERNAL_SERVER_ERROR) {
1006
1008
  return axiosError.response;
1007
1009
  }
1008
- if (!errorData || !("error" in errorData)) {
1010
+ if (!errorData || typeof errorData !== "object") {
1009
1011
  return Promise.reject(new UnexpectedServiceError(status, errorData));
1010
1012
  }
1011
- const serviceError = errorData.error;
1013
+ const serviceError = errorData;
1012
1014
  return Promise.reject(new ApiError(serviceError.errorCode, status, serviceError.message, serviceError));
1013
1015
  }
1014
1016
  );
1015
1017
  }
1018
+ function shouldRetryRequest(error) {
1019
+ const status = error.response?.status;
1020
+ switch (status) {
1021
+ case 403:
1022
+ case 404:
1023
+ return true;
1024
+ default:
1025
+ return (0, import_axios_retry.isNetworkError)(error) || (0, import_axios_retry.isIdempotentRequestError)(error);
1026
+ }
1027
+ }
1016
1028
  installInterceptors();
1017
1029
  // Annotate the CommonJS export names for ESM import in node:
1018
1030
  0 && (module.exports = {
@@ -1085,7 +1097,6 @@ installInterceptors();
1085
1097
  setApiKey,
1086
1098
  setAssetThumbnail,
1087
1099
  setBaseURL,
1088
- setBaseUrl,
1089
1100
  setUserToken,
1090
1101
  updateAssetDescription,
1091
1102
  updateEntity,