bruce-models 3.0.5 → 3.0.8
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 +87 -58
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +87 -58
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/entity/entity.js +52 -22
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/lib/plugin/plugin.js +32 -32
- package/dist/lib/project/menu-item.js +2 -4
- package/dist/lib/project/menu-item.js.map +1 -1
- package/dist/lib/project/project-view-bookmark.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/custom-form/custom-form-content.d.ts +1 -0
- package/dist/types/entity/entity.d.ts +14 -1
- package/dist/types/project/menu-item.d.ts +34 -3
- package/dist/types/project/project-view-bookmark.d.ts +2 -1
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -2059,11 +2059,12 @@ var PathUtils;
|
|
|
2059
2059
|
*/
|
|
2060
2060
|
var Entity;
|
|
2061
2061
|
(function (Entity) {
|
|
2062
|
-
function GetCacheKey(
|
|
2062
|
+
function GetCacheKey(params) {
|
|
2063
|
+
let { entityId, entityTypeId, expandLocation, expandRelations } = params;
|
|
2063
2064
|
if (!entityTypeId) {
|
|
2064
2065
|
entityTypeId = "";
|
|
2065
2066
|
}
|
|
2066
|
-
return `${Api.ECacheKey.Entity}${Api.ECacheKey.Id}${entityId}${String(entityTypeId)}${String(Boolean(expandLocation))}`;
|
|
2067
|
+
return `${Api.ECacheKey.Entity}${Api.ECacheKey.Id}${entityId}${String(entityTypeId)}${String(Boolean(expandLocation))}${String(Boolean(expandRelations))}`;
|
|
2067
2068
|
}
|
|
2068
2069
|
Entity.GetCacheKey = GetCacheKey;
|
|
2069
2070
|
function GetContainsKey(entityId) {
|
|
@@ -2072,15 +2073,20 @@ var Entity;
|
|
|
2072
2073
|
Entity.GetContainsKey = GetContainsKey;
|
|
2073
2074
|
function Get(params) {
|
|
2074
2075
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2075
|
-
let { api, entityId, req: reqParams, expandLocation, entityTypeId } = params;
|
|
2076
|
+
let { api, entityId, req: reqParams, expandLocation, expandRelations, entityTypeId } = params;
|
|
2076
2077
|
if (!api) {
|
|
2077
2078
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
2078
2079
|
}
|
|
2079
2080
|
if (!entityId) {
|
|
2080
2081
|
throw ("Entity ID is required.");
|
|
2081
2082
|
}
|
|
2082
|
-
const key = GetCacheKey(
|
|
2083
|
-
|
|
2083
|
+
const key = GetCacheKey({
|
|
2084
|
+
entityId,
|
|
2085
|
+
entityTypeId,
|
|
2086
|
+
expandLocation,
|
|
2087
|
+
expandRelations
|
|
2088
|
+
});
|
|
2089
|
+
const cache = api.GetCacheItem(key, reqParams);
|
|
2084
2090
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
2085
2091
|
return cache.data;
|
|
2086
2092
|
}
|
|
@@ -2090,6 +2096,9 @@ var Entity;
|
|
|
2090
2096
|
if (expandLocation) {
|
|
2091
2097
|
urlParams.append("$expand", "location");
|
|
2092
2098
|
}
|
|
2099
|
+
if (expandRelations) {
|
|
2100
|
+
urlParams.append("$expand", "relation");
|
|
2101
|
+
}
|
|
2093
2102
|
if (entityTypeId) {
|
|
2094
2103
|
urlParams.append("BruceEntityType", entityTypeId);
|
|
2095
2104
|
}
|
|
@@ -2102,7 +2111,7 @@ var Entity;
|
|
|
2102
2111
|
rej(e);
|
|
2103
2112
|
}
|
|
2104
2113
|
}));
|
|
2105
|
-
|
|
2114
|
+
api.SetCacheItem({
|
|
2106
2115
|
key,
|
|
2107
2116
|
value: prom,
|
|
2108
2117
|
req: reqParams
|
|
@@ -2113,7 +2122,7 @@ var Entity;
|
|
|
2113
2122
|
Entity.Get = Get;
|
|
2114
2123
|
function GetListByIds(params) {
|
|
2115
2124
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2116
|
-
let { api, entityIds, req: reqParams } = params;
|
|
2125
|
+
let { api, entityIds, req: reqParams, expandRelations } = params;
|
|
2117
2126
|
if (!api) {
|
|
2118
2127
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
2119
2128
|
}
|
|
@@ -2124,8 +2133,8 @@ var Entity;
|
|
|
2124
2133
|
const reqIds = [];
|
|
2125
2134
|
for (let i = 0; i < entityIds.length; i++) {
|
|
2126
2135
|
const entityId = entityIds[i];
|
|
2127
|
-
const key = GetCacheKey(entityId);
|
|
2128
|
-
const cache =
|
|
2136
|
+
const key = GetCacheKey({ entityId, expandRelations });
|
|
2137
|
+
const cache = api.GetCacheItem(key, reqParams);
|
|
2129
2138
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
2130
2139
|
reqs.push(cache.data);
|
|
2131
2140
|
}
|
|
@@ -2142,10 +2151,14 @@ var Entity;
|
|
|
2142
2151
|
PageSize: reqIds.length
|
|
2143
2152
|
};
|
|
2144
2153
|
if (reqIds.length > 0) {
|
|
2145
|
-
const
|
|
2154
|
+
const urlParams = new URLSearchParams();
|
|
2155
|
+
if (expandRelations) {
|
|
2156
|
+
urlParams.append("$expand", "relation");
|
|
2157
|
+
}
|
|
2158
|
+
const req = api.POST("entities?" + urlParams.toString(), reqData, Api.PrepReqParams(reqParams));
|
|
2146
2159
|
for (let i = 0; i < reqIds.length; i++) {
|
|
2147
2160
|
const entityId = reqIds[i];
|
|
2148
|
-
const key = GetCacheKey(entityId);
|
|
2161
|
+
const key = GetCacheKey({ entityId });
|
|
2149
2162
|
const prom = new Promise((res) => __awaiter(this, void 0, void 0, function* () {
|
|
2150
2163
|
try {
|
|
2151
2164
|
const data = yield req;
|
|
@@ -2159,7 +2172,7 @@ var Entity;
|
|
|
2159
2172
|
}
|
|
2160
2173
|
res(null);
|
|
2161
2174
|
}));
|
|
2162
|
-
|
|
2175
|
+
api.SetCacheItem({
|
|
2163
2176
|
key,
|
|
2164
2177
|
value: prom,
|
|
2165
2178
|
req: reqParams
|
|
@@ -2316,7 +2329,7 @@ var Entity;
|
|
|
2316
2329
|
function GetList(params) {
|
|
2317
2330
|
var _a;
|
|
2318
2331
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2319
|
-
let { api, filter, req: reqParams, viaCdn, viaCdnCacheToken, analysis } = params;
|
|
2332
|
+
let { api, filter, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations } = params;
|
|
2320
2333
|
if (!api) {
|
|
2321
2334
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
2322
2335
|
}
|
|
@@ -2351,12 +2364,17 @@ var Entity;
|
|
|
2351
2364
|
};
|
|
2352
2365
|
let totalCount;
|
|
2353
2366
|
let entities = [];
|
|
2354
|
-
if (analysis || (viaCdn && api.EntityCdnUrl)) {
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2367
|
+
if (analysis || expandRelations || (viaCdn && api.EntityCdnUrl)) {
|
|
2368
|
+
let url;
|
|
2369
|
+
if (analysis) {
|
|
2370
|
+
url = new URL(api.GetBaseUrl() + "entities/summary");
|
|
2371
|
+
}
|
|
2372
|
+
else if (viaCdn && api.EntityCdnUrl) {
|
|
2373
|
+
url = new URL(api.EntityCdnUrl);
|
|
2374
|
+
}
|
|
2375
|
+
else {
|
|
2376
|
+
url = new URL(api.GetBaseUrl() + "entities");
|
|
2377
|
+
}
|
|
2360
2378
|
const urlParams = new URLSearchParams(url.search);
|
|
2361
2379
|
urlParams.set("cacheToken", String(viaCdnCacheToken ? viaCdnCacheToken : 0));
|
|
2362
2380
|
if (body.SortOrder) {
|
|
@@ -2380,6 +2398,9 @@ var Entity;
|
|
|
2380
2398
|
if (body.PageSize) {
|
|
2381
2399
|
urlParams.set("PageSize", String(body.PageSize));
|
|
2382
2400
|
}
|
|
2401
|
+
if (expandRelations) {
|
|
2402
|
+
urlParams.append("$expand", "relation");
|
|
2403
|
+
}
|
|
2383
2404
|
const urlStr = url.toString() + "?" + urlParams.toString();
|
|
2384
2405
|
const data = yield api.get(urlStr, Api.PrepReqParams(reqParams));
|
|
2385
2406
|
if (!analysis) {
|
|
@@ -2388,15 +2409,24 @@ var Entity;
|
|
|
2388
2409
|
totalCount = data.TotalCount;
|
|
2389
2410
|
}
|
|
2390
2411
|
else {
|
|
2391
|
-
const
|
|
2412
|
+
const url = new URL(api.GetBaseUrl() + (analysis ? "entities/summary" : "entities"));
|
|
2413
|
+
const urlParams = new URLSearchParams(url.search);
|
|
2414
|
+
if (expandRelations) {
|
|
2415
|
+
urlParams.append("$expand", "relation");
|
|
2416
|
+
}
|
|
2417
|
+
const urlStr = url.toString() + "?" + urlParams.toString();
|
|
2418
|
+
const data = yield api.post(urlStr, body, Api.PrepReqParams(reqParams));
|
|
2392
2419
|
if (!analysis) {
|
|
2393
2420
|
entities = data.Items;
|
|
2394
2421
|
// Only caching when non-CDN.
|
|
2395
2422
|
for (let i = 0; i < entities.length; i++) {
|
|
2396
2423
|
const entity = entities[i];
|
|
2397
2424
|
const id = entity.Bruce.ID;
|
|
2398
|
-
|
|
2399
|
-
key: GetCacheKey(
|
|
2425
|
+
api.SetCacheItem({
|
|
2426
|
+
key: GetCacheKey({
|
|
2427
|
+
entityId: id,
|
|
2428
|
+
expandRelations
|
|
2429
|
+
}),
|
|
2400
2430
|
value: {
|
|
2401
2431
|
entity: entity
|
|
2402
2432
|
},
|
|
@@ -6589,7 +6619,9 @@ var MenuItem;
|
|
|
6589
6619
|
EType["PointCloud"] = "PointCloudTileset";
|
|
6590
6620
|
EType["EntitiesLoaded"] = "LoadedEntities";
|
|
6591
6621
|
EType["EntitiesIds"] = "EntitiesIds";
|
|
6622
|
+
// Deprecated. Use Relationships instead.
|
|
6592
6623
|
EType["Relations"] = "Relations";
|
|
6624
|
+
EType["Relationships"] = "Relationships";
|
|
6593
6625
|
EType["GooglePhotoTileset"] = "GooglePhotoTileset";
|
|
6594
6626
|
})(EType = MenuItem.EType || (MenuItem.EType = {}));
|
|
6595
6627
|
function CreateFromEntityId(entityId, typeId, styleId) {
|
|
@@ -6678,9 +6710,6 @@ var MenuItem;
|
|
|
6678
6710
|
throw ("Tileset type not supported.");
|
|
6679
6711
|
}
|
|
6680
6712
|
MenuItem.CreateFromTilesetId = CreateFromTilesetId;
|
|
6681
|
-
let Item;
|
|
6682
|
-
(function (Item) {
|
|
6683
|
-
})(Item = MenuItem.Item || (MenuItem.Item = {}));
|
|
6684
6713
|
})(MenuItem || (MenuItem = {}));
|
|
6685
6714
|
|
|
6686
6715
|
/**
|
|
@@ -8967,40 +8996,40 @@ var Plugin;
|
|
|
8967
8996
|
window[paramsId] = pluginParams ? pluginParams : {};
|
|
8968
8997
|
const disposeId = ObjectUtils.UId();
|
|
8969
8998
|
const elementId = ObjectUtils.UId();
|
|
8970
|
-
let script = `
|
|
8971
|
-
function run() {
|
|
8972
|
-
${fileContent}
|
|
8973
|
-
|
|
8974
|
-
const paramsId = "${paramsId}";
|
|
8975
|
-
const containerId = "${containerId}";
|
|
8976
|
-
let container;
|
|
8977
|
-
if (containerId) {
|
|
8978
|
-
container = document.getElementById("${containerId}");
|
|
8979
|
-
}
|
|
8980
|
-
|
|
8981
|
-
let pluginHTML = null;
|
|
8982
|
-
if (container) {
|
|
8983
|
-
pluginHTML = document.createElement("div");
|
|
8984
|
-
pluginHTML.id = "${elementId}";
|
|
8985
|
-
container.appendChild(pluginHTML);
|
|
8986
|
-
}
|
|
8987
|
-
|
|
8988
|
-
{TEMPLATE_CODE}
|
|
8989
|
-
const params = window["${paramsId}"];
|
|
8990
|
-
|
|
8991
|
-
window["${disposeId}"] = Run({
|
|
8992
|
-
element: pluginHTML,
|
|
8993
|
-
container: container,
|
|
8994
|
-
pluginParams: params
|
|
8995
|
-
});
|
|
8996
|
-
}
|
|
8997
|
-
run();
|
|
8999
|
+
let script = `
|
|
9000
|
+
function run() {
|
|
9001
|
+
${fileContent}
|
|
9002
|
+
|
|
9003
|
+
const paramsId = "${paramsId}";
|
|
9004
|
+
const containerId = "${containerId}";
|
|
9005
|
+
let container;
|
|
9006
|
+
if (containerId) {
|
|
9007
|
+
container = document.getElementById("${containerId}");
|
|
9008
|
+
}
|
|
9009
|
+
|
|
9010
|
+
let pluginHTML = null;
|
|
9011
|
+
if (container) {
|
|
9012
|
+
pluginHTML = document.createElement("div");
|
|
9013
|
+
pluginHTML.id = "${elementId}";
|
|
9014
|
+
container.appendChild(pluginHTML);
|
|
9015
|
+
}
|
|
9016
|
+
|
|
9017
|
+
{TEMPLATE_CODE}
|
|
9018
|
+
const params = window["${paramsId}"];
|
|
9019
|
+
|
|
9020
|
+
window["${disposeId}"] = Run({
|
|
9021
|
+
element: pluginHTML,
|
|
9022
|
+
container: container,
|
|
9023
|
+
pluginParams: params
|
|
9024
|
+
});
|
|
9025
|
+
}
|
|
9026
|
+
run();
|
|
8998
9027
|
`;
|
|
8999
9028
|
if (script.includes("var template")) {
|
|
9000
|
-
script = script.replace("{TEMPLATE_CODE}", `
|
|
9001
|
-
if (pluginHTML && template) {
|
|
9002
|
-
pluginHTML.innerHTML = template;
|
|
9003
|
-
}
|
|
9029
|
+
script = script.replace("{TEMPLATE_CODE}", `
|
|
9030
|
+
if (pluginHTML && template) {
|
|
9031
|
+
pluginHTML.innerHTML = template;
|
|
9032
|
+
}
|
|
9004
9033
|
`);
|
|
9005
9034
|
}
|
|
9006
9035
|
else {
|
|
@@ -9139,7 +9168,7 @@ var DataSource;
|
|
|
9139
9168
|
DataSource.GetList = GetList;
|
|
9140
9169
|
})(DataSource || (DataSource = {}));
|
|
9141
9170
|
|
|
9142
|
-
const VERSION = "3.0.
|
|
9171
|
+
const VERSION = "3.0.8";
|
|
9143
9172
|
|
|
9144
9173
|
export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
|
|
9145
9174
|
//# sourceMappingURL=bruce-models.es5.js.map
|