bruce-models 4.9.8 → 5.0.0

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.
Files changed (71) hide show
  1. package/dist/bruce-models.es5.js +397 -328
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +397 -328
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/account/account-features.js +1 -1
  6. package/dist/lib/account/account-features.js.map +1 -1
  7. package/dist/lib/account/account.js +11 -11
  8. package/dist/lib/account/account.js.map +1 -1
  9. package/dist/lib/ann-document/ann-document.js +4 -4
  10. package/dist/lib/ann-document/ann-document.js.map +1 -1
  11. package/dist/lib/api/abstract-api.js +1 -1
  12. package/dist/lib/api/abstract-api.js.map +1 -1
  13. package/dist/lib/api/api-getters.js +12 -3
  14. package/dist/lib/api/api-getters.js.map +1 -1
  15. package/dist/lib/bruce-models.js +1 -1
  16. package/dist/lib/calculator/calculator.js +223 -172
  17. package/dist/lib/calculator/calculator.js.map +1 -1
  18. package/dist/lib/client-file/client-file.js +2 -2
  19. package/dist/lib/client-file/client-file.js.map +1 -1
  20. package/dist/lib/custom-form/custom-form.js +6 -6
  21. package/dist/lib/custom-form/custom-form.js.map +1 -1
  22. package/dist/lib/data-source/data-source.js +6 -6
  23. package/dist/lib/data-source/data-source.js.map +1 -1
  24. package/dist/lib/entity/entity-attachment-type.js +2 -2
  25. package/dist/lib/entity/entity-attachment-type.js.map +1 -1
  26. package/dist/lib/entity/entity-attachment.js +6 -6
  27. package/dist/lib/entity/entity-attachment.js.map +1 -1
  28. package/dist/lib/entity/entity-comment.js +4 -4
  29. package/dist/lib/entity/entity-comment.js.map +1 -1
  30. package/dist/lib/entity/entity-coords.js +2 -2
  31. package/dist/lib/entity/entity-coords.js.map +1 -1
  32. package/dist/lib/entity/entity-link.js +4 -4
  33. package/dist/lib/entity/entity-link.js.map +1 -1
  34. package/dist/lib/entity/entity-lod-category.js +4 -4
  35. package/dist/lib/entity/entity-lod-category.js.map +1 -1
  36. package/dist/lib/entity/entity-lod.js +6 -6
  37. package/dist/lib/entity/entity-lod.js.map +1 -1
  38. package/dist/lib/entity/entity-relation-type.js +4 -4
  39. package/dist/lib/entity/entity-relation-type.js.map +1 -1
  40. package/dist/lib/entity/entity-relation.js +15 -15
  41. package/dist/lib/entity/entity-relation.js.map +1 -1
  42. package/dist/lib/entity/entity-source.js +2 -2
  43. package/dist/lib/entity/entity-source.js.map +1 -1
  44. package/dist/lib/entity/entity-tag.js +5 -5
  45. package/dist/lib/entity/entity-tag.js.map +1 -1
  46. package/dist/lib/entity/entity-type.js +4 -4
  47. package/dist/lib/entity/entity-type.js.map +1 -1
  48. package/dist/lib/environment.js +1 -1
  49. package/dist/lib/environment.js.map +1 -1
  50. package/dist/lib/import/imported-file.js +6 -6
  51. package/dist/lib/import/imported-file.js.map +1 -1
  52. package/dist/lib/plugin/plugin.js +4 -4
  53. package/dist/lib/plugin/plugin.js.map +1 -1
  54. package/dist/lib/program-key/program-key.js +4 -4
  55. package/dist/lib/program-key/program-key.js.map +1 -1
  56. package/dist/lib/project/project-view-bookmark.js +6 -6
  57. package/dist/lib/project/project-view-bookmark.js.map +1 -1
  58. package/dist/lib/project/project-view.js +4 -4
  59. package/dist/lib/project/project-view.js.map +1 -1
  60. package/dist/lib/style/style.js +4 -4
  61. package/dist/lib/style/style.js.map +1 -1
  62. package/dist/lib/tileset/tileset.js +15 -15
  63. package/dist/lib/tileset/tileset.js.map +1 -1
  64. package/dist/lib/user/session.js +2 -2
  65. package/dist/lib/user/session.js.map +1 -1
  66. package/dist/lib/user/user.js +26 -17
  67. package/dist/lib/user/user.js.map +1 -1
  68. package/dist/types/api/api-getters.d.ts +1 -0
  69. package/dist/types/bruce-models.d.ts +1 -1
  70. package/dist/types/calculator/calculator.d.ts +22 -6
  71. package/package.json +1 -1
@@ -368,7 +368,7 @@ class AbstractApi {
368
368
  if (noCache) {
369
369
  return;
370
370
  }
371
- if (isNaN(duration)) {
371
+ if (isNaN(duration) || duration == null) {
372
372
  duration = Api.DEFAULT_CACHE_DURATION;
373
373
  }
374
374
  this.Cache.Set({
@@ -1399,6 +1399,15 @@ class ApiGetters {
1399
1399
  this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : Api.EEnv.PROD;
1400
1400
  this.sessionId = params === null || params === void 0 ? void 0 : params.sessionId;
1401
1401
  }
1402
+ prepEnv(_env) {
1403
+ if (!_env) {
1404
+ _env = this.env;
1405
+ }
1406
+ if (!_env) {
1407
+ _env = Api.EEnv.PROD;
1408
+ }
1409
+ return _env.toUpperCase();
1410
+ }
1402
1411
  /**
1403
1412
  * Clears all cache items in all API instances.
1404
1413
  */
@@ -1489,7 +1498,7 @@ class ApiGetters {
1489
1498
  }
1490
1499
  let { accountId, env, loadConfig, loadWebSocket } = params;
1491
1500
  accountId = accountId ? accountId : this.accountId;
1492
- env = env ? env : this.env;
1501
+ env = this.prepEnv(env);
1493
1502
  const key = `${accountId}-${env}`;
1494
1503
  if (!this.bruce[key]) {
1495
1504
  this.bruce[key] = new BruceApi.Api({
@@ -1533,7 +1542,7 @@ class ApiGetters {
1533
1542
  params = {};
1534
1543
  }
1535
1544
  let { env } = params;
1536
- env = env ? env : this.env;
1545
+ env = this.prepEnv(env);
1537
1546
  const key = `${env}`;
1538
1547
  if (!this.global[key]) {
1539
1548
  this.global[key] = new GlobalApi.Api({
@@ -1553,7 +1562,7 @@ class ApiGetters {
1553
1562
  params = {};
1554
1563
  }
1555
1564
  let { env } = params;
1556
- env = env ? env : this.env;
1565
+ env = this.prepEnv(env);
1557
1566
  const key = `${env}`;
1558
1567
  if (!this.guardian[key]) {
1559
1568
  this.guardian[key] = new GuardianApi.Api({
@@ -1657,7 +1666,7 @@ var ENVIRONMENT;
1657
1666
  if (!_getters) {
1658
1667
  _getters = new ApiGetters({
1659
1668
  accountId: ENVIRONMENT.PARAMS.accountId,
1660
- env: ENVIRONMENT.PARAMS.env ? ENVIRONMENT.PARAMS.env : Api.EEnv.UAT,
1669
+ env: ENVIRONMENT.PARAMS.env ? ENVIRONMENT.PARAMS.env : Api.EEnv.PROD,
1661
1670
  sessionId: ENVIRONMENT.PARAMS.sessionId
1662
1671
  });
1663
1672
  }
@@ -1719,7 +1728,7 @@ var AnnDocument;
1719
1728
  api = ENVIRONMENT.Api().GetBruceApi();
1720
1729
  }
1721
1730
  const key = GetCacheKey(docId);
1722
- const cache = yield api.GetCacheItem(key, reqParams);
1731
+ const cache = api.GetCacheItem(key, reqParams);
1723
1732
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
1724
1733
  return cache.data;
1725
1734
  }
@@ -1734,7 +1743,7 @@ var AnnDocument;
1734
1743
  rej(e);
1735
1744
  }
1736
1745
  }));
1737
- yield api.SetCacheItem({
1746
+ api.SetCacheItem({
1738
1747
  key,
1739
1748
  value: prom,
1740
1749
  req: reqParams
@@ -1757,7 +1766,7 @@ var AnnDocument;
1757
1766
  if (!type) {
1758
1767
  type = "";
1759
1768
  }
1760
- const cache = yield api.GetCacheItem(GetListCacheKey(type, entityId, expandSettings), reqParams);
1769
+ const cache = api.GetCacheItem(GetListCacheKey(type, entityId, expandSettings), reqParams);
1761
1770
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
1762
1771
  return cache.data;
1763
1772
  }
@@ -1783,7 +1792,7 @@ var AnnDocument;
1783
1792
  rej(e);
1784
1793
  }
1785
1794
  }));
1786
- yield api.SetCacheItem({
1795
+ api.SetCacheItem({
1787
1796
  key: GetListCacheKey(type, entityId, expandSettings),
1788
1797
  value: req,
1789
1798
  req: reqParams
@@ -1861,7 +1870,7 @@ var CustomForm;
1861
1870
  if (!api) {
1862
1871
  api = ENVIRONMENT.Api().GetBruceApi();
1863
1872
  }
1864
- const cache = yield api.GetCacheItem(GetCacheKey(id), reqParams);
1873
+ const cache = api.GetCacheItem(GetCacheKey(id), reqParams);
1865
1874
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
1866
1875
  return cache.data;
1867
1876
  }
@@ -1876,7 +1885,7 @@ var CustomForm;
1876
1885
  rej(err);
1877
1886
  }
1878
1887
  }));
1879
- yield api.SetCacheItem({
1888
+ api.SetCacheItem({
1880
1889
  key: GetCacheKey(id),
1881
1890
  value: prom,
1882
1891
  req: reqParams
@@ -1899,7 +1908,7 @@ var CustomForm;
1899
1908
  api = ENVIRONMENT.Api().GetBruceApi();
1900
1909
  }
1901
1910
  yield api.DELETE(`customForm/${id}`, Api.PrepReqParams(reqParams));
1902
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.CustomForm);
1911
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.CustomForm);
1903
1912
  });
1904
1913
  }
1905
1914
  CustomForm.Delete = Delete;
@@ -1915,7 +1924,7 @@ var CustomForm;
1915
1924
  api = ENVIRONMENT.Api().GetBruceApi();
1916
1925
  }
1917
1926
  const url = typeId ? `entityType/${typeId}/customForms` : "customForms";
1918
- const cache = yield api.GetCacheItem(GetListCacheKey(typeId), reqParams);
1927
+ const cache = api.GetCacheItem(GetListCacheKey(typeId), reqParams);
1919
1928
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
1920
1929
  return cache.data;
1921
1930
  }
@@ -1925,7 +1934,7 @@ var CustomForm;
1925
1934
  forms: data.Items
1926
1935
  };
1927
1936
  });
1928
- yield api.SetCacheItem({
1937
+ api.SetCacheItem({
1929
1938
  key: GetListCacheKey(typeId),
1930
1939
  value: prom,
1931
1940
  req: reqParams
@@ -1949,7 +1958,7 @@ var CustomForm;
1949
1958
  data.ID = 0;
1950
1959
  }
1951
1960
  const res = yield api.POST(`customForm/${data.ID}`, data, Api.PrepReqParams(reqParams));
1952
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.CustomForm);
1961
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.CustomForm);
1953
1962
  return {
1954
1963
  form: res
1955
1964
  };
@@ -2407,7 +2416,7 @@ var EntityType;
2407
2416
  api = ENVIRONMENT.Api().GetBruceApi();
2408
2417
  }
2409
2418
  const key = GetCacheKey(typeId);
2410
- const cache = yield api.GetCacheItem(key, reqParams);
2419
+ const cache = api.GetCacheItem(key, reqParams);
2411
2420
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
2412
2421
  return cache.data;
2413
2422
  }
@@ -2423,7 +2432,7 @@ var EntityType;
2423
2432
  rej(e);
2424
2433
  }
2425
2434
  }));
2426
- yield api.SetCacheItem({
2435
+ api.SetCacheItem({
2427
2436
  key,
2428
2437
  value: prom,
2429
2438
  req: reqParams
@@ -2462,7 +2471,7 @@ var EntityType;
2462
2471
  if (!api) {
2463
2472
  api = ENVIRONMENT.Api().GetBruceApi();
2464
2473
  }
2465
- const cache = yield api.GetCacheItem(GetListCacheKey({
2474
+ const cache = api.GetCacheItem(GetListCacheKey({
2466
2475
  typeIds: entityTypeIds,
2467
2476
  parentTypeId,
2468
2477
  expandSettings,
@@ -2528,7 +2537,7 @@ var EntityType;
2528
2537
  }
2529
2538
  }));
2530
2539
  if (!parentTypeId) {
2531
- yield api.SetCacheItem({
2540
+ api.SetCacheItem({
2532
2541
  key: GetListCacheKey({
2533
2542
  typeIds: entityTypeIds,
2534
2543
  parentTypeId,
@@ -4138,61 +4147,228 @@ var Calculator;
4138
4147
  EValueType[EValueType["RandomColor"] = 5] = "RandomColor";
4139
4148
  })(EValueType = Calculator.EValueType || (Calculator.EValueType = {}));
4140
4149
  /**
4141
- * Calculates the value of arbitrary field options.
4142
- * The context calling this should validate results and parse stuff if needed.
4143
- * @deprecated use specific calls: eg GetColor or GetNumber.
4144
- * @param fields
4145
- * @param entity
4146
- * @param tags
4147
- * @returns
4150
+ * Calculates a value-type 'T' based on given set of fields.
4151
+ * The supplied data + tags are fed into the calculation.
4152
+ * When a value fails to be calculated, the 'defaultValue' is returned.
4153
+ * If no 'defaultValue' is provided, then 'null' is returned.
4148
4154
  */
4149
- function GetValue(fields, entity, tags) {
4150
- if (!(fields === null || fields === void 0 ? void 0 : fields.length)) {
4151
- return null;
4155
+ function Calculate(params) {
4156
+ let { fields, tags, data, defaultValue, type } = params;
4157
+ if (fields == null) {
4158
+ return defaultValue;
4159
+ }
4160
+ if (data == null || typeof data != "object") {
4161
+ data = {};
4152
4162
  }
4153
- if (!tags) {
4163
+ if (tags == null || !Array.isArray(tags)) {
4154
4164
  tags = [];
4155
4165
  }
4156
- if (!entity) {
4157
- entity = {};
4166
+ if (type == null) {
4167
+ type = "any";
4158
4168
  }
4159
- for (let i = 0; i < fields.length; i++) {
4160
- const field = fields[i];
4161
- let value;
4169
+ // Normalize fields to be an array of options.
4170
+ let fieldsArr = [];
4171
+ if (Array.isArray(fields)) {
4172
+ fieldsArr = fields;
4173
+ }
4174
+ else {
4175
+ fieldsArr = [fields];
4176
+ }
4177
+ // Indicator for old data.
4178
+ // When a range is provided in older data, it is expected that invalid/failed mappings should default to the minimum value.
4179
+ // We are deprecating this logic.
4180
+ // The first step of deprecation is to avoid using this logic when multiple calculations are provided.
4181
+ // TODO: When we've reviewed all existing uses, we can remove this logic entirely and just update the needed style records.
4182
+ let shouldRangesDefaultToMin = true;
4183
+ // This reduce totals the number of mappings and gradients.
4184
+ // >1 means we should not default to min as there are multiple calculations.
4185
+ if (fieldsArr.reduce((acc, field) => acc += (field.type == EValueType.Mapping || field.type == EValueType.Gradient) ? 1 : 0, 0) > 1) {
4186
+ shouldRangesDefaultToMin = false;
4187
+ }
4188
+ const assertColor = (color) => {
4189
+ if (color && typeof color == "string") {
4190
+ color = Color.ColorFromStr(color);
4191
+ }
4192
+ if (color && typeof color == "object" && !isNaN(color.red) && color.red != null) {
4193
+ return color;
4194
+ }
4195
+ return null;
4196
+ };
4197
+ const isColor = (value) => {
4198
+ if (value && typeof value == "object" && !isNaN(value.red) && value.red != null) {
4199
+ return true;
4200
+ }
4201
+ return false;
4202
+ };
4203
+ // Calculate the value.
4204
+ let value = null;
4205
+ for (let i = 0; i < fieldsArr.length; i++) {
4206
+ let field = fieldsArr[i];
4207
+ if (field) {
4208
+ // Dereference.
4209
+ // We do this because we'll be modifying the field to fix bad data.
4210
+ field = JSON.parse(JSON.stringify(field));
4211
+ }
4212
+ // Bad data has it set to 'color' but expects the input to be a number.
4213
+ if (type == "number" && field.type == EValueType.Color) {
4214
+ field.type = EValueType.Input;
4215
+ }
4162
4216
  switch (field.type) {
4163
4217
  case EValueType.Color:
4218
+ if (type === "number") {
4219
+ break;
4220
+ }
4164
4221
  value = field.value;
4165
- if (value) {
4166
- value = Color.ColorFromStr(value);
4222
+ value = assertColor(value);
4223
+ if (value && type == "string") {
4224
+ value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
4167
4225
  }
4168
4226
  break;
4169
4227
  case EValueType.Gradient:
4170
- value = GetGradientValue(field.value, entity);
4171
- break;
4172
- case EValueType.Input:
4173
- value = GetInputValue(field.value, entity);
4174
- break;
4175
- case EValueType.Mapping:
4176
- value = GetMappingValue(field.value, entity);
4228
+ if (type === "number") {
4229
+ break;
4230
+ }
4231
+ value = GetGradientValue(field.value, data, shouldRangesDefaultToMin);
4232
+ value = assertColor(value);
4233
+ if (value && type == "string") {
4234
+ value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
4235
+ }
4177
4236
  break;
4178
4237
  case EValueType.RandomColor:
4238
+ if (type === "number") {
4239
+ break;
4240
+ }
4179
4241
  value = Color.RandomColor();
4242
+ value = assertColor(value);
4243
+ if (value && type == "string") {
4244
+ value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
4245
+ }
4180
4246
  break;
4181
4247
  case EValueType.TagColor:
4248
+ if (type === "number") {
4249
+ break;
4250
+ }
4182
4251
  for (let i = 0; i < tags.length; i++) {
4183
4252
  const tag = tags[i];
4184
4253
  if (tag.Color) {
4185
4254
  value = Color.ColorFromStr(tag.Color);
4186
- break;
4255
+ value = assertColor(value);
4256
+ if (value) {
4257
+ break;
4258
+ }
4259
+ }
4260
+ }
4261
+ if (value && type == "string") {
4262
+ const cColor = value;
4263
+ value = `rgba(${cColor.red},${cColor.green},${cColor.blue},${cColor.alpha})`;
4264
+ }
4265
+ break;
4266
+ // Input can be an arbitrary value.
4267
+ // Eg: Result is a colour, a number, a string.
4268
+ // This means we first calculate the value, then validate it in the context of the desired type.
4269
+ case EValueType.Input:
4270
+ value = GetInputValue(field.value, data);
4271
+ if (value != null) {
4272
+ if (type == "number") {
4273
+ if (typeof value == "string" && value != "" && value != null && value != undefined) {
4274
+ value = Number(value);
4275
+ }
4276
+ else if (typeof value != "number") {
4277
+ value = null;
4278
+ }
4279
+ }
4280
+ else if (type == "string") {
4281
+ if (typeof value == "number") {
4282
+ value = String(value);
4283
+ }
4284
+ else if (typeof value == "object") {
4285
+ if (isColor(value)) {
4286
+ value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
4287
+ }
4288
+ else {
4289
+ value = null;
4290
+ }
4291
+ }
4292
+ }
4293
+ else if (type == "color") {
4294
+ value = assertColor(value);
4295
+ }
4296
+ }
4297
+ break;
4298
+ // Mapping can be an arbitrary value.
4299
+ // Eg: mapping a value to a Client File ID, or a colour, or a number.
4300
+ // This means we first calculate the value, then validate it in the context of the desired type.
4301
+ case EValueType.Mapping:
4302
+ value = GetMappingValue(field.value, data);
4303
+ if (value != null) {
4304
+ if (type == "number") {
4305
+ if (typeof value == "string" && value != "" && value != null && value != undefined) {
4306
+ value = Number(value);
4307
+ }
4308
+ else if (typeof value != "number") {
4309
+ value = null;
4310
+ }
4311
+ }
4312
+ else if (type == "string") {
4313
+ if (typeof value == "number") {
4314
+ value = String(value);
4315
+ }
4316
+ else if (typeof value == "object") {
4317
+ if (isColor(value)) {
4318
+ value = `rgba(${value.red},${value.green},${value.blue},${value.alpha})`;
4319
+ }
4320
+ else {
4321
+ value = null;
4322
+ }
4323
+ }
4324
+ }
4325
+ else if (type == "color") {
4326
+ value = assertColor(typeof value === "number" ? String(value) : value);
4187
4327
  }
4188
4328
  }
4189
4329
  break;
4190
4330
  }
4191
- if (value || value == 0) {
4192
- return value;
4331
+ // Extra layer of validation.
4332
+ // This is a backup in case some branch above failed to convert into the right type.
4333
+ if (type == "number") {
4334
+ if (typeof value !== "number" || isNaN(value)) {
4335
+ value = null;
4336
+ }
4337
+ }
4338
+ else if (type == "color") {
4339
+ if (typeof value !== "object" || !value) {
4340
+ value = null;
4341
+ }
4342
+ }
4343
+ else if (type == "string") {
4344
+ if (typeof value !== "string" || !value) {
4345
+ value = null;
4346
+ }
4347
+ }
4348
+ if (value != null) {
4349
+ break;
4193
4350
  }
4194
4351
  }
4195
- return null;
4352
+ // Return the value or default.
4353
+ return value != null ? value : defaultValue;
4354
+ }
4355
+ Calculator.Calculate = Calculate;
4356
+ /**
4357
+ * Calculates the value of arbitrary field options.
4358
+ * The context calling this should validate results and parse stuff if needed.
4359
+ * @param fields
4360
+ * @param entity
4361
+ * @param tags
4362
+ * @returns
4363
+ */
4364
+ function GetValue(fields, entity = {}, tags = []) {
4365
+ return Calculate({
4366
+ fields: fields,
4367
+ data: entity,
4368
+ defaultValue: null,
4369
+ tags: tags,
4370
+ type: "any"
4371
+ });
4196
4372
  }
4197
4373
  Calculator.GetValue = GetValue;
4198
4374
  /**
@@ -4202,53 +4378,14 @@ var Calculator;
4202
4378
  * @param entity
4203
4379
  * @param tags
4204
4380
  */
4205
- function GetColor(fields, entity, tags) {
4206
- if (!(fields === null || fields === void 0 ? void 0 : fields.length)) {
4207
- return null;
4208
- }
4209
- if (!tags) {
4210
- tags = [];
4211
- }
4212
- if (!entity) {
4213
- entity = {};
4214
- }
4215
- for (let i = 0; i < fields.length; i++) {
4216
- const field = fields[i];
4217
- let value;
4218
- switch (field.type) {
4219
- case EValueType.Color:
4220
- value = field.value;
4221
- break;
4222
- case EValueType.Gradient:
4223
- value = GetGradientValue(field.value, entity);
4224
- break;
4225
- case EValueType.Input:
4226
- value = GetInputValue(field.value, entity);
4227
- break;
4228
- case EValueType.Mapping:
4229
- value = GetMappingValue(field.value, entity);
4230
- break;
4231
- case EValueType.RandomColor:
4232
- value = Color.RandomColor();
4233
- break;
4234
- case EValueType.TagColor:
4235
- for (let i = 0; i < tags.length; i++) {
4236
- const tag = tags[i];
4237
- if (tag.Color) {
4238
- value = Color.ColorFromStr(tag.Color);
4239
- break;
4240
- }
4241
- }
4242
- break;
4243
- }
4244
- if (typeof value === "string") {
4245
- value = Color.ColorFromStr(value);
4246
- }
4247
- if (value && typeof value === "object" && (value.red || value.red == 0)) {
4248
- return value;
4249
- }
4250
- }
4251
- return null;
4381
+ function GetColor(fields, entity = {}, tags = []) {
4382
+ return Calculate({
4383
+ fields: fields,
4384
+ data: entity,
4385
+ defaultValue: null,
4386
+ tags: tags,
4387
+ type: "color"
4388
+ });
4252
4389
  }
4253
4390
  Calculator.GetColor = GetColor;
4254
4391
  /**
@@ -4259,39 +4396,14 @@ var Calculator;
4259
4396
  * @param tags
4260
4397
  * @returns
4261
4398
  */
4262
- function GetNumber(fields, entity, tags) {
4263
- if (!(fields === null || fields === void 0 ? void 0 : fields.length)) {
4264
- return null;
4265
- }
4266
- if (!tags) {
4267
- tags = [];
4268
- }
4269
- if (!entity) {
4270
- entity = {};
4271
- }
4272
- for (let i = 0; i < fields.length; i++) {
4273
- const field = fields[i];
4274
- let value;
4275
- switch (field.type) {
4276
- case EValueType.Gradient:
4277
- value = GetGradientValue(field.value, entity);
4278
- break;
4279
- case EValueType.Color:
4280
- case EValueType.Input:
4281
- value = GetInputValue(field.value, entity);
4282
- break;
4283
- case EValueType.Mapping:
4284
- value = GetMappingValue(field.value, entity);
4285
- break;
4286
- }
4287
- if (value != "" && value != null && value != undefined) {
4288
- value = Number(value);
4289
- }
4290
- if (value || value == 0) {
4291
- return value;
4292
- }
4293
- }
4294
- return null;
4399
+ function GetNumber(fields, entity = {}, tags = []) {
4400
+ return Calculate({
4401
+ fields: fields,
4402
+ data: entity,
4403
+ defaultValue: null,
4404
+ tags: tags,
4405
+ type: "number"
4406
+ });
4295
4407
  }
4296
4408
  Calculator.GetNumber = GetNumber;
4297
4409
  /**
@@ -4302,68 +4414,14 @@ var Calculator;
4302
4414
  * @param tags
4303
4415
  * @returns
4304
4416
  */
4305
- function GetString(fields, entity, tags) {
4306
- if (!(fields === null || fields === void 0 ? void 0 : fields.length)) {
4307
- return null;
4308
- }
4309
- if (!tags) {
4310
- tags = [];
4311
- }
4312
- if (!entity) {
4313
- entity = {};
4314
- }
4315
- for (let i = 0; i < fields.length; i++) {
4316
- const field = fields[i];
4317
- let value;
4318
- switch (field.type) {
4319
- case EValueType.Gradient:
4320
- {
4321
- const tmp = GetGradientValue(field.value, entity);
4322
- // This avoids null turning into "null".
4323
- if (tmp) {
4324
- value = String(tmp);
4325
- }
4326
- }
4327
- break;
4328
- case EValueType.Color:
4329
- case EValueType.Input:
4330
- {
4331
- const tmp = GetInputValue(field.value, entity);
4332
- // This avoids null turning into "null".
4333
- if (tmp) {
4334
- value = String(tmp);
4335
- }
4336
- }
4337
- break;
4338
- case EValueType.Mapping:
4339
- {
4340
- const tmp = GetMappingValue(field.value, entity);
4341
- // This avoids null turning into "null".
4342
- if (tmp) {
4343
- value = String(tmp);
4344
- }
4345
- }
4346
- break;
4347
- case EValueType.RandomColor:
4348
- // Would be nice to randomize based on an attribute or entity ID instead of pure random.
4349
- var color = Color.RandomColor();
4350
- value = `rgba(${color.red},${color.green},${color.blue},${color.alpha})`;
4351
- break;
4352
- case EValueType.TagColor:
4353
- for (let i = 0; i < tags.length; i++) {
4354
- const tag = tags[i];
4355
- if (tag.Color) {
4356
- value = tag.Color;
4357
- break;
4358
- }
4359
- }
4360
- break;
4361
- }
4362
- if (value) {
4363
- return value;
4364
- }
4365
- }
4366
- return null;
4417
+ function GetString(fields, entity = {}, tags = []) {
4418
+ return Calculate({
4419
+ fields: fields,
4420
+ data: entity,
4421
+ defaultValue: null,
4422
+ tags: tags,
4423
+ type: "string"
4424
+ });
4367
4425
  }
4368
4426
  Calculator.GetString = GetString;
4369
4427
  /**
@@ -4431,9 +4489,11 @@ var Calculator;
4431
4489
  * It is intended to be parsed and validated within a value-type context. Eg: GetColor, GetNumber, GetString.
4432
4490
  * @param value
4433
4491
  * @param entity
4492
+ * @param defaultToMin if a value fails to be calculated, should we default to the minimum value?
4493
+ * Default is true for backwards compatibility.
4434
4494
  * @returns
4435
4495
  */
4436
- function GetGradientValue(value, entity) {
4496
+ function GetGradientValue(value, entity, defaultToMin) {
4437
4497
  const min = +value.points[0].position;
4438
4498
  const max = +value.points[value.points.length - 1].position;
4439
4499
  const attrPaths = parseLegacyPath(value.field);
@@ -5611,7 +5671,7 @@ var EntityAttachmentType;
5611
5671
  if (!api) {
5612
5672
  api = ENVIRONMENT.Api().GetBruceApi();
5613
5673
  }
5614
- const cache = yield api.GetCacheItem(GetListCacheKey(), reqParams);
5674
+ const cache = api.GetCacheItem(GetListCacheKey(), reqParams);
5615
5675
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
5616
5676
  return cache.data;
5617
5677
  }
@@ -5626,7 +5686,7 @@ var EntityAttachmentType;
5626
5686
  rej(e);
5627
5687
  }
5628
5688
  }));
5629
- yield api.SetCacheItem({
5689
+ api.SetCacheItem({
5630
5690
  key: GetListCacheKey(),
5631
5691
  value: req,
5632
5692
  req: reqParams
@@ -5696,7 +5756,7 @@ var EntityAttachment;
5696
5756
  api.Cache.Remove(GetCacheKey(attachments[i].ID));
5697
5757
  }
5698
5758
  }
5699
- yield api.Cache.Remove(GetListCacheKey(entityId));
5759
+ api.Cache.Remove(GetListCacheKey(entityId));
5700
5760
  return {
5701
5761
  attachments: res.attachments
5702
5762
  };
@@ -5727,7 +5787,7 @@ var EntityAttachment;
5727
5787
  for (let i = 0; i < attachments.length; i++) {
5728
5788
  api.Cache.Remove(GetCacheKey(attachments[i].ID));
5729
5789
  }
5730
- yield api.Cache.RemoveByStartsWith(GetListCacheKey(entityId));
5790
+ api.Cache.RemoveByStartsWith(GetListCacheKey(entityId));
5731
5791
  });
5732
5792
  }
5733
5793
  EntityAttachment.UpdateOrder = UpdateOrder;
@@ -5745,8 +5805,8 @@ var EntityAttachment;
5745
5805
  api = ENVIRONMENT.Api().GetBruceApi();
5746
5806
  }
5747
5807
  yield api.DELETE(`entity/${entityId}/attachments/${attachmentId}`, Api.PrepReqParams(req));
5748
- yield api.Cache.Remove(GetCacheKey(attachmentId));
5749
- yield api.Cache.Remove(GetListCacheKey(params.entityId));
5808
+ api.Cache.Remove(GetCacheKey(attachmentId));
5809
+ api.Cache.Remove(GetListCacheKey(params.entityId));
5750
5810
  });
5751
5811
  }
5752
5812
  EntityAttachment.Delete = Delete;
@@ -5764,7 +5824,7 @@ var EntityAttachment;
5764
5824
  if (!api) {
5765
5825
  api = ENVIRONMENT.Api().GetBruceApi();
5766
5826
  }
5767
- const cache = yield api.GetCacheItem(GetListCacheKey(entityId), reqParams);
5827
+ const cache = api.GetCacheItem(GetListCacheKey(entityId), reqParams);
5768
5828
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
5769
5829
  return cache.data;
5770
5830
  }
@@ -5779,7 +5839,7 @@ var EntityAttachment;
5779
5839
  rej(e);
5780
5840
  }
5781
5841
  }));
5782
- yield api.SetCacheItem({
5842
+ api.SetCacheItem({
5783
5843
  key: GetListCacheKey(entityId),
5784
5844
  value: req,
5785
5845
  req: reqParams
@@ -5868,7 +5928,7 @@ var EntityComment;
5868
5928
  const url = `entity/${data["TargetObject.ID"]}/comment` + (data.ID == null ? "" : "/" + data.ID);
5869
5929
  const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
5870
5930
  api.Cache.Remove(GetCacheKey(data.ID));
5871
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Comment + Api.ECacheKey.Entity);
5931
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Comment + Api.ECacheKey.Entity);
5872
5932
  return {
5873
5933
  comment: res
5874
5934
  };
@@ -5890,7 +5950,7 @@ var EntityComment;
5890
5950
  }
5891
5951
  yield api.DELETE(`entity/${entityId}/comment/${commentId}`, Api.PrepReqParams(reqParams));
5892
5952
  api.Cache.Remove(GetCacheKey(commentId));
5893
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Comment + Api.ECacheKey.Entity);
5953
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Comment + Api.ECacheKey.Entity);
5894
5954
  });
5895
5955
  }
5896
5956
  EntityComment.Delete = Delete;
@@ -5908,7 +5968,7 @@ var EntityComment;
5908
5968
  if (!api) {
5909
5969
  api = ENVIRONMENT.Api().GetBruceApi();
5910
5970
  }
5911
- const cache = yield api.GetCacheItem(GetListCacheKey(entityId), reqParams);
5971
+ const cache = api.GetCacheItem(GetListCacheKey(entityId), reqParams);
5912
5972
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
5913
5973
  return cache.data;
5914
5974
  }
@@ -5923,7 +5983,7 @@ var EntityComment;
5923
5983
  rej(e);
5924
5984
  }
5925
5985
  }));
5926
- yield api.SetCacheItem({
5986
+ api.SetCacheItem({
5927
5987
  key: GetListCacheKey(entityId),
5928
5988
  value: req,
5929
5989
  req: reqParams
@@ -5985,7 +6045,7 @@ var EntityLink;
5985
6045
  const url = `entity/${data["Entity.ID"]}/link` + (data.ID == null ? "" : "/" + data.ID);
5986
6046
  const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
5987
6047
  api.Cache.Remove(GetCacheKey(data.ID));
5988
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Link + Api.ECacheKey.Entity);
6048
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Link + Api.ECacheKey.Entity);
5989
6049
  return {
5990
6050
  link: res
5991
6051
  };
@@ -6007,7 +6067,7 @@ var EntityLink;
6007
6067
  }
6008
6068
  yield api.DELETE(`entity/${entityId}/link/${linkId}`, Api.PrepReqParams(reqParams));
6009
6069
  api.Cache.Remove(GetCacheKey(linkId));
6010
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Link + Api.ECacheKey.Entity);
6070
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Link + Api.ECacheKey.Entity);
6011
6071
  });
6012
6072
  }
6013
6073
  EntityLink.Delete = Delete;
@@ -6025,7 +6085,7 @@ var EntityLink;
6025
6085
  if (!api) {
6026
6086
  api = ENVIRONMENT.Api().GetBruceApi();
6027
6087
  }
6028
- const cache = yield api.GetCacheItem(GetListCacheKey(entityId), reqParams);
6088
+ const cache = api.GetCacheItem(GetListCacheKey(entityId), reqParams);
6029
6089
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
6030
6090
  return cache.data;
6031
6091
  }
@@ -6040,7 +6100,7 @@ var EntityLink;
6040
6100
  rej(e);
6041
6101
  }
6042
6102
  }));
6043
- yield api.SetCacheItem({
6103
+ api.SetCacheItem({
6044
6104
  key: GetListCacheKey(entityId),
6045
6105
  value: req,
6046
6106
  req: reqParams
@@ -6130,7 +6190,7 @@ var EntityLod;
6130
6190
  if (!api) {
6131
6191
  api = ENVIRONMENT.Api().GetBruceApi();
6132
6192
  }
6133
- const cache = yield api.GetCacheItem(GetCacheKey(url), reqParams);
6193
+ const cache = api.GetCacheItem(GetCacheKey(url), reqParams);
6134
6194
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
6135
6195
  return cache.data;
6136
6196
  }
@@ -6145,7 +6205,7 @@ var EntityLod;
6145
6205
  rej(e);
6146
6206
  }
6147
6207
  }));
6148
- yield api.SetCacheItem({
6208
+ api.SetCacheItem({
6149
6209
  key: GetCacheKey(url),
6150
6210
  value: req,
6151
6211
  req: reqParams
@@ -6192,7 +6252,7 @@ var EntityLod;
6192
6252
  if (!entityId) {
6193
6253
  throw ("Entity id is required.");
6194
6254
  }
6195
- const cache = yield api.GetCacheItem(GetEntityListKey(entityId), reqParams);
6255
+ const cache = api.GetCacheItem(GetEntityListKey(entityId), reqParams);
6196
6256
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
6197
6257
  return cache.data;
6198
6258
  }
@@ -6208,7 +6268,7 @@ var EntityLod;
6208
6268
  rej(e);
6209
6269
  }
6210
6270
  }));
6211
- yield api.SetCacheItem({
6271
+ api.SetCacheItem({
6212
6272
  key: GetEntityListKey(entityId),
6213
6273
  value: prom,
6214
6274
  req: reqParams
@@ -6230,7 +6290,7 @@ var EntityLod;
6230
6290
  if (!group) {
6231
6291
  group = "DEFAULT";
6232
6292
  }
6233
- const cache = yield api.GetCacheItem(GetTypeListKey(typeId, group), reqParams);
6293
+ const cache = api.GetCacheItem(GetTypeListKey(typeId, group), reqParams);
6234
6294
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
6235
6295
  return cache.data;
6236
6296
  }
@@ -6247,7 +6307,7 @@ var EntityLod;
6247
6307
  rej(e);
6248
6308
  }
6249
6309
  }));
6250
- yield api.SetCacheItem({
6310
+ api.SetCacheItem({
6251
6311
  key: GetTypeListKey(typeId, group),
6252
6312
  value: prom,
6253
6313
  req: reqParams
@@ -6366,7 +6426,7 @@ var EntityLodCategory;
6366
6426
  if (!api) {
6367
6427
  api = ENVIRONMENT.Api().GetBruceApi();
6368
6428
  }
6369
- const cache = yield api.GetCacheItem(GetListCacheKey(), reqParams);
6429
+ const cache = api.GetCacheItem(GetListCacheKey(), reqParams);
6370
6430
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
6371
6431
  return cache.data;
6372
6432
  }
@@ -6381,7 +6441,7 @@ var EntityLodCategory;
6381
6441
  rej(e);
6382
6442
  }
6383
6443
  }));
6384
- yield api.SetCacheItem({
6444
+ api.SetCacheItem({
6385
6445
  key: GetListCacheKey(),
6386
6446
  value: req,
6387
6447
  req: reqParams
@@ -6404,7 +6464,7 @@ var EntityLodCategory;
6404
6464
  if (!api) {
6405
6465
  api = ENVIRONMENT.Api().GetBruceApi();
6406
6466
  }
6407
- const cache = yield api.GetCacheItem(GetCacheKey(id), reqParams);
6467
+ const cache = api.GetCacheItem(GetCacheKey(id), reqParams);
6408
6468
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
6409
6469
  return cache.data;
6410
6470
  }
@@ -6419,7 +6479,7 @@ var EntityLodCategory;
6419
6479
  rej(e);
6420
6480
  }
6421
6481
  }));
6422
- yield api.SetCacheItem({
6482
+ api.SetCacheItem({
6423
6483
  key: GetCacheKey(id),
6424
6484
  value: req,
6425
6485
  req: reqParams
@@ -6520,7 +6580,7 @@ var EntityRelationType;
6520
6580
  api = ENVIRONMENT.Api().GetBruceApi();
6521
6581
  }
6522
6582
  const key = GetCacheKey(typeId);
6523
- const cache = yield api.GetCacheItem(key, reqParams);
6583
+ const cache = api.GetCacheItem(key, reqParams);
6524
6584
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
6525
6585
  return cache.data;
6526
6586
  }
@@ -6535,7 +6595,7 @@ var EntityRelationType;
6535
6595
  rej(e);
6536
6596
  }
6537
6597
  }));
6538
- yield api.SetCacheItem({
6598
+ api.SetCacheItem({
6539
6599
  key,
6540
6600
  value: prom,
6541
6601
  req: reqParams
@@ -6574,7 +6634,7 @@ var EntityRelationType;
6574
6634
  if (!api) {
6575
6635
  api = ENVIRONMENT.Api().GetBruceApi();
6576
6636
  }
6577
- const cache = yield api.GetCacheItem(GetListCacheKey(), reqParams);
6637
+ const cache = api.GetCacheItem(GetListCacheKey(), reqParams);
6578
6638
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
6579
6639
  return cache.data;
6580
6640
  }
@@ -6589,7 +6649,7 @@ var EntityRelationType;
6589
6649
  rej(e);
6590
6650
  }
6591
6651
  }));
6592
- yield api.SetCacheItem({
6652
+ api.SetCacheItem({
6593
6653
  key: GetListCacheKey(),
6594
6654
  value: req,
6595
6655
  req: reqParams
@@ -6678,11 +6738,11 @@ var EntityRelation;
6678
6738
  };
6679
6739
  const url = `entity/${data["Principal.Entity.ID"]}/relation/${data["Relation.Type.ID"]}/add`;
6680
6740
  yield api.POST(url, reqData, Api.PrepReqParams(reqParams));
6681
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + data["Principal.Entity.ID"]);
6682
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + data["Related.Entity.ID"]);
6683
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.RelationType);
6741
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + data["Principal.Entity.ID"]);
6742
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + data["Related.Entity.ID"]);
6743
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.RelationType);
6684
6744
  if (data["Data.Entity.ID"]) {
6685
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Entity + Api.ECacheKey.Id + data["Data.Entity.ID"]);
6745
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Entity + Api.ECacheKey.Id + data["Data.Entity.ID"]);
6686
6746
  }
6687
6747
  });
6688
6748
  }
@@ -6705,9 +6765,9 @@ var EntityRelation;
6705
6765
  "Related.Entity.ID": [relatedEntityId]
6706
6766
  }, Api.PrepReqParams(reqParams));
6707
6767
  // Remove related cache entries
6708
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + principalEntityId);
6709
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + relatedEntityId);
6710
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.RelationType + Api.ECacheKey.Id + relationTypeId);
6768
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + principalEntityId);
6769
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + relatedEntityId);
6770
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.RelationType + Api.ECacheKey.Id + relationTypeId);
6711
6771
  });
6712
6772
  }
6713
6773
  EntityRelation.Delete = Delete;
@@ -6727,11 +6787,11 @@ var EntityRelation;
6727
6787
  }
6728
6788
  const url = `entity/${data["Principal.Entity.ID"]}/otherEntityID/${data["Related.Entity.ID"]}/relation/${data["Relation.Type.ID"]}/update`;
6729
6789
  const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
6730
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + data["Principal.Entity.ID"]);
6731
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + data["Related.Entity.ID"]);
6732
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.RelationType + Api.ECacheKey.Id + data["Relation.Type.ID"]);
6790
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + data["Principal.Entity.ID"]);
6791
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + data["Related.Entity.ID"]);
6792
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.RelationType + Api.ECacheKey.Id + data["Relation.Type.ID"]);
6733
6793
  if (data["Data.Entity.ID"]) {
6734
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Entity + Api.ECacheKey.Id + data["Data.Entity.ID"]);
6794
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Entity + Api.ECacheKey.Id + data["Data.Entity.ID"]);
6735
6795
  }
6736
6796
  });
6737
6797
  }
@@ -6751,7 +6811,7 @@ var EntityRelation;
6751
6811
  api = ENVIRONMENT.Api().GetBruceApi();
6752
6812
  }
6753
6813
  filter = Object.assign({ relationTypeId: "", oneWayOnly: false, loadEntityData: false }, filter);
6754
- const cache = yield api.GetCacheItem(GetListCacheKey(entityId, filter), reqParams);
6814
+ const cache = api.GetCacheItem(GetListCacheKey(entityId, filter), reqParams);
6755
6815
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
6756
6816
  return cache.data;
6757
6817
  }
@@ -6771,7 +6831,7 @@ var EntityRelation;
6771
6831
  rej(e);
6772
6832
  }
6773
6833
  }));
6774
- yield api.SetCacheItem({
6834
+ api.SetCacheItem({
6775
6835
  key: GetListCacheKey(entityId, filter),
6776
6836
  value: req,
6777
6837
  req: reqParams
@@ -6794,7 +6854,7 @@ var EntityRelation;
6794
6854
  if (!api) {
6795
6855
  api = ENVIRONMENT.Api().GetBruceApi();
6796
6856
  }
6797
- const cache = yield api.GetCacheItem(GetEntityCacheKey(entityId), reqParams);
6857
+ const cache = api.GetCacheItem(GetEntityCacheKey(entityId), reqParams);
6798
6858
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
6799
6859
  return cache.data;
6800
6860
  }
@@ -6809,7 +6869,7 @@ var EntityRelation;
6809
6869
  rej(e);
6810
6870
  }
6811
6871
  }));
6812
- yield api.SetCacheItem({
6872
+ api.SetCacheItem({
6813
6873
  key: GetEntityCacheKey(entityId),
6814
6874
  value: prom,
6815
6875
  req: reqParams
@@ -6923,7 +6983,7 @@ var EntitySource;
6923
6983
  const reqs = [];
6924
6984
  for (let i = 0; i < sourceKeys.length; i++) {
6925
6985
  const sourceKey = sourceKeys[i];
6926
- const cache = yield api.GetCacheItem(GetCacheKey(sourceId, sourceKey), reqParams);
6986
+ const cache = api.GetCacheItem(GetCacheKey(sourceId, sourceKey), reqParams);
6927
6987
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
6928
6988
  reqs.push(cache.data);
6929
6989
  }
@@ -7019,7 +7079,7 @@ var EntitySource;
7019
7079
  }
7020
7080
  const res = yield api.POST("entitysource", source);
7021
7081
  const cacheKey = GetCacheKey(source["Source.ID"], source["SourceRecord.Key"]);
7022
- yield api.Cache.Remove(cacheKey);
7082
+ api.Cache.Remove(cacheKey);
7023
7083
  return {
7024
7084
  source: res
7025
7085
  };
@@ -7142,7 +7202,7 @@ var EntityTag;
7142
7202
  rej(e);
7143
7203
  }
7144
7204
  }));
7145
- yield api.SetCacheItem({
7205
+ api.SetCacheItem({
7146
7206
  key: GetCacheKey(id),
7147
7207
  value: req,
7148
7208
  req: reqParams
@@ -7167,7 +7227,7 @@ var EntityTag;
7167
7227
  if (!api) {
7168
7228
  api = ENVIRONMENT.Api().GetBruceApi();
7169
7229
  }
7170
- const cache = yield api.GetCacheItem(GetListCacheKey(entityTypeId), reqParams);
7230
+ const cache = api.GetCacheItem(GetListCacheKey(entityTypeId), reqParams);
7171
7231
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
7172
7232
  return cache.data;
7173
7233
  }
@@ -7182,7 +7242,7 @@ var EntityTag;
7182
7242
  rej(e);
7183
7243
  }
7184
7244
  }));
7185
- yield api.SetCacheItem({
7245
+ api.SetCacheItem({
7186
7246
  key: GetListCacheKey(entityTypeId),
7187
7247
  value: req,
7188
7248
  req: reqParams
@@ -7206,7 +7266,7 @@ var EntityTag;
7206
7266
  }
7207
7267
  yield api.DELETE(`layer/${tagId}`, Api.PrepReqParams(reqParams));
7208
7268
  api.Cache.Remove(GetCacheKey(tagId));
7209
- yield api.Cache.RemoveByStartsWith(GetListCacheKey());
7269
+ api.Cache.RemoveByStartsWith(GetListCacheKey());
7210
7270
  });
7211
7271
  }
7212
7272
  EntityTag.Delete = Delete;
@@ -7224,7 +7284,7 @@ var EntityTag;
7224
7284
  const url = data.ID ? `layer/${data.ID}` : "layer";
7225
7285
  const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
7226
7286
  api.Cache.Remove(GetCacheKey(data.ID));
7227
- yield api.Cache.RemoveByStartsWith(GetListCacheKey());
7287
+ api.Cache.RemoveByStartsWith(GetListCacheKey());
7228
7288
  return {
7229
7289
  tag: res
7230
7290
  };
@@ -7319,7 +7379,7 @@ var EntityCoords;
7319
7379
  if (!api) {
7320
7380
  api = ENVIRONMENT.Api().GetBruceApi();
7321
7381
  }
7322
- const cache = yield api.GetCacheItem(GetCacheKey(entityId), reqParams);
7382
+ const cache = api.GetCacheItem(GetCacheKey(entityId), reqParams);
7323
7383
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
7324
7384
  return cache.data;
7325
7385
  }
@@ -7334,7 +7394,7 @@ var EntityCoords;
7334
7394
  rej(e);
7335
7395
  }
7336
7396
  }));
7337
- yield api.SetCacheItem({
7397
+ api.SetCacheItem({
7338
7398
  key: GetCacheKey(entityId),
7339
7399
  value: prom,
7340
7400
  req: reqParams
@@ -7640,7 +7700,7 @@ var Style;
7640
7700
  if (!api) {
7641
7701
  api = ENVIRONMENT.Api().GetBruceApi();
7642
7702
  }
7643
- const cache = yield api.GetCacheItem(GetListCacheKey(), reqParams);
7703
+ const cache = api.GetCacheItem(GetListCacheKey(), reqParams);
7644
7704
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
7645
7705
  return cache.data;
7646
7706
  }
@@ -7655,7 +7715,7 @@ var Style;
7655
7715
  rej(e);
7656
7716
  }
7657
7717
  }));
7658
- yield api.SetCacheItem({
7718
+ api.SetCacheItem({
7659
7719
  key: GetListCacheKey(),
7660
7720
  value: res,
7661
7721
  req: reqParams
@@ -7678,7 +7738,7 @@ var Style;
7678
7738
  if (!api) {
7679
7739
  api = ENVIRONMENT.Api().GetBruceApi();
7680
7740
  }
7681
- const cache = yield api.GetCacheItem(GetCacheKey(id), reqParams);
7741
+ const cache = api.GetCacheItem(GetCacheKey(id), reqParams);
7682
7742
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
7683
7743
  return cache.data;
7684
7744
  }
@@ -7693,7 +7753,7 @@ var Style;
7693
7753
  rej(e);
7694
7754
  }
7695
7755
  }));
7696
- yield api.SetCacheItem({
7756
+ api.SetCacheItem({
7697
7757
  key: GetCacheKey(id),
7698
7758
  value: prom,
7699
7759
  req: reqParams
@@ -8386,7 +8446,7 @@ var ClientFile;
8386
8446
  throw ("File ID is required.");
8387
8447
  }
8388
8448
  const key = GetCacheKey(fileId);
8389
- const cache = yield api.GetCacheItem(key, reqParams);
8449
+ const cache = api.GetCacheItem(key, reqParams);
8390
8450
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
8391
8451
  return cache.data;
8392
8452
  }
@@ -8401,7 +8461,7 @@ var ClientFile;
8401
8461
  rej(e);
8402
8462
  }
8403
8463
  }));
8404
- yield api.SetCacheItem({
8464
+ api.SetCacheItem({
8405
8465
  key,
8406
8466
  value: prom,
8407
8467
  req: reqParams
@@ -8912,7 +8972,7 @@ var ProgramKey;
8912
8972
  });
8913
8973
  const key = prom.programKeys.find(k => k.ProgramId === programId);
8914
8974
  // const key = GetCacheKey(programId);
8915
- // const cache = await api.GetCacheItem(key, reqParams);
8975
+ // const cache = api.GetCacheItem(key, reqParams);
8916
8976
  // if (cache?.found) {
8917
8977
  // return cache.data;
8918
8978
  // }
@@ -8927,7 +8987,7 @@ var ProgramKey;
8927
8987
  // rej(e);
8928
8988
  // }
8929
8989
  // });
8930
- // await api.SetCacheItem({
8990
+ // api.SetCacheItem({
8931
8991
  // key,
8932
8992
  // value: prom,
8933
8993
  // req: reqParams
@@ -8949,7 +9009,7 @@ var ProgramKey;
8949
9009
  if (!api) {
8950
9010
  api = ENVIRONMENT.Api().GetBruceApi();
8951
9011
  }
8952
- const cache = yield api.GetCacheItem(GetListCacheKey(), reqParams);
9012
+ const cache = api.GetCacheItem(GetListCacheKey(), reqParams);
8953
9013
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
8954
9014
  return cache.data;
8955
9015
  }
@@ -8964,7 +9024,7 @@ var ProgramKey;
8964
9024
  rej(e);
8965
9025
  }
8966
9026
  }));
8967
- yield api.SetCacheItem({
9027
+ api.SetCacheItem({
8968
9028
  key: GetListCacheKey(),
8969
9029
  value: req,
8970
9030
  req: reqParams
@@ -9199,7 +9259,7 @@ var Tileset;
9199
9259
  if (!api) {
9200
9260
  api = ENVIRONMENT.Api().GetBruceApi();
9201
9261
  }
9202
- const cache = yield api.GetCacheItem(GetCacheKey(tilesetId, loadFiles), reqParams);
9262
+ const cache = api.GetCacheItem(GetCacheKey(tilesetId, loadFiles), reqParams);
9203
9263
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
9204
9264
  return cache.data;
9205
9265
  }
@@ -9219,7 +9279,7 @@ var Tileset;
9219
9279
  rej(e);
9220
9280
  }
9221
9281
  }));
9222
- yield api.SetCacheItem({
9282
+ api.SetCacheItem({
9223
9283
  key: GetCacheKey(tilesetId, loadFiles),
9224
9284
  value: prom,
9225
9285
  req: reqParams
@@ -9275,7 +9335,7 @@ var Tileset;
9275
9335
  if (!api) {
9276
9336
  api = ENVIRONMENT.Api().GetBruceApi();
9277
9337
  }
9278
- const cache = yield api.GetCacheItem(GetListCacheKey({
9338
+ const cache = api.GetCacheItem(GetListCacheKey({
9279
9339
  assertLocation: assertLocation,
9280
9340
  expandSettings: expandSettings,
9281
9341
  type: type
@@ -9315,7 +9375,7 @@ var Tileset;
9315
9375
  rej(e);
9316
9376
  }
9317
9377
  }));
9318
- yield api.SetCacheItem({
9378
+ api.SetCacheItem({
9319
9379
  key: GetListCacheKey({
9320
9380
  assertLocation: assertLocation,
9321
9381
  expandSettings: expandSettings,
@@ -9342,8 +9402,8 @@ var Tileset;
9342
9402
  api = ENVIRONMENT.Api().GetBruceApi();
9343
9403
  }
9344
9404
  yield api.DELETE(`tileset/delete/${tilesetId}`, reqParams);
9345
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Tileset + Api.ECacheKey.Id + tilesetId);
9346
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Tileset);
9405
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Tileset + Api.ECacheKey.Id + tilesetId);
9406
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Tileset);
9347
9407
  });
9348
9408
  }
9349
9409
  Tileset$$1.Delete = Delete;
@@ -9380,8 +9440,8 @@ var Tileset;
9380
9440
  yield api.POST(`tileset/update/${data.id}`, data, Api.PrepReqParams(reqParams));
9381
9441
  }
9382
9442
  }
9383
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Tileset + Api.ECacheKey.Id + data.id);
9384
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Tileset);
9443
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Tileset + Api.ECacheKey.Id + data.id);
9444
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Tileset);
9385
9445
  return {
9386
9446
  tileset: data
9387
9447
  };
@@ -9666,9 +9726,9 @@ var Tileset;
9666
9726
  };
9667
9727
  data.ID = res.ID;
9668
9728
  yield api.POST(`tileset/${data.ID}/enableForAccounts`, req, reqParams);
9669
- yield api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"], data["Tileset.ID"]));
9670
- yield api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"]));
9671
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.PublishTileset + Api.ECacheKey.TilesetAccess);
9729
+ api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"], data["Tileset.ID"]));
9730
+ api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"]));
9731
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.PublishTileset + Api.ECacheKey.TilesetAccess);
9672
9732
  return {
9673
9733
  published: data
9674
9734
  };
@@ -9684,7 +9744,7 @@ var Tileset;
9684
9744
  if (!accountId || !tilesetId) {
9685
9745
  throw ("Client account ID and tileset ID are required.");
9686
9746
  }
9687
- const cache = yield api.GetCacheItem(GetCacheKey(accountId, tilesetId), reqParams);
9747
+ const cache = api.GetCacheItem(GetCacheKey(accountId, tilesetId), reqParams);
9688
9748
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
9689
9749
  return cache.data;
9690
9750
  }
@@ -9699,7 +9759,7 @@ var Tileset;
9699
9759
  rej(e);
9700
9760
  }
9701
9761
  }));
9702
- yield api.SetCacheItem({
9762
+ api.SetCacheItem({
9703
9763
  key: GetCacheKey(accountId, tilesetId),
9704
9764
  value: prom,
9705
9765
  req: reqParams
@@ -9717,7 +9777,7 @@ var Tileset;
9717
9777
  if (!accountId) {
9718
9778
  throw ("Client account ID is required.");
9719
9779
  }
9720
- const cache = yield api.GetCacheItem(GetCacheKey(accountId), reqParams);
9780
+ const cache = api.GetCacheItem(GetCacheKey(accountId), reqParams);
9721
9781
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
9722
9782
  return cache.data;
9723
9783
  }
@@ -9732,7 +9792,7 @@ var Tileset;
9732
9792
  rej(e);
9733
9793
  }
9734
9794
  }));
9735
- yield api.SetCacheItem({
9795
+ api.SetCacheItem({
9736
9796
  key: GetCacheKey(accountId),
9737
9797
  value: req,
9738
9798
  req: reqParams
@@ -10071,7 +10131,7 @@ var ProjectViewBookmark;
10071
10131
  api = ENVIRONMENT.Api().GetBruceApi();
10072
10132
  }
10073
10133
  const key = GetCacheKey(viewId, bookmarkId);
10074
- const cache = yield api.GetCacheItem(key, reqParams);
10134
+ const cache = api.GetCacheItem(key, reqParams);
10075
10135
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
10076
10136
  return cache.data;
10077
10137
  }
@@ -10086,7 +10146,7 @@ var ProjectViewBookmark;
10086
10146
  rej(e);
10087
10147
  }
10088
10148
  }));
10089
- yield api.SetCacheItem({
10149
+ api.SetCacheItem({
10090
10150
  key,
10091
10151
  value: prom,
10092
10152
  req: reqParams
@@ -10128,7 +10188,7 @@ var ProjectViewBookmark;
10128
10188
  if (!api) {
10129
10189
  api = ENVIRONMENT.Api().GetBruceApi();
10130
10190
  }
10131
- const cache = yield api.GetCacheItem(GetListCacheKey(viewId), reqParams);
10191
+ const cache = api.GetCacheItem(GetListCacheKey(viewId), reqParams);
10132
10192
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
10133
10193
  return cache.data;
10134
10194
  }
@@ -10146,7 +10206,7 @@ var ProjectViewBookmark;
10146
10206
  bookmark: item
10147
10207
  });
10148
10208
  });
10149
- yield api.SetCacheItem({
10209
+ api.SetCacheItem({
10150
10210
  key: GetCacheKey(viewId, item.ID),
10151
10211
  value: prom,
10152
10212
  req: reqParams
@@ -10160,7 +10220,7 @@ var ProjectViewBookmark;
10160
10220
  rej(e);
10161
10221
  }
10162
10222
  }));
10163
- yield api.SetCacheItem({
10223
+ api.SetCacheItem({
10164
10224
  key: GetListCacheKey(viewId),
10165
10225
  value: req,
10166
10226
  req: reqParams
@@ -10207,7 +10267,7 @@ var ProjectViewBookmark;
10207
10267
  "DisplayOrder.Start": 0
10208
10268
  };
10209
10269
  yield api.POST(`ui.view/${viewId}/slides/setOrder`, reqData, Api.PrepReqParams(reqParams));
10210
- yield api.Cache.RemoveByStartsWith(GetListCacheKey(viewId));
10270
+ api.Cache.RemoveByStartsWith(GetListCacheKey(viewId));
10211
10271
  });
10212
10272
  }
10213
10273
  ProjectViewBookmark.SetOrder = SetOrder;
@@ -10273,7 +10333,7 @@ var ProjectView;
10273
10333
  api = ENVIRONMENT.Api().GetBruceApi();
10274
10334
  }
10275
10335
  const key = GetCacheKey(viewId);
10276
- const cache = yield api.GetCacheItem(key, reqParams);
10336
+ const cache = api.GetCacheItem(key, reqParams);
10277
10337
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
10278
10338
  return cache.data;
10279
10339
  }
@@ -10288,7 +10348,7 @@ var ProjectView;
10288
10348
  rej(e);
10289
10349
  }
10290
10350
  }));
10291
- yield api.SetCacheItem({
10351
+ api.SetCacheItem({
10292
10352
  key,
10293
10353
  value: prom,
10294
10354
  req: reqParams
@@ -10308,7 +10368,7 @@ var ProjectView;
10308
10368
  if (!api) {
10309
10369
  api = ENVIRONMENT.Api().GetBruceApi();
10310
10370
  }
10311
- const cache = yield api.GetCacheItem(GetListCacheKey(type), reqParams);
10371
+ const cache = api.GetCacheItem(GetListCacheKey(type), reqParams);
10312
10372
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
10313
10373
  return cache.data;
10314
10374
  }
@@ -10323,7 +10383,7 @@ var ProjectView;
10323
10383
  rej(e);
10324
10384
  }
10325
10385
  }));
10326
- yield api.SetCacheItem({
10386
+ api.SetCacheItem({
10327
10387
  key: GetListCacheKey(type),
10328
10388
  value: prom,
10329
10389
  req: reqParams
@@ -10937,7 +10997,7 @@ var Account;
10937
10997
  if (!api) {
10938
10998
  api = ENVIRONMENT.Api().GetGuardianApi();
10939
10999
  }
10940
- const cache = yield api.GetCacheItem(GetCacheKey(id), reqParams);
11000
+ const cache = api.GetCacheItem(GetCacheKey(id), reqParams);
10941
11001
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
10942
11002
  return cache.data;
10943
11003
  }
@@ -10946,7 +11006,7 @@ var Account;
10946
11006
  const data = yield api.GET(`accountbyid/${id}`, reqParams);
10947
11007
  // Update the cache by subdomain as well in case it's different to the ID.
10948
11008
  if ((data === null || data === void 0 ? void 0 : data.ID) && (reqParams === null || reqParams === void 0 ? void 0 : reqParams.noCache) != false) {
10949
- yield api.SetCacheItem({
11009
+ api.SetCacheItem({
10950
11010
  key: data.Subdomain,
10951
11011
  value: prom,
10952
11012
  req: reqParams
@@ -10960,7 +11020,7 @@ var Account;
10960
11020
  rej(e);
10961
11021
  }
10962
11022
  }));
10963
- yield api.SetCacheItem({
11023
+ api.SetCacheItem({
10964
11024
  key: GetCacheKey(id),
10965
11025
  value: prom,
10966
11026
  req: reqParams
@@ -10980,7 +11040,7 @@ var Account;
10980
11040
  if (!api) {
10981
11041
  api = ENVIRONMENT.Api().GetGuardianApi();
10982
11042
  }
10983
- const cache = yield api.GetCacheItem(GetCacheKey(subdomain), reqParams);
11043
+ const cache = api.GetCacheItem(GetCacheKey(subdomain), reqParams);
10984
11044
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
10985
11045
  return cache.data;
10986
11046
  }
@@ -10989,7 +11049,7 @@ var Account;
10989
11049
  const data = yield api.GET(`account/${subdomain}`, reqParams);
10990
11050
  // Update the cache by ID as well in case it's different to the subdomain.
10991
11051
  if ((data === null || data === void 0 ? void 0 : data.ID) && (reqParams === null || reqParams === void 0 ? void 0 : reqParams.noCache) != false) {
10992
- yield api.SetCacheItem({
11052
+ api.SetCacheItem({
10993
11053
  key: data.ID,
10994
11054
  value: prom,
10995
11055
  req: reqParams
@@ -11003,7 +11063,7 @@ var Account;
11003
11063
  rej(e);
11004
11064
  }
11005
11065
  }));
11006
- yield api.SetCacheItem({
11066
+ api.SetCacheItem({
11007
11067
  key: GetCacheKey(subdomain),
11008
11068
  value: prom,
11009
11069
  req: reqParams
@@ -11023,7 +11083,7 @@ var Account;
11023
11083
  if (!api) {
11024
11084
  api = ENVIRONMENT.Api().GetGuardianApi();
11025
11085
  }
11026
- const cache = yield api.GetCacheItem(GetListCacheKey(api.GetSessionId()), reqParams);
11086
+ const cache = api.GetCacheItem(GetListCacheKey(api.GetSessionId()), reqParams);
11027
11087
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
11028
11088
  return cache.data;
11029
11089
  }
@@ -11040,7 +11100,7 @@ var Account;
11040
11100
  rej(e);
11041
11101
  }
11042
11102
  }));
11043
- yield api.SetCacheItem({
11103
+ api.SetCacheItem({
11044
11104
  key: GetListCacheKey(api.GetSessionId()),
11045
11105
  value: prom,
11046
11106
  req: reqParams
@@ -11060,7 +11120,7 @@ var Account;
11060
11120
  if (!api) {
11061
11121
  api = ENVIRONMENT.Api().GetGuardianApi();
11062
11122
  }
11063
- const cache = yield api.GetCacheItem(GetCacheKey(id, appId), reqParams);
11123
+ const cache = api.GetCacheItem(GetCacheKey(id, appId), reqParams);
11064
11124
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
11065
11125
  return cache.data;
11066
11126
  }
@@ -11078,7 +11138,7 @@ var Account;
11078
11138
  rej(e);
11079
11139
  }
11080
11140
  }));
11081
- yield api.SetCacheItem({
11141
+ api.SetCacheItem({
11082
11142
  key: GetCacheKey(id, appId),
11083
11143
  value: prom,
11084
11144
  req: reqParams
@@ -11100,7 +11160,7 @@ var Account;
11100
11160
  api = ENVIRONMENT.Api().GetGuardianApi();
11101
11161
  }
11102
11162
  const res = yield api.POST(`account/${id}/applicationSettings/${appId}`, data, reqParams);
11103
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.Account + Api.ECacheKey.Id + id);
11163
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Account + Api.ECacheKey.Id + id);
11104
11164
  return {
11105
11165
  settings: res
11106
11166
  };
@@ -11441,7 +11501,7 @@ var Session;
11441
11501
  api = ENVIRONMENT.Api().GetGuardianApi();
11442
11502
  }
11443
11503
  const key = GetCacheKey(sessionId);
11444
- const cache = yield api.GetCacheItem(key, reqParams);
11504
+ const cache = api.GetCacheItem(key, reqParams);
11445
11505
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
11446
11506
  return cache.data;
11447
11507
  }
@@ -11456,7 +11516,7 @@ var Session;
11456
11516
  rej(e);
11457
11517
  }
11458
11518
  }));
11459
- yield api.SetCacheItem({
11519
+ api.SetCacheItem({
11460
11520
  key,
11461
11521
  value: prom,
11462
11522
  req: reqParams,
@@ -11846,13 +11906,22 @@ var User;
11846
11906
  if (!api) {
11847
11907
  api = ENVIRONMENT.Api().GetGuardianApi();
11848
11908
  }
11849
- const cache = yield api.GetCacheItem(GetCacheKey(id, accountId), reqParams);
11909
+ const cacheKey = GetCacheKey(id, accountId);
11910
+ const cache = api.GetCacheItem(cacheKey, reqParams);
11850
11911
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
11851
11912
  return cache.data;
11852
11913
  }
11853
11914
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
11854
11915
  try {
11855
- const data = yield api.GET(`user/${id}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
11916
+ const urlParams = new URLSearchParams();
11917
+ if (accountId) {
11918
+ urlParams.append("clientAccountID", accountId);
11919
+ }
11920
+ let url = `user/${id}`;
11921
+ if (urlParams.toString().length) {
11922
+ url += "?" + urlParams.toString();
11923
+ }
11924
+ const data = yield api.GET(url, reqParams);
11856
11925
  res({
11857
11926
  user: data
11858
11927
  });
@@ -11861,8 +11930,8 @@ var User;
11861
11930
  rej(e);
11862
11931
  }
11863
11932
  }));
11864
- yield api.SetCacheItem({
11865
- key: GetCacheKey(id, accountId),
11933
+ api.SetCacheItem({
11934
+ key: cacheKey,
11866
11935
  value: prom,
11867
11936
  req: reqParams
11868
11937
  });
@@ -11901,10 +11970,10 @@ var User;
11901
11970
  const res = yield api.POST(`user/${data.ID}`, data, reqParams);
11902
11971
  api.Cache.RemoveByContains(Api.ECacheKey.User + Api.ECacheKey.Id + data.ID);
11903
11972
  if (data.Type == EType.AccessToken) {
11904
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.AccessToken + Api.ECacheKey.Account);
11973
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.AccessToken + Api.ECacheKey.Account);
11905
11974
  }
11906
11975
  else if (data.Type == EType.User) {
11907
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.User + Api.ECacheKey.Account);
11976
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.User + Api.ECacheKey.Account);
11908
11977
  }
11909
11978
  return {
11910
11979
  user: res
@@ -11926,7 +11995,7 @@ var User;
11926
11995
  if (!api) {
11927
11996
  api = ENVIRONMENT.Api().GetGuardianApi();
11928
11997
  }
11929
- const cache = yield api.GetCacheItem(GetSettingsCacheKey(userId, appId), req);
11998
+ const cache = api.GetCacheItem(GetSettingsCacheKey(userId, appId), req);
11930
11999
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
11931
12000
  return cache.data;
11932
12001
  }
@@ -11952,7 +12021,7 @@ var User;
11952
12021
  rej(e);
11953
12022
  }
11954
12023
  }));
11955
- yield api.SetCacheItem({
12024
+ api.SetCacheItem({
11956
12025
  key: GetSettingsCacheKey(userId, appId),
11957
12026
  value: prom,
11958
12027
  req: req
@@ -12048,7 +12117,7 @@ var User;
12048
12117
  if (!api) {
12049
12118
  api = ENVIRONMENT.Api().GetGuardianApi();
12050
12119
  }
12051
- const cache = yield api.GetCacheItem(GetEmailCacheKey(email, accountId), reqParams);
12120
+ const cache = api.GetCacheItem(GetEmailCacheKey(email, accountId), reqParams);
12052
12121
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
12053
12122
  return cache.data;
12054
12123
  }
@@ -12063,7 +12132,7 @@ var User;
12063
12132
  rej(e);
12064
12133
  }
12065
12134
  }));
12066
- yield api.SetCacheItem({
12135
+ api.SetCacheItem({
12067
12136
  key: GetEmailCacheKey(email, accountId),
12068
12137
  value: prom,
12069
12138
  req: reqParams
@@ -12089,7 +12158,7 @@ var User;
12089
12158
  if (!exclusive) {
12090
12159
  exclusive = false;
12091
12160
  }
12092
- const cache = exclusive ? null : yield api.GetCacheItem(GetListCacheKey(accountId), reqParams);
12161
+ const cache = exclusive ? null : api.GetCacheItem(GetListCacheKey(accountId), reqParams);
12093
12162
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
12094
12163
  return cache.data;
12095
12164
  }
@@ -12107,7 +12176,7 @@ var User;
12107
12176
  req.then((data) => __awaiter(this, void 0, void 0, function* () {
12108
12177
  const users = data.users;
12109
12178
  for (let i = 0; i < users.length; i++) {
12110
- yield api.SetCacheItem({
12179
+ api.SetCacheItem({
12111
12180
  key: GetCacheKey(users[i].ID, accountId),
12112
12181
  value: {
12113
12182
  user: users[i]
@@ -12117,7 +12186,7 @@ var User;
12117
12186
  }
12118
12187
  }));
12119
12188
  if (!exclusive) {
12120
- yield api.SetCacheItem({
12189
+ api.SetCacheItem({
12121
12190
  key: GetListCacheKey(accountId),
12122
12191
  value: req,
12123
12192
  req: reqParams
@@ -12284,7 +12353,7 @@ var User;
12284
12353
  if (!api) {
12285
12354
  api = ENVIRONMENT.Api().GetGuardianApi();
12286
12355
  }
12287
- const cache = yield api.GetCacheItem(GetListCacheKey(accountId), reqParams);
12356
+ const cache = api.GetCacheItem(GetListCacheKey(accountId), reqParams);
12288
12357
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
12289
12358
  return cache.data;
12290
12359
  }
@@ -12299,7 +12368,7 @@ var User;
12299
12368
  rej(e);
12300
12369
  }
12301
12370
  }));
12302
- yield api.SetCacheItem({
12371
+ api.SetCacheItem({
12303
12372
  key: GetListCacheKey(accountId),
12304
12373
  value: req,
12305
12374
  req: reqParams
@@ -12320,7 +12389,7 @@ var User;
12320
12389
  }
12321
12390
  yield api.DELETE(`accessToken/${id}`, reqParams);
12322
12391
  api.Cache.RemoveByContains(Api.ECacheKey.User + Api.ECacheKey.Id + id);
12323
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.AccessToken + Api.ECacheKey.Account);
12392
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.AccessToken + Api.ECacheKey.Account);
12324
12393
  });
12325
12394
  }
12326
12395
  AccessToken.Delete = Delete;
@@ -12345,7 +12414,7 @@ var User;
12345
12414
  data.Type = EType.AccessToken;
12346
12415
  }
12347
12416
  data = yield api.POST("accessToken", data, reqParams);
12348
- yield api.Cache.RemoveByStartsWith(Api.ECacheKey.AccessToken + Api.ECacheKey.Account);
12417
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.AccessToken + Api.ECacheKey.Account);
12349
12418
  return {
12350
12419
  user: data
12351
12420
  };
@@ -12559,7 +12628,7 @@ var AccountFeatures;
12559
12628
  api = ENVIRONMENT.Api().GetBruceApi();
12560
12629
  }
12561
12630
  const accountId = api.AccountId;
12562
- const cache = yield api.GetCacheItem(GetCacheKey(accountId), reqParams);
12631
+ const cache = api.GetCacheItem(GetCacheKey(accountId), reqParams);
12563
12632
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
12564
12633
  return cache.data;
12565
12634
  }
@@ -13597,7 +13666,7 @@ var ImportedFile;
13597
13666
  if (!pageIndex) {
13598
13667
  pageIndex = 0;
13599
13668
  }
13600
- const cache = yield api.GetCacheItem(GetListCacheKey(type, pageIndex), reqParams);
13669
+ const cache = api.GetCacheItem(GetListCacheKey(type, pageIndex), reqParams);
13601
13670
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
13602
13671
  return cache.data;
13603
13672
  }
@@ -13622,7 +13691,7 @@ var ImportedFile;
13622
13691
  rej(e);
13623
13692
  }
13624
13693
  }));
13625
- yield api.SetCacheItem({
13694
+ api.SetCacheItem({
13626
13695
  key: GetListCacheKey(type, pageIndex),
13627
13696
  value: prom,
13628
13697
  req: reqParams
@@ -13642,7 +13711,7 @@ var ImportedFile;
13642
13711
  if (!api) {
13643
13712
  api = ENVIRONMENT.Api().GetBruceApi();
13644
13713
  }
13645
- const cache = yield api.GetCacheItem(GetCacheKeyByRootId(rootId), reqParams);
13714
+ const cache = api.GetCacheItem(GetCacheKeyByRootId(rootId), reqParams);
13646
13715
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
13647
13716
  return cache.data;
13648
13717
  }
@@ -13657,7 +13726,7 @@ var ImportedFile;
13657
13726
  rej(e);
13658
13727
  }
13659
13728
  }));
13660
- yield api.SetCacheItem({
13729
+ api.SetCacheItem({
13661
13730
  key: GetCacheKeyByRootId(rootId),
13662
13731
  value: prom,
13663
13732
  req: reqParams
@@ -13677,7 +13746,7 @@ var ImportedFile;
13677
13746
  if (!api) {
13678
13747
  api = ENVIRONMENT.Api().GetBruceApi();
13679
13748
  }
13680
- const cache = yield api.GetCacheItem(GetCacheKey(fileId), reqParams);
13749
+ const cache = api.GetCacheItem(GetCacheKey(fileId), reqParams);
13681
13750
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
13682
13751
  return cache.data;
13683
13752
  }
@@ -13692,7 +13761,7 @@ var ImportedFile;
13692
13761
  rej(e);
13693
13762
  }
13694
13763
  }));
13695
- yield api.SetCacheItem({
13764
+ api.SetCacheItem({
13696
13765
  key: GetCacheKey(fileId),
13697
13766
  value: prom,
13698
13767
  req: reqParams
@@ -13914,7 +13983,7 @@ var Plugin;
13914
13983
  if (!api) {
13915
13984
  api = ENVIRONMENT.Api().GetBruceApi();
13916
13985
  }
13917
- const cache = yield api.GetCacheItem(GetCacheKey(pluginId), req);
13986
+ const cache = api.GetCacheItem(GetCacheKey(pluginId), req);
13918
13987
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
13919
13988
  return cache.data;
13920
13989
  }
@@ -13929,7 +13998,7 @@ var Plugin;
13929
13998
  rej(e);
13930
13999
  }
13931
14000
  }));
13932
- yield api.SetCacheItem({
14001
+ api.SetCacheItem({
13933
14002
  key: GetCacheKey(pluginId),
13934
14003
  value: prom,
13935
14004
  req: req
@@ -13949,7 +14018,7 @@ var Plugin;
13949
14018
  if (!api) {
13950
14019
  api = ENVIRONMENT.Api().GetBruceApi();
13951
14020
  }
13952
- const cache = yield api.GetCacheItem(GetListCacheKey(), req);
14021
+ const cache = api.GetCacheItem(GetListCacheKey(), req);
13953
14022
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
13954
14023
  return cache.data;
13955
14024
  }
@@ -13964,7 +14033,7 @@ var Plugin;
13964
14033
  rej(e);
13965
14034
  }
13966
14035
  }));
13967
- yield api.SetCacheItem({
14036
+ api.SetCacheItem({
13968
14037
  key: GetListCacheKey(),
13969
14038
  value: prom,
13970
14039
  req: req
@@ -14249,8 +14318,8 @@ var DataSource;
14249
14318
  }
14250
14319
  const url = `source` + (data.ID == null ? "" : "/" + data.ID);
14251
14320
  const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
14252
- yield api.Cache.Remove(GetCacheKey(data.ID));
14253
- yield api.Cache.Remove(GetListCacheKey());
14321
+ api.Cache.Remove(GetCacheKey(data.ID));
14322
+ api.Cache.Remove(GetListCacheKey());
14254
14323
  return {
14255
14324
  source: res
14256
14325
  };
@@ -14268,8 +14337,8 @@ var DataSource;
14268
14337
  api = ENVIRONMENT.Api().GetBruceApi();
14269
14338
  }
14270
14339
  yield api.DELETE(`source/${id}`, Api.PrepReqParams(reqParams));
14271
- yield api.Cache.Remove(GetCacheKey(id));
14272
- yield api.Cache.Remove(GetListCacheKey());
14340
+ api.Cache.Remove(GetCacheKey(id));
14341
+ api.Cache.Remove(GetListCacheKey());
14273
14342
  });
14274
14343
  }
14275
14344
  DataSource.Delete = Delete;
@@ -14285,7 +14354,7 @@ var DataSource;
14285
14354
  api = ENVIRONMENT.Api().GetBruceApi();
14286
14355
  }
14287
14356
  reqParams = Api.PrepReqParams(reqParams);
14288
- const cacheData = yield api.GetCacheItem(GetCacheKey(id), reqParams);
14357
+ const cacheData = api.GetCacheItem(GetCacheKey(id), reqParams);
14289
14358
  if (cacheData === null || cacheData === void 0 ? void 0 : cacheData.found) {
14290
14359
  return cacheData.data;
14291
14360
  }
@@ -14321,7 +14390,7 @@ var DataSource;
14321
14390
  api = ENVIRONMENT.Api().GetBruceApi();
14322
14391
  }
14323
14392
  reqParams = Api.PrepReqParams(reqParams);
14324
- const cacheData = yield api.GetCacheItem(GetListCacheKey(), reqParams);
14393
+ const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
14325
14394
  if (cacheData === null || cacheData === void 0 ? void 0 : cacheData.found) {
14326
14395
  return cacheData.data;
14327
14396
  }
@@ -14399,7 +14468,7 @@ var DataSource;
14399
14468
  })(DataSource || (DataSource = {}));
14400
14469
 
14401
14470
  // This is updated with the package.json version on build.
14402
- const VERSION = "4.9.8";
14471
+ const VERSION = "5.0.0";
14403
14472
 
14404
14473
  export { VERSION, 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, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
14405
14474
  //# sourceMappingURL=bruce-models.es5.js.map