bruce-models 4.1.6 → 4.1.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.
@@ -3307,11 +3307,18 @@ var Entity;
3307
3307
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3308
3308
  try {
3309
3309
  const urlParams = new URLSearchParams();
3310
+ let expand;
3310
3311
  if (expandLocation) {
3311
- urlParams.append("$expand", "location");
3312
+ expand = "location";
3312
3313
  }
3313
3314
  if (expandRelations) {
3314
- urlParams.append("$expand", "relation");
3315
+ if (expand) {
3316
+ expand += ",";
3317
+ }
3318
+ expand += "relation";
3319
+ }
3320
+ if (expand) {
3321
+ urlParams.append("$expand", expand);
3315
3322
  }
3316
3323
  if (entityTypeId) {
3317
3324
  urlParams.append("BruceEntityType", entityTypeId);
@@ -3356,7 +3363,7 @@ var Entity;
3356
3363
  */
3357
3364
  function GetListByIds(params) {
3358
3365
  return __awaiter(this, void 0, void 0, function* () {
3359
- let { api, entityIds, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint } = params;
3366
+ let { api, entityIds, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources } = params;
3360
3367
  if (!entityIds.length) {
3361
3368
  throw ("Entity IDs are required.");
3362
3369
  }
@@ -3387,8 +3394,16 @@ var Entity;
3387
3394
  if (expandRelations) {
3388
3395
  reqData["Expand"] = "relation";
3389
3396
  }
3390
- else if (expandLocation) {
3391
- reqData["Expand"] = "location";
3397
+ if (expandLocation) {
3398
+ if (reqData["Expand"]) {
3399
+ reqData["Expand"] += ",location";
3400
+ }
3401
+ else {
3402
+ reqData["Expand"] = "location";
3403
+ }
3404
+ }
3405
+ if (expandSources) {
3406
+ reqData["ExpandSources"] = true;
3392
3407
  }
3393
3408
  if (historicKey) {
3394
3409
  reqData["historicKey"] = historicKey;
@@ -3416,6 +3431,7 @@ var Entity;
3416
3431
  entityId,
3417
3432
  expandLocation,
3418
3433
  expandRelations,
3434
+ expandSources,
3419
3435
  entityTypeId: null,
3420
3436
  historicFrom: historicFrom,
3421
3437
  historicKey: historicKey,
@@ -3706,7 +3722,7 @@ var Entity;
3706
3722
  function GetList(params) {
3707
3723
  var _a;
3708
3724
  return __awaiter(this, void 0, void 0, function* () {
3709
- let { api, filter, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, historicFrom, historicKey, historicTo, historicPoint } = params;
3725
+ let { api, filter, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources } = params;
3710
3726
  if (!api) {
3711
3727
  api = ENVIRONMENT.Api().GetBruceApi();
3712
3728
  }
@@ -3746,8 +3762,24 @@ var Entity;
3746
3762
  historicKey: historicKey,
3747
3763
  historicFrom: historicFrom,
3748
3764
  historicTo: historicTo,
3749
- historicPoint: historicPoint
3765
+ historicPoint: historicPoint,
3766
+ ExpandSources: expandSources
3750
3767
  };
3768
+ if (expandLocation || expandRelations) {
3769
+ let expand = "";
3770
+ if (expandLocation) {
3771
+ expand += "location";
3772
+ }
3773
+ if (expandRelations) {
3774
+ if (expand) {
3775
+ expand += ",";
3776
+ }
3777
+ expand += "relation";
3778
+ }
3779
+ if (expand) {
3780
+ body["Expand"] = expand;
3781
+ }
3782
+ }
3751
3783
  let totalCount;
3752
3784
  let entities = [];
3753
3785
  if (analysis || expandRelations || (viaCdn && api.EntityCdnUrl)) {
@@ -3787,6 +3819,12 @@ var Entity;
3787
3819
  if (expandRelations) {
3788
3820
  urlParams.append("$expand", "relation");
3789
3821
  }
3822
+ if (expandLocation) {
3823
+ urlParams.append("$expand", "location");
3824
+ }
3825
+ if (expandSources) {
3826
+ urlParams.append("ExpandSources", "true");
3827
+ }
3790
3828
  if (historicKey) {
3791
3829
  urlParams.set("historicKey", historicKey);
3792
3830
  }
@@ -3815,6 +3853,9 @@ var Entity;
3815
3853
  if (expandRelations) {
3816
3854
  urlParams.append("$expand", "relation");
3817
3855
  }
3856
+ if (expandLocation) {
3857
+ urlParams.append("$expand", "location");
3858
+ }
3818
3859
  if (schemaId) {
3819
3860
  urlParams.set("schema", schemaId);
3820
3861
  }
@@ -3830,7 +3871,8 @@ var Entity;
3830
3871
  key: GetCacheKey({
3831
3872
  entityId: id,
3832
3873
  expandRelations,
3833
- expandLocation: false,
3874
+ expandLocation,
3875
+ expandSources,
3834
3876
  entityTypeId: filter.entityTypeId,
3835
3877
  historicFrom: historicFrom,
3836
3878
  historicKey: historicKey,
@@ -3983,7 +4025,7 @@ var Entity;
3983
4025
  * @returns
3984
4026
  */
3985
4027
  function GetCacheKey(params) {
3986
- let { entityId, entityTypeId, schemaId, expandLocation, expandRelations, historicFrom, historicKey, historicTo, historicPoint } = params;
4028
+ let { entityId, entityTypeId, schemaId, expandLocation, expandRelations, expandSources, historicFrom, historicKey, historicTo, historicPoint } = params;
3987
4029
  if (!entityTypeId) {
3988
4030
  entityTypeId = "";
3989
4031
  }
@@ -4003,7 +4045,7 @@ var Entity;
4003
4045
  schemaId = "";
4004
4046
  }
4005
4047
  let key = `${Api.ECacheKey.Entity}${Api.ECacheKey.Id}${entityId}${String(entityTypeId)}${schemaId}`;
4006
- key += `${String(Boolean(expandLocation))}${String(Boolean(expandRelations))}`;
4048
+ key += `${String(Boolean(expandLocation))}${String(Boolean(expandRelations))}${String(Boolean(expandSources))}`;
4007
4049
  key += `${Api.ECacheKey.EntityHistoricData}${Api.ECacheKey.Id}${historicKey}-${historicFrom}-${historicTo}-${historicPoint}`;
4008
4050
  return key;
4009
4051
  }
@@ -11398,17 +11440,18 @@ var AccountFeatures;
11398
11440
  EFeature["EntityLexicalSearch"] = "Feature_Entity_Lexical_Search";
11399
11441
  })(EFeature = AccountFeatures.EFeature || (AccountFeatures.EFeature = {}));
11400
11442
  /**
11401
- * Gets account features corresponding to an account ID.
11443
+ * Gets account features corresponding to the API instance's account.
11402
11444
  * @param params
11403
11445
  * @returns
11404
11446
  */
11405
11447
  function Get(params) {
11406
11448
  return __awaiter(this, void 0, void 0, function* () {
11407
- let { api, accountId: id, req: reqParams } = params;
11449
+ let { api, req: reqParams } = params;
11408
11450
  if (!api) {
11409
11451
  api = ENVIRONMENT.Api().GetBruceApi();
11410
11452
  }
11411
- const cache = yield api.GetCacheItem(GetCacheKey(id), reqParams);
11453
+ const accountId = api.AccountId;
11454
+ const cache = yield api.GetCacheItem(GetCacheKey(accountId), reqParams);
11412
11455
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
11413
11456
  return cache.data;
11414
11457
  }
@@ -11425,7 +11468,7 @@ var AccountFeatures;
11425
11468
  }
11426
11469
  }));
11427
11470
  api.SetCacheItem({
11428
- key: GetCacheKey(id),
11471
+ key: GetCacheKey(accountId),
11429
11472
  value: prom,
11430
11473
  req: reqParams
11431
11474
  });
@@ -11435,10 +11478,11 @@ var AccountFeatures;
11435
11478
  AccountFeatures.Get = Get;
11436
11479
  function Update(params) {
11437
11480
  return __awaiter(this, void 0, void 0, function* () {
11438
- let { api, accountId: id, features, req: reqParams } = params;
11481
+ let { api, features, req: reqParams } = params;
11439
11482
  if (!api) {
11440
11483
  api = ENVIRONMENT.Api().GetBruceApi();
11441
11484
  }
11485
+ const accountId = api.AccountId;
11442
11486
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
11443
11487
  try {
11444
11488
  const data = yield api.POST("features", {
@@ -11453,7 +11497,7 @@ var AccountFeatures;
11453
11497
  rej(e);
11454
11498
  }
11455
11499
  }));
11456
- api.Cache.Remove(GetCacheKey(id));
11500
+ api.Cache.Remove(GetCacheKey(accountId));
11457
11501
  return prom;
11458
11502
  });
11459
11503
  }
@@ -13114,7 +13158,7 @@ var DataSource;
13114
13158
  })(DataSource || (DataSource = {}));
13115
13159
 
13116
13160
  // This is updated with the package.json version on build.
13117
- const VERSION = "4.1.6";
13161
+ const VERSION = "4.1.8";
13118
13162
 
13119
13163
  export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, 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, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
13120
13164
  //# sourceMappingURL=bruce-models.es5.js.map