roavatar-renderer 1.5.10 → 1.5.12

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/index.d.ts CHANGED
@@ -341,6 +341,7 @@ export declare const API: {
341
341
  */
342
342
  GetRBX: (url: string, headers?: HeadersInit, contentRepresentationPriorityList?: any) => Promise<Response | RBX>;
343
343
  GetMesh: (url: string, headers?: HeadersInit, readOnly?: boolean) => Promise<FileMesh | Response>;
344
+ GetAssetTypeId: (assetId: string | number) => Promise<number | Response>;
344
345
  IsLayered: (id: number) => Promise<boolean | Response>;
345
346
  };
346
347
  Catalog: {
package/dist/index.js CHANGED
@@ -33750,11 +33750,10 @@ class Outfit {
33750
33750
  assetDetailsRequest.push({ itemType: "Asset", id: assetToAdd.id });
33751
33751
  }
33752
33752
  const assetDetails = await API.Catalog.GetItemDetails(auth, assetDetailsRequest);
33753
- if (assetDetails instanceof Response) {
33754
- return assetDetails;
33755
- }
33756
- for (const assetDetail of assetDetails.data) {
33757
- this.addAsset(assetDetail.id, assetDetail.assetType, assetDetail.name, assetDetail.supportsHeadShapes);
33753
+ if (!(assetDetails instanceof Response)) {
33754
+ for (const assetDetail of assetDetails.data) {
33755
+ this.addAsset(assetDetail.id, assetDetail.assetType, assetDetail.name, assetDetail.supportsHeadShapes);
33756
+ }
33758
33757
  }
33759
33758
  for (const asset of assetsToAdd) {
33760
33759
  const assetId = asset.id;
@@ -33767,6 +33766,23 @@ class Outfit {
33767
33766
  }
33768
33767
  }
33769
33768
  await Promise.all(assetPromises);
33769
+ const assetDeliveryPromises = [];
33770
+ for (const asset of assetsToAdd) {
33771
+ const assetId = asset.id;
33772
+ if (assetId && !this.getAssetId(assetId)) {
33773
+ assetDeliveryPromises.push(new Promise((resolve) => {
33774
+ API.Asset.GetAssetTypeId(assetId).then((assetTypeId) => {
33775
+ if (!(assetTypeId instanceof Response)) {
33776
+ if (Number(assetTypeId) === assetTypeId) {
33777
+ this.addAsset(assetId, assetTypeId, `${AssetTypes[assetTypeId] || "Asset"} (${assetId})`);
33778
+ resolve(void 0);
33779
+ }
33780
+ }
33781
+ });
33782
+ }));
33783
+ }
33784
+ }
33785
+ await Promise.all(assetDeliveryPromises);
33770
33786
  for (const assetToAdd of assetsToAdd) {
33771
33787
  let asset = void 0;
33772
33788
  for (const assetIn of this.assets) {
@@ -36349,6 +36365,14 @@ const API = {
36349
36365
  }
36350
36366
  }
36351
36367
  },
36368
+ GetAssetTypeId: async function(assetId) {
36369
+ const response = await RBLXGet("https://assetdelivery.roblox.com/v2/asset?id=" + assetId);
36370
+ if (response.status !== 200) {
36371
+ return response;
36372
+ }
36373
+ const body = await response.json();
36374
+ return body.assetTypeId;
36375
+ },
36352
36376
  IsLayered: async function(id) {
36353
36377
  const cached = CACHE.IsLayered.get(id);
36354
36378
  if (cached !== void 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roavatar-renderer",
3
- "version": "1.5.10",
3
+ "version": "1.5.12",
4
4
  "description": "A renderer for Roblox avatars, used by the RoAvatar extension.",
5
5
  "author": "steinan",
6
6
  "type": "module",