bruce-models 5.9.6 → 5.9.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.
- package/dist/bruce-models.es5.js +160 -104
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +160 -104
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/calculator/calculator.js +25 -13
- package/dist/lib/calculator/calculator.js.map +1 -1
- package/dist/lib/common/bruce-event.js +8 -3
- package/dist/lib/common/bruce-event.js.map +1 -1
- package/dist/lib/common/bruce-variable.js +31 -38
- package/dist/lib/common/bruce-variable.js.map +1 -1
- package/dist/lib/common/cache.js +2 -3
- package/dist/lib/common/cache.js.map +1 -1
- package/dist/lib/common/delay-queue.js +6 -2
- package/dist/lib/common/delay-queue.js.map +1 -1
- package/dist/lib/common/geometry.js +17 -13
- package/dist/lib/common/geometry.js.map +1 -1
- package/dist/lib/common/lru-cache.js +7 -1
- package/dist/lib/common/lru-cache.js.map +1 -1
- package/dist/lib/common/utc.js +15 -7
- package/dist/lib/common/utc.js.map +1 -1
- package/dist/lib/entity/entity-attribute.js +4 -1
- package/dist/lib/entity/entity-attribute.js.map +1 -1
- package/dist/lib/entity/entity.js +33 -5
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/lib/util/math-utils.js +7 -7
- package/dist/lib/util/math-utils.js.map +1 -1
- package/dist/lib/util/path-utils.js +6 -5
- package/dist/lib/util/path-utils.js.map +1 -1
- package/dist/types/api/api.d.ts +2 -2
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/calculator/calculator.d.ts +1 -1
- package/dist/types/common/bruce-variable.d.ts +1 -0
- package/dist/types/common/delay-queue.d.ts +2 -1
- package/dist/types/entity/entity.d.ts +32 -29
- package/dist/types/util/math-utils.d.ts +1 -1
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -150,8 +150,6 @@ var Api;
|
|
|
150
150
|
Api.PrepReqParams = PrepReqParams;
|
|
151
151
|
})(Api || (Api = {}));
|
|
152
152
|
|
|
153
|
-
// 1 minute.
|
|
154
|
-
const DEFAULT_DURATION = 60 * 1000;
|
|
155
153
|
class CacheControl {
|
|
156
154
|
constructor(id) {
|
|
157
155
|
this.memory = new Map();
|
|
@@ -172,7 +170,7 @@ class CacheControl {
|
|
|
172
170
|
}
|
|
173
171
|
let { id, data, duration } = params;
|
|
174
172
|
if (!duration || duration < 0) {
|
|
175
|
-
duration =
|
|
173
|
+
duration = Api.DEFAULT_CACHE_DURATION;
|
|
176
174
|
}
|
|
177
175
|
id = String(id);
|
|
178
176
|
const expires = Date.now() + duration;
|
|
@@ -1653,6 +1651,10 @@ class BruceEvent {
|
|
|
1653
1651
|
Unsubscribe(id) {
|
|
1654
1652
|
let index = this.callbacks.findIndex(x => x._id == id);
|
|
1655
1653
|
if (index > -1) {
|
|
1654
|
+
// Null the callback function to prevent it from being called.
|
|
1655
|
+
// This stops a trigger from calling it if it's currently looping.
|
|
1656
|
+
this.callbacks[index].callback = null;
|
|
1657
|
+
// Remove the callback from the list.
|
|
1656
1658
|
this.callbacks.splice(index, 1);
|
|
1657
1659
|
}
|
|
1658
1660
|
}
|
|
@@ -1662,9 +1664,10 @@ class BruceEvent {
|
|
|
1662
1664
|
* @param data
|
|
1663
1665
|
*/
|
|
1664
1666
|
Trigger(data) {
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1667
|
+
// We copy in case the callback modifies the list.
|
|
1668
|
+
const callbacksCopy = [...this.callbacks];
|
|
1669
|
+
for (let i = 0; i < callbacksCopy.length; i++) {
|
|
1670
|
+
const callback = callbacksCopy[i];
|
|
1668
1671
|
if (callback.callback) {
|
|
1669
1672
|
callback.callback(data);
|
|
1670
1673
|
}
|
|
@@ -2579,7 +2582,10 @@ var EntityAttribute;
|
|
|
2579
2582
|
}
|
|
2580
2583
|
const key = path[0];
|
|
2581
2584
|
const item = items.find((i) => i.Key === key);
|
|
2582
|
-
if (!item
|
|
2585
|
+
if (!item) {
|
|
2586
|
+
return null;
|
|
2587
|
+
}
|
|
2588
|
+
if (path.length === 1) {
|
|
2583
2589
|
return item;
|
|
2584
2590
|
}
|
|
2585
2591
|
return GetAttribute(item.Structure, path.slice(1));
|
|
@@ -3170,13 +3176,14 @@ var PathUtils;
|
|
|
3170
3176
|
}
|
|
3171
3177
|
const broken = str.split(".");
|
|
3172
3178
|
for (let i = 0; i < broken.length; i++) {
|
|
3173
|
-
let piece = broken[
|
|
3174
|
-
if (piece.
|
|
3175
|
-
piece =
|
|
3179
|
+
let piece = broken[i];
|
|
3180
|
+
if (piece.startsWith("\"")) {
|
|
3181
|
+
piece = piece.substring(1);
|
|
3176
3182
|
}
|
|
3177
|
-
if (piece.
|
|
3178
|
-
|
|
3183
|
+
if (piece.endsWith("\"")) {
|
|
3184
|
+
piece = piece.substring(0, piece.length - 1);
|
|
3179
3185
|
}
|
|
3186
|
+
broken[i] = piece;
|
|
3180
3187
|
}
|
|
3181
3188
|
return broken;
|
|
3182
3189
|
}
|
|
@@ -3841,7 +3848,7 @@ var Entity;
|
|
|
3841
3848
|
function GetValue(params) {
|
|
3842
3849
|
var _a;
|
|
3843
3850
|
let { entity: data, path, handleLegacy: checkAgainstLegacy } = params;
|
|
3844
|
-
if (checkAgainstLegacy == null) {
|
|
3851
|
+
if (checkAgainstLegacy == null || checkAgainstLegacy == undefined) {
|
|
3845
3852
|
checkAgainstLegacy = true;
|
|
3846
3853
|
}
|
|
3847
3854
|
if (!path || !path.length) {
|
|
@@ -4081,7 +4088,7 @@ var Entity;
|
|
|
4081
4088
|
OrderBy: filter.orderBy,
|
|
4082
4089
|
Filter: requestFilter,
|
|
4083
4090
|
LODType: filter.lodCategoryId,
|
|
4084
|
-
BruceEntityType: filter.entityTypeId,
|
|
4091
|
+
BruceEntityType: (!filter.entityTypeId ? null : filter.entityTypeId),
|
|
4085
4092
|
PageIndex: filter.pageIndex,
|
|
4086
4093
|
PageSize: filter.pageSize,
|
|
4087
4094
|
historicKey: historicKey,
|
|
@@ -4133,7 +4140,7 @@ var Entity;
|
|
|
4133
4140
|
urlParams.set("LODType", body.LODType);
|
|
4134
4141
|
}
|
|
4135
4142
|
if (body.BruceEntityType) {
|
|
4136
|
-
urlParams.set("BruceEntityType", body.BruceEntityType);
|
|
4143
|
+
urlParams.set("BruceEntityType", typeof body.BruceEntityType == "string" ? body.BruceEntityType : body.BruceEntityType.join(","));
|
|
4137
4144
|
}
|
|
4138
4145
|
if (body.PageIndex) {
|
|
4139
4146
|
urlParams.set("PageIndex", String(body.PageIndex));
|
|
@@ -4232,7 +4239,7 @@ var Entity;
|
|
|
4232
4239
|
expandLocation,
|
|
4233
4240
|
expandImports,
|
|
4234
4241
|
expandSources,
|
|
4235
|
-
entityTypeId: filter.entityTypeId,
|
|
4242
|
+
entityTypeId: typeof filter.entityTypeId == "string" ? filter.entityTypeId : filter.entityTypeId.join(","),
|
|
4236
4243
|
historicFrom: historicFrom,
|
|
4237
4244
|
historicKey: historicKey,
|
|
4238
4245
|
historicTo: historicTo,
|
|
@@ -4251,12 +4258,40 @@ var Entity;
|
|
|
4251
4258
|
nextPage = data.NextPage;
|
|
4252
4259
|
nextPageUrl = data.NextPageURL;
|
|
4253
4260
|
}
|
|
4261
|
+
// Callback to get the next page.
|
|
4262
|
+
let getNextPage;
|
|
4263
|
+
if (nextPage) {
|
|
4264
|
+
getNextPage = () => __awaiter(this, void 0, void 0, function* () {
|
|
4265
|
+
let urlStr = null;
|
|
4266
|
+
if (nextPageUrl.startsWith("http")) {
|
|
4267
|
+
urlStr = nextPageUrl;
|
|
4268
|
+
}
|
|
4269
|
+
else {
|
|
4270
|
+
urlStr = api.ConstructUrl({
|
|
4271
|
+
cdn: false,
|
|
4272
|
+
url: nextPageUrl
|
|
4273
|
+
});
|
|
4274
|
+
}
|
|
4275
|
+
const data = yield api.get(urlStr, Api.PrepReqParams(reqParams));
|
|
4276
|
+
// Update URL so we can re-use the same function instance.
|
|
4277
|
+
nextPageUrl = data.NextPageURL;
|
|
4278
|
+
return {
|
|
4279
|
+
entities: data.Items,
|
|
4280
|
+
totalCount: data.TotalCount,
|
|
4281
|
+
imports: data.Imports,
|
|
4282
|
+
nextPage: data.NextPage,
|
|
4283
|
+
nextPageUrl: data.NextPageURL,
|
|
4284
|
+
getNextPage: nextPageUrl ? getNextPage : null
|
|
4285
|
+
};
|
|
4286
|
+
});
|
|
4287
|
+
}
|
|
4254
4288
|
return {
|
|
4255
4289
|
entities,
|
|
4256
4290
|
totalCount,
|
|
4257
4291
|
imports,
|
|
4258
4292
|
nextPage,
|
|
4259
|
-
nextPageUrl
|
|
4293
|
+
nextPageUrl,
|
|
4294
|
+
getNextPage
|
|
4260
4295
|
};
|
|
4261
4296
|
});
|
|
4262
4297
|
}
|
|
@@ -4358,25 +4393,6 @@ var Entity;
|
|
|
4358
4393
|
Entity.GetHistoricContainsKey = GetHistoricContainsKey;
|
|
4359
4394
|
})(Entity || (Entity = {}));
|
|
4360
4395
|
|
|
4361
|
-
/**
|
|
4362
|
-
* Gets the first Bruce variable in a string.
|
|
4363
|
-
* @param str
|
|
4364
|
-
* @returns
|
|
4365
|
-
*/
|
|
4366
|
-
function getVariable(str) {
|
|
4367
|
-
const start = str.indexOf("${");
|
|
4368
|
-
if (start > -1) {
|
|
4369
|
-
const end = str.indexOf("}");
|
|
4370
|
-
if (end > -1) {
|
|
4371
|
-
if (start < end) {
|
|
4372
|
-
const path = str.substring(start + 2, end);
|
|
4373
|
-
const txt = str.substring(start, end + 1);
|
|
4374
|
-
return { path: path, text: txt };
|
|
4375
|
-
}
|
|
4376
|
-
}
|
|
4377
|
-
}
|
|
4378
|
-
return null;
|
|
4379
|
-
}
|
|
4380
4396
|
/**
|
|
4381
4397
|
* Utilities for parsing "Bruce variables", typically within strings.
|
|
4382
4398
|
*
|
|
@@ -4393,28 +4409,40 @@ var BruceVariable;
|
|
|
4393
4409
|
* @returns
|
|
4394
4410
|
*/
|
|
4395
4411
|
function SwapValues(params) {
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
}
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
+
const { str, entity: data, legacyParse, retainType } = params;
|
|
4413
|
+
// If the input is just a path, return the value of the path.
|
|
4414
|
+
// We only do this for 'retainType=true' because all existing code expects a string result.
|
|
4415
|
+
if (retainType && str.startsWith("${") && str.endsWith("}")) {
|
|
4416
|
+
let pathStr = str.slice(2, -1);
|
|
4417
|
+
pathStr = pathStr.trim();
|
|
4418
|
+
const path = legacyParse ? PathUtils.ParseLegacy(pathStr) : PathUtils.Parse(pathStr);
|
|
4419
|
+
return Entity.GetValue({
|
|
4420
|
+
entity: data,
|
|
4421
|
+
path: path
|
|
4422
|
+
});
|
|
4423
|
+
}
|
|
4424
|
+
// Regex that will match all Bruce variables.
|
|
4425
|
+
// It looks for ${...} and captures the content inside the brackets.
|
|
4426
|
+
const variableRegex = /\${([^}]*)}/g;
|
|
4427
|
+
return str.replace(variableRegex, (match, pathStr) => {
|
|
4428
|
+
// If the path is empty or just whitespace, return empty string
|
|
4429
|
+
if (!pathStr || pathStr.trim().length === 0) {
|
|
4430
|
+
return "";
|
|
4412
4431
|
}
|
|
4413
|
-
|
|
4414
|
-
|
|
4432
|
+
pathStr = pathStr.trim();
|
|
4433
|
+
const path = legacyParse ? PathUtils.ParseLegacy(pathStr) : PathUtils.Parse(pathStr);
|
|
4434
|
+
if (!path.length) {
|
|
4435
|
+
return "";
|
|
4415
4436
|
}
|
|
4416
|
-
|
|
4417
|
-
|
|
4437
|
+
const value = Entity.GetValue({
|
|
4438
|
+
entity: data,
|
|
4439
|
+
path: path
|
|
4440
|
+
});
|
|
4441
|
+
if (value == null || value == undefined) {
|
|
4442
|
+
return "";
|
|
4443
|
+
}
|
|
4444
|
+
return String(value);
|
|
4445
|
+
});
|
|
4418
4446
|
}
|
|
4419
4447
|
BruceVariable.SwapValues = SwapValues;
|
|
4420
4448
|
})(BruceVariable || (BruceVariable = {}));
|
|
@@ -4498,6 +4526,11 @@ var Calculator;
|
|
|
4498
4526
|
*/
|
|
4499
4527
|
function Calculate(params) {
|
|
4500
4528
|
let { fields, tags, data, defaultValue, type } = params;
|
|
4529
|
+
// If params doesn't include a defaultValue, use null.
|
|
4530
|
+
// Though passing in undefined is valid!
|
|
4531
|
+
if ("defaultValue" in params == false) {
|
|
4532
|
+
defaultValue = null;
|
|
4533
|
+
}
|
|
4501
4534
|
if (fields == null) {
|
|
4502
4535
|
return defaultValue;
|
|
4503
4536
|
}
|
|
@@ -4548,11 +4581,6 @@ var Calculator;
|
|
|
4548
4581
|
let value = null;
|
|
4549
4582
|
for (let i = 0; i < fieldsArr.length; i++) {
|
|
4550
4583
|
let field = fieldsArr[i];
|
|
4551
|
-
if (field) {
|
|
4552
|
-
// Dereference.
|
|
4553
|
-
// We do this because we'll be modifying the field to fix bad data.
|
|
4554
|
-
field = JSON.parse(JSON.stringify(field));
|
|
4555
|
-
}
|
|
4556
4584
|
// Bad data has it set to 'color' but expects the input to be a number.
|
|
4557
4585
|
if (type == "number" && field.type == EValueType.Color) {
|
|
4558
4586
|
field.type = EValueType.Input;
|
|
@@ -4909,20 +4937,26 @@ var Calculator;
|
|
|
4909
4937
|
try {
|
|
4910
4938
|
value = BruceVariable.SwapValues({
|
|
4911
4939
|
str: value,
|
|
4912
|
-
entity: entity
|
|
4940
|
+
entity: entity,
|
|
4941
|
+
retainType: true
|
|
4913
4942
|
});
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
if (
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4943
|
+
if (value == null || value == undefined) {
|
|
4944
|
+
return null;
|
|
4945
|
+
}
|
|
4946
|
+
if (typeof value === "string") {
|
|
4947
|
+
const isJsEval = value.startsWith("JS:");
|
|
4948
|
+
const MATH_REGEX = /(\d+\.?\d*|\.\d+)([+\-*/])(\d+\.?\d*|\.\d+)/;
|
|
4949
|
+
const isMathEval = isJsEval || MATH_REGEX.test(value);
|
|
4950
|
+
if (isJsEval || isMathEval) {
|
|
4951
|
+
if (isJsEval) {
|
|
4952
|
+
value = value.replace("JS:", "");
|
|
4953
|
+
value = value.trim();
|
|
4954
|
+
}
|
|
4955
|
+
// https://rollupjs.org/guide/en/#avoiding-eval
|
|
4956
|
+
// This stops eval warning.
|
|
4957
|
+
const eval2 = eval;
|
|
4958
|
+
return eval2(value);
|
|
4921
4959
|
}
|
|
4922
|
-
// https://rollupjs.org/guide/en/#avoiding-eval
|
|
4923
|
-
// This stops eval warning.
|
|
4924
|
-
const eval2 = eval;
|
|
4925
|
-
return eval2(value);
|
|
4926
4960
|
}
|
|
4927
4961
|
}
|
|
4928
4962
|
catch (exception) {
|
|
@@ -4981,13 +5015,7 @@ var Geometry;
|
|
|
4981
5015
|
if (!points.length) {
|
|
4982
5016
|
throw ("points is empty.");
|
|
4983
5017
|
}
|
|
4984
|
-
|
|
4985
|
-
let lineString = `${carto.longitude},${carto.latitude}` + (carto.altitude != null ? `,${carto.altitude}` : "");
|
|
4986
|
-
for (let i = 1; i < points.length; i++) {
|
|
4987
|
-
carto = points[i];
|
|
4988
|
-
lineString += ` ${carto.longitude},${carto.latitude}` + (carto.altitude != null ? `,${carto.altitude}` : "");
|
|
4989
|
-
}
|
|
4990
|
-
return lineString;
|
|
5018
|
+
return points.map(carto => `${carto.longitude},${carto.latitude}` + (carto.altitude != null ? `,${carto.altitude}` : "")).join(' ');
|
|
4991
5019
|
}
|
|
4992
5020
|
Geometry.LineStrFromPoints = LineStrFromPoints;
|
|
4993
5021
|
/**
|
|
@@ -5079,6 +5107,9 @@ var Geometry;
|
|
|
5079
5107
|
}
|
|
5080
5108
|
return newGeometry;
|
|
5081
5109
|
}
|
|
5110
|
+
else if (!geometry) {
|
|
5111
|
+
return {};
|
|
5112
|
+
}
|
|
5082
5113
|
return geometry;
|
|
5083
5114
|
}
|
|
5084
5115
|
Geometry.ParseGeometry = ParseGeometry;
|
|
@@ -5095,19 +5126,26 @@ var Geometry;
|
|
|
5095
5126
|
const collection = [];
|
|
5096
5127
|
// Returns if two coordinates are equal.
|
|
5097
5128
|
const areCoordinatesEqual = (coord1, coord2) => {
|
|
5098
|
-
return coord1[0] === coord2[0] && coord1[1] === coord2[1] &&
|
|
5129
|
+
return coord1[0] === coord2[0] && coord1[1] === coord2[1] &&
|
|
5130
|
+
(noAltitude || coord1[2] === coord2[2]);
|
|
5099
5131
|
};
|
|
5100
5132
|
// Removes consecutive duplicate coordinates.
|
|
5101
5133
|
const removeConsecutiveDuplicates = (coordinates) => {
|
|
5102
|
-
|
|
5103
|
-
return
|
|
5104
|
-
|
|
5134
|
+
if (coordinates.length <= 1)
|
|
5135
|
+
return coordinates;
|
|
5136
|
+
const result = [coordinates[0]];
|
|
5137
|
+
for (let i = 1; i < coordinates.length; i++) {
|
|
5138
|
+
if (!areCoordinatesEqual(coordinates[i], coordinates[i - 1])) {
|
|
5139
|
+
result.push(coordinates[i]);
|
|
5140
|
+
}
|
|
5141
|
+
}
|
|
5142
|
+
return result;
|
|
5105
5143
|
};
|
|
5106
5144
|
// Ensures that the polygon is closed.
|
|
5107
5145
|
const closePolygonCoordinates = (coordinates) => {
|
|
5108
5146
|
return coordinates.map(ring => {
|
|
5109
|
-
if (!areCoordinatesEqual(ring[0], ring[ring.length - 1])) {
|
|
5110
|
-
ring
|
|
5147
|
+
if (ring.length > 0 && !areCoordinatesEqual(ring[0], ring[ring.length - 1])) {
|
|
5148
|
+
return [...ring, ring[0]];
|
|
5111
5149
|
}
|
|
5112
5150
|
return ring;
|
|
5113
5151
|
});
|
|
@@ -5701,13 +5739,14 @@ var Carto;
|
|
|
5701
5739
|
* If you have a method that may be called often, but you don't want it to run often, use this.
|
|
5702
5740
|
*/
|
|
5703
5741
|
class DelayQueue {
|
|
5704
|
-
constructor(callback, delay = 200) {
|
|
5742
|
+
constructor(callback, delay = 200, startDelayed = false) {
|
|
5705
5743
|
// Millisecond delay.
|
|
5706
5744
|
this.delay = 200;
|
|
5707
5745
|
// Date-time stamp for the last callback call.
|
|
5708
5746
|
this.lastCallTime = null;
|
|
5709
5747
|
this.callback = callback;
|
|
5710
5748
|
this.delay = delay;
|
|
5749
|
+
this.startDelayed = startDelayed;
|
|
5711
5750
|
}
|
|
5712
5751
|
/**
|
|
5713
5752
|
* Request a call on the callback.
|
|
@@ -5715,7 +5754,10 @@ class DelayQueue {
|
|
|
5715
5754
|
*/
|
|
5716
5755
|
Call(force = false) {
|
|
5717
5756
|
if (this.lastCallTime == null) {
|
|
5718
|
-
|
|
5757
|
+
this.lastCallTime = new Date().getTime();
|
|
5758
|
+
if (this.startDelayed) {
|
|
5759
|
+
force = false;
|
|
5760
|
+
}
|
|
5719
5761
|
}
|
|
5720
5762
|
if (force) {
|
|
5721
5763
|
let endDate = new Date().getTime();
|
|
@@ -5820,28 +5862,36 @@ var UTC;
|
|
|
5820
5862
|
* @param utc
|
|
5821
5863
|
*/
|
|
5822
5864
|
function GetPassedTime(utc) {
|
|
5823
|
-
|
|
5865
|
+
let tense = "ago";
|
|
5866
|
+
let passedSeconds = GetPassedSeconds(utc);
|
|
5867
|
+
if (passedSeconds < 0) {
|
|
5868
|
+
// Account for the time difference between the client and the server.
|
|
5869
|
+
if (passedSeconds < -(15 * 60)) {
|
|
5870
|
+
return "recently";
|
|
5871
|
+
}
|
|
5872
|
+
tense = "from now";
|
|
5873
|
+
}
|
|
5824
5874
|
if (passedSeconds < 60) {
|
|
5825
|
-
return `${passedSeconds} second${passedSeconds > 1 ? "s" : ""}
|
|
5875
|
+
return `${passedSeconds} second${passedSeconds > 1 ? "s" : ""} ${tense}`;
|
|
5826
5876
|
}
|
|
5827
5877
|
const passedMinutes = Math.floor(passedSeconds / 60);
|
|
5828
5878
|
if (passedMinutes < 60) {
|
|
5829
|
-
return `${passedMinutes} minute${passedMinutes > 1 ? "s" : ""}
|
|
5879
|
+
return `${passedMinutes} minute${passedMinutes > 1 ? "s" : ""} ${tense}`;
|
|
5830
5880
|
}
|
|
5831
5881
|
const passedHours = Math.floor(passedMinutes / 60);
|
|
5832
5882
|
if (passedHours < 24) {
|
|
5833
|
-
return `${passedHours} hour${passedHours > 1 ? "s" : ""}
|
|
5883
|
+
return `${passedHours} hour${passedHours > 1 ? "s" : ""} ${tense}`;
|
|
5834
5884
|
}
|
|
5835
5885
|
const passedDays = Math.floor(passedHours / 24);
|
|
5836
5886
|
if (passedDays < 30) {
|
|
5837
|
-
return `${passedDays} day${passedDays > 1 ? "s" : ""}
|
|
5887
|
+
return `${passedDays} day${passedDays > 1 ? "s" : ""} ${tense}`;
|
|
5838
5888
|
}
|
|
5839
5889
|
const passedMonths = Math.floor(passedDays / 30);
|
|
5840
5890
|
if (passedMonths < 12) {
|
|
5841
|
-
return `${passedMonths} month${passedMonths > 1 ? "s" : ""}
|
|
5891
|
+
return `${passedMonths} month${passedMonths > 1 ? "s" : ""} ${tense}`;
|
|
5842
5892
|
}
|
|
5843
5893
|
const passedYears = Math.floor(passedMonths / 12);
|
|
5844
|
-
return `${passedYears} year${passedYears > 1 ? "s" : ""}
|
|
5894
|
+
return `${passedYears} year${passedYears > 1 ? "s" : ""} ${tense}`;
|
|
5845
5895
|
}
|
|
5846
5896
|
UTC.GetPassedTime = GetPassedTime;
|
|
5847
5897
|
/**
|
|
@@ -5922,7 +5972,13 @@ class LRUCache {
|
|
|
5922
5972
|
* @param value
|
|
5923
5973
|
*/
|
|
5924
5974
|
Set(key, value) {
|
|
5925
|
-
if (this.
|
|
5975
|
+
if (this.capacity <= 0) {
|
|
5976
|
+
// Empty cache.
|
|
5977
|
+
// Means we were configured to not cache anything.
|
|
5978
|
+
this.cache.clear();
|
|
5979
|
+
return;
|
|
5980
|
+
}
|
|
5981
|
+
else if (this.cache.size >= this.capacity) {
|
|
5926
5982
|
const leastRecentlyUsedKey = this.cache.keys().next().value;
|
|
5927
5983
|
this.cache.delete(leastRecentlyUsedKey);
|
|
5928
5984
|
}
|
|
@@ -7693,15 +7749,15 @@ var MathUtils;
|
|
|
7693
7749
|
* @returns
|
|
7694
7750
|
*/
|
|
7695
7751
|
function Round(num, decimals = 0) {
|
|
7696
|
-
|
|
7697
|
-
|
|
7752
|
+
const n = typeof num === 'string' ? parseFloat(num) : num;
|
|
7753
|
+
if (isNaN(n)) {
|
|
7754
|
+
return 0;
|
|
7698
7755
|
}
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
tmp += "0";
|
|
7756
|
+
if (decimals <= 0) {
|
|
7757
|
+
return Math.round(n);
|
|
7702
7758
|
}
|
|
7703
|
-
const
|
|
7704
|
-
return Math.round((
|
|
7759
|
+
const multiplier = Math.pow(10, decimals);
|
|
7760
|
+
return Math.round((n + Number.EPSILON) * multiplier) / multiplier;
|
|
7705
7761
|
}
|
|
7706
7762
|
MathUtils.Round = Round;
|
|
7707
7763
|
/**
|
|
@@ -15621,7 +15677,7 @@ var Scenario;
|
|
|
15621
15677
|
})(Scenario || (Scenario = {}));
|
|
15622
15678
|
|
|
15623
15679
|
// This is updated with the package.json version on build.
|
|
15624
|
-
const VERSION = "5.9.
|
|
15680
|
+
const VERSION = "5.9.8";
|
|
15625
15681
|
|
|
15626
15682
|
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, 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 };
|
|
15627
15683
|
//# sourceMappingURL=bruce-models.es5.js.map
|