bruce-models 7.1.113 → 7.1.115
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 +130 -4
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +130 -4
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/calculator/calculator.js +73 -0
- package/dist/lib/calculator/calculator.js.map +1 -1
- package/dist/lib/data-lab/data-lab.js.map +1 -1
- package/dist/lib/entity/entity.js +15 -2
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/lib/markup/markup.js.map +1 -1
- package/dist/lib/plugin/plugin.js +8 -1
- package/dist/lib/plugin/plugin.js.map +1 -1
- package/dist/lib/tracking/tracking.js +33 -0
- package/dist/lib/tracking/tracking.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/calculator/calculator.d.ts +6 -0
- package/dist/types/data-lab/data-lab.d.ts +2 -2
- package/dist/types/entity/entity.d.ts +1 -0
- package/dist/types/markup/markup.d.ts +1 -0
- package/dist/types/tracking/tracking.d.ts +26 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -7097,11 +7097,18 @@
|
|
|
7097
7097
|
function Update(params) {
|
|
7098
7098
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
7099
7099
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7100
|
-
let { api, entity: data, entities, override, req: reqParams, migrated } = params;
|
|
7100
|
+
let { api, entity: data, entities, override, req: reqParams, migrated, skipSourcePush } = params;
|
|
7101
7101
|
if (migrated == null || migrated == undefined) {
|
|
7102
7102
|
// Changed to default = true. 18th April 2025.
|
|
7103
7103
|
migrated = true;
|
|
7104
7104
|
}
|
|
7105
|
+
let skipSourcePushParam = null;
|
|
7106
|
+
if (skipSourcePush === true) {
|
|
7107
|
+
skipSourcePushParam = "true";
|
|
7108
|
+
}
|
|
7109
|
+
else if (Array.isArray(skipSourcePush) && skipSourcePush.length) {
|
|
7110
|
+
skipSourcePushParam = skipSourcePush.join(",");
|
|
7111
|
+
}
|
|
7105
7112
|
// Bulk save. Always using a v3 endpoint as v1 did not have a bulk save.
|
|
7106
7113
|
if (entities === null || entities === void 0 ? void 0 : entities.length) {
|
|
7107
7114
|
// If the Entities don't have IDs, then they must have a Type ID.
|
|
@@ -7116,7 +7123,10 @@
|
|
|
7116
7123
|
if (!api) {
|
|
7117
7124
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
7118
7125
|
}
|
|
7119
|
-
|
|
7126
|
+
let reqUrl = "v3/entities";
|
|
7127
|
+
if (skipSourcePushParam) {
|
|
7128
|
+
reqUrl += `?SkipSourcePush=${encodeURIComponent(skipSourcePushParam)}`;
|
|
7129
|
+
}
|
|
7120
7130
|
const reqBody = {
|
|
7121
7131
|
Items: entities,
|
|
7122
7132
|
Override: override
|
|
@@ -7176,6 +7186,9 @@
|
|
|
7176
7186
|
if (!migrated) {
|
|
7177
7187
|
reqUrl += "&hasMigrated=false";
|
|
7178
7188
|
}
|
|
7189
|
+
if (skipSourcePushParam) {
|
|
7190
|
+
reqUrl += `&SkipSourcePush=${encodeURIComponent(skipSourcePushParam)}`;
|
|
7191
|
+
}
|
|
7179
7192
|
const res = yield api.POST(reqUrl, data, exports.Api.PrepReqParams(reqParams));
|
|
7180
7193
|
api.Cache.RemoveByContains(GetContainsKey(data.Bruce.ID));
|
|
7181
7194
|
exports.EntityHistoricData.ClearCacheByEntityIds(api, [data.Bruce.ID]);
|
|
@@ -8217,6 +8230,79 @@
|
|
|
8217
8230
|
// Fallback to min (static, no data path resolved).
|
|
8218
8231
|
return { result: exports.Color.ColorFromStr(points[0].color), attrPath: null, eValue: null };
|
|
8219
8232
|
}
|
|
8233
|
+
/**
|
|
8234
|
+
* Lists every attribute path a set of fields could read from an entity record.
|
|
8235
|
+
* Returns null when the fields depend on more than attribute values (tags, or a function).
|
|
8236
|
+
* @param fields
|
|
8237
|
+
*/
|
|
8238
|
+
function GetFieldPaths(fields) {
|
|
8239
|
+
var _a, _b;
|
|
8240
|
+
if (fields == null) {
|
|
8241
|
+
return [];
|
|
8242
|
+
}
|
|
8243
|
+
const fieldsArr = Array.isArray(fields) ? fields : [fields];
|
|
8244
|
+
const paths = [];
|
|
8245
|
+
const seen = new Set();
|
|
8246
|
+
const add = (path) => {
|
|
8247
|
+
if (!path.length || path.some(segment => !segment || segment.includes("\""))) {
|
|
8248
|
+
return;
|
|
8249
|
+
}
|
|
8250
|
+
const key = JSON.stringify(path);
|
|
8251
|
+
if (!seen.has(key)) {
|
|
8252
|
+
seen.add(key);
|
|
8253
|
+
paths.push(path);
|
|
8254
|
+
}
|
|
8255
|
+
};
|
|
8256
|
+
// Mirrors BruceVariable.SwapValues, which reads every ${...} with PathUtils.Parse.
|
|
8257
|
+
// TODO: expand BruceVariable to include a util for this instead of duping logic.
|
|
8258
|
+
const addVariables = (template) => {
|
|
8259
|
+
if (typeof template != "string") {
|
|
8260
|
+
return;
|
|
8261
|
+
}
|
|
8262
|
+
const variableRegex = /\${([^}]*)}/g;
|
|
8263
|
+
let match;
|
|
8264
|
+
while ((match = variableRegex.exec(template)) != null) {
|
|
8265
|
+
const pathStr = match[1].trim();
|
|
8266
|
+
if (pathStr) {
|
|
8267
|
+
add(exports.PathUtils.Parse(pathStr));
|
|
8268
|
+
}
|
|
8269
|
+
}
|
|
8270
|
+
};
|
|
8271
|
+
for (const field of fieldsArr) {
|
|
8272
|
+
if (field == null) {
|
|
8273
|
+
continue;
|
|
8274
|
+
}
|
|
8275
|
+
if (field.value instanceof Function) {
|
|
8276
|
+
return null;
|
|
8277
|
+
}
|
|
8278
|
+
switch (field.type) {
|
|
8279
|
+
case EValueType.Color:
|
|
8280
|
+
case EValueType.Input:
|
|
8281
|
+
addVariables(field.value);
|
|
8282
|
+
break;
|
|
8283
|
+
case EValueType.Gradient:
|
|
8284
|
+
parseLegacyPath((_a = field.value) === null || _a === void 0 ? void 0 : _a.field).forEach(add);
|
|
8285
|
+
break;
|
|
8286
|
+
case EValueType.Mapping:
|
|
8287
|
+
{
|
|
8288
|
+
const mapping = field.value;
|
|
8289
|
+
parseLegacyPath(mapping === null || mapping === void 0 ? void 0 : mapping.field).forEach(add);
|
|
8290
|
+
// A JS: row can read other attributes besides the mapped one.
|
|
8291
|
+
for (const option of (_b = mapping === null || mapping === void 0 ? void 0 : mapping.values) !== null && _b !== void 0 ? _b : []) {
|
|
8292
|
+
const fieldValues = Array.isArray(option.fieldValue) ? option.fieldValue : [option.fieldValue];
|
|
8293
|
+
fieldValues.filter(v => typeof v == "string" && v.startsWith("JS:")).forEach(addVariables);
|
|
8294
|
+
}
|
|
8295
|
+
}
|
|
8296
|
+
break;
|
|
8297
|
+
case EValueType.RandomColor:
|
|
8298
|
+
break;
|
|
8299
|
+
default:
|
|
8300
|
+
return null;
|
|
8301
|
+
}
|
|
8302
|
+
}
|
|
8303
|
+
return paths;
|
|
8304
|
+
}
|
|
8305
|
+
Calculator.GetFieldPaths = GetFieldPaths;
|
|
8220
8306
|
/**
|
|
8221
8307
|
* Like Calculate, but also returns an 'effective' key describing how the value
|
|
8222
8308
|
* was derived. See ITraceResult for the key format.
|
|
@@ -19541,9 +19627,16 @@
|
|
|
19541
19627
|
if (plugin.IsLoginRequired) {
|
|
19542
19628
|
headers[api.GetSessionHeader()] = api.GetSessionId();
|
|
19543
19629
|
}
|
|
19630
|
+
// A refusal must not be cached and run as if it were the plugin's code.
|
|
19544
19631
|
fileContentProm = fetch(indexFileUrl, {
|
|
19545
19632
|
headers: headers
|
|
19546
|
-
}).then((res) =>
|
|
19633
|
+
}).then((res) => {
|
|
19634
|
+
if (!res.ok) {
|
|
19635
|
+
api.Cache.Remove(GetIndexFileCacheKey(pluginId, indexFileUrl));
|
|
19636
|
+
throw new Error(`Failed to load plugin "${pluginId}" (${res.status}).`);
|
|
19637
|
+
}
|
|
19638
|
+
return res.text();
|
|
19639
|
+
});
|
|
19547
19640
|
api.SetCacheItem({
|
|
19548
19641
|
key: GetIndexFileCacheKey(pluginId, indexFileUrl),
|
|
19549
19642
|
value: fileContentProm,
|
|
@@ -22523,12 +22616,27 @@
|
|
|
22523
22616
|
})(exports.PendingAction || (exports.PendingAction = {}));
|
|
22524
22617
|
|
|
22525
22618
|
(function (Tracking) {
|
|
22619
|
+
/**
|
|
22620
|
+
* Columns a transaction summary can be grouped by.
|
|
22621
|
+
* Guardian groups by App, Account, Type and Count when none are given.
|
|
22622
|
+
*/
|
|
22623
|
+
let ETransactionGroupBy;
|
|
22624
|
+
(function (ETransactionGroupBy) {
|
|
22625
|
+
ETransactionGroupBy["App"] = "App";
|
|
22626
|
+
ETransactionGroupBy["Account"] = "Account";
|
|
22627
|
+
ETransactionGroupBy["User"] = "User";
|
|
22628
|
+
ETransactionGroupBy["Environment"] = "Environment";
|
|
22629
|
+
ETransactionGroupBy["Type"] = "Type";
|
|
22630
|
+
ETransactionGroupBy["Count"] = "Count";
|
|
22631
|
+
ETransactionGroupBy["Month"] = "Month";
|
|
22632
|
+
})(ETransactionGroupBy = Tracking.ETransactionGroupBy || (Tracking.ETransactionGroupBy = {}));
|
|
22526
22633
|
/**
|
|
22527
22634
|
* Returns tracking data based on provided parameters.
|
|
22528
22635
|
* @param params
|
|
22529
22636
|
* @returns
|
|
22530
22637
|
*/
|
|
22531
22638
|
function GetData(params) {
|
|
22639
|
+
var _a;
|
|
22532
22640
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22533
22641
|
let { api, req } = params;
|
|
22534
22642
|
if (!api) {
|
|
@@ -22541,6 +22649,9 @@
|
|
|
22541
22649
|
if (params.cType) {
|
|
22542
22650
|
query.append("CType", params.cType);
|
|
22543
22651
|
}
|
|
22652
|
+
if (params.tType) {
|
|
22653
|
+
query.append("TType", params.tType);
|
|
22654
|
+
}
|
|
22544
22655
|
if (params.tCount) {
|
|
22545
22656
|
query.append("TCount", params.tCount);
|
|
22546
22657
|
}
|
|
@@ -22550,12 +22661,27 @@
|
|
|
22550
22661
|
if (params.app) {
|
|
22551
22662
|
query.append("App", params.app);
|
|
22552
22663
|
}
|
|
22664
|
+
if (params.environment) {
|
|
22665
|
+
query.append("Environment", params.environment);
|
|
22666
|
+
}
|
|
22667
|
+
if (params.includeDeleted != null) {
|
|
22668
|
+
query.append("IncludeDeleted", String(params.includeDeleted));
|
|
22669
|
+
}
|
|
22553
22670
|
if (params.year) {
|
|
22554
22671
|
query.append("Year", String(params.year));
|
|
22555
22672
|
}
|
|
22556
22673
|
if (params.month) {
|
|
22557
22674
|
query.append("Month", String(params.month));
|
|
22558
22675
|
}
|
|
22676
|
+
if (params.fromYear) {
|
|
22677
|
+
query.append("FromYear", String(params.fromYear));
|
|
22678
|
+
}
|
|
22679
|
+
if (params.fromMonth) {
|
|
22680
|
+
query.append("FromMonth", String(params.fromMonth));
|
|
22681
|
+
}
|
|
22682
|
+
if ((_a = params.groupBy) === null || _a === void 0 ? void 0 : _a.length) {
|
|
22683
|
+
query.append("GroupBy", params.groupBy.join(","));
|
|
22684
|
+
}
|
|
22559
22685
|
return yield api.GET("tracking?" + query.toString(), exports.Api.PrepReqParams(req));
|
|
22560
22686
|
});
|
|
22561
22687
|
}
|
|
@@ -24718,7 +24844,7 @@
|
|
|
24718
24844
|
}
|
|
24719
24845
|
|
|
24720
24846
|
// This is updated with the package.json version on build.
|
|
24721
|
-
const VERSION = "7.1.
|
|
24847
|
+
const VERSION = "7.1.115";
|
|
24722
24848
|
|
|
24723
24849
|
exports.VERSION = VERSION;
|
|
24724
24850
|
exports.AbstractApi = AbstractApi;
|