bruce-models 3.0.4 → 3.0.7
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 +75 -34
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +75 -34
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/entity/entity.js +72 -30
- package/dist/lib/entity/entity.js.map +1 -1
- 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 +22 -2
- package/dist/types/entity/entity.d.ts +17 -2
- 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 } = 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
|
}
|
|
@@ -2306,9 +2319,19 @@
|
|
|
2306
2319
|
PageIndex: filter.pageIndex,
|
|
2307
2320
|
PageSize: filter.pageSize
|
|
2308
2321
|
};
|
|
2322
|
+
let totalCount;
|
|
2309
2323
|
let entities = [];
|
|
2310
|
-
if (viaCdn && api.EntityCdnUrl) {
|
|
2311
|
-
|
|
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
|
+
}
|
|
2312
2335
|
const urlParams = new URLSearchParams(url.search);
|
|
2313
2336
|
urlParams.set("cacheToken", String(viaCdnCacheToken ? viaCdnCacheToken : 0));
|
|
2314
2337
|
if (body.SortOrder) {
|
|
@@ -2332,28 +2355,47 @@
|
|
|
2332
2355
|
if (body.PageSize) {
|
|
2333
2356
|
urlParams.set("PageSize", String(body.PageSize));
|
|
2334
2357
|
}
|
|
2358
|
+
if (expandRelations) {
|
|
2359
|
+
urlParams.append("$expand", "relation");
|
|
2360
|
+
}
|
|
2335
2361
|
const urlStr = url.toString() + "?" + urlParams.toString();
|
|
2336
2362
|
const data = yield api.get(urlStr, exports.Api.PrepReqParams(reqParams));
|
|
2337
|
-
|
|
2363
|
+
if (!analysis) {
|
|
2364
|
+
entities = data.Items;
|
|
2365
|
+
}
|
|
2366
|
+
totalCount = data.TotalCount;
|
|
2338
2367
|
}
|
|
2339
2368
|
else {
|
|
2340
|
-
const
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
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));
|
|
2376
|
+
if (!analysis) {
|
|
2377
|
+
entities = data.Items;
|
|
2378
|
+
// Only caching when non-CDN.
|
|
2379
|
+
for (let i = 0; i < entities.length; i++) {
|
|
2380
|
+
const entity = entities[i];
|
|
2381
|
+
const id = entity.Bruce.ID;
|
|
2382
|
+
api.SetCacheItem({
|
|
2383
|
+
key: GetCacheKey({
|
|
2384
|
+
entityId: id,
|
|
2385
|
+
expandRelations
|
|
2386
|
+
}),
|
|
2387
|
+
value: {
|
|
2388
|
+
entity: entity
|
|
2389
|
+
},
|
|
2390
|
+
req: reqParams
|
|
2391
|
+
});
|
|
2392
|
+
}
|
|
2353
2393
|
}
|
|
2394
|
+
totalCount = data.TotalCount;
|
|
2354
2395
|
}
|
|
2355
2396
|
return {
|
|
2356
|
-
entities
|
|
2397
|
+
entities,
|
|
2398
|
+
totalCount
|
|
2357
2399
|
};
|
|
2358
2400
|
});
|
|
2359
2401
|
}
|
|
@@ -6413,7 +6455,9 @@
|
|
|
6413
6455
|
EType["PointCloud"] = "PointCloudTileset";
|
|
6414
6456
|
EType["EntitiesLoaded"] = "LoadedEntities";
|
|
6415
6457
|
EType["EntitiesIds"] = "EntitiesIds";
|
|
6458
|
+
// Deprecated. Use Relationships instead.
|
|
6416
6459
|
EType["Relations"] = "Relations";
|
|
6460
|
+
EType["Relationships"] = "Relationships";
|
|
6417
6461
|
EType["GooglePhotoTileset"] = "GooglePhotoTileset";
|
|
6418
6462
|
})(EType = MenuItem.EType || (MenuItem.EType = {}));
|
|
6419
6463
|
function CreateFromEntityId(entityId, typeId, styleId) {
|
|
@@ -6502,9 +6546,6 @@
|
|
|
6502
6546
|
throw ("Tileset type not supported.");
|
|
6503
6547
|
}
|
|
6504
6548
|
MenuItem.CreateFromTilesetId = CreateFromTilesetId;
|
|
6505
|
-
let Item;
|
|
6506
|
-
(function (Item) {
|
|
6507
|
-
})(Item = MenuItem.Item || (MenuItem.Item = {}));
|
|
6508
6549
|
})(exports.MenuItem || (exports.MenuItem = {}));
|
|
6509
6550
|
|
|
6510
6551
|
(function (ProjectViewBookmark) {
|
|
@@ -8893,7 +8934,7 @@
|
|
|
8893
8934
|
DataSource.GetList = GetList;
|
|
8894
8935
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
8895
8936
|
|
|
8896
|
-
const VERSION = "3.0.
|
|
8937
|
+
const VERSION = "3.0.7";
|
|
8897
8938
|
|
|
8898
8939
|
exports.VERSION = VERSION;
|
|
8899
8940
|
exports.AbstractApi = AbstractApi;
|