From e4e6c867507cd28f184796fbbd590631edf0b106 Mon Sep 17 00:00:00 2001 From: Aaron Putterman <60486980+abp6318@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:04:39 -0500 Subject: [PATCH] feat: expose item size for content entities (#1720) --- packages/common/src/content/_internal/getPropertyMap.ts | 5 +++++ packages/common/src/core/types/IHubItemEntity.ts | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/packages/common/src/content/_internal/getPropertyMap.ts b/packages/common/src/content/_internal/getPropertyMap.ts index 63a0a0c6f19..26ed21cad0d 100644 --- a/packages/common/src/content/_internal/getPropertyMap.ts +++ b/packages/common/src/content/_internal/getPropertyMap.ts @@ -30,6 +30,11 @@ export function getPropertyMap(): IPropertyMap[] { storeKey: "item.licenseInfo", }); + map.push({ + entityKey: "size", + storeKey: "item.size", + }); + // features is intentionally left out // TODO: look into composeContent() for what we can add here diff --git a/packages/common/src/core/types/IHubItemEntity.ts b/packages/common/src/core/types/IHubItemEntity.ts index 865ac490ac0..2764adda0d9 100644 --- a/packages/common/src/core/types/IHubItemEntity.ts +++ b/packages/common/src/core/types/IHubItemEntity.ts @@ -77,6 +77,13 @@ export interface IHubItemEntity */ schemaVersion: number; + /** + * The size of the item in bytes + * + * Use `formatBytes` util in hub.js for all your formatting needs + */ + size?: number; + /** * User configurable tags */