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.
@@ -3000,14 +3000,14 @@ var Entity;
3000
3000
  if (!api) {
3001
3001
  api = ENVIRONMENT.Api().GetBruceApi();
3002
3002
  }
3003
- const reqs = [];
3003
+ const crashRiskReqs = [];
3004
3004
  const reqIds = [];
3005
3005
  for (let i = 0; i < entityIds.length; i++) {
3006
3006
  const entityId = entityIds[i];
3007
3007
  const key = GetCacheKey({ entityId, expandRelations, expandLocation });
3008
3008
  const cache = api.GetCacheItem(key, reqParams);
3009
3009
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
3010
- reqs.push(cache.data);
3010
+ crashRiskReqs.push(cache.data);
3011
3011
  }
3012
3012
  else {
3013
3013
  reqIds.push(entityId);
@@ -3027,6 +3027,7 @@ var Entity;
3027
3027
  else if (expandLocation) {
3028
3028
  reqData["Expand"] = "location";
3029
3029
  }
3030
+ const reqs = [];
3030
3031
  if (reqIds.length > 0) {
3031
3032
  const req = api.POST("entities", reqData, Api.PrepReqParams(reqParams));
3032
3033
  for (let i = 0; i < reqIds.length; i++) {
@@ -3053,8 +3054,22 @@ var Entity;
3053
3054
  reqs.push(prom);
3054
3055
  }
3055
3056
  }
3057
+ const entities = (yield Promise.all(reqs)).map(x => x === null || x === void 0 ? void 0 : x.entity).filter(x => !!x);
3058
+ // We'll try/catch the crash-risk ones and append the results.
3059
+ for (let i = 0; i < crashRiskReqs.length; i++) {
3060
+ const req = crashRiskReqs[i];
3061
+ try {
3062
+ const data = yield req;
3063
+ if (data === null || data === void 0 ? void 0 : data.entity) {
3064
+ entities.push(data.entity);
3065
+ }
3066
+ }
3067
+ catch (e) {
3068
+ // No showing error as we don't want to see it 2000 times.
3069
+ }
3070
+ }
3056
3071
  return {
3057
- entities: (yield Promise.all(reqs)).map(x => x === null || x === void 0 ? void 0 : x.entity).filter(x => !!x)
3072
+ entities: entities
3058
3073
  };
3059
3074
  });
3060
3075
  }
@@ -4013,9 +4028,14 @@ var Calculator;
4013
4028
  str: value,
4014
4029
  entity: entity
4015
4030
  });
4016
- // Check if it includes a math operation.
4031
+ const isJsEval = typeof value == "string" && value.startsWith("JS:");
4017
4032
  const MATH_REGEX = /(\d+\.?\d*|\.\d+)([+\-*/])(\d+\.?\d*|\.\d+)/;
4018
- if (MATH_REGEX.test(value)) {
4033
+ const isMathEval = isJsEval || MATH_REGEX.test(value);
4034
+ if (isJsEval || isMathEval) {
4035
+ if (isJsEval) {
4036
+ value = value.replace("JS:", "");
4037
+ value = value.trim();
4038
+ }
4019
4039
  // https://rollupjs.org/guide/en/#avoiding-eval
4020
4040
  // This stops eval warning.
4021
4041
  const eval2 = eval;
@@ -10872,7 +10892,7 @@ var DataSource;
10872
10892
  })(DataSource || (DataSource = {}));
10873
10893
 
10874
10894
  // This is updated with the package.json version on build.
10875
- const VERSION = "3.5.6";
10895
+ const VERSION = "3.5.8";
10876
10896
 
10877
10897
  export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
10878
10898
  //# sourceMappingURL=bruce-models.es5.js.map