bruce-models 3.0.1 → 3.0.3

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.
@@ -2023,10 +2023,10 @@
2023
2023
  return `${exports.Api.ECacheKey.Entity}${exports.Api.ECacheKey.Id}${entityId}${String(entityTypeId)}${String(Boolean(expandLocation))}`;
2024
2024
  }
2025
2025
  Entity.GetCacheKey = GetCacheKey;
2026
- function GetStartsWithKey(entityId) {
2026
+ function GetContainsKey(entityId) {
2027
2027
  return `${exports.Api.ECacheKey.Entity}${exports.Api.ECacheKey.Id}${entityId}`;
2028
2028
  }
2029
- Entity.GetStartsWithKey = GetStartsWithKey;
2029
+ Entity.GetContainsKey = GetContainsKey;
2030
2030
  function Get(params) {
2031
2031
  return __awaiter(this, void 0, void 0, function* () {
2032
2032
  let { api, entityId, req: reqParams, expandLocation, entityTypeId } = params;
@@ -2140,7 +2140,7 @@
2140
2140
  throw ("Entity ID is required.");
2141
2141
  }
2142
2142
  yield api.DELETE(`entity/${entityId}`, exports.Api.PrepReqParams(reqParams));
2143
- api.Cache.RemoveByStartsWith(GetStartsWithKey(entityId));
2143
+ api.Cache.RemoveByContains(GetContainsKey(entityId));
2144
2144
  });
2145
2145
  }
2146
2146
  Entity.Delete = Delete;
@@ -2158,7 +2158,7 @@
2158
2158
  }, exports.Api.PrepReqParams(reqParams));
2159
2159
  for (let i = 0; i < entityIds.length; i++) {
2160
2160
  const entityId = entityIds[i];
2161
- api.Cache.RemoveByStartsWith(GetStartsWithKey(entityId));
2161
+ api.Cache.RemoveByContains(GetContainsKey(entityId));
2162
2162
  }
2163
2163
  });
2164
2164
  }
@@ -2178,7 +2178,7 @@
2178
2178
  }
2179
2179
  const reqUrl = `entity/${data.Bruce.ID}/?dataoverride=${override}&BruceEntityType=${data.Bruce["EntityType.ID"]}`;
2180
2180
  const res = yield api.POST(reqUrl, data, exports.Api.PrepReqParams(reqParams));
2181
- api.Cache.RemoveByStartsWith(GetStartsWithKey(data.Bruce.ID));
2181
+ api.Cache.RemoveByContains(GetContainsKey(data.Bruce.ID));
2182
2182
  return {
2183
2183
  entity: res
2184
2184
  };
@@ -2635,16 +2635,35 @@
2635
2635
  let value;
2636
2636
  switch (field.type) {
2637
2637
  case EValueType.Gradient:
2638
- value = String(GetGradientValue(field.value, entity));
2638
+ {
2639
+ const tmp = GetGradientValue(field.value, entity);
2640
+ // This avoids null turning into "null".
2641
+ if (tmp) {
2642
+ value = String(tmp);
2643
+ }
2644
+ }
2639
2645
  break;
2640
2646
  case EValueType.Color:
2641
2647
  case EValueType.Input:
2642
- value = String(GetInputValue(field.value, entity));
2648
+ {
2649
+ const tmp = GetInputValue(field.value, entity);
2650
+ // This avoids null turning into "null".
2651
+ if (tmp) {
2652
+ value = String(tmp);
2653
+ }
2654
+ }
2643
2655
  break;
2644
2656
  case EValueType.Mapping:
2645
- value = String(GetMappingValue(field.value, entity));
2657
+ {
2658
+ const tmp = GetMappingValue(field.value, entity);
2659
+ // This avoids null turning into "null".
2660
+ if (tmp) {
2661
+ value = String(tmp);
2662
+ }
2663
+ }
2646
2664
  break;
2647
2665
  case EValueType.RandomColor:
2666
+ // Would be nice to randomize based on an attribute or entity ID instead of pure random.
2648
2667
  var color = exports.Color.RandomColor();
2649
2668
  value = `rgba(${color.red},${color.green},${color.blue},${color.alpha})`;
2650
2669
  break;
@@ -8874,7 +8893,7 @@
8874
8893
  DataSource.GetList = GetList;
8875
8894
  })(exports.DataSource || (exports.DataSource = {}));
8876
8895
 
8877
- const VERSION = "3.0.1";
8896
+ const VERSION = "3.0.3";
8878
8897
 
8879
8898
  exports.VERSION = VERSION;
8880
8899
  exports.AbstractApi = AbstractApi;