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.umd.js
CHANGED
|
@@ -2016,11 +2016,12 @@
|
|
|
2016
2016
|
})(exports.PathUtils || (exports.PathUtils = {}));
|
|
2017
2017
|
|
|
2018
2018
|
(function (Entity) {
|
|
2019
|
-
function GetCacheKey(
|
|
2019
|
+
function GetCacheKey(params) {
|
|
2020
|
+
let { entityId, entityTypeId, expandLocation, expandRelations } = params;
|
|
2020
2021
|
if (!entityTypeId) {
|
|
2021
2022
|
entityTypeId = "";
|
|
2022
2023
|
}
|
|
2023
|
-
return `${exports.Api.ECacheKey.Entity}${exports.Api.ECacheKey.Id}${entityId}${String(entityTypeId)}${String(Boolean(expandLocation))}`;
|
|
2024
|
+
return `${exports.Api.ECacheKey.Entity}${exports.Api.ECacheKey.Id}${entityId}${String(entityTypeId)}${String(Boolean(expandLocation))}${String(Boolean(expandRelations))}`;
|
|
2024
2025
|
}
|
|
2025
2026
|
Entity.GetCacheKey = GetCacheKey;
|
|
2026
2027
|
function GetContainsKey(entityId) {
|
|
@@ -2029,15 +2030,20 @@
|
|
|
2029
2030
|
Entity.GetContainsKey = GetContainsKey;
|
|
2030
2031
|
function Get(params) {
|
|
2031
2032
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2032
|
-
let { api, entityId, req: reqParams, expandLocation, entityTypeId } = params;
|
|
2033
|
+
let { api, entityId, req: reqParams, expandLocation, expandRelations, entityTypeId } = params;
|
|
2033
2034
|
if (!api) {
|
|
2034
2035
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
2035
2036
|
}
|
|
2036
2037
|
if (!entityId) {
|
|
2037
2038
|
throw ("Entity ID is required.");
|
|
2038
2039
|
}
|
|
2039
|
-
const key = GetCacheKey(
|
|
2040
|
-
|
|
2040
|
+
const key = GetCacheKey({
|
|
2041
|
+
entityId,
|
|
2042
|
+
entityTypeId,
|
|
2043
|
+
expandLocation,
|
|
2044
|
+
expandRelations
|
|
2045
|
+
});
|
|
2046
|
+
const cache = api.GetCacheItem(key, reqParams);
|
|
2041
2047
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
2042
2048
|
return cache.data;
|
|
2043
2049
|
}
|
|
@@ -2047,6 +2053,9 @@
|
|
|
2047
2053
|
if (expandLocation) {
|
|
2048
2054
|
urlParams.append("$expand", "location");
|
|
2049
2055
|
}
|
|
2056
|
+
if (expandRelations) {
|
|
2057
|
+
urlParams.append("$expand", "relation");
|
|
2058
|
+
}
|
|
2050
2059
|
if (entityTypeId) {
|
|
2051
2060
|
urlParams.append("BruceEntityType", entityTypeId);
|
|
2052
2061
|
}
|
|
@@ -2059,7 +2068,7 @@
|
|
|
2059
2068
|
rej(e);
|
|
2060
2069
|
}
|
|
2061
2070
|
}));
|
|
2062
|
-
|
|
2071
|
+
api.SetCacheItem({
|
|
2063
2072
|
key,
|
|
2064
2073
|
value: prom,
|
|
2065
2074
|
req: reqParams
|
|
@@ -2070,7 +2079,7 @@
|
|
|
2070
2079
|
Entity.Get = Get;
|
|
2071
2080
|
function GetListByIds(params) {
|
|
2072
2081
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2073
|
-
let { api, entityIds, req: reqParams } = params;
|
|
2082
|
+
let { api, entityIds, req: reqParams, expandRelations } = params;
|
|
2074
2083
|
if (!api) {
|
|
2075
2084
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
2076
2085
|
}
|
|
@@ -2081,8 +2090,8 @@
|
|
|
2081
2090
|
const reqIds = [];
|
|
2082
2091
|
for (let i = 0; i < entityIds.length; i++) {
|
|
2083
2092
|
const entityId = entityIds[i];
|
|
2084
|
-
const key = GetCacheKey(entityId);
|
|
2085
|
-
const cache =
|
|
2093
|
+
const key = GetCacheKey({ entityId, expandRelations });
|
|
2094
|
+
const cache = api.GetCacheItem(key, reqParams);
|
|
2086
2095
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
2087
2096
|
reqs.push(cache.data);
|
|
2088
2097
|
}
|
|
@@ -2099,10 +2108,14 @@
|
|
|
2099
2108
|
PageSize: reqIds.length
|
|
2100
2109
|
};
|
|
2101
2110
|
if (reqIds.length > 0) {
|
|
2102
|
-
const
|
|
2111
|
+
const urlParams = new URLSearchParams();
|
|
2112
|
+
if (expandRelations) {
|
|
2113
|
+
urlParams.append("$expand", "relation");
|
|
2114
|
+
}
|
|
2115
|
+
const req = api.POST("entities?" + urlParams.toString(), reqData, exports.Api.PrepReqParams(reqParams));
|
|
2103
2116
|
for (let i = 0; i < reqIds.length; i++) {
|
|
2104
2117
|
const entityId = reqIds[i];
|
|
2105
|
-
const key = GetCacheKey(entityId);
|
|
2118
|
+
const key = GetCacheKey({ entityId });
|
|
2106
2119
|
const prom = new Promise((res) => __awaiter(this, void 0, void 0, function* () {
|
|
2107
2120
|
try {
|
|
2108
2121
|
const data = yield req;
|
|
@@ -2116,7 +2129,7 @@
|
|
|
2116
2129
|
}
|
|
2117
2130
|
res(null);
|
|
2118
2131
|
}));
|
|
2119
|
-
|
|
2132
|
+
api.SetCacheItem({
|
|
2120
2133
|
key,
|
|
2121
2134
|
value: prom,
|
|
2122
2135
|
req: reqParams
|
|
@@ -2273,7 +2286,7 @@
|
|
|
2273
2286
|
function GetList(params) {
|
|
2274
2287
|
var _a;
|
|
2275
2288
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2276
|
-
let { api, filter, req: reqParams, viaCdn, viaCdnCacheToken, analysis } = params;
|
|
2289
|
+
let { api, filter, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations } = params;
|
|
2277
2290
|
if (!api) {
|
|
2278
2291
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
2279
2292
|
}
|
|
@@ -2308,12 +2321,17 @@
|
|
|
2308
2321
|
};
|
|
2309
2322
|
let totalCount;
|
|
2310
2323
|
let entities = [];
|
|
2311
|
-
if (analysis || (viaCdn && api.EntityCdnUrl)) {
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2324
|
+
if (analysis || expandRelations || (viaCdn && api.EntityCdnUrl)) {
|
|
2325
|
+
let url;
|
|
2326
|
+
if (analysis) {
|
|
2327
|
+
url = new URL(api.GetBaseUrl() + "entities/summary");
|
|
2328
|
+
}
|
|
2329
|
+
else if (viaCdn && api.EntityCdnUrl) {
|
|
2330
|
+
url = new URL(api.EntityCdnUrl);
|
|
2331
|
+
}
|
|
2332
|
+
else {
|
|
2333
|
+
url = new URL(api.GetBaseUrl() + "entities");
|
|
2334
|
+
}
|
|
2317
2335
|
const urlParams = new URLSearchParams(url.search);
|
|
2318
2336
|
urlParams.set("cacheToken", String(viaCdnCacheToken ? viaCdnCacheToken : 0));
|
|
2319
2337
|
if (body.SortOrder) {
|
|
@@ -2337,6 +2355,9 @@
|
|
|
2337
2355
|
if (body.PageSize) {
|
|
2338
2356
|
urlParams.set("PageSize", String(body.PageSize));
|
|
2339
2357
|
}
|
|
2358
|
+
if (expandRelations) {
|
|
2359
|
+
urlParams.append("$expand", "relation");
|
|
2360
|
+
}
|
|
2340
2361
|
const urlStr = url.toString() + "?" + urlParams.toString();
|
|
2341
2362
|
const data = yield api.get(urlStr, exports.Api.PrepReqParams(reqParams));
|
|
2342
2363
|
if (!analysis) {
|
|
@@ -2345,15 +2366,24 @@
|
|
|
2345
2366
|
totalCount = data.TotalCount;
|
|
2346
2367
|
}
|
|
2347
2368
|
else {
|
|
2348
|
-
const
|
|
2369
|
+
const url = new URL(api.GetBaseUrl() + (analysis ? "entities/summary" : "entities"));
|
|
2370
|
+
const urlParams = new URLSearchParams(url.search);
|
|
2371
|
+
if (expandRelations) {
|
|
2372
|
+
urlParams.append("$expand", "relation");
|
|
2373
|
+
}
|
|
2374
|
+
const urlStr = url.toString() + "?" + urlParams.toString();
|
|
2375
|
+
const data = yield api.post(urlStr, body, exports.Api.PrepReqParams(reqParams));
|
|
2349
2376
|
if (!analysis) {
|
|
2350
2377
|
entities = data.Items;
|
|
2351
2378
|
// Only caching when non-CDN.
|
|
2352
2379
|
for (let i = 0; i < entities.length; i++) {
|
|
2353
2380
|
const entity = entities[i];
|
|
2354
2381
|
const id = entity.Bruce.ID;
|
|
2355
|
-
|
|
2356
|
-
key: GetCacheKey(
|
|
2382
|
+
api.SetCacheItem({
|
|
2383
|
+
key: GetCacheKey({
|
|
2384
|
+
entityId: id,
|
|
2385
|
+
expandRelations
|
|
2386
|
+
}),
|
|
2357
2387
|
value: {
|
|
2358
2388
|
entity: entity
|
|
2359
2389
|
},
|
|
@@ -6425,7 +6455,9 @@
|
|
|
6425
6455
|
EType["PointCloud"] = "PointCloudTileset";
|
|
6426
6456
|
EType["EntitiesLoaded"] = "LoadedEntities";
|
|
6427
6457
|
EType["EntitiesIds"] = "EntitiesIds";
|
|
6458
|
+
// Deprecated. Use Relationships instead.
|
|
6428
6459
|
EType["Relations"] = "Relations";
|
|
6460
|
+
EType["Relationships"] = "Relationships";
|
|
6429
6461
|
EType["GooglePhotoTileset"] = "GooglePhotoTileset";
|
|
6430
6462
|
})(EType = MenuItem.EType || (MenuItem.EType = {}));
|
|
6431
6463
|
function CreateFromEntityId(entityId, typeId, styleId) {
|
|
@@ -6514,9 +6546,6 @@
|
|
|
6514
6546
|
throw ("Tileset type not supported.");
|
|
6515
6547
|
}
|
|
6516
6548
|
MenuItem.CreateFromTilesetId = CreateFromTilesetId;
|
|
6517
|
-
let Item;
|
|
6518
|
-
(function (Item) {
|
|
6519
|
-
})(Item = MenuItem.Item || (MenuItem.Item = {}));
|
|
6520
6549
|
})(exports.MenuItem || (exports.MenuItem = {}));
|
|
6521
6550
|
|
|
6522
6551
|
(function (ProjectViewBookmark) {
|
|
@@ -8734,40 +8763,40 @@
|
|
|
8734
8763
|
window[paramsId] = pluginParams ? pluginParams : {};
|
|
8735
8764
|
const disposeId = exports.ObjectUtils.UId();
|
|
8736
8765
|
const elementId = exports.ObjectUtils.UId();
|
|
8737
|
-
let script = `
|
|
8738
|
-
function run() {
|
|
8739
|
-
${fileContent}
|
|
8740
|
-
|
|
8741
|
-
const paramsId = "${paramsId}";
|
|
8742
|
-
const containerId = "${containerId}";
|
|
8743
|
-
let container;
|
|
8744
|
-
if (containerId) {
|
|
8745
|
-
container = document.getElementById("${containerId}");
|
|
8746
|
-
}
|
|
8747
|
-
|
|
8748
|
-
let pluginHTML = null;
|
|
8749
|
-
if (container) {
|
|
8750
|
-
pluginHTML = document.createElement("div");
|
|
8751
|
-
pluginHTML.id = "${elementId}";
|
|
8752
|
-
container.appendChild(pluginHTML);
|
|
8753
|
-
}
|
|
8754
|
-
|
|
8755
|
-
{TEMPLATE_CODE}
|
|
8756
|
-
const params = window["${paramsId}"];
|
|
8757
|
-
|
|
8758
|
-
window["${disposeId}"] = Run({
|
|
8759
|
-
element: pluginHTML,
|
|
8760
|
-
container: container,
|
|
8761
|
-
pluginParams: params
|
|
8762
|
-
});
|
|
8763
|
-
}
|
|
8764
|
-
run();
|
|
8766
|
+
let script = `
|
|
8767
|
+
function run() {
|
|
8768
|
+
${fileContent}
|
|
8769
|
+
|
|
8770
|
+
const paramsId = "${paramsId}";
|
|
8771
|
+
const containerId = "${containerId}";
|
|
8772
|
+
let container;
|
|
8773
|
+
if (containerId) {
|
|
8774
|
+
container = document.getElementById("${containerId}");
|
|
8775
|
+
}
|
|
8776
|
+
|
|
8777
|
+
let pluginHTML = null;
|
|
8778
|
+
if (container) {
|
|
8779
|
+
pluginHTML = document.createElement("div");
|
|
8780
|
+
pluginHTML.id = "${elementId}";
|
|
8781
|
+
container.appendChild(pluginHTML);
|
|
8782
|
+
}
|
|
8783
|
+
|
|
8784
|
+
{TEMPLATE_CODE}
|
|
8785
|
+
const params = window["${paramsId}"];
|
|
8786
|
+
|
|
8787
|
+
window["${disposeId}"] = Run({
|
|
8788
|
+
element: pluginHTML,
|
|
8789
|
+
container: container,
|
|
8790
|
+
pluginParams: params
|
|
8791
|
+
});
|
|
8792
|
+
}
|
|
8793
|
+
run();
|
|
8765
8794
|
`;
|
|
8766
8795
|
if (script.includes("var template")) {
|
|
8767
|
-
script = script.replace("{TEMPLATE_CODE}", `
|
|
8768
|
-
if (pluginHTML && template) {
|
|
8769
|
-
pluginHTML.innerHTML = template;
|
|
8770
|
-
}
|
|
8796
|
+
script = script.replace("{TEMPLATE_CODE}", `
|
|
8797
|
+
if (pluginHTML && template) {
|
|
8798
|
+
pluginHTML.innerHTML = template;
|
|
8799
|
+
}
|
|
8771
8800
|
`);
|
|
8772
8801
|
}
|
|
8773
8802
|
else {
|
|
@@ -8905,7 +8934,7 @@
|
|
|
8905
8934
|
DataSource.GetList = GetList;
|
|
8906
8935
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
8907
8936
|
|
|
8908
|
-
const VERSION = "3.0.
|
|
8937
|
+
const VERSION = "3.0.8";
|
|
8909
8938
|
|
|
8910
8939
|
exports.VERSION = VERSION;
|
|
8911
8940
|
exports.AbstractApi = AbstractApi;
|