bruce-models 6.4.9 → 6.5.1
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 +45 -5
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +45 -5
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/calculator/calculator.js +41 -3
- package/dist/lib/calculator/calculator.js.map +1 -1
- package/dist/lib/user/session.js +3 -1
- package/dist/lib/user/session.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -4991,7 +4991,45 @@
|
|
|
4991
4991
|
}
|
|
4992
4992
|
for (let i = 0; i < value.values.length; i++) {
|
|
4993
4993
|
const option = value.values[i];
|
|
4994
|
-
|
|
4994
|
+
let mapValue = option.fieldValue;
|
|
4995
|
+
// If mapValue is prefixed with "JS:", we evaluate it as JavaScript.
|
|
4996
|
+
// This lets us do things like JS:Boolean("${}") as a quick way to map 'existence' to a target value.
|
|
4997
|
+
if (typeof mapValue === "string" && mapValue.startsWith("JS:")) {
|
|
4998
|
+
try {
|
|
4999
|
+
let jsEval = mapValue.replace("JS:", "").trim();
|
|
5000
|
+
const attrPathStr = exports.PathUtils.Wrap(attrPath);
|
|
5001
|
+
jsEval = jsEval.replace("${}", "${" + attrPathStr + "}");
|
|
5002
|
+
jsEval = exports.BruceVariable.SwapValues({
|
|
5003
|
+
str: jsEval,
|
|
5004
|
+
entity: entity
|
|
5005
|
+
});
|
|
5006
|
+
// https://rollupjs.org/guide/en/#avoiding-eval
|
|
5007
|
+
// This stops eval warning.
|
|
5008
|
+
const eval2 = eval;
|
|
5009
|
+
mapValue = eval2(jsEval);
|
|
5010
|
+
// We currently expect eval to return a validity bool.
|
|
5011
|
+
// So it either matches and we return it, or it doesn't and we continue.
|
|
5012
|
+
if (mapValue) {
|
|
5013
|
+
return option.appliedValue;
|
|
5014
|
+
}
|
|
5015
|
+
else {
|
|
5016
|
+
continue;
|
|
5017
|
+
}
|
|
5018
|
+
}
|
|
5019
|
+
catch (exception) {
|
|
5020
|
+
const e = exception;
|
|
5021
|
+
let suppress = false;
|
|
5022
|
+
if (e && typeof e == "object") {
|
|
5023
|
+
const msg = e.message;
|
|
5024
|
+
suppress = !!msg && (msg.includes("Unexpected end") || msg.includes("got end of script"));
|
|
5025
|
+
}
|
|
5026
|
+
if (!suppress) {
|
|
5027
|
+
console.error(e);
|
|
5028
|
+
}
|
|
5029
|
+
// Eval failed, therefor not a valid mapping-row.
|
|
5030
|
+
continue;
|
|
5031
|
+
}
|
|
5032
|
+
}
|
|
4995
5033
|
let isMapValueNum = !isNaN(+mapValue);
|
|
4996
5034
|
if (isMapValueNum == null) {
|
|
4997
5035
|
isMapValueNum = false;
|
|
@@ -5028,7 +5066,7 @@
|
|
|
5028
5066
|
// Common as mapping value is typically a user-entered string.
|
|
5029
5067
|
else if (typeof eValue === "boolean" && typeof mapValue === "string") {
|
|
5030
5068
|
const eValueStr = eValue ? "true" : "false";
|
|
5031
|
-
if (mapValue == eValueStr) {
|
|
5069
|
+
if (mapValue.toLowerCase() == eValueStr) {
|
|
5032
5070
|
return option.appliedValue;
|
|
5033
5071
|
}
|
|
5034
5072
|
}
|
|
@@ -5036,7 +5074,7 @@
|
|
|
5036
5074
|
// Have not seen this happen yet, but preparing for any future cases.
|
|
5037
5075
|
else if (typeof mapValue === "boolean" && typeof eValue === "string") {
|
|
5038
5076
|
const mapValueStr = mapValue ? "true" : "false";
|
|
5039
|
-
if (mapValueStr == eValue) {
|
|
5077
|
+
if (mapValueStr == eValue.toLowerCase()) {
|
|
5040
5078
|
return option.appliedValue;
|
|
5041
5079
|
}
|
|
5042
5080
|
}
|
|
@@ -12385,6 +12423,7 @@
|
|
|
12385
12423
|
if ((_c = (_b = session === null || session === void 0 ? void 0 : session.User) === null || _b === void 0 ? void 0 : _b.AccessPermissions) === null || _c === void 0 ? void 0 : _c.length) {
|
|
12386
12424
|
for (let i = 0; i < session.User.AccessPermissions.length; i++) {
|
|
12387
12425
|
const perms = session.User.AccessPermissions[i];
|
|
12426
|
+
let accIdChecked = false;
|
|
12388
12427
|
// Newer API versions always specify accountId in the collections.
|
|
12389
12428
|
// If it's set we can do a super account check early.
|
|
12390
12429
|
if (perms["ClientAccount.ID"] != null) {
|
|
@@ -12392,13 +12431,14 @@
|
|
|
12392
12431
|
if (pAccountId != exports.Api.SUPER_ACCOUNT_ID) {
|
|
12393
12432
|
continue;
|
|
12394
12433
|
}
|
|
12434
|
+
accIdChecked = true;
|
|
12395
12435
|
}
|
|
12396
12436
|
if ((_d = perms === null || perms === void 0 ? void 0 : perms.UserGroups) === null || _d === void 0 ? void 0 : _d.length) {
|
|
12397
12437
|
for (let j = 0; j < perms.UserGroups.length; j++) {
|
|
12398
12438
|
const group = perms.UserGroups[j];
|
|
12399
12439
|
if (typeof group != "string") {
|
|
12400
12440
|
const gAccountId = String(group["ClientAccount.ID"]).toLowerCase();
|
|
12401
|
-
if (gAccountId != exports.Api.SUPER_ACCOUNT_ID) {
|
|
12441
|
+
if (gAccountId != exports.Api.SUPER_ACCOUNT_ID && !accIdChecked) {
|
|
12402
12442
|
continue;
|
|
12403
12443
|
}
|
|
12404
12444
|
const features = group.Features;
|
|
@@ -15795,7 +15835,7 @@
|
|
|
15795
15835
|
})(exports.Tracking || (exports.Tracking = {}));
|
|
15796
15836
|
|
|
15797
15837
|
// This is updated with the package.json version on build.
|
|
15798
|
-
const VERSION = "6.
|
|
15838
|
+
const VERSION = "6.5.1";
|
|
15799
15839
|
|
|
15800
15840
|
exports.VERSION = VERSION;
|
|
15801
15841
|
exports.AbstractApi = AbstractApi;
|