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.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 } = params;
|
|
2332
|
+
let { api, filter, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations } = params;
|
|
2320
2333
|
if (!api) {
|
|
2321
2334
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
2322
2335
|
}
|
|
@@ -2349,9 +2362,19 @@ var Entity;
|
|
|
2349
2362
|
PageIndex: filter.pageIndex,
|
|
2350
2363
|
PageSize: filter.pageSize
|
|
2351
2364
|
};
|
|
2365
|
+
let totalCount;
|
|
2352
2366
|
let entities = [];
|
|
2353
|
-
if (viaCdn && api.EntityCdnUrl) {
|
|
2354
|
-
|
|
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
|
+
}
|
|
2355
2378
|
const urlParams = new URLSearchParams(url.search);
|
|
2356
2379
|
urlParams.set("cacheToken", String(viaCdnCacheToken ? viaCdnCacheToken : 0));
|
|
2357
2380
|
if (body.SortOrder) {
|
|
@@ -2375,28 +2398,47 @@ var Entity;
|
|
|
2375
2398
|
if (body.PageSize) {
|
|
2376
2399
|
urlParams.set("PageSize", String(body.PageSize));
|
|
2377
2400
|
}
|
|
2401
|
+
if (expandRelations) {
|
|
2402
|
+
urlParams.append("$expand", "relation");
|
|
2403
|
+
}
|
|
2378
2404
|
const urlStr = url.toString() + "?" + urlParams.toString();
|
|
2379
2405
|
const data = yield api.get(urlStr, Api.PrepReqParams(reqParams));
|
|
2380
|
-
|
|
2406
|
+
if (!analysis) {
|
|
2407
|
+
entities = data.Items;
|
|
2408
|
+
}
|
|
2409
|
+
totalCount = data.TotalCount;
|
|
2381
2410
|
}
|
|
2382
2411
|
else {
|
|
2383
|
-
const
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
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));
|
|
2419
|
+
if (!analysis) {
|
|
2420
|
+
entities = data.Items;
|
|
2421
|
+
// Only caching when non-CDN.
|
|
2422
|
+
for (let i = 0; i < entities.length; i++) {
|
|
2423
|
+
const entity = entities[i];
|
|
2424
|
+
const id = entity.Bruce.ID;
|
|
2425
|
+
api.SetCacheItem({
|
|
2426
|
+
key: GetCacheKey({
|
|
2427
|
+
entityId: id,
|
|
2428
|
+
expandRelations
|
|
2429
|
+
}),
|
|
2430
|
+
value: {
|
|
2431
|
+
entity: entity
|
|
2432
|
+
},
|
|
2433
|
+
req: reqParams
|
|
2434
|
+
});
|
|
2435
|
+
}
|
|
2396
2436
|
}
|
|
2437
|
+
totalCount = data.TotalCount;
|
|
2397
2438
|
}
|
|
2398
2439
|
return {
|
|
2399
|
-
entities
|
|
2440
|
+
entities,
|
|
2441
|
+
totalCount
|
|
2400
2442
|
};
|
|
2401
2443
|
});
|
|
2402
2444
|
}
|
|
@@ -6577,7 +6619,9 @@ var MenuItem;
|
|
|
6577
6619
|
EType["PointCloud"] = "PointCloudTileset";
|
|
6578
6620
|
EType["EntitiesLoaded"] = "LoadedEntities";
|
|
6579
6621
|
EType["EntitiesIds"] = "EntitiesIds";
|
|
6622
|
+
// Deprecated. Use Relationships instead.
|
|
6580
6623
|
EType["Relations"] = "Relations";
|
|
6624
|
+
EType["Relationships"] = "Relationships";
|
|
6581
6625
|
EType["GooglePhotoTileset"] = "GooglePhotoTileset";
|
|
6582
6626
|
})(EType = MenuItem.EType || (MenuItem.EType = {}));
|
|
6583
6627
|
function CreateFromEntityId(entityId, typeId, styleId) {
|
|
@@ -6666,9 +6710,6 @@ var MenuItem;
|
|
|
6666
6710
|
throw ("Tileset type not supported.");
|
|
6667
6711
|
}
|
|
6668
6712
|
MenuItem.CreateFromTilesetId = CreateFromTilesetId;
|
|
6669
|
-
let Item;
|
|
6670
|
-
(function (Item) {
|
|
6671
|
-
})(Item = MenuItem.Item || (MenuItem.Item = {}));
|
|
6672
6713
|
})(MenuItem || (MenuItem = {}));
|
|
6673
6714
|
|
|
6674
6715
|
/**
|
|
@@ -9127,7 +9168,7 @@ var DataSource;
|
|
|
9127
9168
|
DataSource.GetList = GetList;
|
|
9128
9169
|
})(DataSource || (DataSource = {}));
|
|
9129
9170
|
|
|
9130
|
-
const VERSION = "3.0.
|
|
9171
|
+
const VERSION = "3.0.7";
|
|
9131
9172
|
|
|
9132
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 };
|
|
9133
9174
|
//# sourceMappingURL=bruce-models.es5.js.map
|