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.
@@ -7175,11 +7175,18 @@ var Entity;
7175
7175
  function Update(params) {
7176
7176
  var _a, _b, _c, _d, _e, _f, _g;
7177
7177
  return __awaiter(this, void 0, void 0, function* () {
7178
- let { api, entity: data, entities, override, req: reqParams, migrated } = params;
7178
+ let { api, entity: data, entities, override, req: reqParams, migrated, skipSourcePush } = params;
7179
7179
  if (migrated == null || migrated == undefined) {
7180
7180
  // Changed to default = true. 18th April 2025.
7181
7181
  migrated = true;
7182
7182
  }
7183
+ let skipSourcePushParam = null;
7184
+ if (skipSourcePush === true) {
7185
+ skipSourcePushParam = "true";
7186
+ }
7187
+ else if (Array.isArray(skipSourcePush) && skipSourcePush.length) {
7188
+ skipSourcePushParam = skipSourcePush.join(",");
7189
+ }
7183
7190
  // Bulk save. Always using a v3 endpoint as v1 did not have a bulk save.
7184
7191
  if (entities === null || entities === void 0 ? void 0 : entities.length) {
7185
7192
  // If the Entities don't have IDs, then they must have a Type ID.
@@ -7194,7 +7201,10 @@ var Entity;
7194
7201
  if (!api) {
7195
7202
  api = ENVIRONMENT.Api().GetBruceApi();
7196
7203
  }
7197
- const reqUrl = `v3/entities`;
7204
+ let reqUrl = "v3/entities";
7205
+ if (skipSourcePushParam) {
7206
+ reqUrl += `?SkipSourcePush=${encodeURIComponent(skipSourcePushParam)}`;
7207
+ }
7198
7208
  const reqBody = {
7199
7209
  Items: entities,
7200
7210
  Override: override
@@ -7254,6 +7264,9 @@ var Entity;
7254
7264
  if (!migrated) {
7255
7265
  reqUrl += "&hasMigrated=false";
7256
7266
  }
7267
+ if (skipSourcePushParam) {
7268
+ reqUrl += `&SkipSourcePush=${encodeURIComponent(skipSourcePushParam)}`;
7269
+ }
7257
7270
  const res = yield api.POST(reqUrl, data, Api.PrepReqParams(reqParams));
7258
7271
  api.Cache.RemoveByContains(GetContainsKey(data.Bruce.ID));
7259
7272
  EntityHistoricData.ClearCacheByEntityIds(api, [data.Bruce.ID]);
@@ -8307,6 +8320,79 @@ var Calculator;
8307
8320
  // Fallback to min (static, no data path resolved).
8308
8321
  return { result: Color.ColorFromStr(points[0].color), attrPath: null, eValue: null };
8309
8322
  }
8323
+ /**
8324
+ * Lists every attribute path a set of fields could read from an entity record.
8325
+ * Returns null when the fields depend on more than attribute values (tags, or a function).
8326
+ * @param fields
8327
+ */
8328
+ function GetFieldPaths(fields) {
8329
+ var _a, _b;
8330
+ if (fields == null) {
8331
+ return [];
8332
+ }
8333
+ const fieldsArr = Array.isArray(fields) ? fields : [fields];
8334
+ const paths = [];
8335
+ const seen = new Set();
8336
+ const add = (path) => {
8337
+ if (!path.length || path.some(segment => !segment || segment.includes("\""))) {
8338
+ return;
8339
+ }
8340
+ const key = JSON.stringify(path);
8341
+ if (!seen.has(key)) {
8342
+ seen.add(key);
8343
+ paths.push(path);
8344
+ }
8345
+ };
8346
+ // Mirrors BruceVariable.SwapValues, which reads every ${...} with PathUtils.Parse.
8347
+ // TODO: expand BruceVariable to include a util for this instead of duping logic.
8348
+ const addVariables = (template) => {
8349
+ if (typeof template != "string") {
8350
+ return;
8351
+ }
8352
+ const variableRegex = /\${([^}]*)}/g;
8353
+ let match;
8354
+ while ((match = variableRegex.exec(template)) != null) {
8355
+ const pathStr = match[1].trim();
8356
+ if (pathStr) {
8357
+ add(PathUtils.Parse(pathStr));
8358
+ }
8359
+ }
8360
+ };
8361
+ for (const field of fieldsArr) {
8362
+ if (field == null) {
8363
+ continue;
8364
+ }
8365
+ if (field.value instanceof Function) {
8366
+ return null;
8367
+ }
8368
+ switch (field.type) {
8369
+ case EValueType.Color:
8370
+ case EValueType.Input:
8371
+ addVariables(field.value);
8372
+ break;
8373
+ case EValueType.Gradient:
8374
+ parseLegacyPath((_a = field.value) === null || _a === void 0 ? void 0 : _a.field).forEach(add);
8375
+ break;
8376
+ case EValueType.Mapping:
8377
+ {
8378
+ const mapping = field.value;
8379
+ parseLegacyPath(mapping === null || mapping === void 0 ? void 0 : mapping.field).forEach(add);
8380
+ // A JS: row can read other attributes besides the mapped one.
8381
+ for (const option of (_b = mapping === null || mapping === void 0 ? void 0 : mapping.values) !== null && _b !== void 0 ? _b : []) {
8382
+ const fieldValues = Array.isArray(option.fieldValue) ? option.fieldValue : [option.fieldValue];
8383
+ fieldValues.filter(v => typeof v == "string" && v.startsWith("JS:")).forEach(addVariables);
8384
+ }
8385
+ }
8386
+ break;
8387
+ case EValueType.RandomColor:
8388
+ break;
8389
+ default:
8390
+ return null;
8391
+ }
8392
+ }
8393
+ return paths;
8394
+ }
8395
+ Calculator.GetFieldPaths = GetFieldPaths;
8310
8396
  /**
8311
8397
  * Like Calculate, but also returns an 'effective' key describing how the value
8312
8398
  * was derived. See ITraceResult for the key format.
@@ -19828,9 +19914,16 @@ var Plugin;
19828
19914
  if (plugin.IsLoginRequired) {
19829
19915
  headers[api.GetSessionHeader()] = api.GetSessionId();
19830
19916
  }
19917
+ // A refusal must not be cached and run as if it were the plugin's code.
19831
19918
  fileContentProm = fetch(indexFileUrl, {
19832
19919
  headers: headers
19833
- }).then((res) => res.text());
19920
+ }).then((res) => {
19921
+ if (!res.ok) {
19922
+ api.Cache.Remove(GetIndexFileCacheKey(pluginId, indexFileUrl));
19923
+ throw new Error(`Failed to load plugin "${pluginId}" (${res.status}).`);
19924
+ }
19925
+ return res.text();
19926
+ });
19834
19927
  api.SetCacheItem({
19835
19928
  key: GetIndexFileCacheKey(pluginId, indexFileUrl),
19836
19929
  value: fileContentProm,
@@ -22884,12 +22977,27 @@ var PendingAction;
22884
22977
  */
22885
22978
  var Tracking;
22886
22979
  (function (Tracking) {
22980
+ /**
22981
+ * Columns a transaction summary can be grouped by.
22982
+ * Guardian groups by App, Account, Type and Count when none are given.
22983
+ */
22984
+ let ETransactionGroupBy;
22985
+ (function (ETransactionGroupBy) {
22986
+ ETransactionGroupBy["App"] = "App";
22987
+ ETransactionGroupBy["Account"] = "Account";
22988
+ ETransactionGroupBy["User"] = "User";
22989
+ ETransactionGroupBy["Environment"] = "Environment";
22990
+ ETransactionGroupBy["Type"] = "Type";
22991
+ ETransactionGroupBy["Count"] = "Count";
22992
+ ETransactionGroupBy["Month"] = "Month";
22993
+ })(ETransactionGroupBy = Tracking.ETransactionGroupBy || (Tracking.ETransactionGroupBy = {}));
22887
22994
  /**
22888
22995
  * Returns tracking data based on provided parameters.
22889
22996
  * @param params
22890
22997
  * @returns
22891
22998
  */
22892
22999
  function GetData(params) {
23000
+ var _a;
22893
23001
  return __awaiter(this, void 0, void 0, function* () {
22894
23002
  let { api, req } = params;
22895
23003
  if (!api) {
@@ -22902,6 +23010,9 @@ var Tracking;
22902
23010
  if (params.cType) {
22903
23011
  query.append("CType", params.cType);
22904
23012
  }
23013
+ if (params.tType) {
23014
+ query.append("TType", params.tType);
23015
+ }
22905
23016
  if (params.tCount) {
22906
23017
  query.append("TCount", params.tCount);
22907
23018
  }
@@ -22911,12 +23022,27 @@ var Tracking;
22911
23022
  if (params.app) {
22912
23023
  query.append("App", params.app);
22913
23024
  }
23025
+ if (params.environment) {
23026
+ query.append("Environment", params.environment);
23027
+ }
23028
+ if (params.includeDeleted != null) {
23029
+ query.append("IncludeDeleted", String(params.includeDeleted));
23030
+ }
22914
23031
  if (params.year) {
22915
23032
  query.append("Year", String(params.year));
22916
23033
  }
22917
23034
  if (params.month) {
22918
23035
  query.append("Month", String(params.month));
22919
23036
  }
23037
+ if (params.fromYear) {
23038
+ query.append("FromYear", String(params.fromYear));
23039
+ }
23040
+ if (params.fromMonth) {
23041
+ query.append("FromMonth", String(params.fromMonth));
23042
+ }
23043
+ if ((_a = params.groupBy) === null || _a === void 0 ? void 0 : _a.length) {
23044
+ query.append("GroupBy", params.groupBy.join(","));
23045
+ }
22920
23046
  return yield api.GET("tracking?" + query.toString(), Api.PrepReqParams(req));
22921
23047
  });
22922
23048
  }
@@ -25109,7 +25235,7 @@ function getFirstWrappedArray(data, wrapperKeys) {
25109
25235
  }
25110
25236
 
25111
25237
  // This is updated with the package.json version on build.
25112
- const VERSION = "7.1.113";
25238
+ const VERSION = "7.1.115";
25113
25239
 
25114
25240
  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
25241
  //# sourceMappingURL=bruce-models.es5.js.map