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.
@@ -4724,24 +4724,34 @@ var PathUtils;
4724
4724
  */
4725
4725
  var Entity;
4726
4726
  (function (Entity) {
4727
- function GetCacheKey(entityId, expandLocation) {
4728
- return `${Api.ECacheKey.Entity}${Api.ECacheKey.Id}${entityId}${String(Boolean(expandLocation))}`;
4727
+ function GetCacheKey(entityId, entityTypeId, expandLocation) {
4728
+ if (!entityTypeId) {
4729
+ entityTypeId = "";
4730
+ }
4731
+ return `${Api.ECacheKey.Entity}${Api.ECacheKey.Id}${entityId}${String(entityTypeId)}${String(Boolean(expandLocation))}`;
4729
4732
  }
4730
4733
  Entity.GetCacheKey = GetCacheKey;
4731
4734
  function Get(params) {
4732
4735
  return __awaiter(this, void 0, void 0, function* () {
4733
- const { api, entityId, req: reqParams, expandLocation } = params;
4736
+ const { api, entityId, req: reqParams, expandLocation, entityTypeId } = params;
4734
4737
  if (!entityId) {
4735
4738
  throw ("Entity ID is required.");
4736
4739
  }
4737
- const key = GetCacheKey(entityId, expandLocation);
4740
+ const key = GetCacheKey(entityId, entityTypeId, expandLocation);
4738
4741
  const cacheData = yield api.GetCacheItem(key, reqParams);
4739
4742
  if (cacheData) {
4740
4743
  return cacheData;
4741
4744
  }
4742
4745
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4743
4746
  try {
4744
- const data = yield api.GET(`entity/${entityId}${expandLocation ? "?$expand=location" : ""}`, Api.PrepReqParams(reqParams));
4747
+ const urlParams = new URLSearchParams();
4748
+ if (expandLocation) {
4749
+ urlParams.append("$expand", "location");
4750
+ }
4751
+ if (entityTypeId) {
4752
+ urlParams.append("BruceEntityType", entityTypeId);
4753
+ }
4754
+ const data = yield api.GET(`entity/${entityId}?${urlParams.toString()}`, Api.PrepReqParams(reqParams));
4745
4755
  res({
4746
4756
  entity: data
4747
4757
  });