bruce-models 4.2.8 → 4.3.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.
@@ -3547,7 +3547,13 @@
3547
3547
  * @param params
3548
3548
  */
3549
3549
  function SetValue(params) {
3550
- const { entity: data, path, value } = params;
3550
+ let { entity: data, path, value } = params;
3551
+ if (!path || !path.length) {
3552
+ return;
3553
+ }
3554
+ if (typeof path == "string") {
3555
+ path = exports.PathUtils.Parse(path);
3556
+ }
3551
3557
  let curData = data;
3552
3558
  for (let i = 0; i < path.length; i++) {
3553
3559
  const step = path[i];
@@ -3573,6 +3579,12 @@
3573
3579
  if (checkAgainstLegacy == null) {
3574
3580
  checkAgainstLegacy = true;
3575
3581
  }
3582
+ if (!path || !path.length) {
3583
+ return null;
3584
+ }
3585
+ if (typeof path == "string") {
3586
+ path = exports.PathUtils.Parse(path);
3587
+ }
3576
3588
  // Backwards compatibility for incredibly old data.
3577
3589
  if (checkAgainstLegacy && path.length == 1 && path[0] == "ID") {
3578
3590
  return (_a = data.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
@@ -3600,60 +3612,66 @@
3600
3612
  // So we'll check against both locations until migration is complete.
3601
3613
  // First we'll check against properties that could be found inside the internal section.
3602
3614
  if (path[0] == "location") {
3603
- value = checkForValue(["Bruce"].concat(path));
3615
+ value = checkForValue(["Bruce", "Location"].concat(path.slice(1)));
3604
3616
  }
3605
3617
  else if (path[0] == "transform") {
3606
- value = checkForValue(["Bruce"].concat(path));
3618
+ value = checkForValue(["Bruce", "Transform"].concat(path.slice(1)));
3607
3619
  }
3608
3620
  else if (path[0] == "geometry") {
3609
- value = checkForValue(["Bruce"].concat(path));
3621
+ value = checkForValue(["Bruce", "VectorGeometry"].concat(path.slice(1)));
3610
3622
  }
3611
3623
  else if (path[0] == "boundaries") {
3612
- value = checkForValue(["Bruce"].concat(path));
3624
+ value = checkForValue(["Bruce", "Boundaries"].concat(path.slice(1)));
3613
3625
  }
3614
3626
  else if (path[0] == "geometryPivot") {
3615
- value = checkForValue(["Bruce"].concat(path));
3627
+ value = checkForValue(["Bruce", "GeometryPivot"].concat(path.slice(1)));
3616
3628
  }
3617
3629
  else if (path[0] == "worldPivot") {
3618
- value = checkForValue(["Bruce"].concat(path));
3630
+ value = checkForValue(["Bruce", "GeometryWorldPivot"].concat(path.slice(1)));
3619
3631
  }
3620
3632
  else if (path[0] == "worldPosition") {
3621
- value = checkForValue(["Bruce"].concat(path));
3633
+ value = checkForValue(["Bruce", "AssemblyWorldPosition"].concat(path.slice(1)));
3622
3634
  }
3623
3635
  else if (path[0] == "tilesetID") {
3624
- value = checkForValue(["Bruce"].concat(path));
3636
+ value = checkForValue(["Bruce", "TilesetIDs"].concat(path.slice(1)));
3625
3637
  }
3626
3638
  else if (path[0] == "geometryRadius") {
3627
- value = checkForValue(["Bruce"].concat(path));
3639
+ value = checkForValue(["Bruce", "GeometryRadius"].concat(path.slice(1)));
3628
3640
  }
3629
3641
  // Now we'll check against properties that could still be in the top-level and haven't been migrated yet.
3630
3642
  if (path[0] == "Bruce" && path.length > 1) {
3631
- if (path[1] == "location") {
3632
- value = checkForValue(path.slice(1));
3643
+ if (path[1] == "Location") {
3644
+ value = checkForValue(["location"].concat(path.slice(2)));
3633
3645
  }
3634
- else if (path[1] == "transform") {
3635
- value = checkForValue(path.slice(1));
3646
+ else if (path[1] == "Transform") {
3647
+ value = checkForValue(["transform"].concat(path.slice(2)));
3636
3648
  }
3637
- else if (path[1] == "geometry") {
3638
- value = checkForValue(path.slice(1));
3649
+ else if (path[1] == "VectorGeometry") {
3650
+ value = checkForValue(["geometry"].concat(path.slice(2)));
3639
3651
  }
3640
- else if (path[1] == "boundaries") {
3641
- value = checkForValue(path.slice(1));
3652
+ else if (path[1] == "Boundaries") {
3653
+ value = checkForValue(["boundaries"].concat(path.slice(2)));
3642
3654
  }
3643
- else if (path[1] == "geometryPivot") {
3644
- value = checkForValue(path.slice(1));
3655
+ else if (path[1] == "GeometryPivot") {
3656
+ value = checkForValue(["geometryPivot"].concat(path.slice(2)));
3645
3657
  }
3646
- else if (path[1] == "worldPivot") {
3647
- value = checkForValue(path.slice(1));
3658
+ else if (path[1] == "GeometryWorldPivot") {
3659
+ value = checkForValue(["worldPivot"].concat(path.slice(2)));
3648
3660
  }
3649
- else if (path[1] == "worldPosition") {
3650
- value = checkForValue(path.slice(1));
3661
+ else if (path[1] == "AssemblyWorldPosition") {
3662
+ value = checkForValue(["worldPosition"].concat(path.slice(2)));
3651
3663
  }
3652
- else if (path[1] == "tilesetID") {
3653
- value = checkForValue(path.slice(1));
3664
+ else if (path[1] == "TilesetIDs") {
3665
+ value = checkForValue(["tilesetID"].concat(path.slice(2)));
3654
3666
  }
3655
- else if (path[1] == "geometryRadius") {
3656
- value = checkForValue(path.slice(1));
3667
+ else if (path[1] == "GeometryRadius") {
3668
+ value = checkForValue(["geometryRadius"].concat(path.slice(2)));
3669
+ }
3670
+ else if (path[1] == "relations") {
3671
+ value = checkForValue(["Bruce", "Relations"].concat(path.slice(2)));
3672
+ }
3673
+ else if (path[1] == "Relations") {
3674
+ value = checkForValue(["Bruce", "relations"].concat(path.slice(2)));
3657
3675
  }
3658
3676
  }
3659
3677
  }
@@ -3667,7 +3685,13 @@
3667
3685
  * @param params
3668
3686
  */
3669
3687
  function RemoveValue(params) {
3670
- const { entity: data, path } = params;
3688
+ let { entity: data, path } = params;
3689
+ if (!path || !path.length) {
3690
+ return;
3691
+ }
3692
+ if (typeof path == "string") {
3693
+ path = exports.PathUtils.Parse(path);
3694
+ }
3671
3695
  let curData = data;
3672
3696
  for (let i = 0; i < path.length; i++) {
3673
3697
  const step = path[i];
@@ -4663,14 +4687,14 @@
4663
4687
  const points = [];
4664
4688
  const location = exports.Entity.GetValue({
4665
4689
  entity: entity,
4666
- path: ["location"]
4690
+ path: ["Bruce", "Location"]
4667
4691
  });
4668
4692
  if (location) {
4669
4693
  points.push(location);
4670
4694
  }
4671
4695
  const geometry = exports.Entity.GetValue({
4672
4696
  entity: entity,
4673
- path: ["geometry"]
4697
+ path: ["Bruce", "VectorGeometry"]
4674
4698
  });
4675
4699
  const processGeometry = (geometry, depth = 0) => {
4676
4700
  if (!geometry || depth > 5) {
@@ -13042,7 +13066,7 @@
13042
13066
  })(exports.DataSource || (exports.DataSource = {}));
13043
13067
 
13044
13068
  // This is updated with the package.json version on build.
13045
- const VERSION = "4.2.8";
13069
+ const VERSION = "4.3.0";
13046
13070
 
13047
13071
  exports.VERSION = VERSION;
13048
13072
  exports.AbstractApi = AbstractApi;