bruce-models 4.2.8 → 4.3.1

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.
@@ -3295,7 +3295,7 @@ var Entity;
3295
3295
  */
3296
3296
  function Get(params) {
3297
3297
  return __awaiter(this, void 0, void 0, function* () {
3298
- let { api, entityId, schemaId, req: reqParams, expandLocation, expandRelations, entityTypeId, historicFrom, historicKey, historicTo, historicPoint } = params;
3298
+ let { api, entityId, migrated, schemaId, req: reqParams, expandLocation, expandRelations, entityTypeId, historicFrom, historicKey, historicTo, historicPoint } = params;
3299
3299
  if (!entityId) {
3300
3300
  throw ("Entity ID is required.");
3301
3301
  }
@@ -3351,6 +3351,7 @@ var Entity;
3351
3351
  if (schemaId) {
3352
3352
  urlParams.set("schema", schemaId);
3353
3353
  }
3354
+ urlParams.set("hasMigrated", String(Boolean(migrated)));
3354
3355
  const data = yield api.GET(`entity/${entityId}?${urlParams.toString()}`, Api.PrepReqParams(reqParams));
3355
3356
  res({
3356
3357
  entity: data
@@ -3376,7 +3377,7 @@ var Entity;
3376
3377
  */
3377
3378
  function GetListByIds(params) {
3378
3379
  return __awaiter(this, void 0, void 0, function* () {
3379
- let { api, entityIds, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources } = params;
3380
+ let { api, entityIds, migrated, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources } = params;
3380
3381
  if (!entityIds.length) {
3381
3382
  throw ("Entity IDs are required.");
3382
3383
  }
@@ -3434,6 +3435,7 @@ var Entity;
3434
3435
  if (schemaId) {
3435
3436
  urlParams.set("schema", schemaId);
3436
3437
  }
3438
+ urlParams.set("hasMigrated", String(Boolean(migrated)));
3437
3439
  const url = `entities?${urlParams.toString()}`;
3438
3440
  const reqs = [];
3439
3441
  if (reqIds.length > 0) {
@@ -3544,7 +3546,7 @@ var Entity;
3544
3546
  function Update(params) {
3545
3547
  var _a, _b;
3546
3548
  return __awaiter(this, void 0, void 0, function* () {
3547
- let { api, entity: data, override, req: reqParams } = params;
3549
+ let { api, entity: data, override, req: reqParams, migrated } = params;
3548
3550
  if (!((_a = data === null || data === void 0 ? void 0 : data.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"])) {
3549
3551
  throw ("Entity Type ID is required.");
3550
3552
  }
@@ -3554,7 +3556,10 @@ var Entity;
3554
3556
  if (!((_b = data === null || data === void 0 ? void 0 : data.Bruce) === null || _b === void 0 ? void 0 : _b.ID)) {
3555
3557
  data.Bruce = Object.assign(Object.assign({}, data.Bruce), { ID: ObjectUtils.UId() });
3556
3558
  }
3557
- const reqUrl = `entity/${data.Bruce.ID}/?dataoverride=${override}&BruceEntityType=${data.Bruce["EntityType.ID"]}`;
3559
+ let reqUrl = `entity/${data.Bruce.ID}/?dataoverride=${override}&BruceEntityType=${data.Bruce["EntityType.ID"]}`;
3560
+ if (migrated) {
3561
+ reqUrl += "&hasMigrated=true";
3562
+ }
3558
3563
  const res = yield api.POST(reqUrl, data, Api.PrepReqParams(reqParams));
3559
3564
  api.Cache.RemoveByContains(GetContainsKey(data.Bruce.ID));
3560
3565
  EntityHistoricData.ClearCacheByEntityIds(api, [data.Bruce.ID]);
@@ -3601,7 +3606,13 @@ var Entity;
3601
3606
  * @param params
3602
3607
  */
3603
3608
  function SetValue(params) {
3604
- const { entity: data, path, value } = params;
3609
+ let { entity: data, path, value } = params;
3610
+ if (!path || !path.length) {
3611
+ return;
3612
+ }
3613
+ if (typeof path == "string") {
3614
+ path = PathUtils.Parse(path);
3615
+ }
3605
3616
  let curData = data;
3606
3617
  for (let i = 0; i < path.length; i++) {
3607
3618
  const step = path[i];
@@ -3627,6 +3638,12 @@ var Entity;
3627
3638
  if (checkAgainstLegacy == null) {
3628
3639
  checkAgainstLegacy = true;
3629
3640
  }
3641
+ if (!path || !path.length) {
3642
+ return null;
3643
+ }
3644
+ if (typeof path == "string") {
3645
+ path = PathUtils.Parse(path);
3646
+ }
3630
3647
  // Backwards compatibility for incredibly old data.
3631
3648
  if (checkAgainstLegacy && path.length == 1 && path[0] == "ID") {
3632
3649
  return (_a = data.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
@@ -3654,60 +3671,66 @@ var Entity;
3654
3671
  // So we'll check against both locations until migration is complete.
3655
3672
  // First we'll check against properties that could be found inside the internal section.
3656
3673
  if (path[0] == "location") {
3657
- value = checkForValue(["Bruce"].concat(path));
3674
+ value = checkForValue(["Bruce", "Location"].concat(path.slice(1)));
3658
3675
  }
3659
3676
  else if (path[0] == "transform") {
3660
- value = checkForValue(["Bruce"].concat(path));
3677
+ value = checkForValue(["Bruce", "Transform"].concat(path.slice(1)));
3661
3678
  }
3662
3679
  else if (path[0] == "geometry") {
3663
- value = checkForValue(["Bruce"].concat(path));
3680
+ value = checkForValue(["Bruce", "VectorGeometry"].concat(path.slice(1)));
3664
3681
  }
3665
3682
  else if (path[0] == "boundaries") {
3666
- value = checkForValue(["Bruce"].concat(path));
3683
+ value = checkForValue(["Bruce", "Boundaries"].concat(path.slice(1)));
3667
3684
  }
3668
3685
  else if (path[0] == "geometryPivot") {
3669
- value = checkForValue(["Bruce"].concat(path));
3686
+ value = checkForValue(["Bruce", "GeometryPivot"].concat(path.slice(1)));
3670
3687
  }
3671
3688
  else if (path[0] == "worldPivot") {
3672
- value = checkForValue(["Bruce"].concat(path));
3689
+ value = checkForValue(["Bruce", "GeometryWorldPivot"].concat(path.slice(1)));
3673
3690
  }
3674
3691
  else if (path[0] == "worldPosition") {
3675
- value = checkForValue(["Bruce"].concat(path));
3692
+ value = checkForValue(["Bruce", "AssemblyWorldPosition"].concat(path.slice(1)));
3676
3693
  }
3677
3694
  else if (path[0] == "tilesetID") {
3678
- value = checkForValue(["Bruce"].concat(path));
3695
+ value = checkForValue(["Bruce", "TilesetIDs"].concat(path.slice(1)));
3679
3696
  }
3680
3697
  else if (path[0] == "geometryRadius") {
3681
- value = checkForValue(["Bruce"].concat(path));
3698
+ value = checkForValue(["Bruce", "GeometryRadius"].concat(path.slice(1)));
3682
3699
  }
3683
3700
  // Now we'll check against properties that could still be in the top-level and haven't been migrated yet.
3684
3701
  if (path[0] == "Bruce" && path.length > 1) {
3685
- if (path[1] == "location") {
3686
- value = checkForValue(path.slice(1));
3702
+ if (path[1] == "Location") {
3703
+ value = checkForValue(["location"].concat(path.slice(2)));
3704
+ }
3705
+ else if (path[1] == "Transform") {
3706
+ value = checkForValue(["transform"].concat(path.slice(2)));
3707
+ }
3708
+ else if (path[1] == "VectorGeometry") {
3709
+ value = checkForValue(["geometry"].concat(path.slice(2)));
3687
3710
  }
3688
- else if (path[1] == "transform") {
3689
- value = checkForValue(path.slice(1));
3711
+ else if (path[1] == "Boundaries") {
3712
+ value = checkForValue(["boundaries"].concat(path.slice(2)));
3690
3713
  }
3691
- else if (path[1] == "geometry") {
3692
- value = checkForValue(path.slice(1));
3714
+ else if (path[1] == "GeometryPivot") {
3715
+ value = checkForValue(["geometryPivot"].concat(path.slice(2)));
3693
3716
  }
3694
- else if (path[1] == "boundaries") {
3695
- value = checkForValue(path.slice(1));
3717
+ else if (path[1] == "GeometryWorldPivot") {
3718
+ value = checkForValue(["worldPivot"].concat(path.slice(2)));
3696
3719
  }
3697
- else if (path[1] == "geometryPivot") {
3698
- value = checkForValue(path.slice(1));
3720
+ else if (path[1] == "AssemblyWorldPosition") {
3721
+ value = checkForValue(["worldPosition"].concat(path.slice(2)));
3699
3722
  }
3700
- else if (path[1] == "worldPivot") {
3701
- value = checkForValue(path.slice(1));
3723
+ else if (path[1] == "TilesetIDs") {
3724
+ value = checkForValue(["tilesetID"].concat(path.slice(2)));
3702
3725
  }
3703
- else if (path[1] == "worldPosition") {
3704
- value = checkForValue(path.slice(1));
3726
+ else if (path[1] == "GeometryRadius") {
3727
+ value = checkForValue(["geometryRadius"].concat(path.slice(2)));
3705
3728
  }
3706
- else if (path[1] == "tilesetID") {
3707
- value = checkForValue(path.slice(1));
3729
+ else if (path[1] == "relations") {
3730
+ value = checkForValue(["Bruce", "Relations"].concat(path.slice(2)));
3708
3731
  }
3709
- else if (path[1] == "geometryRadius") {
3710
- value = checkForValue(path.slice(1));
3732
+ else if (path[1] == "Relations") {
3733
+ value = checkForValue(["Bruce", "relations"].concat(path.slice(2)));
3711
3734
  }
3712
3735
  }
3713
3736
  }
@@ -3721,7 +3744,13 @@ var Entity;
3721
3744
  * @param params
3722
3745
  */
3723
3746
  function RemoveValue(params) {
3724
- const { entity: data, path } = params;
3747
+ let { entity: data, path } = params;
3748
+ if (!path || !path.length) {
3749
+ return;
3750
+ }
3751
+ if (typeof path == "string") {
3752
+ path = PathUtils.Parse(path);
3753
+ }
3725
3754
  let curData = data;
3726
3755
  for (let i = 0; i < path.length; i++) {
3727
3756
  const step = path[i];
@@ -3811,7 +3840,7 @@ var Entity;
3811
3840
  function GetList(params) {
3812
3841
  var _a;
3813
3842
  return __awaiter(this, void 0, void 0, function* () {
3814
- let { api, filter, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources } = params;
3843
+ let { api, filter, migrated, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources } = params;
3815
3844
  if (!api) {
3816
3845
  api = ENVIRONMENT.Api().GetBruceApi();
3817
3846
  }
@@ -3929,6 +3958,7 @@ var Entity;
3929
3958
  if (schemaId) {
3930
3959
  urlParams.set("schema", schemaId);
3931
3960
  }
3961
+ urlParams.set("hasMigrated", String(Boolean(migrated)));
3932
3962
  const urlStr = url.toString();
3933
3963
  const data = yield api.get(urlStr, Api.PrepReqParams(reqParams));
3934
3964
  if (!analysis) {
@@ -3948,6 +3978,7 @@ var Entity;
3948
3978
  if (schemaId) {
3949
3979
  urlParams.set("schema", schemaId);
3950
3980
  }
3981
+ urlParams.set("hasMigrated", String(Boolean(migrated)));
3951
3982
  const urlStr = url.toString();
3952
3983
  const data = yield api.post(urlStr, body, Api.PrepReqParams(reqParams));
3953
3984
  if (!analysis) {
@@ -4730,14 +4761,14 @@ var Bounds;
4730
4761
  const points = [];
4731
4762
  const location = Entity.GetValue({
4732
4763
  entity: entity,
4733
- path: ["location"]
4764
+ path: ["Bruce", "Location"]
4734
4765
  });
4735
4766
  if (location) {
4736
4767
  points.push(location);
4737
4768
  }
4738
4769
  const geometry = Entity.GetValue({
4739
4770
  entity: entity,
4740
- path: ["geometry"]
4771
+ path: ["Bruce", "VectorGeometry"]
4741
4772
  });
4742
4773
  const processGeometry = (geometry, depth = 0) => {
4743
4774
  if (!geometry || depth > 5) {
@@ -13308,7 +13339,7 @@ var DataSource;
13308
13339
  })(DataSource || (DataSource = {}));
13309
13340
 
13310
13341
  // This is updated with the package.json version on build.
13311
- const VERSION = "4.2.8";
13342
+ const VERSION = "4.3.1";
13312
13343
 
13313
13344
  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 };
13314
13345
  //# sourceMappingURL=bruce-models.es5.js.map