bruce-models 3.5.6 → 3.5.8

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.
@@ -2947,14 +2947,14 @@
2947
2947
  if (!api) {
2948
2948
  api = exports.ENVIRONMENT.Api().GetBruceApi();
2949
2949
  }
2950
- const reqs = [];
2950
+ const crashRiskReqs = [];
2951
2951
  const reqIds = [];
2952
2952
  for (let i = 0; i < entityIds.length; i++) {
2953
2953
  const entityId = entityIds[i];
2954
2954
  const key = GetCacheKey({ entityId, expandRelations, expandLocation });
2955
2955
  const cache = api.GetCacheItem(key, reqParams);
2956
2956
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
2957
- reqs.push(cache.data);
2957
+ crashRiskReqs.push(cache.data);
2958
2958
  }
2959
2959
  else {
2960
2960
  reqIds.push(entityId);
@@ -2974,6 +2974,7 @@
2974
2974
  else if (expandLocation) {
2975
2975
  reqData["Expand"] = "location";
2976
2976
  }
2977
+ const reqs = [];
2977
2978
  if (reqIds.length > 0) {
2978
2979
  const req = api.POST("entities", reqData, exports.Api.PrepReqParams(reqParams));
2979
2980
  for (let i = 0; i < reqIds.length; i++) {
@@ -3000,8 +3001,22 @@
3000
3001
  reqs.push(prom);
3001
3002
  }
3002
3003
  }
3004
+ const entities = (yield Promise.all(reqs)).map(x => x === null || x === void 0 ? void 0 : x.entity).filter(x => !!x);
3005
+ // We'll try/catch the crash-risk ones and append the results.
3006
+ for (let i = 0; i < crashRiskReqs.length; i++) {
3007
+ const req = crashRiskReqs[i];
3008
+ try {
3009
+ const data = yield req;
3010
+ if (data === null || data === void 0 ? void 0 : data.entity) {
3011
+ entities.push(data.entity);
3012
+ }
3013
+ }
3014
+ catch (e) {
3015
+ // No showing error as we don't want to see it 2000 times.
3016
+ }
3017
+ }
3003
3018
  return {
3004
- entities: (yield Promise.all(reqs)).map(x => x === null || x === void 0 ? void 0 : x.entity).filter(x => !!x)
3019
+ entities: entities
3005
3020
  };
3006
3021
  });
3007
3022
  }
@@ -3948,9 +3963,14 @@
3948
3963
  str: value,
3949
3964
  entity: entity
3950
3965
  });
3951
- // Check if it includes a math operation.
3966
+ const isJsEval = typeof value == "string" && value.startsWith("JS:");
3952
3967
  const MATH_REGEX = /(\d+\.?\d*|\.\d+)([+\-*/])(\d+\.?\d*|\.\d+)/;
3953
- if (MATH_REGEX.test(value)) {
3968
+ const isMathEval = isJsEval || MATH_REGEX.test(value);
3969
+ if (isJsEval || isMathEval) {
3970
+ if (isJsEval) {
3971
+ value = value.replace("JS:", "");
3972
+ value = value.trim();
3973
+ }
3954
3974
  // https://rollupjs.org/guide/en/#avoiding-eval
3955
3975
  // This stops eval warning.
3956
3976
  const eval2 = eval;
@@ -10619,7 +10639,7 @@
10619
10639
  })(exports.DataSource || (exports.DataSource = {}));
10620
10640
 
10621
10641
  // This is updated with the package.json version on build.
10622
- const VERSION = "3.5.6";
10642
+ const VERSION = "3.5.8";
10623
10643
 
10624
10644
  exports.VERSION = VERSION;
10625
10645
  exports.AbstractApi = AbstractApi;