bruce-models 0.6.8 → 0.7.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 +221 -212
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +214 -205
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js +244 -244
- package/dist/lib/account/account.js.map +1 -1
- package/dist/lib/ann-document/ann-document.js +116 -116
- package/dist/lib/api/abstract-api.js +267 -267
- package/dist/lib/api/api.js +85 -85
- package/dist/lib/api/bruce-api.js +202 -202
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/api/cam-api.js +132 -132
- package/dist/lib/api/global-api.js +131 -131
- package/dist/lib/api/idm-api.js +132 -132
- package/dist/lib/bruce-models.js +83 -83
- package/dist/lib/calculator/calculator.js +158 -158
- package/dist/lib/client-file/client-file.js +188 -185
- package/dist/lib/client-file/client-file.js.map +1 -1
- package/dist/lib/common/bounds.js +2 -2
- package/dist/lib/common/bruce-event.js +48 -48
- package/dist/lib/common/bruce-variable.js +54 -54
- package/dist/lib/common/cache.js +86 -86
- package/dist/lib/common/camera.js +11 -11
- package/dist/lib/common/cartes.js +55 -55
- package/dist/lib/common/carto.js +60 -60
- package/dist/lib/common/color.js +86 -86
- package/dist/lib/common/delay-queue.js +60 -60
- package/dist/lib/common/dictionary.js +2 -2
- package/dist/lib/common/geometry.js +120 -120
- package/dist/lib/common/transform.js +2 -2
- package/dist/lib/common/utc.js +39 -39
- package/dist/lib/custom-form/custom-form.js +136 -136
- package/dist/lib/data-lab/data-lab.js +90 -90
- package/dist/lib/entity/entity-attachment-type.js +132 -132
- package/dist/lib/entity/entity-attachment.js +208 -208
- package/dist/lib/entity/entity-comment.js +132 -132
- package/dist/lib/entity/entity-link.js +132 -132
- package/dist/lib/entity/entity-lod.js +189 -189
- package/dist/lib/entity/entity-relation-type.js +150 -150
- package/dist/lib/entity/entity-relation.js +189 -189
- package/dist/lib/entity/entity-source.js +176 -176
- package/dist/lib/entity/entity-tag.js +229 -229
- package/dist/lib/entity/entity-type.js +163 -163
- package/dist/lib/entity/entity.js +349 -349
- package/dist/lib/entity/getters/batched-data-getter.js +91 -91
- package/dist/lib/entity/getters/entity-filter-getter.js +344 -344
- package/dist/lib/entity/getters/entity-globe.js +135 -135
- package/dist/lib/entity/getters/view-monitor.js +2 -2
- package/dist/lib/import/import-cad.js +82 -82
- package/dist/lib/import/import-csv.js +51 -51
- package/dist/lib/import/import-json.js +51 -51
- package/dist/lib/import/import-kml.js +51 -51
- package/dist/lib/import/imported-file.js +121 -121
- package/dist/lib/markup/markup.js +40 -40
- package/dist/lib/program-key/program-key.js +152 -152
- package/dist/lib/project/menu-item.js +115 -115
- package/dist/lib/project/project-view-bookmark.js +172 -172
- package/dist/lib/project/project-view-tile-source.js +115 -115
- package/dist/lib/project/project-view.js +166 -166
- package/dist/lib/project/zoom-control.js +17 -17
- package/dist/lib/server/pending-action.js +106 -106
- package/dist/lib/server/task.js +113 -113
- package/dist/lib/style/style.js +152 -152
- package/dist/lib/tileset/tileset-cad.js +2 -2
- package/dist/lib/tileset/tileset-entities-map-tiles.js +18 -18
- package/dist/lib/tileset/tileset-entities.js +2 -2
- package/dist/lib/tileset/tileset-ext-map-tiles.js +17 -17
- package/dist/lib/tileset/tileset-ext-terrain-tiles.js +2 -2
- package/dist/lib/tileset/tileset-map-tiles.js +2 -2
- package/dist/lib/tileset/tileset-pointcloud.js +2 -2
- package/dist/lib/tileset/tileset-terrain-tiles.js +2 -2
- package/dist/lib/tileset/tileset.js +403 -397
- package/dist/lib/tileset/tileset.js.map +1 -1
- package/dist/lib/ucs/ucs.js +135 -135
- package/dist/lib/user/permission.js +20 -20
- package/dist/lib/user/session.js +160 -160
- package/dist/lib/user/user-group.js +139 -139
- package/dist/lib/user/user.js +451 -451
- package/dist/lib/util/encrypt-utils.js +20 -20
- package/dist/lib/util/math-utils.js +41 -41
- package/dist/lib/util/object-utils.js +17 -17
- package/dist/lib/util/path-utils.js +61 -61
- package/dist/lib/util/url-utils.js +107 -107
- package/dist/types/account/account.d.ts +1 -0
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -631,6 +631,211 @@ var AbstractApi = /** @class */ (function () {
|
|
|
631
631
|
return AbstractApi;
|
|
632
632
|
}());
|
|
633
633
|
|
|
634
|
+
var ACCOUNT_EXCLUSIONS = ["hyperportal", "hypeportal", "bviewer"];
|
|
635
|
+
/**
|
|
636
|
+
* Describes the "Client Account" concept within Bruce.
|
|
637
|
+
* A client account is a database instance that holds one or many users.
|
|
638
|
+
*/
|
|
639
|
+
var Account;
|
|
640
|
+
(function (Account) {
|
|
641
|
+
function GetCacheKey(accountId, appSettingsId) {
|
|
642
|
+
if (appSettingsId) {
|
|
643
|
+
return Api.ECacheKey.Account + Api.ECacheKey.Id + accountId + Api.ECacheKey + appSettingsId;
|
|
644
|
+
}
|
|
645
|
+
return Api.ECacheKey.Account + Api.ECacheKey.Id + accountId;
|
|
646
|
+
}
|
|
647
|
+
Account.GetCacheKey = GetCacheKey;
|
|
648
|
+
function GetListCacheKey(ssid) {
|
|
649
|
+
return Api.ECacheKey.Account + Api.ECacheKey.Session + Api.ECacheKey.Id + ssid;
|
|
650
|
+
}
|
|
651
|
+
Account.GetListCacheKey = GetListCacheKey;
|
|
652
|
+
var EDbRegion;
|
|
653
|
+
(function (EDbRegion) {
|
|
654
|
+
EDbRegion["USA"] = "US";
|
|
655
|
+
EDbRegion["Paris"] = "EU";
|
|
656
|
+
EDbRegion["Singapore"] = "SE";
|
|
657
|
+
EDbRegion["Australia"] = "AU";
|
|
658
|
+
})(EDbRegion = Account.EDbRegion || (Account.EDbRegion = {}));
|
|
659
|
+
var EAppId;
|
|
660
|
+
(function (EAppId) {
|
|
661
|
+
EAppId["BruceApi"] = "BruceAPI";
|
|
662
|
+
})(EAppId = Account.EAppId || (Account.EAppId = {}));
|
|
663
|
+
var EStarterContent;
|
|
664
|
+
(function (EStarterContent) {
|
|
665
|
+
EStarterContent["Default"] = "default";
|
|
666
|
+
EStarterContent["None"] = "none";
|
|
667
|
+
})(EStarterContent = Account.EStarterContent || (Account.EStarterContent = {}));
|
|
668
|
+
Account.DbRegions = [
|
|
669
|
+
{
|
|
670
|
+
name: "North California, USA",
|
|
671
|
+
value: EDbRegion.USA
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
name: "Paris, France",
|
|
675
|
+
value: EDbRegion.Paris
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
name: "Singapore",
|
|
679
|
+
value: EDbRegion.Singapore
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
name: "Sydney, Australia",
|
|
683
|
+
value: EDbRegion.Australia
|
|
684
|
+
}
|
|
685
|
+
];
|
|
686
|
+
function Get(api, id) {
|
|
687
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
688
|
+
var cacheData, req;
|
|
689
|
+
return __generator(this, function (_a) {
|
|
690
|
+
switch (_a.label) {
|
|
691
|
+
case 0:
|
|
692
|
+
cacheData = api.Cache.Get(GetCacheKey(id));
|
|
693
|
+
if (cacheData) {
|
|
694
|
+
return [2 /*return*/, cacheData];
|
|
695
|
+
}
|
|
696
|
+
return [4 /*yield*/, api.GET("account/" + id)];
|
|
697
|
+
case 1:
|
|
698
|
+
req = _a.sent();
|
|
699
|
+
api.Cache.Set(GetCacheKey(id), req, Api.DEFAULT_CACHE_DURATION);
|
|
700
|
+
return [2 /*return*/, req];
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
Account.Get = Get;
|
|
706
|
+
function GetRelatedList(api) {
|
|
707
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
708
|
+
var cacheData, req, prom;
|
|
709
|
+
var _this = this;
|
|
710
|
+
return __generator(this, function (_a) {
|
|
711
|
+
cacheData = api.Cache.Get(GetListCacheKey(api.GetSessionId()));
|
|
712
|
+
if (cacheData) {
|
|
713
|
+
return [2 /*return*/, cacheData];
|
|
714
|
+
}
|
|
715
|
+
req = api.GET("user/relatedClientAccounts");
|
|
716
|
+
prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
|
|
717
|
+
var data, items, e_1;
|
|
718
|
+
return __generator(this, function (_a) {
|
|
719
|
+
switch (_a.label) {
|
|
720
|
+
case 0:
|
|
721
|
+
_a.trys.push([0, 2, , 3]);
|
|
722
|
+
return [4 /*yield*/, req];
|
|
723
|
+
case 1:
|
|
724
|
+
data = _a.sent();
|
|
725
|
+
items = data.Items.filter(function (x) { return !ACCOUNT_EXCLUSIONS.includes(x.ID); });
|
|
726
|
+
res(items);
|
|
727
|
+
return [3 /*break*/, 3];
|
|
728
|
+
case 2:
|
|
729
|
+
e_1 = _a.sent();
|
|
730
|
+
rej(e_1);
|
|
731
|
+
return [3 /*break*/, 3];
|
|
732
|
+
case 3: return [2 /*return*/];
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
}); });
|
|
736
|
+
api.Cache.Set(GetListCacheKey(api.GetSessionId()), prom, Api.DEFAULT_CACHE_DURATION);
|
|
737
|
+
return [2 /*return*/, prom];
|
|
738
|
+
});
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
Account.GetRelatedList = GetRelatedList;
|
|
742
|
+
function GetAppSettings(api, id, appId) {
|
|
743
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
744
|
+
var cacheData, req, prom;
|
|
745
|
+
var _this = this;
|
|
746
|
+
return __generator(this, function (_a) {
|
|
747
|
+
switch (_a.label) {
|
|
748
|
+
case 0:
|
|
749
|
+
cacheData = api.Cache.Get(GetCacheKey(id, appId));
|
|
750
|
+
if (cacheData) {
|
|
751
|
+
return [2 /*return*/, cacheData];
|
|
752
|
+
}
|
|
753
|
+
return [4 /*yield*/, api.GET("account/" + id + "?ApplicationID=" + appId)];
|
|
754
|
+
case 1:
|
|
755
|
+
req = _a.sent();
|
|
756
|
+
prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
|
|
757
|
+
var data, settings, e_2;
|
|
758
|
+
var _a;
|
|
759
|
+
return __generator(this, function (_b) {
|
|
760
|
+
switch (_b.label) {
|
|
761
|
+
case 0:
|
|
762
|
+
_b.trys.push([0, 2, , 3]);
|
|
763
|
+
return [4 /*yield*/, req];
|
|
764
|
+
case 1:
|
|
765
|
+
data = _b.sent();
|
|
766
|
+
settings = (_a = data === null || data === void 0 ? void 0 : data["Application.Settings"]) !== null && _a !== void 0 ? _a : {};
|
|
767
|
+
res(settings);
|
|
768
|
+
return [3 /*break*/, 3];
|
|
769
|
+
case 2:
|
|
770
|
+
e_2 = _b.sent();
|
|
771
|
+
rej(e_2);
|
|
772
|
+
return [3 /*break*/, 3];
|
|
773
|
+
case 3: return [2 /*return*/];
|
|
774
|
+
}
|
|
775
|
+
});
|
|
776
|
+
}); });
|
|
777
|
+
api.Cache.Set(GetCacheKey(id, appId), prom, Api.DEFAULT_CACHE_DURATION);
|
|
778
|
+
return [2 /*return*/, prom];
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
Account.GetAppSettings = GetAppSettings;
|
|
784
|
+
/**
|
|
785
|
+
* WARNING: Do not update API settings without knowing what you're doing.
|
|
786
|
+
* @param api
|
|
787
|
+
* @param id
|
|
788
|
+
* @param appId
|
|
789
|
+
* @param data
|
|
790
|
+
* @returns
|
|
791
|
+
*/
|
|
792
|
+
function UpdateAppSettings(api, id, appId, data) {
|
|
793
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
794
|
+
return __generator(this, function (_a) {
|
|
795
|
+
switch (_a.label) {
|
|
796
|
+
case 0: return [4 /*yield*/, api.POST("account/" + id + "/applicationSettings/" + appId, data)];
|
|
797
|
+
case 1:
|
|
798
|
+
data = _a.sent();
|
|
799
|
+
api.Cache.RemoveByStartsWith(Api.ECacheKey.Account + Api.ECacheKey.Id + id);
|
|
800
|
+
return [2 /*return*/, data];
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
Account.UpdateAppSettings = UpdateAppSettings;
|
|
806
|
+
/**
|
|
807
|
+
* Creates a new Bruce account using given details.
|
|
808
|
+
* @param api
|
|
809
|
+
* @param id
|
|
810
|
+
* @param name
|
|
811
|
+
* @param region
|
|
812
|
+
* @param starterContent
|
|
813
|
+
* @returns
|
|
814
|
+
*/
|
|
815
|
+
function Create(api, id, name, region, starterContent) {
|
|
816
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
817
|
+
var reqData, res;
|
|
818
|
+
return __generator(this, function (_a) {
|
|
819
|
+
if (!id || !name || !region) {
|
|
820
|
+
throw new Error("Id, Name and Region are required.");
|
|
821
|
+
}
|
|
822
|
+
if (!starterContent) {
|
|
823
|
+
starterContent = EStarterContent.None;
|
|
824
|
+
}
|
|
825
|
+
reqData = {
|
|
826
|
+
"Name": name,
|
|
827
|
+
"DBLocation": region,
|
|
828
|
+
"StarterContent": starterContent
|
|
829
|
+
};
|
|
830
|
+
res = api.POST("clientAccount/" + id, reqData, Api.PrepReqParams());
|
|
831
|
+
api.Cache.Remove(GetListCacheKey(api.GetSessionId()));
|
|
832
|
+
return [2 /*return*/, res];
|
|
833
|
+
});
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
Account.Create = Create;
|
|
837
|
+
})(Account || (Account = {}));
|
|
838
|
+
|
|
634
839
|
/**
|
|
635
840
|
* This is the request handler for Cam Api,
|
|
636
841
|
* it should be passed to any method that wants to communicate with this particular api.
|
|
@@ -711,7 +916,7 @@ var CamApi;
|
|
|
711
916
|
})(CamApi || (CamApi = {}));
|
|
712
917
|
|
|
713
918
|
var BruceApi;
|
|
714
|
-
(function (BruceApi
|
|
919
|
+
(function (BruceApi) {
|
|
715
920
|
/**
|
|
716
921
|
* This is the request handler for Bruce Api,
|
|
717
922
|
* it should be passed to any method that wants to communicate with this particular api.
|
|
@@ -854,7 +1059,7 @@ var BruceApi;
|
|
|
854
1059
|
};
|
|
855
1060
|
return Api$$1;
|
|
856
1061
|
}(AbstractApi));
|
|
857
|
-
BruceApi
|
|
1062
|
+
BruceApi.Api = Api$$1;
|
|
858
1063
|
})(BruceApi || (BruceApi = {}));
|
|
859
1064
|
|
|
860
1065
|
var IdmApi;
|
|
@@ -3932,7 +4137,7 @@ var ClientFile;
|
|
|
3932
4137
|
ClientFile.Delete = Delete;
|
|
3933
4138
|
function Upload(api, file, purpose, onProgress) {
|
|
3934
4139
|
return __awaiter(this, void 0, void 0, function () {
|
|
3935
|
-
var formData;
|
|
4140
|
+
var formData, params;
|
|
3936
4141
|
return __generator(this, function (_a) {
|
|
3937
4142
|
if (!file) {
|
|
3938
4143
|
throw ("File is required.");
|
|
@@ -3943,7 +4148,10 @@ var ClientFile;
|
|
|
3943
4148
|
"Purpose": purpose
|
|
3944
4149
|
};
|
|
3945
4150
|
}
|
|
3946
|
-
|
|
4151
|
+
params = Api.PrepReqParams();
|
|
4152
|
+
params.onProgress = onProgress;
|
|
4153
|
+
params.formData = formData;
|
|
4154
|
+
return [2 /*return*/, api.UPLOAD("file/uploadNew", file, params)];
|
|
3947
4155
|
});
|
|
3948
4156
|
});
|
|
3949
4157
|
}
|
|
@@ -4006,7 +4214,7 @@ var ClientFile;
|
|
|
4006
4214
|
clientFileId: clientFileId,
|
|
4007
4215
|
destinationFormat: ext,
|
|
4008
4216
|
operations: []
|
|
4009
|
-
}
|
|
4217
|
+
})];
|
|
4010
4218
|
});
|
|
4011
4219
|
});
|
|
4012
4220
|
}
|
|
@@ -4281,11 +4489,14 @@ var Tileset;
|
|
|
4281
4489
|
Tileset.Update = Update;
|
|
4282
4490
|
function UploadFile(api, tilesetId, file, onProgress) {
|
|
4283
4491
|
return __awaiter(this, void 0, void 0, function () {
|
|
4492
|
+
var params;
|
|
4284
4493
|
return __generator(this, function (_a) {
|
|
4285
4494
|
if (!tilesetId || !file) {
|
|
4286
4495
|
throw ("Tileset ID and file are required.");
|
|
4287
4496
|
}
|
|
4288
|
-
|
|
4497
|
+
params = Api.PrepReqParams();
|
|
4498
|
+
params.onProgress = onProgress;
|
|
4499
|
+
return [2 /*return*/, api.UPLOAD("tileset/uploadFile/" + tilesetId + "/files", file, params)];
|
|
4289
4500
|
});
|
|
4290
4501
|
});
|
|
4291
4502
|
}
|
|
@@ -4310,13 +4521,16 @@ var Tileset;
|
|
|
4310
4521
|
Tileset.DeleteFile = DeleteFile;
|
|
4311
4522
|
function UploadSrcFile(api, tilesetId, file, onProgress) {
|
|
4312
4523
|
return __awaiter(this, void 0, void 0, function () {
|
|
4524
|
+
var params;
|
|
4313
4525
|
return __generator(this, function (_a) {
|
|
4314
4526
|
switch (_a.label) {
|
|
4315
4527
|
case 0:
|
|
4316
4528
|
if (!tilesetId || !file) {
|
|
4317
4529
|
throw ("Tileset ID and file are required.");
|
|
4318
4530
|
}
|
|
4319
|
-
|
|
4531
|
+
params = Api.PrepReqParams();
|
|
4532
|
+
params.onProgress = onProgress;
|
|
4533
|
+
return [4 /*yield*/, api.UPLOAD("tileset/uploadFile/" + tilesetId + "/src", file, params)];
|
|
4320
4534
|
case 1:
|
|
4321
4535
|
_a.sent();
|
|
4322
4536
|
api.Cache.Remove(GetCacheKey(tilesetId, true));
|
|
@@ -5890,211 +6104,6 @@ var User;
|
|
|
5890
6104
|
})(AccessToken = User.AccessToken || (User.AccessToken = {}));
|
|
5891
6105
|
})(User || (User = {}));
|
|
5892
6106
|
|
|
5893
|
-
var ACCOUNT_EXCLUSIONS = ["hyperportal", "hypeportal", "bviewer"];
|
|
5894
|
-
/**
|
|
5895
|
-
* Describes the "Client Account" concept within Bruce.
|
|
5896
|
-
* A client account is a database instance that holds one or many users.
|
|
5897
|
-
*/
|
|
5898
|
-
var Account;
|
|
5899
|
-
(function (Account) {
|
|
5900
|
-
function GetCacheKey(accountId, appSettingsId) {
|
|
5901
|
-
if (appSettingsId) {
|
|
5902
|
-
return Api.ECacheKey.Account + Api.ECacheKey.Id + accountId + Api.ECacheKey + appSettingsId;
|
|
5903
|
-
}
|
|
5904
|
-
return Api.ECacheKey.Account + Api.ECacheKey.Id + accountId;
|
|
5905
|
-
}
|
|
5906
|
-
Account.GetCacheKey = GetCacheKey;
|
|
5907
|
-
function GetListCacheKey(ssid) {
|
|
5908
|
-
return Api.ECacheKey.Account + Api.ECacheKey.Session + Api.ECacheKey.Id + ssid;
|
|
5909
|
-
}
|
|
5910
|
-
Account.GetListCacheKey = GetListCacheKey;
|
|
5911
|
-
var EDbRegion;
|
|
5912
|
-
(function (EDbRegion) {
|
|
5913
|
-
EDbRegion["USA"] = "US";
|
|
5914
|
-
EDbRegion["Paris"] = "EU";
|
|
5915
|
-
EDbRegion["Singapore"] = "SE";
|
|
5916
|
-
EDbRegion["Australia"] = "AU";
|
|
5917
|
-
})(EDbRegion = Account.EDbRegion || (Account.EDbRegion = {}));
|
|
5918
|
-
var EAppId;
|
|
5919
|
-
(function (EAppId) {
|
|
5920
|
-
EAppId["BruceApi"] = "BruceAPI";
|
|
5921
|
-
})(EAppId = Account.EAppId || (Account.EAppId = {}));
|
|
5922
|
-
var EStarterContent;
|
|
5923
|
-
(function (EStarterContent) {
|
|
5924
|
-
EStarterContent["Default"] = "default";
|
|
5925
|
-
EStarterContent["None"] = "none";
|
|
5926
|
-
})(EStarterContent = Account.EStarterContent || (Account.EStarterContent = {}));
|
|
5927
|
-
Account.DbRegions = [
|
|
5928
|
-
{
|
|
5929
|
-
name: "North California, USA",
|
|
5930
|
-
value: EDbRegion.USA
|
|
5931
|
-
},
|
|
5932
|
-
{
|
|
5933
|
-
name: "Paris, France",
|
|
5934
|
-
value: EDbRegion.Paris
|
|
5935
|
-
},
|
|
5936
|
-
{
|
|
5937
|
-
name: "Singapore",
|
|
5938
|
-
value: EDbRegion.Singapore
|
|
5939
|
-
},
|
|
5940
|
-
{
|
|
5941
|
-
name: "Sydney, Australia",
|
|
5942
|
-
value: EDbRegion.Australia
|
|
5943
|
-
}
|
|
5944
|
-
];
|
|
5945
|
-
function Get(api, id) {
|
|
5946
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
5947
|
-
var cacheData, req;
|
|
5948
|
-
return __generator(this, function (_a) {
|
|
5949
|
-
switch (_a.label) {
|
|
5950
|
-
case 0:
|
|
5951
|
-
cacheData = api.Cache.Get(GetCacheKey(id));
|
|
5952
|
-
if (cacheData) {
|
|
5953
|
-
return [2 /*return*/, cacheData];
|
|
5954
|
-
}
|
|
5955
|
-
return [4 /*yield*/, api.GET("account/" + id)];
|
|
5956
|
-
case 1:
|
|
5957
|
-
req = _a.sent();
|
|
5958
|
-
api.Cache.Set(GetCacheKey(id), req, Api.DEFAULT_CACHE_DURATION);
|
|
5959
|
-
return [2 /*return*/, req];
|
|
5960
|
-
}
|
|
5961
|
-
});
|
|
5962
|
-
});
|
|
5963
|
-
}
|
|
5964
|
-
Account.Get = Get;
|
|
5965
|
-
function GetRelatedList(api) {
|
|
5966
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
5967
|
-
var cacheData, req, prom;
|
|
5968
|
-
var _this = this;
|
|
5969
|
-
return __generator(this, function (_a) {
|
|
5970
|
-
cacheData = api.Cache.Get(GetListCacheKey(api.GetSessionId()));
|
|
5971
|
-
if (cacheData) {
|
|
5972
|
-
return [2 /*return*/, cacheData];
|
|
5973
|
-
}
|
|
5974
|
-
req = api.GET("user/relatedClientAccounts");
|
|
5975
|
-
prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
|
|
5976
|
-
var data, items, e_1;
|
|
5977
|
-
return __generator(this, function (_a) {
|
|
5978
|
-
switch (_a.label) {
|
|
5979
|
-
case 0:
|
|
5980
|
-
_a.trys.push([0, 2, , 3]);
|
|
5981
|
-
return [4 /*yield*/, req];
|
|
5982
|
-
case 1:
|
|
5983
|
-
data = _a.sent();
|
|
5984
|
-
items = data.Items.filter(function (x) { return !ACCOUNT_EXCLUSIONS.includes(x.ID); });
|
|
5985
|
-
res(items);
|
|
5986
|
-
return [3 /*break*/, 3];
|
|
5987
|
-
case 2:
|
|
5988
|
-
e_1 = _a.sent();
|
|
5989
|
-
rej(e_1);
|
|
5990
|
-
return [3 /*break*/, 3];
|
|
5991
|
-
case 3: return [2 /*return*/];
|
|
5992
|
-
}
|
|
5993
|
-
});
|
|
5994
|
-
}); });
|
|
5995
|
-
api.Cache.Set(GetListCacheKey(api.GetSessionId()), prom, Api.DEFAULT_CACHE_DURATION);
|
|
5996
|
-
return [2 /*return*/, prom];
|
|
5997
|
-
});
|
|
5998
|
-
});
|
|
5999
|
-
}
|
|
6000
|
-
Account.GetRelatedList = GetRelatedList;
|
|
6001
|
-
function GetAppSettings(api, id, appId) {
|
|
6002
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
6003
|
-
var cacheData, req, prom;
|
|
6004
|
-
var _this = this;
|
|
6005
|
-
return __generator(this, function (_a) {
|
|
6006
|
-
switch (_a.label) {
|
|
6007
|
-
case 0:
|
|
6008
|
-
cacheData = api.Cache.Get(GetCacheKey(id, appId));
|
|
6009
|
-
if (cacheData) {
|
|
6010
|
-
return [2 /*return*/, cacheData];
|
|
6011
|
-
}
|
|
6012
|
-
return [4 /*yield*/, api.GET("account/" + id + "?ApplicationID=" + appId)];
|
|
6013
|
-
case 1:
|
|
6014
|
-
req = _a.sent();
|
|
6015
|
-
prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
|
|
6016
|
-
var data, settings, e_2;
|
|
6017
|
-
var _a;
|
|
6018
|
-
return __generator(this, function (_b) {
|
|
6019
|
-
switch (_b.label) {
|
|
6020
|
-
case 0:
|
|
6021
|
-
_b.trys.push([0, 2, , 3]);
|
|
6022
|
-
return [4 /*yield*/, req];
|
|
6023
|
-
case 1:
|
|
6024
|
-
data = _b.sent();
|
|
6025
|
-
settings = (_a = data === null || data === void 0 ? void 0 : data["Application.Settings"]) !== null && _a !== void 0 ? _a : {};
|
|
6026
|
-
res(settings);
|
|
6027
|
-
return [3 /*break*/, 3];
|
|
6028
|
-
case 2:
|
|
6029
|
-
e_2 = _b.sent();
|
|
6030
|
-
rej(e_2);
|
|
6031
|
-
return [3 /*break*/, 3];
|
|
6032
|
-
case 3: return [2 /*return*/];
|
|
6033
|
-
}
|
|
6034
|
-
});
|
|
6035
|
-
}); });
|
|
6036
|
-
api.Cache.Set(GetCacheKey(id, appId), prom, Api.DEFAULT_CACHE_DURATION);
|
|
6037
|
-
return [2 /*return*/, prom];
|
|
6038
|
-
}
|
|
6039
|
-
});
|
|
6040
|
-
});
|
|
6041
|
-
}
|
|
6042
|
-
Account.GetAppSettings = GetAppSettings;
|
|
6043
|
-
/**
|
|
6044
|
-
* WARNING: Do not update API settings without knowing what you're doing.
|
|
6045
|
-
* @param api
|
|
6046
|
-
* @param id
|
|
6047
|
-
* @param appId
|
|
6048
|
-
* @param data
|
|
6049
|
-
* @returns
|
|
6050
|
-
*/
|
|
6051
|
-
function UpdateAppSettings(api, id, appId, data) {
|
|
6052
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
6053
|
-
return __generator(this, function (_a) {
|
|
6054
|
-
switch (_a.label) {
|
|
6055
|
-
case 0: return [4 /*yield*/, api.POST("account/" + id + "/applicationSettings/" + appId, data)];
|
|
6056
|
-
case 1:
|
|
6057
|
-
data = _a.sent();
|
|
6058
|
-
api.Cache.RemoveByStartsWith(Api.ECacheKey.Account + Api.ECacheKey.Id + id);
|
|
6059
|
-
return [2 /*return*/, data];
|
|
6060
|
-
}
|
|
6061
|
-
});
|
|
6062
|
-
});
|
|
6063
|
-
}
|
|
6064
|
-
Account.UpdateAppSettings = UpdateAppSettings;
|
|
6065
|
-
/**
|
|
6066
|
-
* Creates a new Bruce account using given details.
|
|
6067
|
-
* @param api
|
|
6068
|
-
* @param id
|
|
6069
|
-
* @param name
|
|
6070
|
-
* @param region
|
|
6071
|
-
* @param starterContent
|
|
6072
|
-
* @returns
|
|
6073
|
-
*/
|
|
6074
|
-
function Create(api, id, name, region, starterContent) {
|
|
6075
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
6076
|
-
var reqData, res;
|
|
6077
|
-
return __generator(this, function (_a) {
|
|
6078
|
-
if (!id || !name || !region) {
|
|
6079
|
-
throw new Error("Id, Name and Region are required.");
|
|
6080
|
-
}
|
|
6081
|
-
if (!starterContent) {
|
|
6082
|
-
starterContent = EStarterContent.None;
|
|
6083
|
-
}
|
|
6084
|
-
reqData = {
|
|
6085
|
-
"Name": name,
|
|
6086
|
-
"DBLocation": region,
|
|
6087
|
-
"StarterContent": starterContent
|
|
6088
|
-
};
|
|
6089
|
-
res = api.POST("clientAccount/" + id, reqData, Api.PrepReqParams());
|
|
6090
|
-
api.Cache.Remove(GetListCacheKey(api.GetSessionId()));
|
|
6091
|
-
return [2 /*return*/, res];
|
|
6092
|
-
});
|
|
6093
|
-
});
|
|
6094
|
-
}
|
|
6095
|
-
Account.Create = Create;
|
|
6096
|
-
})(Account || (Account = {}));
|
|
6097
|
-
|
|
6098
6107
|
var EncryptUtils;
|
|
6099
6108
|
(function (EncryptUtils) {
|
|
6100
6109
|
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
|