bruce-models 1.9.2 → 1.9.4

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.
@@ -1184,6 +1184,15 @@ var BruceApi;
1184
1184
  })).regions[0];
1185
1185
  if (region === null || region === void 0 ? void 0 : region.CDN) {
1186
1186
  this.EntityCdnUrl = (_b = region.CDN.entityURL) === null || _b === void 0 ? void 0 : _b[env];
1187
+ // We need to fix our configs.
1188
+ if (this.EntityCdnUrl) {
1189
+ if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
1190
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
1191
+ }
1192
+ else {
1193
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
1194
+ }
1195
+ }
1187
1196
  this.LegacyTilesetCdnUrl = (_c = region.CDN.legacyTilesetURL) === null || _c === void 0 ? void 0 : _c[env];
1188
1197
  }
1189
1198
  }
@@ -2058,18 +2067,24 @@ var BruceVariable;
2058
2067
  * Needs to become ["Test", "Test1"].
2059
2068
  * We need to cull this in admin-ui.
2060
2069
  * @param path
2061
- * @returns
2070
+ * @returns Possible paths this legacy one could mean.
2062
2071
  */
2063
2072
  function parseLegacyPath(path) {
2064
2073
  if (!path) {
2065
2074
  return [];
2066
2075
  }
2076
+ const paths = [];
2067
2077
  if (path.startsWith("${") && path.endsWith("}")) {
2068
2078
  path = path.replace("${", "");
2069
2079
  path = path.replace("}", "");
2070
- return PathUtils.ParseLegacy(path);
2071
- }
2072
- return PathUtils.Parse(path);
2080
+ // Split by dots.
2081
+ paths.push(PathUtils.ParseLegacy(path));
2082
+ // Take string as is.
2083
+ paths.push([path]);
2084
+ }
2085
+ // Split by backslashes.
2086
+ paths.push(PathUtils.Parse(path));
2087
+ return paths;
2073
2088
  }
2074
2089
  /**
2075
2090
  * Utility for calculating values from Bruce fields.
@@ -2266,43 +2281,46 @@ var Calculator;
2266
2281
  }
2267
2282
  Calculator.GetString = GetString;
2268
2283
  function GetMappingValue(value, entity) {
2269
- const attrPath = parseLegacyPath(value.field);
2270
- let eValue = Entity.GetValue({
2271
- entity: entity,
2272
- path: attrPath
2273
- });
2274
- const isValueNum = !isNaN(+eValue);
2275
- for (let i = 0; i < value.values.length; i++) {
2276
- const option = value.values[i];
2277
- const mapValue = option.fieldValue;
2278
- const isMapValueNum = !isNaN(+mapValue);
2279
- if (isValueNum && isMapValueNum) {
2280
- if (+mapValue == +eValue) {
2281
- return option.appliedValue;
2282
- }
2283
- const mapSplit = mapValue.split("-");
2284
- if (mapSplit.length == 2) {
2285
- const min = mapSplit[0];
2286
- const max = mapSplit[1];
2287
- if (min != "") {
2288
- if (+eValue < +min) {
2289
- continue;
2290
- }
2284
+ const attrPaths = parseLegacyPath(value.field);
2285
+ for (let i = 0; i < attrPaths.length; i++) {
2286
+ const attrPath = attrPaths[i];
2287
+ let eValue = Entity.GetValue({
2288
+ entity: entity,
2289
+ path: attrPath
2290
+ });
2291
+ const isValueNum = !isNaN(+eValue);
2292
+ for (let i = 0; i < value.values.length; i++) {
2293
+ const option = value.values[i];
2294
+ const mapValue = option.fieldValue;
2295
+ const isMapValueNum = !isNaN(+mapValue);
2296
+ if (isValueNum && isMapValueNum) {
2297
+ if (+mapValue == +eValue) {
2298
+ return option.appliedValue;
2291
2299
  }
2292
- if (max != "") {
2293
- if (+eValue > +max) {
2300
+ const mapSplit = mapValue.split("-");
2301
+ if (mapSplit.length == 2) {
2302
+ const min = mapSplit[0];
2303
+ const max = mapSplit[1];
2304
+ if (min != "") {
2305
+ if (+eValue < +min) {
2306
+ continue;
2307
+ }
2308
+ }
2309
+ if (max != "") {
2310
+ if (+eValue > +max) {
2311
+ continue;
2312
+ }
2313
+ }
2314
+ if (min == "" && max == "") {
2294
2315
  continue;
2295
2316
  }
2317
+ return option.appliedValue;
2296
2318
  }
2297
- if (min == "" && max == "") {
2298
- continue;
2299
- }
2300
- return option.appliedValue;
2301
2319
  }
2302
- }
2303
- else {
2304
- if (mapValue == eValue) {
2305
- return option.appliedValue;
2320
+ else {
2321
+ if (mapValue == eValue) {
2322
+ return option.appliedValue;
2323
+ }
2306
2324
  }
2307
2325
  }
2308
2326
  }
@@ -2310,31 +2328,34 @@ var Calculator;
2310
2328
  }
2311
2329
  Calculator.GetMappingValue = GetMappingValue;
2312
2330
  function GetGradientValue(value, entity) {
2313
- const attrPath = parseLegacyPath(value.field);
2314
- let eValue = Entity.GetValue({
2315
- entity: entity,
2316
- path: attrPath
2317
- });
2318
- eValue = Math.min(Math.max(eValue, value.min), value.max);
2319
- if (eValue < value.points[0].position) {
2320
- return Color.ColorFromStr(value.points[0].color);
2321
- }
2322
- for (let i = 0; i < value.points.length - 1; i++) {
2323
- const pointA = value.points[i];
2324
- const pointB = value.points[i + 1];
2325
- if (eValue >= pointA.position && eValue <= pointB.position) {
2326
- if (pointA.position == pointB.position) {
2327
- return Color.ColorFromStr(pointA.color);
2328
- }
2329
- const distance = (eValue - pointA.position) / (pointB.position - pointA.position);
2330
- const colorA = Color.ColorFromStr(pointA.color);
2331
- const colorB = Color.ColorFromStr(pointB.color);
2332
- return {
2333
- red: colorA.red + (colorB.red - colorA.red) * distance,
2334
- green: colorA.green + (colorB.green - colorA.green) * distance,
2335
- blue: colorA.blue + (colorB.blue - colorA.blue) * distance,
2336
- alpha: colorA.alpha + (colorB.alpha - colorA.alpha) * distance
2337
- };
2331
+ const attrPaths = parseLegacyPath(value.field);
2332
+ for (let i = 0; i < attrPaths.length; i++) {
2333
+ const attrPath = attrPaths[i];
2334
+ let eValue = Entity.GetValue({
2335
+ entity: entity,
2336
+ path: attrPath
2337
+ });
2338
+ eValue = Math.min(Math.max(eValue, value.min), value.max);
2339
+ if (eValue < value.points[0].position) {
2340
+ return Color.ColorFromStr(value.points[0].color);
2341
+ }
2342
+ for (let i = 0; i < value.points.length - 1; i++) {
2343
+ const pointA = value.points[i];
2344
+ const pointB = value.points[i + 1];
2345
+ if (eValue >= pointA.position && eValue <= pointB.position) {
2346
+ if (pointA.position == pointB.position) {
2347
+ return Color.ColorFromStr(pointA.color);
2348
+ }
2349
+ const distance = (eValue - pointA.position) / (pointB.position - pointA.position);
2350
+ const colorA = Color.ColorFromStr(pointA.color);
2351
+ const colorB = Color.ColorFromStr(pointB.color);
2352
+ return {
2353
+ red: colorA.red + (colorB.red - colorA.red) * distance,
2354
+ green: colorA.green + (colorB.green - colorA.green) * distance,
2355
+ blue: colorA.blue + (colorB.blue - colorA.blue) * distance,
2356
+ alpha: colorA.alpha + (colorB.alpha - colorA.alpha) * distance
2357
+ };
2358
+ }
2338
2359
  }
2339
2360
  }
2340
2361
  return Color.ColorFromStr(value.points[value.points.length - 1].color);
@@ -7461,15 +7482,15 @@ var Markup;
7461
7482
  })(Markup || (Markup = {}));
7462
7483
 
7463
7484
  var Plugin;
7464
- (function (Plugin$$1) {
7485
+ (function (Plugin) {
7465
7486
  function GetCacheKey(pluginId) {
7466
7487
  return `${Api.ECacheKey.Plugin}${Api.ECacheKey.Id}${pluginId}`;
7467
7488
  }
7468
- Plugin$$1.GetCacheKey = GetCacheKey;
7489
+ Plugin.GetCacheKey = GetCacheKey;
7469
7490
  function GetListCacheKey() {
7470
7491
  return Api.ECacheKey.Plugin;
7471
7492
  }
7472
- Plugin$$1.GetListCacheKey = GetListCacheKey;
7493
+ Plugin.GetListCacheKey = GetListCacheKey;
7473
7494
  function Get(params) {
7474
7495
  return __awaiter(this, void 0, void 0, function* () {
7475
7496
  const { api, pluginId, req } = params;
@@ -7495,7 +7516,7 @@ var Plugin;
7495
7516
  return prom;
7496
7517
  });
7497
7518
  }
7498
- Plugin$$1.Get = Get;
7519
+ Plugin.Get = Get;
7499
7520
  function GetList(params) {
7500
7521
  return __awaiter(this, void 0, void 0, function* () {
7501
7522
  const { api, req } = params;
@@ -7518,7 +7539,7 @@ var Plugin;
7518
7539
  return prom;
7519
7540
  });
7520
7541
  }
7521
- Plugin$$1.GetList = GetList;
7542
+ Plugin.GetList = GetList;
7522
7543
  function GetLoadUrl(params) {
7523
7544
  let { api, pluginId, req, cacheKey } = params;
7524
7545
  if (!cacheKey) {
@@ -7528,7 +7549,7 @@ var Plugin;
7528
7549
  indexFileUrl: `${api.GetBaseUrl()}ui.plugin/${pluginId}/file/index.jsc?version=${cacheKey}`
7529
7550
  };
7530
7551
  }
7531
- Plugin$$1.GetLoadUrl = GetLoadUrl;
7552
+ Plugin.GetLoadUrl = GetLoadUrl;
7532
7553
  })(Plugin || (Plugin = {}));
7533
7554
 
7534
7555
  export { AnnDocument, CustomForm, CustomFormContent, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, PendingAction, MessageBroker, Style, Tileset, Permission, Session, UserGroup, User, Account, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin };