bruce-models 4.1.7 → 4.1.9

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.
@@ -3253,11 +3253,18 @@
3253
3253
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3254
3254
  try {
3255
3255
  const urlParams = new URLSearchParams();
3256
+ let expand;
3256
3257
  if (expandLocation) {
3257
- urlParams.append("$expand", "location");
3258
+ expand = "location";
3258
3259
  }
3259
3260
  if (expandRelations) {
3260
- urlParams.append("$expand", "relation");
3261
+ if (expand) {
3262
+ expand += ",";
3263
+ }
3264
+ expand += "relation";
3265
+ }
3266
+ if (expand) {
3267
+ urlParams.append("$expand", expand);
3261
3268
  }
3262
3269
  if (entityTypeId) {
3263
3270
  urlParams.append("BruceEntityType", entityTypeId);
@@ -3302,7 +3309,7 @@
3302
3309
  */
3303
3310
  function GetListByIds(params) {
3304
3311
  return __awaiter(this, void 0, void 0, function* () {
3305
- let { api, entityIds, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint } = params;
3312
+ let { api, entityIds, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources } = params;
3306
3313
  if (!entityIds.length) {
3307
3314
  throw ("Entity IDs are required.");
3308
3315
  }
@@ -3333,8 +3340,16 @@
3333
3340
  if (expandRelations) {
3334
3341
  reqData["Expand"] = "relation";
3335
3342
  }
3336
- else if (expandLocation) {
3337
- reqData["Expand"] = "location";
3343
+ if (expandLocation) {
3344
+ if (reqData["Expand"]) {
3345
+ reqData["Expand"] += ",location";
3346
+ }
3347
+ else {
3348
+ reqData["Expand"] = "location";
3349
+ }
3350
+ }
3351
+ if (expandSources) {
3352
+ reqData["ExpandSources"] = true;
3338
3353
  }
3339
3354
  if (historicKey) {
3340
3355
  reqData["historicKey"] = historicKey;
@@ -3362,6 +3377,7 @@
3362
3377
  entityId,
3363
3378
  expandLocation,
3364
3379
  expandRelations,
3380
+ expandSources,
3365
3381
  entityTypeId: null,
3366
3382
  historicFrom: historicFrom,
3367
3383
  historicKey: historicKey,
@@ -3652,7 +3668,7 @@
3652
3668
  function GetList(params) {
3653
3669
  var _a;
3654
3670
  return __awaiter(this, void 0, void 0, function* () {
3655
- let { api, filter, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, historicFrom, historicKey, historicTo, historicPoint } = params;
3671
+ let { api, filter, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources } = params;
3656
3672
  if (!api) {
3657
3673
  api = exports.ENVIRONMENT.Api().GetBruceApi();
3658
3674
  }
@@ -3692,8 +3708,24 @@
3692
3708
  historicKey: historicKey,
3693
3709
  historicFrom: historicFrom,
3694
3710
  historicTo: historicTo,
3695
- historicPoint: historicPoint
3711
+ historicPoint: historicPoint,
3712
+ ExpandSources: expandSources
3696
3713
  };
3714
+ if (expandLocation || expandRelations) {
3715
+ let expand = "";
3716
+ if (expandLocation) {
3717
+ expand += "location";
3718
+ }
3719
+ if (expandRelations) {
3720
+ if (expand) {
3721
+ expand += ",";
3722
+ }
3723
+ expand += "relation";
3724
+ }
3725
+ if (expand) {
3726
+ body["Expand"] = expand;
3727
+ }
3728
+ }
3697
3729
  let totalCount;
3698
3730
  let entities = [];
3699
3731
  if (analysis || expandRelations || (viaCdn && api.EntityCdnUrl)) {
@@ -3733,6 +3765,12 @@
3733
3765
  if (expandRelations) {
3734
3766
  urlParams.append("$expand", "relation");
3735
3767
  }
3768
+ if (expandLocation) {
3769
+ urlParams.append("$expand", "location");
3770
+ }
3771
+ if (expandSources) {
3772
+ urlParams.append("ExpandSources", "true");
3773
+ }
3736
3774
  if (historicKey) {
3737
3775
  urlParams.set("historicKey", historicKey);
3738
3776
  }
@@ -3761,6 +3799,9 @@
3761
3799
  if (expandRelations) {
3762
3800
  urlParams.append("$expand", "relation");
3763
3801
  }
3802
+ if (expandLocation) {
3803
+ urlParams.append("$expand", "location");
3804
+ }
3764
3805
  if (schemaId) {
3765
3806
  urlParams.set("schema", schemaId);
3766
3807
  }
@@ -3776,7 +3817,8 @@
3776
3817
  key: GetCacheKey({
3777
3818
  entityId: id,
3778
3819
  expandRelations,
3779
- expandLocation: false,
3820
+ expandLocation,
3821
+ expandSources,
3780
3822
  entityTypeId: filter.entityTypeId,
3781
3823
  historicFrom: historicFrom,
3782
3824
  historicKey: historicKey,
@@ -3929,7 +3971,7 @@
3929
3971
  * @returns
3930
3972
  */
3931
3973
  function GetCacheKey(params) {
3932
- let { entityId, entityTypeId, schemaId, expandLocation, expandRelations, historicFrom, historicKey, historicTo, historicPoint } = params;
3974
+ let { entityId, entityTypeId, schemaId, expandLocation, expandRelations, expandSources, historicFrom, historicKey, historicTo, historicPoint } = params;
3933
3975
  if (!entityTypeId) {
3934
3976
  entityTypeId = "";
3935
3977
  }
@@ -3949,7 +3991,7 @@
3949
3991
  schemaId = "";
3950
3992
  }
3951
3993
  let key = `${exports.Api.ECacheKey.Entity}${exports.Api.ECacheKey.Id}${entityId}${String(entityTypeId)}${schemaId}`;
3952
- key += `${String(Boolean(expandLocation))}${String(Boolean(expandRelations))}`;
3994
+ key += `${String(Boolean(expandLocation))}${String(Boolean(expandRelations))}${String(Boolean(expandSources))}`;
3953
3995
  key += `${exports.Api.ECacheKey.EntityHistoricData}${exports.Api.ECacheKey.Id}${historicKey}-${historicFrom}-${historicTo}-${historicPoint}`;
3954
3996
  return key;
3955
3997
  }
@@ -8738,7 +8780,10 @@
8738
8780
  yield api.POST(`ui.tileset/${data.id}`, legacy, exports.Api.PrepReqParams(reqParams));
8739
8781
  }
8740
8782
  else {
8741
- yield api.POST(`tileset/update/${data.id}`, data, exports.Api.PrepReqParams(reqParams));
8783
+ // We avoid saving again if there are no settings and it is new.
8784
+ if (!isNew || (data.settings && Object.keys(data.settings).length > 0)) {
8785
+ yield api.POST(`tileset/update/${data.id}`, data, exports.Api.PrepReqParams(reqParams));
8786
+ }
8742
8787
  }
8743
8788
  yield api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Tileset + exports.Api.ECacheKey.Id + data.id);
8744
8789
  yield api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Tileset);
@@ -12850,7 +12895,7 @@
12850
12895
  })(exports.DataSource || (exports.DataSource = {}));
12851
12896
 
12852
12897
  // This is updated with the package.json version on build.
12853
- const VERSION = "4.1.7";
12898
+ const VERSION = "4.1.9";
12854
12899
 
12855
12900
  exports.VERSION = VERSION;
12856
12901
  exports.AbstractApi = AbstractApi;