bruce-models 7.1.68 → 7.1.70

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.
@@ -79,6 +79,7 @@ var Api;
79
79
  ECacheKey["DatabaseRegion"] = "databaseregion";
80
80
  ECacheKey["CustomForm"] = "customform";
81
81
  ECacheKey["ImportedFile"] = "importedfile";
82
+ ECacheKey["UIMarkup"] = "uimarkup";
82
83
  ECacheKey["Plugin"] = "plugin";
83
84
  ECacheKey["PluginIndexFile"] = "pluginindexfile";
84
85
  ECacheKey["EntityHistoricData"] = "entityhistoricdata";
@@ -353,6 +354,7 @@ var AccountConcept;
353
354
  EConcept["TILESET"] = "ts";
354
355
  EConcept["UI_DASHBOARD_VIEW"] = "dbv";
355
356
  EConcept["UI_ENTITY_DISPLAY_SETTING"] = "s";
357
+ EConcept["UI_MARKUP"] = "um";
356
358
  EConcept["UI_PLUGIN"] = "pg";
357
359
  EConcept["UI_SLIDE"] = "pvs";
358
360
  EConcept["UI_SLIDE_GROUP"] = "sg";
@@ -418,6 +420,7 @@ var AccountConcept;
418
420
  { concept: EConcept.TILESET, label: "Tileset", description: undefined },
419
421
  { concept: EConcept.UI_DASHBOARD_VIEW, label: "Dashboard View", description: undefined },
420
422
  { concept: EConcept.UI_ENTITY_DISPLAY_SETTING, label: "Style", description: undefined },
423
+ { concept: EConcept.UI_MARKUP, label: "Markup", description: undefined },
421
424
  { concept: EConcept.UI_PLUGIN, label: "Plugin", description: undefined },
422
425
  { concept: EConcept.UI_SLIDE, label: "Bookmark", description: undefined },
423
426
  { concept: EConcept.UI_SLIDE_GROUP, label: "Bookmark Group", description: undefined },
@@ -660,6 +663,8 @@ var RecordChangeFeed;
660
663
  return [Api.ECacheKey.Tileset, Api.ECacheKey.PublishTileset, Api.ECacheKey.TilesetAccess];
661
664
  case AccountConcept.EConcept.UI_ENTITY_DISPLAY_SETTING:
662
665
  return [Api.ECacheKey.Style];
666
+ case AccountConcept.EConcept.UI_MARKUP:
667
+ return [Api.ECacheKey.UIMarkup];
663
668
  case AccountConcept.EConcept.UI_PLUGIN:
664
669
  return [Api.ECacheKey.Plugin, Api.ECacheKey.PluginIndexFile];
665
670
  case AccountConcept.EConcept.UI_SLIDE:
@@ -5362,13 +5367,18 @@ var EntityType;
5362
5367
  }
5363
5368
  const data = yield Promise.all(reqs);
5364
5369
  // Populate array, while checking for already added types.
5370
+ // Batched ID requests can overlap.
5365
5371
  const types = [];
5372
+ const seenIds = new Set();
5366
5373
  for (const item of data) {
5367
5374
  for (const type of item.Items) {
5368
- appendInternalAttrSchema(type);
5369
- if (!types.find(x => x.ID == type.ID)) {
5370
- types.push(type);
5375
+ const key = String(type.ID);
5376
+ if (seenIds.has(key)) {
5377
+ continue;
5371
5378
  }
5379
+ seenIds.add(key);
5380
+ appendInternalAttrSchema(type);
5381
+ types.push(type);
5372
5382
  }
5373
5383
  }
5374
5384
  res({
@@ -6365,13 +6375,22 @@ var Entity;
6365
6375
  const reqs = [];
6366
6376
  if (reqIds.length > 0) {
6367
6377
  const req = api.POST(url, reqData, Api.PrepReqParams(reqParams));
6378
+ const itemsById = req.then(data => {
6379
+ const map = new Map();
6380
+ for (const item of data.Items) {
6381
+ const id = String(item.Bruce.ID);
6382
+ if (!map.has(id)) {
6383
+ map.set(id, item);
6384
+ }
6385
+ }
6386
+ return map;
6387
+ });
6368
6388
  for (let i = 0; i < reqIds.length; i++) {
6369
6389
  const entityId = reqIds[i];
6370
6390
  const key = GetCacheKey(Object.assign(Object.assign({}, cacheKeyData), { entityId }));
6371
6391
  const prom = new Promise((res) => __awaiter(this, void 0, void 0, function* () {
6372
6392
  try {
6373
- const data = yield req;
6374
- const item = data.Items.find(x => x.Bruce.ID == entityId);
6393
+ const item = (yield itemsById).get(String(entityId));
6375
6394
  res({
6376
6395
  entity: item
6377
6396
  });
@@ -13392,11 +13411,19 @@ var EntitySource;
13392
13411
  rej(e);
13393
13412
  }
13394
13413
  }));
13414
+ const sourcesByKey = prom.then((sources) => {
13415
+ const map = new Map();
13416
+ for (const s of sources) {
13417
+ if (!map.has(s["SourceRecord.Key"])) {
13418
+ map.set(s["SourceRecord.Key"], s);
13419
+ }
13420
+ }
13421
+ return map;
13422
+ });
13395
13423
  for (let i = 0; i < reqKeys.length; i++) {
13396
13424
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
13397
13425
  try {
13398
- const sources = yield prom;
13399
- res(sources.find((s) => s["SourceRecord.Key"] === reqKeys[i]));
13426
+ res((yield sourcesByKey).get(reqKeys[i]));
13400
13427
  }
13401
13428
  catch (e) {
13402
13429
  rej(e);
@@ -13667,12 +13694,20 @@ var EntityTag;
13667
13694
  rej(e);
13668
13695
  }
13669
13696
  }));
13697
+ const tagsById = prom.then((tags) => {
13698
+ const map = new Map();
13699
+ for (const t of tags) {
13700
+ if (!map.has(t.ID)) {
13701
+ map.set(t.ID, t);
13702
+ }
13703
+ }
13704
+ return map;
13705
+ });
13670
13706
  for (let i = 0; i < reqIds.length; i++) {
13671
13707
  const id = reqIds[i];
13672
13708
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
13673
13709
  try {
13674
- const tags = yield prom;
13675
- const tag = tags.find((t) => t.ID === id);
13710
+ const tag = (yield tagsById).get(id);
13676
13711
  res({
13677
13712
  tag: tag
13678
13713
  });
@@ -14779,6 +14814,153 @@ var Markup;
14779
14814
  })(Circle = Markup.Circle || (Markup.Circle = {}));
14780
14815
  })(Markup || (Markup = {}));
14781
14816
 
14817
+ /**
14818
+ * Describes the "UI.Markup" concept within Nextspace.
14819
+ * These records store reusable markup payloads as first-class API records.
14820
+ */
14821
+ var UIMarkup;
14822
+ (function (UIMarkup) {
14823
+ /**
14824
+ * Returns a UI.Markup record.
14825
+ * @param params
14826
+ */
14827
+ function Get(params) {
14828
+ return __awaiter(this, void 0, void 0, function* () {
14829
+ let { api, markupId, req: reqParams } = params;
14830
+ if (markupId == null || markupId <= 0) {
14831
+ throw ("Markup ID is required.");
14832
+ }
14833
+ if (!api) {
14834
+ api = ENVIRONMENT.Api().GetBruceApi();
14835
+ }
14836
+ const key = GetCacheKey(markupId);
14837
+ const cache = api.GetCacheItem(key, reqParams);
14838
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
14839
+ return cache.data;
14840
+ }
14841
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
14842
+ try {
14843
+ const data = yield api.GET(`ui.markup/${markupId}`, Api.PrepReqParams(reqParams));
14844
+ res({
14845
+ markup: data
14846
+ });
14847
+ }
14848
+ catch (e) {
14849
+ rej(e);
14850
+ }
14851
+ }));
14852
+ api.SetCacheItem({
14853
+ key,
14854
+ value: req,
14855
+ req: reqParams
14856
+ });
14857
+ return req;
14858
+ });
14859
+ }
14860
+ UIMarkup.Get = Get;
14861
+ /**
14862
+ * Returns the list of UI.Markup records.
14863
+ * @param params
14864
+ */
14865
+ function GetList(params) {
14866
+ return __awaiter(this, void 0, void 0, function* () {
14867
+ if (!params) {
14868
+ params = {};
14869
+ }
14870
+ let { api, req: reqParams } = params;
14871
+ if (!api) {
14872
+ api = ENVIRONMENT.Api().GetBruceApi();
14873
+ }
14874
+ const key = GetListCacheKey();
14875
+ const cache = api.GetCacheItem(key, reqParams);
14876
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
14877
+ return cache.data;
14878
+ }
14879
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
14880
+ var _a;
14881
+ try {
14882
+ const data = yield api.GET("ui.markups", Api.PrepReqParams(reqParams));
14883
+ res({
14884
+ markups: (_a = data === null || data === void 0 ? void 0 : data.Items) !== null && _a !== void 0 ? _a : []
14885
+ });
14886
+ }
14887
+ catch (e) {
14888
+ rej(e);
14889
+ }
14890
+ }));
14891
+ api.SetCacheItem({
14892
+ key,
14893
+ value: req,
14894
+ req: reqParams
14895
+ });
14896
+ return req;
14897
+ });
14898
+ }
14899
+ UIMarkup.GetList = GetList;
14900
+ /**
14901
+ * Creates or updates a UI.Markup record.
14902
+ * @param params
14903
+ */
14904
+ function Update(params) {
14905
+ return __awaiter(this, void 0, void 0, function* () {
14906
+ let { markup, api, req: reqParams } = params;
14907
+ if (!api) {
14908
+ api = ENVIRONMENT.Api().GetBruceApi();
14909
+ }
14910
+ if (!markup) {
14911
+ markup = {};
14912
+ }
14913
+ const markupId = markup.ID && markup.ID > 0 ? markup.ID : 0;
14914
+ const res = yield api.POST(`ui.markup/${markupId}`, markup, Api.PrepReqParams(reqParams));
14915
+ if (markup.ID && markup.ID > 0) {
14916
+ api.Cache.Remove(GetCacheKey(markup.ID));
14917
+ }
14918
+ if ((res === null || res === void 0 ? void 0 : res.ID) && res.ID > 0) {
14919
+ api.Cache.Remove(GetCacheKey(res.ID));
14920
+ }
14921
+ api.Cache.RemoveByStartsWith(GetListCacheKey());
14922
+ return {
14923
+ markup: res
14924
+ };
14925
+ });
14926
+ }
14927
+ UIMarkup.Update = Update;
14928
+ /**
14929
+ * Deletes a UI.Markup record.
14930
+ * @param params
14931
+ */
14932
+ function Delete(params) {
14933
+ return __awaiter(this, void 0, void 0, function* () {
14934
+ let { markupId, api, req: reqParams } = params;
14935
+ if (markupId == null || markupId <= 0) {
14936
+ throw ("Markup ID is required.");
14937
+ }
14938
+ if (!api) {
14939
+ api = ENVIRONMENT.Api().GetBruceApi();
14940
+ }
14941
+ yield api.DELETE(`ui.markup/${markupId}`, Api.PrepReqParams(reqParams));
14942
+ api.Cache.Remove(GetCacheKey(markupId));
14943
+ api.Cache.RemoveByStartsWith(GetListCacheKey());
14944
+ });
14945
+ }
14946
+ UIMarkup.Delete = Delete;
14947
+ /**
14948
+ * Returns cache identifier for a UI.Markup record.
14949
+ * @param id
14950
+ */
14951
+ function GetCacheKey(id) {
14952
+ return `${Api.ECacheKey.UIMarkup}${Api.ECacheKey.Id}${id}`;
14953
+ }
14954
+ UIMarkup.GetCacheKey = GetCacheKey;
14955
+ /**
14956
+ * Returns cache identifier for the UI.Markup list.
14957
+ */
14958
+ function GetListCacheKey() {
14959
+ return Api.ECacheKey.UIMarkup;
14960
+ }
14961
+ UIMarkup.GetListCacheKey = GetListCacheKey;
14962
+ })(UIMarkup || (UIMarkup = {}));
14963
+
14782
14964
  const DEFAULT_JOB_POLL_INTERVAL_MS = 1000;
14783
14965
  const DEFAULT_JOB_POLL_TIMEOUT_MS = 10 * 60 * 1000; // match server timeout (10 minutes)
14784
14966
  const NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED = "entity_highlight_applied";
@@ -15892,8 +16074,9 @@ var Tileset;
15892
16074
  }
15893
16075
  else if (tilesetIds.length > 1) {
15894
16076
  const tilesets = yield api.GET("ui.tilesets", Api.PrepReqParams(reqParams));
16077
+ const tilesetIdsSet = new Set(tilesetIds);
15895
16078
  for (const tileset of tilesets) {
15896
- if (tilesetIds.indexOf(tileset.ID) >= 0) {
16079
+ if (tilesetIdsSet.has(tileset.ID)) {
15897
16080
  mapping[tileset.ID] = tileset.Type;
15898
16081
  }
15899
16082
  }
@@ -19605,7 +19788,7 @@ var UrlUtils;
19605
19788
  })(UrlUtils || (UrlUtils = {}));
19606
19789
 
19607
19790
  // This is updated with the package.json version on build.
19608
- const VERSION = "7.1.68";
19791
+ const VERSION = "7.1.70";
19609
19792
 
19610
- export { VERSION, Account, AccountAudit, AccountConcept, AccountFeatures, AccountInvite, AccountLimits, AccountTemplate, AccountType, AnnDocument, AbstractApi, Api, ApiGetters, BruceApi, GlobalApi, GuardianApi, Assembly, Calculator, ChangeSet, ClientFile, Bounds, BruceEvent, BruceVariable, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, 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, EntityTypeTrigger, Ontology, ENVIRONMENT, ExportBrz, ExportUsd, ImportAssembly, ImportCad, ImportCsv, ImportGeoJson, ImportJson, ImportKml, ImportLcc, ImportedFile, Uploader, Markup, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, Plugin, 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 };
19793
+ export { VERSION, Account, AccountAudit, AccountConcept, AccountFeatures, AccountInvite, AccountLimits, AccountTemplate, AccountType, AnnDocument, AbstractApi, Api, ApiGetters, BruceApi, GlobalApi, GuardianApi, Assembly, Calculator, ChangeSet, ClientFile, Bounds, BruceEvent, BruceVariable, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, 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, EntityTypeTrigger, Ontology, ENVIRONMENT, ExportBrz, ExportUsd, ImportAssembly, ImportCad, ImportCsv, ImportGeoJson, ImportJson, ImportKml, ImportLcc, ImportedFile, Uploader, Markup, UIMarkup, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, Plugin, 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 };
19611
19794
  //# sourceMappingURL=bruce-models.es5.js.map