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.
- package/dist/bruce-models.es5.js +68 -37
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +68 -37
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/common/bounds.js +2 -2
- package/dist/lib/common/bounds.js.map +1 -1
- package/dist/lib/entity/entity.js +65 -34
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/entity/entity.d.ts +36 -15
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -3241,7 +3241,7 @@
|
|
|
3241
3241
|
*/
|
|
3242
3242
|
function Get(params) {
|
|
3243
3243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3244
|
-
let { api, entityId, schemaId, req: reqParams, expandLocation, expandRelations, entityTypeId, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
3244
|
+
let { api, entityId, migrated, schemaId, req: reqParams, expandLocation, expandRelations, entityTypeId, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
3245
3245
|
if (!entityId) {
|
|
3246
3246
|
throw ("Entity ID is required.");
|
|
3247
3247
|
}
|
|
@@ -3297,6 +3297,7 @@
|
|
|
3297
3297
|
if (schemaId) {
|
|
3298
3298
|
urlParams.set("schema", schemaId);
|
|
3299
3299
|
}
|
|
3300
|
+
urlParams.set("hasMigrated", String(Boolean(migrated)));
|
|
3300
3301
|
const data = yield api.GET(`entity/${entityId}?${urlParams.toString()}`, exports.Api.PrepReqParams(reqParams));
|
|
3301
3302
|
res({
|
|
3302
3303
|
entity: data
|
|
@@ -3322,7 +3323,7 @@
|
|
|
3322
3323
|
*/
|
|
3323
3324
|
function GetListByIds(params) {
|
|
3324
3325
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3325
|
-
let { api, entityIds, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources } = params;
|
|
3326
|
+
let { api, entityIds, migrated, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources } = params;
|
|
3326
3327
|
if (!entityIds.length) {
|
|
3327
3328
|
throw ("Entity IDs are required.");
|
|
3328
3329
|
}
|
|
@@ -3380,6 +3381,7 @@
|
|
|
3380
3381
|
if (schemaId) {
|
|
3381
3382
|
urlParams.set("schema", schemaId);
|
|
3382
3383
|
}
|
|
3384
|
+
urlParams.set("hasMigrated", String(Boolean(migrated)));
|
|
3383
3385
|
const url = `entities?${urlParams.toString()}`;
|
|
3384
3386
|
const reqs = [];
|
|
3385
3387
|
if (reqIds.length > 0) {
|
|
@@ -3490,7 +3492,7 @@
|
|
|
3490
3492
|
function Update(params) {
|
|
3491
3493
|
var _a, _b;
|
|
3492
3494
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3493
|
-
let { api, entity: data, override, req: reqParams } = params;
|
|
3495
|
+
let { api, entity: data, override, req: reqParams, migrated } = params;
|
|
3494
3496
|
if (!((_a = data === null || data === void 0 ? void 0 : data.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"])) {
|
|
3495
3497
|
throw ("Entity Type ID is required.");
|
|
3496
3498
|
}
|
|
@@ -3500,7 +3502,10 @@
|
|
|
3500
3502
|
if (!((_b = data === null || data === void 0 ? void 0 : data.Bruce) === null || _b === void 0 ? void 0 : _b.ID)) {
|
|
3501
3503
|
data.Bruce = Object.assign(Object.assign({}, data.Bruce), { ID: exports.ObjectUtils.UId() });
|
|
3502
3504
|
}
|
|
3503
|
-
|
|
3505
|
+
let reqUrl = `entity/${data.Bruce.ID}/?dataoverride=${override}&BruceEntityType=${data.Bruce["EntityType.ID"]}`;
|
|
3506
|
+
if (migrated) {
|
|
3507
|
+
reqUrl += "&hasMigrated=true";
|
|
3508
|
+
}
|
|
3504
3509
|
const res = yield api.POST(reqUrl, data, exports.Api.PrepReqParams(reqParams));
|
|
3505
3510
|
api.Cache.RemoveByContains(GetContainsKey(data.Bruce.ID));
|
|
3506
3511
|
exports.EntityHistoricData.ClearCacheByEntityIds(api, [data.Bruce.ID]);
|
|
@@ -3547,7 +3552,13 @@
|
|
|
3547
3552
|
* @param params
|
|
3548
3553
|
*/
|
|
3549
3554
|
function SetValue(params) {
|
|
3550
|
-
|
|
3555
|
+
let { entity: data, path, value } = params;
|
|
3556
|
+
if (!path || !path.length) {
|
|
3557
|
+
return;
|
|
3558
|
+
}
|
|
3559
|
+
if (typeof path == "string") {
|
|
3560
|
+
path = exports.PathUtils.Parse(path);
|
|
3561
|
+
}
|
|
3551
3562
|
let curData = data;
|
|
3552
3563
|
for (let i = 0; i < path.length; i++) {
|
|
3553
3564
|
const step = path[i];
|
|
@@ -3573,6 +3584,12 @@
|
|
|
3573
3584
|
if (checkAgainstLegacy == null) {
|
|
3574
3585
|
checkAgainstLegacy = true;
|
|
3575
3586
|
}
|
|
3587
|
+
if (!path || !path.length) {
|
|
3588
|
+
return null;
|
|
3589
|
+
}
|
|
3590
|
+
if (typeof path == "string") {
|
|
3591
|
+
path = exports.PathUtils.Parse(path);
|
|
3592
|
+
}
|
|
3576
3593
|
// Backwards compatibility for incredibly old data.
|
|
3577
3594
|
if (checkAgainstLegacy && path.length == 1 && path[0] == "ID") {
|
|
3578
3595
|
return (_a = data.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
|
|
@@ -3600,60 +3617,66 @@
|
|
|
3600
3617
|
// So we'll check against both locations until migration is complete.
|
|
3601
3618
|
// First we'll check against properties that could be found inside the internal section.
|
|
3602
3619
|
if (path[0] == "location") {
|
|
3603
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3620
|
+
value = checkForValue(["Bruce", "Location"].concat(path.slice(1)));
|
|
3604
3621
|
}
|
|
3605
3622
|
else if (path[0] == "transform") {
|
|
3606
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3623
|
+
value = checkForValue(["Bruce", "Transform"].concat(path.slice(1)));
|
|
3607
3624
|
}
|
|
3608
3625
|
else if (path[0] == "geometry") {
|
|
3609
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3626
|
+
value = checkForValue(["Bruce", "VectorGeometry"].concat(path.slice(1)));
|
|
3610
3627
|
}
|
|
3611
3628
|
else if (path[0] == "boundaries") {
|
|
3612
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3629
|
+
value = checkForValue(["Bruce", "Boundaries"].concat(path.slice(1)));
|
|
3613
3630
|
}
|
|
3614
3631
|
else if (path[0] == "geometryPivot") {
|
|
3615
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3632
|
+
value = checkForValue(["Bruce", "GeometryPivot"].concat(path.slice(1)));
|
|
3616
3633
|
}
|
|
3617
3634
|
else if (path[0] == "worldPivot") {
|
|
3618
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3635
|
+
value = checkForValue(["Bruce", "GeometryWorldPivot"].concat(path.slice(1)));
|
|
3619
3636
|
}
|
|
3620
3637
|
else if (path[0] == "worldPosition") {
|
|
3621
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3638
|
+
value = checkForValue(["Bruce", "AssemblyWorldPosition"].concat(path.slice(1)));
|
|
3622
3639
|
}
|
|
3623
3640
|
else if (path[0] == "tilesetID") {
|
|
3624
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3641
|
+
value = checkForValue(["Bruce", "TilesetIDs"].concat(path.slice(1)));
|
|
3625
3642
|
}
|
|
3626
3643
|
else if (path[0] == "geometryRadius") {
|
|
3627
|
-
value = checkForValue(["Bruce"].concat(path));
|
|
3644
|
+
value = checkForValue(["Bruce", "GeometryRadius"].concat(path.slice(1)));
|
|
3628
3645
|
}
|
|
3629
3646
|
// Now we'll check against properties that could still be in the top-level and haven't been migrated yet.
|
|
3630
3647
|
if (path[0] == "Bruce" && path.length > 1) {
|
|
3631
|
-
if (path[1] == "
|
|
3632
|
-
value = checkForValue(path.slice(
|
|
3648
|
+
if (path[1] == "Location") {
|
|
3649
|
+
value = checkForValue(["location"].concat(path.slice(2)));
|
|
3650
|
+
}
|
|
3651
|
+
else if (path[1] == "Transform") {
|
|
3652
|
+
value = checkForValue(["transform"].concat(path.slice(2)));
|
|
3653
|
+
}
|
|
3654
|
+
else if (path[1] == "VectorGeometry") {
|
|
3655
|
+
value = checkForValue(["geometry"].concat(path.slice(2)));
|
|
3633
3656
|
}
|
|
3634
|
-
else if (path[1] == "
|
|
3635
|
-
value = checkForValue(path.slice(
|
|
3657
|
+
else if (path[1] == "Boundaries") {
|
|
3658
|
+
value = checkForValue(["boundaries"].concat(path.slice(2)));
|
|
3636
3659
|
}
|
|
3637
|
-
else if (path[1] == "
|
|
3638
|
-
value = checkForValue(path.slice(
|
|
3660
|
+
else if (path[1] == "GeometryPivot") {
|
|
3661
|
+
value = checkForValue(["geometryPivot"].concat(path.slice(2)));
|
|
3639
3662
|
}
|
|
3640
|
-
else if (path[1] == "
|
|
3641
|
-
value = checkForValue(path.slice(
|
|
3663
|
+
else if (path[1] == "GeometryWorldPivot") {
|
|
3664
|
+
value = checkForValue(["worldPivot"].concat(path.slice(2)));
|
|
3642
3665
|
}
|
|
3643
|
-
else if (path[1] == "
|
|
3644
|
-
value = checkForValue(path.slice(
|
|
3666
|
+
else if (path[1] == "AssemblyWorldPosition") {
|
|
3667
|
+
value = checkForValue(["worldPosition"].concat(path.slice(2)));
|
|
3645
3668
|
}
|
|
3646
|
-
else if (path[1] == "
|
|
3647
|
-
value = checkForValue(path.slice(
|
|
3669
|
+
else if (path[1] == "TilesetIDs") {
|
|
3670
|
+
value = checkForValue(["tilesetID"].concat(path.slice(2)));
|
|
3648
3671
|
}
|
|
3649
|
-
else if (path[1] == "
|
|
3650
|
-
value = checkForValue(path.slice(
|
|
3672
|
+
else if (path[1] == "GeometryRadius") {
|
|
3673
|
+
value = checkForValue(["geometryRadius"].concat(path.slice(2)));
|
|
3651
3674
|
}
|
|
3652
|
-
else if (path[1] == "
|
|
3653
|
-
value = checkForValue(path.slice(
|
|
3675
|
+
else if (path[1] == "relations") {
|
|
3676
|
+
value = checkForValue(["Bruce", "Relations"].concat(path.slice(2)));
|
|
3654
3677
|
}
|
|
3655
|
-
else if (path[1] == "
|
|
3656
|
-
value = checkForValue(path.slice(
|
|
3678
|
+
else if (path[1] == "Relations") {
|
|
3679
|
+
value = checkForValue(["Bruce", "relations"].concat(path.slice(2)));
|
|
3657
3680
|
}
|
|
3658
3681
|
}
|
|
3659
3682
|
}
|
|
@@ -3667,7 +3690,13 @@
|
|
|
3667
3690
|
* @param params
|
|
3668
3691
|
*/
|
|
3669
3692
|
function RemoveValue(params) {
|
|
3670
|
-
|
|
3693
|
+
let { entity: data, path } = params;
|
|
3694
|
+
if (!path || !path.length) {
|
|
3695
|
+
return;
|
|
3696
|
+
}
|
|
3697
|
+
if (typeof path == "string") {
|
|
3698
|
+
path = exports.PathUtils.Parse(path);
|
|
3699
|
+
}
|
|
3671
3700
|
let curData = data;
|
|
3672
3701
|
for (let i = 0; i < path.length; i++) {
|
|
3673
3702
|
const step = path[i];
|
|
@@ -3757,7 +3786,7 @@
|
|
|
3757
3786
|
function GetList(params) {
|
|
3758
3787
|
var _a;
|
|
3759
3788
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3760
|
-
let { api, filter, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources } = params;
|
|
3789
|
+
let { api, filter, migrated, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources } = params;
|
|
3761
3790
|
if (!api) {
|
|
3762
3791
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
3763
3792
|
}
|
|
@@ -3875,6 +3904,7 @@
|
|
|
3875
3904
|
if (schemaId) {
|
|
3876
3905
|
urlParams.set("schema", schemaId);
|
|
3877
3906
|
}
|
|
3907
|
+
urlParams.set("hasMigrated", String(Boolean(migrated)));
|
|
3878
3908
|
const urlStr = url.toString();
|
|
3879
3909
|
const data = yield api.get(urlStr, exports.Api.PrepReqParams(reqParams));
|
|
3880
3910
|
if (!analysis) {
|
|
@@ -3894,6 +3924,7 @@
|
|
|
3894
3924
|
if (schemaId) {
|
|
3895
3925
|
urlParams.set("schema", schemaId);
|
|
3896
3926
|
}
|
|
3927
|
+
urlParams.set("hasMigrated", String(Boolean(migrated)));
|
|
3897
3928
|
const urlStr = url.toString();
|
|
3898
3929
|
const data = yield api.post(urlStr, body, exports.Api.PrepReqParams(reqParams));
|
|
3899
3930
|
if (!analysis) {
|
|
@@ -4663,14 +4694,14 @@
|
|
|
4663
4694
|
const points = [];
|
|
4664
4695
|
const location = exports.Entity.GetValue({
|
|
4665
4696
|
entity: entity,
|
|
4666
|
-
path: ["
|
|
4697
|
+
path: ["Bruce", "Location"]
|
|
4667
4698
|
});
|
|
4668
4699
|
if (location) {
|
|
4669
4700
|
points.push(location);
|
|
4670
4701
|
}
|
|
4671
4702
|
const geometry = exports.Entity.GetValue({
|
|
4672
4703
|
entity: entity,
|
|
4673
|
-
path: ["
|
|
4704
|
+
path: ["Bruce", "VectorGeometry"]
|
|
4674
4705
|
});
|
|
4675
4706
|
const processGeometry = (geometry, depth = 0) => {
|
|
4676
4707
|
if (!geometry || depth > 5) {
|
|
@@ -13042,7 +13073,7 @@
|
|
|
13042
13073
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
13043
13074
|
|
|
13044
13075
|
// This is updated with the package.json version on build.
|
|
13045
|
-
const VERSION = "4.
|
|
13076
|
+
const VERSION = "4.3.1";
|
|
13046
13077
|
|
|
13047
13078
|
exports.VERSION = VERSION;
|
|
13048
13079
|
exports.AbstractApi = AbstractApi;
|