@3dverse/api 0.2.3 → 0.3.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.
@@ -1629,6 +1629,8 @@ export type GetEntity_ShadowCaster = {
1629
1629
  nearDist?: number;
1630
1630
  farDist?: number;
1631
1631
  quality?: number;
1632
+ cascadeSplitLambda?: number;
1633
+ cascadeMaxZ?: number;
1632
1634
  accumulateShadowCascades?: boolean;
1633
1635
  };
1634
1636
  export type GetEntity_entity_components_skeleton_ref = {
@@ -1985,6 +1987,8 @@ export type UpdateEntity_ShadowCaster = {
1985
1987
  nearDist?: number;
1986
1988
  farDist?: number;
1987
1989
  quality?: number;
1990
+ cascadeSplitLambda?: number;
1991
+ cascadeMaxZ?: number;
1988
1992
  accumulateShadowCascades?: boolean;
1989
1993
  };
1990
1994
  export type UpdateEntity_entity_components_skeleton_ref = {
@@ -2058,16 +2062,10 @@ export type UpdateEntity_volume_ref = {
2058
2062
  export type UpdateEntity_VolumeReference = {
2059
2063
  texture3dRef: string;
2060
2064
  };
2061
- export type UpdateEntity_Entity = {
2062
- euid: UpdateEntity_EntityUid;
2063
- };
2064
- export type UpdateEntity_EntityUid = {
2065
- value: string;
2066
- };
2067
- export declare function updateEntity({ scene_id, entity_id, entity }: {
2065
+ export declare function updateEntity({ scene_id, entity_id, entityComponents }: {
2068
2066
  scene_id: string;
2069
2067
  entity_id: string;
2070
- entity: (UpdateEntity_animation_controller | UpdateEntity_bone | UpdateEntity_box_geometry | UpdateEntity_camera | UpdateEntity_capsule_geometry | UpdateEntity_character_controller | UpdateEntity_collision_geometry_ref | UpdateEntity_cylinder_geometry | UpdateEntity_debug_name | UpdateEntity_decal_projector | UpdateEntity_environment | UpdateEntity_joint | UpdateEntity_lineage | UpdateEntity_local_aabb | UpdateEntity_local_transform | UpdateEntity_material | UpdateEntity_material_ref | UpdateEntity_mesh_ref | UpdateEntity_orthographic_lens | UpdateEntity_overrider | UpdateEntity_perspective_lens | UpdateEntity_physics_material | UpdateEntity_plane_geometry | UpdateEntity_point_cloud_ref | UpdateEntity_point_light | UpdateEntity_reflection_probe | UpdateEntity_revolute_joint | UpdateEntity_rigid_body | UpdateEntity_scene_ref | UpdateEntity_script_element | UpdateEntity_script_map | UpdateEntity_shadow_caster | UpdateEntity_entity_components_skeleton_ref | UpdateEntity_sound_ref | UpdateEntity_sphere_geometry | UpdateEntity_spot_light | UpdateEntity_stereoscopic_lens | UpdateEntity_tags | UpdateEntity_volume_filter | UpdateEntity_volume_material_ref | UpdateEntity_volume_ref) & UpdateEntity_Entity;
2068
+ entityComponents: (UpdateEntity_animation_controller | UpdateEntity_bone | UpdateEntity_box_geometry | UpdateEntity_camera | UpdateEntity_capsule_geometry | UpdateEntity_character_controller | UpdateEntity_collision_geometry_ref | UpdateEntity_cylinder_geometry | UpdateEntity_debug_name | UpdateEntity_decal_projector | UpdateEntity_environment | UpdateEntity_joint | UpdateEntity_lineage | UpdateEntity_local_aabb | UpdateEntity_local_transform | UpdateEntity_material | UpdateEntity_material_ref | UpdateEntity_mesh_ref | UpdateEntity_orthographic_lens | UpdateEntity_overrider | UpdateEntity_perspective_lens | UpdateEntity_physics_material | UpdateEntity_plane_geometry | UpdateEntity_point_cloud_ref | UpdateEntity_point_light | UpdateEntity_reflection_probe | UpdateEntity_revolute_joint | UpdateEntity_rigid_body | UpdateEntity_scene_ref | UpdateEntity_script_element | UpdateEntity_script_map | UpdateEntity_shadow_caster | UpdateEntity_entity_components_skeleton_ref | UpdateEntity_sound_ref | UpdateEntity_sphere_geometry | UpdateEntity_spot_light | UpdateEntity_stereoscopic_lens | UpdateEntity_tags | UpdateEntity_volume_filter | UpdateEntity_volume_material_ref | UpdateEntity_volume_ref);
2071
2069
  }): Promise<import("axios").AxiosResponse<any, any>>;
2072
2070
  export declare function deleteEntity({ scene_id, entity_id }: {
2073
2071
  scene_id: 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,
@@ -862,13 +861,13 @@ function getEntity({
862
861
  function updateEntity({
863
862
  scene_id,
864
863
  entity_id,
865
- entity
864
+ entityComponents
866
865
  }) {
867
866
  return axiosInstance({
868
867
  operationId: "updateEntity",
869
868
  method: "patch",
870
869
  url: "/assets/scenes/" + scene_id + "/entities/" + entity_id,
871
- data: entity
870
+ data: entityComponents
872
871
  });
873
872
  }
874
873
  function deleteEntity({
@@ -948,6 +947,7 @@ function generateGuestToken({
948
947
  }
949
948
 
950
949
  // index.ts
950
+ var import_axios_retry = __toESM(require("axios-retry"));
951
951
  function setApiKey(apiKey) {
952
952
  axiosInstance.defaults.headers.common["api_key"] = apiKey;
953
953
  delete axiosInstance.defaults.headers.common["user_token"];
@@ -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,