bruce-models 2.0.9 → 2.1.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.
@@ -4695,24 +4695,34 @@
4695
4695
  })(exports.PathUtils || (exports.PathUtils = {}));
4696
4696
 
4697
4697
  (function (Entity) {
4698
- function GetCacheKey(entityId, expandLocation) {
4699
- return `${exports.Api.ECacheKey.Entity}${exports.Api.ECacheKey.Id}${entityId}${String(Boolean(expandLocation))}`;
4698
+ function GetCacheKey(entityId, entityTypeId, expandLocation) {
4699
+ if (!entityTypeId) {
4700
+ entityTypeId = "";
4701
+ }
4702
+ return `${exports.Api.ECacheKey.Entity}${exports.Api.ECacheKey.Id}${entityId}${String(entityTypeId)}${String(Boolean(expandLocation))}`;
4700
4703
  }
4701
4704
  Entity.GetCacheKey = GetCacheKey;
4702
4705
  function Get(params) {
4703
4706
  return __awaiter(this, void 0, void 0, function* () {
4704
- const { api, entityId, req: reqParams, expandLocation } = params;
4707
+ const { api, entityId, req: reqParams, expandLocation, entityTypeId } = params;
4705
4708
  if (!entityId) {
4706
4709
  throw ("Entity ID is required.");
4707
4710
  }
4708
- const key = GetCacheKey(entityId, expandLocation);
4711
+ const key = GetCacheKey(entityId, entityTypeId, expandLocation);
4709
4712
  const cacheData = yield api.GetCacheItem(key, reqParams);
4710
4713
  if (cacheData) {
4711
4714
  return cacheData;
4712
4715
  }
4713
4716
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4714
4717
  try {
4715
- const data = yield api.GET(`entity/${entityId}${expandLocation ? "?$expand=location" : ""}`, exports.Api.PrepReqParams(reqParams));
4718
+ const urlParams = new URLSearchParams();
4719
+ if (expandLocation) {
4720
+ urlParams.append("$expand", "location");
4721
+ }
4722
+ if (entityTypeId) {
4723
+ urlParams.append("BruceEntityType", entityTypeId);
4724
+ }
4725
+ const data = yield api.GET(`entity/${entityId}?${urlParams.toString()}`, exports.Api.PrepReqParams(reqParams));
4716
4726
  res({
4717
4727
  entity: data
4718
4728
  });