bruce-models 7.0.3 → 7.0.5

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.
@@ -2755,6 +2755,8 @@ var EntityAttribute;
2755
2755
  EType["Entity"] = "Entity";
2756
2756
  // Url attribute.
2757
2757
  EType["Url"] = "Url";
2758
+ // Serial number that increments for each new entity/missing-attr-value.
2759
+ EType["Serial"] = "Serial";
2758
2760
  })(EType = EntityAttribute.EType || (EntityAttribute.EType = {}));
2759
2761
  /**
2760
2762
  * Describes url open behavior.
@@ -5291,92 +5293,96 @@ var Calculator;
5291
5293
  }
5292
5294
  for (let i = 0; i < value.values.length; i++) {
5293
5295
  const option = value.values[i];
5294
- let mapValue = option.fieldValue;
5295
- // If mapValue is prefixed with "JS:", we evaluate it as JavaScript.
5296
- // This lets us do things like JS:Boolean("${}") as a quick way to map 'existence' to a target value.
5297
- if (typeof mapValue === "string" && mapValue.startsWith("JS:")) {
5298
- try {
5299
- let jsEval = mapValue.replace("JS:", "").trim();
5300
- const attrPathStr = PathUtils.Wrap(attrPath);
5301
- jsEval = jsEval.replace("${}", "${" + attrPathStr + "}");
5302
- jsEval = BruceVariable.SwapValues({
5303
- str: jsEval,
5304
- entity: entity
5305
- });
5306
- // https://rollupjs.org/guide/en/#avoiding-eval
5307
- // This stops eval warning.
5308
- const eval2 = eval;
5309
- mapValue = eval2(jsEval);
5310
- // We currently expect eval to return a validity bool.
5311
- // So it either matches and we return it, or it doesn't and we continue.
5312
- if (mapValue) {
5313
- return option.appliedValue;
5314
- }
5315
- else {
5316
- continue;
5317
- }
5318
- }
5319
- catch (exception) {
5320
- const e = exception;
5321
- let suppress = false;
5322
- if (e && typeof e == "object") {
5323
- const msg = e.message;
5324
- suppress = !!msg && (msg.includes("Unexpected end") || msg.includes("got end of script"));
5325
- }
5326
- if (!suppress) {
5327
- console.error(e);
5328
- }
5329
- // Eval failed, therefor not a valid mapping-row.
5330
- continue;
5331
- }
5332
- }
5333
- let isMapValueNum = !isNaN(+mapValue);
5334
- if (isMapValueNum == null) {
5335
- isMapValueNum = false;
5336
- }
5337
- if (isValueNum && (isMapValueNum || (typeof mapValue === "string" && mapValue.includes("-")))) {
5338
- if (+mapValue == +eValue) {
5339
- return option.appliedValue;
5340
- }
5341
- const mapSplit = mapValue.split("-");
5342
- if (mapSplit.length == 2) {
5343
- const min = mapSplit[0];
5344
- const max = mapSplit[1];
5345
- if (min != "") {
5346
- if (+eValue < +min) {
5347
- continue;
5296
+ const fieldValues = Array.isArray(option.fieldValue) ? option.fieldValue : [option.fieldValue];
5297
+ // Check each field value in the array.
5298
+ for (let j = 0; j < fieldValues.length; j++) {
5299
+ let mapValue = fieldValues[j];
5300
+ // If mapValue is prefixed with "JS:", we evaluate it as JavaScript.
5301
+ // This lets us do things like JS:Boolean("${}") as a quick way to map 'existence' to a target value.
5302
+ if (typeof mapValue === "string" && mapValue.startsWith("JS:")) {
5303
+ try {
5304
+ let jsEval = mapValue.replace("JS:", "").trim();
5305
+ const attrPathStr = PathUtils.Wrap(attrPath);
5306
+ jsEval = jsEval.replace("${}", "${" + attrPathStr + "}");
5307
+ jsEval = BruceVariable.SwapValues({
5308
+ str: jsEval,
5309
+ entity: entity
5310
+ });
5311
+ // https://rollupjs.org/guide/en/#avoiding-eval
5312
+ // This stops eval warning.
5313
+ const eval2 = eval;
5314
+ mapValue = eval2(jsEval);
5315
+ // We currently expect eval to return a validity bool.
5316
+ // So it either matches and we return it, or it doesn't and we continue.
5317
+ if (mapValue) {
5318
+ return option.appliedValue;
5348
5319
  }
5349
- }
5350
- if (max != "") {
5351
- if (+eValue > +max) {
5320
+ else {
5352
5321
  continue;
5353
5322
  }
5354
5323
  }
5355
- if (min == "" && max == "") {
5324
+ catch (exception) {
5325
+ const e = exception;
5326
+ let suppress = false;
5327
+ if (e && typeof e == "object") {
5328
+ const msg = e.message;
5329
+ suppress = !!msg && (msg.includes("Unexpected end") || msg.includes("got end of script"));
5330
+ }
5331
+ if (!suppress) {
5332
+ console.error(e);
5333
+ }
5334
+ // Eval failed, therefor not a valid mapping-row.
5356
5335
  continue;
5357
5336
  }
5358
- return option.appliedValue;
5359
5337
  }
5360
- }
5361
- else {
5362
- if (mapValue == eValue) {
5363
- return option.appliedValue;
5338
+ let isMapValueNum = !isNaN(+mapValue);
5339
+ if (isMapValueNum == null) {
5340
+ isMapValueNum = false;
5364
5341
  }
5365
- // Case where Entity value is a boolean but the mapping value is a string.
5366
- // Common as mapping value is typically a user-entered string.
5367
- else if (typeof eValue === "boolean" && typeof mapValue === "string") {
5368
- const eValueStr = eValue ? "true" : "false";
5369
- if (mapValue.toLowerCase() == eValueStr) {
5342
+ if (isValueNum && (isMapValueNum || (typeof mapValue === "string" && mapValue.includes("-")))) {
5343
+ if (+mapValue == +eValue) {
5344
+ return option.appliedValue;
5345
+ }
5346
+ const mapSplit = mapValue.split("-");
5347
+ if (mapSplit.length == 2) {
5348
+ const min = mapSplit[0];
5349
+ const max = mapSplit[1];
5350
+ if (min != "") {
5351
+ if (+eValue < +min) {
5352
+ continue;
5353
+ }
5354
+ }
5355
+ if (max != "") {
5356
+ if (+eValue > +max) {
5357
+ continue;
5358
+ }
5359
+ }
5360
+ if (min == "" && max == "") {
5361
+ continue;
5362
+ }
5370
5363
  return option.appliedValue;
5371
5364
  }
5372
5365
  }
5373
- // Handling possible case where the opposite is true.
5374
- // Have not seen this happen yet, but preparing for any future cases.
5375
- else if (typeof mapValue === "boolean" && typeof eValue === "string") {
5376
- const mapValueStr = mapValue ? "true" : "false";
5377
- if (mapValueStr == eValue.toLowerCase()) {
5366
+ else {
5367
+ if (mapValue == eValue) {
5378
5368
  return option.appliedValue;
5379
5369
  }
5370
+ // Case where Entity value is a boolean but the mapping value is a string.
5371
+ // Common as mapping value is typically a user-entered string.
5372
+ else if (typeof eValue === "boolean" && typeof mapValue === "string") {
5373
+ const eValueStr = eValue ? "true" : "false";
5374
+ if (mapValue.toLowerCase() == eValueStr) {
5375
+ return option.appliedValue;
5376
+ }
5377
+ }
5378
+ // Handling possible case where the opposite is true.
5379
+ // Have not seen this happen yet, but preparing for any future cases.
5380
+ else if (typeof mapValue === "boolean" && typeof eValue === "string") {
5381
+ const mapValueStr = mapValue ? "true" : "false";
5382
+ if (mapValueStr == eValue.toLowerCase()) {
5383
+ return option.appliedValue;
5384
+ }
5385
+ }
5380
5386
  }
5381
5387
  }
5382
5388
  }
@@ -17015,7 +17021,7 @@ class NavigatorMcpWebSocketClient {
17015
17021
  }
17016
17022
 
17017
17023
  // This is updated with the package.json version on build.
17018
- const VERSION = "7.0.3";
17024
+ const VERSION = "7.0.5";
17019
17025
 
17020
17026
  export { VERSION, Assembly, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, UserMfaMethod, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario, Tracking, NavigatorChatClient, NavigatorMcpWebSocketClient };
17021
17027
  //# sourceMappingURL=bruce-models.es5.js.map