bruce-models 7.1.113 → 7.1.114
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 +82 -2
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +82 -2
- 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/plugin/plugin.js +8 -1
- package/dist/lib/plugin/plugin.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/calculator/calculator.d.ts +6 -0
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -8307,6 +8307,79 @@ var Calculator;
|
|
|
8307
8307
|
// Fallback to min (static, no data path resolved).
|
|
8308
8308
|
return { result: Color.ColorFromStr(points[0].color), attrPath: null, eValue: null };
|
|
8309
8309
|
}
|
|
8310
|
+
/**
|
|
8311
|
+
* Lists every attribute path a set of fields could read from an entity record.
|
|
8312
|
+
* Returns null when the fields depend on more than attribute values (tags, or a function).
|
|
8313
|
+
* @param fields
|
|
8314
|
+
*/
|
|
8315
|
+
function GetFieldPaths(fields) {
|
|
8316
|
+
var _a, _b;
|
|
8317
|
+
if (fields == null) {
|
|
8318
|
+
return [];
|
|
8319
|
+
}
|
|
8320
|
+
const fieldsArr = Array.isArray(fields) ? fields : [fields];
|
|
8321
|
+
const paths = [];
|
|
8322
|
+
const seen = new Set();
|
|
8323
|
+
const add = (path) => {
|
|
8324
|
+
if (!path.length || path.some(segment => !segment || segment.includes("\""))) {
|
|
8325
|
+
return;
|
|
8326
|
+
}
|
|
8327
|
+
const key = JSON.stringify(path);
|
|
8328
|
+
if (!seen.has(key)) {
|
|
8329
|
+
seen.add(key);
|
|
8330
|
+
paths.push(path);
|
|
8331
|
+
}
|
|
8332
|
+
};
|
|
8333
|
+
// Mirrors BruceVariable.SwapValues, which reads every ${...} with PathUtils.Parse.
|
|
8334
|
+
// TODO: expand BruceVariable to include a util for this instead of duping logic.
|
|
8335
|
+
const addVariables = (template) => {
|
|
8336
|
+
if (typeof template != "string") {
|
|
8337
|
+
return;
|
|
8338
|
+
}
|
|
8339
|
+
const variableRegex = /\${([^}]*)}/g;
|
|
8340
|
+
let match;
|
|
8341
|
+
while ((match = variableRegex.exec(template)) != null) {
|
|
8342
|
+
const pathStr = match[1].trim();
|
|
8343
|
+
if (pathStr) {
|
|
8344
|
+
add(PathUtils.Parse(pathStr));
|
|
8345
|
+
}
|
|
8346
|
+
}
|
|
8347
|
+
};
|
|
8348
|
+
for (const field of fieldsArr) {
|
|
8349
|
+
if (field == null) {
|
|
8350
|
+
continue;
|
|
8351
|
+
}
|
|
8352
|
+
if (field.value instanceof Function) {
|
|
8353
|
+
return null;
|
|
8354
|
+
}
|
|
8355
|
+
switch (field.type) {
|
|
8356
|
+
case EValueType.Color:
|
|
8357
|
+
case EValueType.Input:
|
|
8358
|
+
addVariables(field.value);
|
|
8359
|
+
break;
|
|
8360
|
+
case EValueType.Gradient:
|
|
8361
|
+
parseLegacyPath((_a = field.value) === null || _a === void 0 ? void 0 : _a.field).forEach(add);
|
|
8362
|
+
break;
|
|
8363
|
+
case EValueType.Mapping:
|
|
8364
|
+
{
|
|
8365
|
+
const mapping = field.value;
|
|
8366
|
+
parseLegacyPath(mapping === null || mapping === void 0 ? void 0 : mapping.field).forEach(add);
|
|
8367
|
+
// A JS: row can read other attributes besides the mapped one.
|
|
8368
|
+
for (const option of (_b = mapping === null || mapping === void 0 ? void 0 : mapping.values) !== null && _b !== void 0 ? _b : []) {
|
|
8369
|
+
const fieldValues = Array.isArray(option.fieldValue) ? option.fieldValue : [option.fieldValue];
|
|
8370
|
+
fieldValues.filter(v => typeof v == "string" && v.startsWith("JS:")).forEach(addVariables);
|
|
8371
|
+
}
|
|
8372
|
+
}
|
|
8373
|
+
break;
|
|
8374
|
+
case EValueType.RandomColor:
|
|
8375
|
+
break;
|
|
8376
|
+
default:
|
|
8377
|
+
return null;
|
|
8378
|
+
}
|
|
8379
|
+
}
|
|
8380
|
+
return paths;
|
|
8381
|
+
}
|
|
8382
|
+
Calculator.GetFieldPaths = GetFieldPaths;
|
|
8310
8383
|
/**
|
|
8311
8384
|
* Like Calculate, but also returns an 'effective' key describing how the value
|
|
8312
8385
|
* was derived. See ITraceResult for the key format.
|
|
@@ -19828,9 +19901,16 @@ var Plugin;
|
|
|
19828
19901
|
if (plugin.IsLoginRequired) {
|
|
19829
19902
|
headers[api.GetSessionHeader()] = api.GetSessionId();
|
|
19830
19903
|
}
|
|
19904
|
+
// A refusal must not be cached and run as if it were the plugin's code.
|
|
19831
19905
|
fileContentProm = fetch(indexFileUrl, {
|
|
19832
19906
|
headers: headers
|
|
19833
|
-
}).then((res) =>
|
|
19907
|
+
}).then((res) => {
|
|
19908
|
+
if (!res.ok) {
|
|
19909
|
+
api.Cache.Remove(GetIndexFileCacheKey(pluginId, indexFileUrl));
|
|
19910
|
+
throw new Error(`Failed to load plugin "${pluginId}" (${res.status}).`);
|
|
19911
|
+
}
|
|
19912
|
+
return res.text();
|
|
19913
|
+
});
|
|
19834
19914
|
api.SetCacheItem({
|
|
19835
19915
|
key: GetIndexFileCacheKey(pluginId, indexFileUrl),
|
|
19836
19916
|
value: fileContentProm,
|
|
@@ -25109,7 +25189,7 @@ function getFirstWrappedArray(data, wrapperKeys) {
|
|
|
25109
25189
|
}
|
|
25110
25190
|
|
|
25111
25191
|
// This is updated with the package.json version on build.
|
|
25112
|
-
const VERSION = "7.1.
|
|
25192
|
+
const VERSION = "7.1.114";
|
|
25113
25193
|
|
|
25114
25194
|
export { VERSION, Account, AccountAudit, AccountConcept, AccountFeatures, AccountInvite, AccountLimits, AccountTemplate, AccountType, AnnDocument, AbstractApi, Api, ApiGetters, BruceApi, GlobalApi, GuardianApi, Assembly, Calculator, ChangeSet, ClientFile, ClientFileValueMap, Bounds, BruceEvent, BruceVariable, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, RequestLane, GeoJson, Geometry, LRUCache, UTC, CustomForm, DashboardView, DataFeed, DataLab, DataLabGroup, DataSource, DataTransform, Comment, Entity, EntityAttachment, EntityAttachmentType, EntityAttribute, EntityComment, EntityCoords, EntityHistoricData, EntityLink, EntityLod, EntityLodCategory, EntityRelation, EntityRelationType, EntitySource, EntityTableView, EntityTag, EntityType, EntityTypeRelation, EntityTypeSource, EntityTypeTrigger, Ontology, OntologyDocument, ENVIRONMENT, ExportBrz, ExportCsv, ExportNsx, ExportUsd, Hexbin, ImportAssembly, ImportCad, ImportCsv, ImportGeoJson, ImportJson, ImportKml, ImportLcc, ImportTif, ImportedFile, Uploader, Markup, UIMarkup, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, Plugin, PluginAiTool, ProgramKey, MenuItem, ProjectView, ProjectViewBookmark, ProjectViewBookmarkGroup, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewLegacyTile, ProjectViewTile, ZoomControl, Scenario, HostingLocation, MessageBroker, PendingAction, RecordChangeFeed, Style, Tileset, Tracking, Permission, Session, User, UserGroup, UserMfaMethod, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, WorkflowItem, WorkflowSchedule, WorkflowType, WorkflowItemType };
|
|
25115
25195
|
//# sourceMappingURL=bruce-models.es5.js.map
|