bruce-models 4.6.8 → 4.7.0

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.
@@ -3088,7 +3088,7 @@
3088
3088
  */
3089
3089
  function GetListByIds(params) {
3090
3090
  return __awaiter(this, void 0, void 0, function* () {
3091
- let { api, entityIds, migrated, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources } = params;
3091
+ let { api, entityIds, migrated, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources, expandImports } = params;
3092
3092
  if (!entityIds.length) {
3093
3093
  throw ("Entity IDs are required.");
3094
3094
  }
@@ -3127,6 +3127,14 @@
3127
3127
  reqData["Expand"] = "location";
3128
3128
  }
3129
3129
  }
3130
+ if (expandImports) {
3131
+ if (reqData["Expand"]) {
3132
+ reqData["Expand"] += ",import";
3133
+ }
3134
+ else {
3135
+ reqData["Expand"] = "import";
3136
+ }
3137
+ }
3130
3138
  if (expandSources) {
3131
3139
  reqData["ExpandSources"] = true;
3132
3140
  }
@@ -3157,6 +3165,7 @@
3157
3165
  entityId,
3158
3166
  expandLocation,
3159
3167
  expandRelations,
3168
+ expandImports,
3160
3169
  expandSources,
3161
3170
  entityTypeId: null,
3162
3171
  historicFrom: historicFrom,
@@ -3552,7 +3561,7 @@
3552
3561
  function GetList(params) {
3553
3562
  var _a;
3554
3563
  return __awaiter(this, void 0, void 0, function* () {
3555
- let { api, filter, migrated, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources } = params;
3564
+ let { api, filter, migrated, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, expandImports, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources } = params;
3556
3565
  if (!api) {
3557
3566
  api = exports.ENVIRONMENT.Api().GetBruceApi();
3558
3567
  }
@@ -3595,7 +3604,7 @@
3595
3604
  historicPoint: historicPoint,
3596
3605
  ExpandSources: expandSources
3597
3606
  };
3598
- if (expandLocation || expandRelations) {
3607
+ if (expandLocation || expandRelations || expandImports) {
3599
3608
  let expand = "";
3600
3609
  if (expandLocation) {
3601
3610
  expand += "location";
@@ -3606,12 +3615,19 @@
3606
3615
  }
3607
3616
  expand += "relation";
3608
3617
  }
3618
+ if (expandImports) {
3619
+ if (expand) {
3620
+ expand += ",";
3621
+ }
3622
+ expand += "import";
3623
+ }
3609
3624
  if (expand) {
3610
3625
  body["Expand"] = expand;
3611
3626
  }
3612
3627
  }
3613
3628
  let totalCount;
3614
3629
  let entities = [];
3630
+ let imports;
3615
3631
  if (analysis || expandRelations || (viaCdn && api.GetCdnBaseUrl())) {
3616
3632
  const urlParams = new URLSearchParams();
3617
3633
  urlParams.set("cacheToken", String(viaCdnCacheToken ? viaCdnCacheToken : 0));
@@ -3642,6 +3658,9 @@
3642
3658
  if (expandLocation) {
3643
3659
  urlParams.append("$expand", "location");
3644
3660
  }
3661
+ if (expandImports) {
3662
+ urlParams.append("$expand", "import");
3663
+ }
3645
3664
  if (expandSources) {
3646
3665
  urlParams.append("ExpandSources", "true");
3647
3666
  }
@@ -3674,6 +3693,7 @@
3674
3693
  entities = data.Items;
3675
3694
  }
3676
3695
  totalCount = data.TotalCount;
3696
+ imports = data.Imports;
3677
3697
  }
3678
3698
  else {
3679
3699
  const urlParams = new URLSearchParams();
@@ -3683,6 +3703,9 @@
3683
3703
  if (expandLocation) {
3684
3704
  urlParams.append("$expand", "location");
3685
3705
  }
3706
+ if (expandImports) {
3707
+ urlParams.append("$expand", "import");
3708
+ }
3686
3709
  if (schemaId) {
3687
3710
  urlParams.set("schema", schemaId);
3688
3711
  }
@@ -3707,6 +3730,7 @@
3707
3730
  entityId: id,
3708
3731
  expandRelations,
3709
3732
  expandLocation,
3733
+ expandImports,
3710
3734
  expandSources,
3711
3735
  entityTypeId: filter.entityTypeId,
3712
3736
  historicFrom: historicFrom,
@@ -3722,10 +3746,12 @@
3722
3746
  }
3723
3747
  }
3724
3748
  totalCount = data.TotalCount;
3749
+ imports = data.Imports;
3725
3750
  }
3726
3751
  return {
3727
3752
  entities,
3728
- totalCount
3753
+ totalCount,
3754
+ imports
3729
3755
  };
3730
3756
  });
3731
3757
  }
@@ -3769,7 +3795,7 @@
3769
3795
  * @returns
3770
3796
  */
3771
3797
  function GetCacheKey(params) {
3772
- let { entityId, entityTypeId, schemaId, expandLocation, expandRelations, expandSources, historicFrom, historicKey, historicTo, historicPoint } = params;
3798
+ let { entityId, entityTypeId, schemaId, expandLocation, expandRelations, expandImports, expandSources, historicFrom, historicKey, historicTo, historicPoint } = params;
3773
3799
  if (!entityTypeId) {
3774
3800
  entityTypeId = "";
3775
3801
  }
@@ -3789,7 +3815,7 @@
3789
3815
  schemaId = "";
3790
3816
  }
3791
3817
  let key = `${exports.Api.ECacheKey.Entity}${exports.Api.ECacheKey.Id}${entityId}${String(entityTypeId)}${schemaId}`;
3792
- key += `${String(Boolean(expandLocation))}${String(Boolean(expandRelations))}${String(Boolean(expandSources))}`;
3818
+ key += `${String(Boolean(expandLocation))}${String(Boolean(expandRelations))}${String(Boolean(expandSources))}${String(Boolean(expandImports))}`;
3793
3819
  key += `${exports.Api.ECacheKey.EntityHistoricData}${exports.Api.ECacheKey.Id}${historicKey}-${historicFrom}-${historicTo}-${historicPoint}`;
3794
3820
  return key;
3795
3821
  }
@@ -4468,7 +4494,7 @@
4468
4494
  * @returns returns GeoJSON or null if conversion failed or resulted in an empty object.
4469
4495
  */
4470
4496
  function ToGeoJsonFeature(params) {
4471
- const { geometry, properties, altitude } = params;
4497
+ const { geometry, properties, altitude, noAltitude } = params;
4472
4498
  // Primary collection of geometries.
4473
4499
  // We will return a single feature that contains many geometries.
4474
4500
  // That way we can attach properties to the top-level.
@@ -4523,6 +4549,9 @@
4523
4549
  const points = ParsePoints(polygon.LinearRing);
4524
4550
  return removeConsecutiveDuplicates(points.map(coord => {
4525
4551
  const { longitude: lon, latitude: lat, altitude: alt } = coord;
4552
+ if (noAltitude) {
4553
+ return [lon, lat];
4554
+ }
4526
4555
  return (altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0]);
4527
4556
  }));
4528
4557
  }));
@@ -4537,6 +4566,9 @@
4537
4566
  const points = ParsePoints(geometry.LineString);
4538
4567
  const coordinates = removeConsecutiveDuplicates(points.map(coord => {
4539
4568
  const { longitude: lon, latitude: lat, altitude: alt } = coord;
4569
+ if (noAltitude) {
4570
+ return [lon, lat];
4571
+ }
4540
4572
  return (altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0]);
4541
4573
  }));
4542
4574
  if (coordinates.length >= 2) {
@@ -4550,7 +4582,13 @@
4550
4582
  const points = ParsePoints(geometry.Point);
4551
4583
  if (points.length) {
4552
4584
  const { longitude: lon, latitude: lat, altitude: alt } = points[0];
4553
- const coordinates = altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0];
4585
+ let coordinates;
4586
+ if (noAltitude) {
4587
+ coordinates = [lon, lat];
4588
+ }
4589
+ else {
4590
+ coordinates = altitude != null ? [lon, lat, altitude] : [lon, lat, alt !== undefined ? alt : 0];
4591
+ }
4554
4592
  jGeometry = {
4555
4593
  coordinates: coordinates,
4556
4594
  type: exports.GeoJson.EType.Point
@@ -13750,7 +13788,7 @@
13750
13788
  })(exports.DataSource || (exports.DataSource = {}));
13751
13789
 
13752
13790
  // This is updated with the package.json version on build.
13753
- const VERSION = "4.6.8";
13791
+ const VERSION = "4.7.0";
13754
13792
 
13755
13793
  exports.VERSION = VERSION;
13756
13794
  exports.AbstractApi = AbstractApi;