bruce-models 7.1.40 → 7.1.42
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 +66 -11
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +66 -11
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/entity/entity-coords.js +65 -10
- package/dist/lib/entity/entity-coords.js.map +1 -1
- package/dist/lib/style/style.js.map +1 -1
- package/dist/lib/tileset/tileset.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/entity/entity-coords.d.ts +20 -5
- package/dist/types/style/style.d.ts +1 -0
- package/dist/types/tileset/tileset.d.ts +17 -8
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -9010,19 +9010,46 @@ var EntityCoords;
|
|
|
9010
9010
|
*/
|
|
9011
9011
|
function GetEntityCoords(params) {
|
|
9012
9012
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9013
|
-
let { api, rootEntityId
|
|
9013
|
+
let { api, rootEntityId, req: reqParams } = params;
|
|
9014
9014
|
if (!api) {
|
|
9015
9015
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
9016
9016
|
}
|
|
9017
|
-
const
|
|
9017
|
+
const entityIds = (Array.isArray(rootEntityId) ? rootEntityId : [rootEntityId]).filter(id => !!id);
|
|
9018
|
+
if (!entityIds.length) {
|
|
9019
|
+
throw ("Root Entity ID is required.");
|
|
9020
|
+
}
|
|
9021
|
+
const cacheKey = GetCacheKey(Array.isArray(rootEntityId) ? entityIds : entityIds[0]);
|
|
9022
|
+
const cache = api.GetCacheItem(cacheKey, reqParams);
|
|
9018
9023
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
9019
9024
|
return cache.data;
|
|
9020
9025
|
}
|
|
9021
9026
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
9027
|
+
var _a;
|
|
9022
9028
|
try {
|
|
9023
|
-
|
|
9029
|
+
if (entityIds.length == 1) {
|
|
9030
|
+
const data = yield api.GET(`entity/${entityIds[0]}/ucs`, reqParams);
|
|
9031
|
+
res({
|
|
9032
|
+
coords: data,
|
|
9033
|
+
coordsMap: {
|
|
9034
|
+
[entityIds[0]]: data
|
|
9035
|
+
}
|
|
9036
|
+
});
|
|
9037
|
+
return;
|
|
9038
|
+
}
|
|
9039
|
+
const data = yield api.GET(`entity/ucs?rootId=${entityIds.map(encodeURIComponent).join(",")}`, reqParams);
|
|
9040
|
+
const coords = (_a = data === null || data === void 0 ? void 0 : data.Items) === null || _a === void 0 ? void 0 : _a[0];
|
|
9041
|
+
if (!coords) {
|
|
9042
|
+
throw ("No Entity coordinates found.");
|
|
9043
|
+
}
|
|
9044
|
+
const coordsMap = {};
|
|
9045
|
+
for (const item of data.Items || []) {
|
|
9046
|
+
if (item === null || item === void 0 ? void 0 : item["Entity.ID"]) {
|
|
9047
|
+
coordsMap[item["Entity.ID"]] = item;
|
|
9048
|
+
}
|
|
9049
|
+
}
|
|
9024
9050
|
res({
|
|
9025
|
-
coords
|
|
9051
|
+
coords,
|
|
9052
|
+
coordsMap
|
|
9026
9053
|
});
|
|
9027
9054
|
}
|
|
9028
9055
|
catch (e) {
|
|
@@ -9030,7 +9057,7 @@ var EntityCoords;
|
|
|
9030
9057
|
}
|
|
9031
9058
|
}));
|
|
9032
9059
|
api.SetCacheItem({
|
|
9033
|
-
key:
|
|
9060
|
+
key: cacheKey,
|
|
9034
9061
|
value: prom,
|
|
9035
9062
|
req: reqParams
|
|
9036
9063
|
});
|
|
@@ -9074,7 +9101,7 @@ var EntityCoords;
|
|
|
9074
9101
|
"test": params.test
|
|
9075
9102
|
}, reqParams);
|
|
9076
9103
|
if (!params.test) {
|
|
9077
|
-
api
|
|
9104
|
+
InvalidateCoordsCache(api, entityId);
|
|
9078
9105
|
}
|
|
9079
9106
|
return {
|
|
9080
9107
|
coords: res
|
|
@@ -9121,7 +9148,7 @@ var EntityCoords;
|
|
|
9121
9148
|
"test": params.test
|
|
9122
9149
|
}, reqParams);
|
|
9123
9150
|
if (!params.test) {
|
|
9124
|
-
api
|
|
9151
|
+
InvalidateCoordsCache(api, entityId);
|
|
9125
9152
|
}
|
|
9126
9153
|
return {
|
|
9127
9154
|
coords: res
|
|
@@ -9155,7 +9182,7 @@ var EntityCoords;
|
|
|
9155
9182
|
"test": params.test
|
|
9156
9183
|
}, reqParams);
|
|
9157
9184
|
if (!params.test) {
|
|
9158
|
-
api
|
|
9185
|
+
InvalidateCoordsCache(api, entityId);
|
|
9159
9186
|
}
|
|
9160
9187
|
return {
|
|
9161
9188
|
coords: res
|
|
@@ -9174,7 +9201,8 @@ var EntityCoords;
|
|
|
9174
9201
|
if (!api) {
|
|
9175
9202
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
9176
9203
|
}
|
|
9177
|
-
|
|
9204
|
+
yield api.DELETE(`entity/${entityId}/ucs`, reqParams);
|
|
9205
|
+
InvalidateCoordsCache(api, entityId);
|
|
9178
9206
|
});
|
|
9179
9207
|
}
|
|
9180
9208
|
EntityCoords.UnlinkCoords = UnlinkCoords;
|
|
@@ -9189,9 +9217,36 @@ var EntityCoords;
|
|
|
9189
9217
|
* @returns
|
|
9190
9218
|
*/
|
|
9191
9219
|
function GetCacheKey(entityId) {
|
|
9192
|
-
|
|
9220
|
+
const isList = Array.isArray(entityId);
|
|
9221
|
+
const id = isList ? entityId.join(",") : entityId;
|
|
9222
|
+
return Api.ECacheKey.EntityCoords + Api.ECacheKey.Entity + (isList ? Api.ECacheKey.ListId : Api.ECacheKey.Id) + id;
|
|
9193
9223
|
}
|
|
9194
9224
|
EntityCoords.GetCacheKey = GetCacheKey;
|
|
9225
|
+
/**
|
|
9226
|
+
* Invalidates all cached coords that involve the given Entity ID.
|
|
9227
|
+
*
|
|
9228
|
+
* Example:
|
|
9229
|
+
* ```
|
|
9230
|
+
* const api: BruceApi.Api = ...;
|
|
9231
|
+
* InvalidateCoordsCache(api, "123");
|
|
9232
|
+
* ```
|
|
9233
|
+
* @param api
|
|
9234
|
+
* @param entityId Single Entity whose cached coords should be invalidated.
|
|
9235
|
+
*/
|
|
9236
|
+
function InvalidateCoordsCache(api, entityId) {
|
|
9237
|
+
// Remove the exact single-entity cache entry.
|
|
9238
|
+
api.Cache.Remove(GetCacheKey(entityId));
|
|
9239
|
+
// Remove any multi-Entity cache entries whose ID list includes this Entity.
|
|
9240
|
+
const multiPrefix = Api.ECacheKey.EntityCoords + Api.ECacheKey.Entity + Api.ECacheKey.ListId;
|
|
9241
|
+
api.Cache.RemoveBy(key => {
|
|
9242
|
+
const k = String(key);
|
|
9243
|
+
if (!k.startsWith(multiPrefix)) {
|
|
9244
|
+
return false;
|
|
9245
|
+
}
|
|
9246
|
+
return k.slice(multiPrefix.length).split(",").includes(entityId);
|
|
9247
|
+
});
|
|
9248
|
+
}
|
|
9249
|
+
EntityCoords.InvalidateCoordsCache = InvalidateCoordsCache;
|
|
9195
9250
|
})(EntityCoords || (EntityCoords = {}));
|
|
9196
9251
|
|
|
9197
9252
|
/**
|
|
@@ -18511,7 +18566,7 @@ var ChangeSet;
|
|
|
18511
18566
|
})(ChangeSet || (ChangeSet = {}));
|
|
18512
18567
|
|
|
18513
18568
|
// This is updated with the package.json version on build.
|
|
18514
|
-
const VERSION = "7.1.
|
|
18569
|
+
const VERSION = "7.1.42";
|
|
18515
18570
|
|
|
18516
18571
|
export { VERSION, Assembly, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityTypeTrigger, EntityType, Entity, EntityCoords, EntityAttribute, EntityHistoricData, EntityTableView, DashboardView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, UserMfaMethod, Account, AccountConcept, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataTransform, DataLabGroup, DataFeed, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportLcc, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario, Tracking, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, ChangeSet };
|
|
18517
18572
|
//# sourceMappingURL=bruce-models.es5.js.map
|