bruce-models 2.2.5 → 2.2.7

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.
@@ -755,13 +755,6 @@ var Account;
755
755
  return Api.ECacheKey.DatabaseRegion;
756
756
  }
757
757
  Account.GetDbRegionListCacheKey = GetDbRegionListCacheKey;
758
- let EDbRegion;
759
- (function (EDbRegion) {
760
- EDbRegion["USA"] = "US";
761
- EDbRegion["Paris"] = "EU";
762
- EDbRegion["Singapore"] = "SE";
763
- EDbRegion["Australia"] = "AU";
764
- })(EDbRegion = Account.EDbRegion || (Account.EDbRegion = {}));
765
758
  let EAppId;
766
759
  (function (EAppId) {
767
760
  EAppId["BruceApi"] = "BruceAPI";
@@ -874,16 +867,16 @@ var Account;
874
867
  */
875
868
  function Create(params) {
876
869
  return __awaiter(this, void 0, void 0, function* () {
877
- let { api, accountId: id, name, region, starterContent, req: reqParams } = params;
878
- if (!id || !name || !region) {
879
- throw new Error("Id, Name and Region are required.");
870
+ let { api, accountId: id, name, hostingLocationKey, starterContent, req: reqParams } = params;
871
+ if (!id || !name || !hostingLocationKey) {
872
+ throw new Error("Id, Name and hostingLocationKey are required.");
880
873
  }
881
874
  if (!starterContent) {
882
875
  starterContent = EStarterContent.None;
883
876
  }
884
877
  const reqData = {
885
878
  "Name": name,
886
- "DBLocation": region,
879
+ "HostingLocation.Key": hostingLocationKey,
887
880
  "StarterContent": starterContent
888
881
  };
889
882
  const res = yield api.POST(`clientAccount/${id}`, reqData, Api.PrepReqParams(reqParams));
@@ -895,145 +888,8 @@ var Account;
895
888
  });
896
889
  }
897
890
  Account.Create = Create;
898
- function GetDbRegions(params) {
899
- return __awaiter(this, void 0, void 0, function* () {
900
- const { api, req: reqParams, key } = params;
901
- const cacheData = yield api.GetCacheItem(GetDbRegionListCacheKey(), reqParams);
902
- if (cacheData) {
903
- return cacheData;
904
- }
905
- const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
906
- try {
907
- const data = yield api.GET(`config/regions${key ? "?Key=" + key : ""}`, Api.PrepReqParams(reqParams));
908
- res(data);
909
- }
910
- catch (e) {
911
- rej(e);
912
- }
913
- }));
914
- yield api.SetCacheItem({
915
- key: GetDbRegionListCacheKey(),
916
- value: prom,
917
- req: reqParams
918
- });
919
- return prom;
920
- });
921
- }
922
- Account.GetDbRegions = GetDbRegions;
923
- function GuessDbLocation(params) {
924
- const { DBServer: databaseUrl } = params;
925
- if (databaseUrl.includes("hyperfarm-prod-instance-1")) {
926
- return "HYPERFARM";
927
- }
928
- if (databaseUrl.includes("prod-syd1.nextspace.host")) {
929
- return "AU-VULTR-FIRST";
930
- }
931
- else if (databaseUrl.includes("prod-nyc1.nextspace.host")) {
932
- return "US-VULTR-FIRST";
933
- }
934
- else if (databaseUrl.includes("prod-ams1.nextspace.host")) {
935
- return "EU-VULTR-FIRST";
936
- }
937
- else if (databaseUrl.includes("prod-sing1.nextspace.host")) {
938
- return "SE-VULTR-FIRST";
939
- }
940
- else if (databaseUrl.includes("dev-first")) {
941
- return "DEV-FIRST";
942
- }
943
- else if (databaseUrl.includes(".ap-southeast-1.")) {
944
- return "SE";
945
- }
946
- else if (databaseUrl.includes(".us-west-1.")) {
947
- return "US";
948
- }
949
- else if (databaseUrl.includes(".eu-west-3.")) {
950
- return "EU";
951
- }
952
- else if (databaseUrl.includes("bruce-prod-au")) {
953
- return "AU";
954
- }
955
- else if (databaseUrl.includes("bruce-dev")) {
956
- return "DEV";
957
- }
958
- return null;
959
- }
960
- Account.GuessDbLocation = GuessDbLocation;
961
891
  })(Account || (Account = {}));
962
892
 
963
- /**
964
- * This is the request handler for Cam Api,
965
- * it should be passed to any method that wants to communicate with this particular api.
966
- */
967
- var CamApi;
968
- (function (CamApi) {
969
- class Api$$1 extends AbstractApi {
970
- constructor(params) {
971
- super({
972
- ssidHeader: "x-sessionid",
973
- cacheId: `CAM_API_${params === null || params === void 0 ? void 0 : params.env}_`
974
- });
975
- this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : Api.EEnv.PROD;
976
- this.setBaseUrl();
977
- }
978
- setBaseUrl() {
979
- let codeWord = "cam";
980
- let url = "https://<CODEWORD>.nextspace";
981
- const env = this.env.toUpperCase();
982
- switch (env) {
983
- case Api.EEnv.DEV:
984
- codeWord = "guardian";
985
- url += "-dev.net/";
986
- break;
987
- case Api.EEnv.STG:
988
- codeWord = "guardian";
989
- url += "-stg.net/";
990
- break;
991
- case Api.EEnv.UAT:
992
- codeWord = "guardian";
993
- url += "-uat.net/";
994
- break;
995
- case Api.EEnv.PROD:
996
- url += ".host/";
997
- break;
998
- default:
999
- throw ("Specified Environment is not valid. SuppliedEnv=" + env);
1000
- }
1001
- url = url.replace("<CODEWORD>", codeWord);
1002
- this.baseUrl = url;
1003
- }
1004
- GetBaseUrl() {
1005
- return this.baseUrl;
1006
- }
1007
- SetBaseUrl(url) {
1008
- this.baseUrl = url;
1009
- if (!this.baseUrl.endsWith("/")) {
1010
- this.baseUrl += "/";
1011
- }
1012
- }
1013
- GET(url, params) {
1014
- return __awaiter(this, void 0, void 0, function* () {
1015
- return this.get(this.baseUrl + url, params);
1016
- });
1017
- }
1018
- DELETE(url, params) {
1019
- return __awaiter(this, void 0, void 0, function* () {
1020
- return this.delete(this.baseUrl + url, params);
1021
- });
1022
- }
1023
- POST(url, data, params) {
1024
- return __awaiter(this, void 0, void 0, function* () {
1025
- return this.post(this.baseUrl + url, data, params);
1026
- });
1027
- }
1028
- UPLOAD(url, blob, params) {
1029
- return __awaiter(this, void 0, void 0, function* () {
1030
- return this.upload(this.baseUrl + url, blob, params);
1031
- });
1032
- }
1033
- }
1034
- CamApi.Api = Api$$1;
1035
- })(CamApi || (CamApi = {}));
1036
-
1037
893
  var MessageBroker;
1038
894
  (function (MessageBroker) {
1039
895
  let EAction;
@@ -1173,6 +1029,199 @@ var MessageBroker;
1173
1029
  MessageBroker.WebSocketBroker = WebSocketBroker;
1174
1030
  })(MessageBroker || (MessageBroker = {}));
1175
1031
 
1032
+ /**
1033
+ * This is the request handler for Cam/Idm Api,
1034
+ * it should be passed to any method that wants to communicate with this particular api.
1035
+ */
1036
+ var GuardianApi;
1037
+ (function (GuardianApi) {
1038
+ class Api$$1 extends AbstractApi {
1039
+ constructor(params) {
1040
+ super({
1041
+ ssidHeader: "x-sessionid",
1042
+ cacheId: `GUARDIAN_API_${params === null || params === void 0 ? void 0 : params.env}_`
1043
+ });
1044
+ this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : Api.EEnv.PROD;
1045
+ this.setBaseUrl();
1046
+ }
1047
+ setBaseUrl() {
1048
+ let url = "https://guardian.nextspace";
1049
+ const env = this.env.toUpperCase();
1050
+ switch (env) {
1051
+ case Api.EEnv.DEV:
1052
+ url += "-dev.net/";
1053
+ break;
1054
+ case Api.EEnv.STG:
1055
+ url += "-stg.net/";
1056
+ break;
1057
+ case Api.EEnv.UAT:
1058
+ url += "-uat.net/";
1059
+ break;
1060
+ case Api.EEnv.PROD:
1061
+ url += ".host/";
1062
+ break;
1063
+ default:
1064
+ throw ("Specified Environment is not valid. SuppliedEnv=" + env);
1065
+ }
1066
+ this.baseUrl = url;
1067
+ }
1068
+ GetBaseUrl() {
1069
+ return this.baseUrl;
1070
+ }
1071
+ SetBaseUrl(url) {
1072
+ this.baseUrl = url;
1073
+ if (!this.baseUrl.endsWith("/")) {
1074
+ this.baseUrl += "/";
1075
+ }
1076
+ }
1077
+ GET(url, params) {
1078
+ return __awaiter(this, void 0, void 0, function* () {
1079
+ return this.get(this.baseUrl + url, params);
1080
+ });
1081
+ }
1082
+ DELETE(url, params) {
1083
+ return __awaiter(this, void 0, void 0, function* () {
1084
+ return this.delete(this.baseUrl + url, params);
1085
+ });
1086
+ }
1087
+ POST(url, data, params) {
1088
+ return __awaiter(this, void 0, void 0, function* () {
1089
+ return this.post(this.baseUrl + url, data, params);
1090
+ });
1091
+ }
1092
+ UPLOAD(url, blob, params) {
1093
+ return __awaiter(this, void 0, void 0, function* () {
1094
+ return this.upload(this.baseUrl + url, blob, params);
1095
+ });
1096
+ }
1097
+ }
1098
+ GuardianApi.Api = Api$$1;
1099
+ })(GuardianApi || (GuardianApi = {}));
1100
+
1101
+ /**
1102
+ * A hosting location is a record for a possible bruce-api server configuration.
1103
+ * A hosting location will have one or many database servers as well, this is an additional setting.
1104
+ */
1105
+ var HostingLocation;
1106
+ (function (HostingLocation) {
1107
+ /**
1108
+ * @Warning: This will not return the Settings property.
1109
+ * @param params
1110
+ * @returns
1111
+ */
1112
+ function GetList(params) {
1113
+ return __awaiter(this, void 0, void 0, function* () {
1114
+ const res = yield params.api.GET("hostinglocations", Api.PrepReqParams(params.req));
1115
+ return {
1116
+ locations: res.Items
1117
+ };
1118
+ });
1119
+ }
1120
+ HostingLocation.GetList = GetList;
1121
+ function GetById(params) {
1122
+ return __awaiter(this, void 0, void 0, function* () {
1123
+ const { id, api, req } = params;
1124
+ if (!id) {
1125
+ throw ("Invalid id");
1126
+ }
1127
+ const res = yield api.GET(`hostinglocation/id/${id}`, Api.PrepReqParams(req));
1128
+ return {
1129
+ location: res
1130
+ };
1131
+ });
1132
+ }
1133
+ HostingLocation.GetById = GetById;
1134
+ function GetByKey(params) {
1135
+ return __awaiter(this, void 0, void 0, function* () {
1136
+ const { key, api, req } = params;
1137
+ if (!key) {
1138
+ throw ("Invalid key");
1139
+ }
1140
+ const res = yield api.GET(`hostinglocation/key/${key}`, Api.PrepReqParams(req));
1141
+ return {
1142
+ location: res
1143
+ };
1144
+ });
1145
+ }
1146
+ HostingLocation.GetByKey = GetByKey;
1147
+ /**
1148
+ * Returns hostingLocationKey from given db url.
1149
+ * Some older accounts don't have this set, so we need to guess it.
1150
+ * @param params
1151
+ * @returns
1152
+ */
1153
+ function GuessKey(params) {
1154
+ const { DBServer: databaseUrl } = params;
1155
+ if (databaseUrl.includes("hyperfarm-prod-instance-1")) {
1156
+ return "HYPERFARM";
1157
+ }
1158
+ if (databaseUrl.includes("prod-syd1.nextspace.host")) {
1159
+ return "AU-VULTR-FIRST";
1160
+ }
1161
+ else if (databaseUrl.includes("prod-nyc1.nextspace.host")) {
1162
+ return "US-VULTR-FIRST";
1163
+ }
1164
+ else if (databaseUrl.includes("prod-ams1.nextspace.host")) {
1165
+ return "EU-VULTR-FIRST";
1166
+ }
1167
+ else if (databaseUrl.includes("prod-sing1.nextspace.host")) {
1168
+ return "SE-VULTR-FIRST";
1169
+ }
1170
+ else if (databaseUrl.includes("dev-first")) {
1171
+ return "DEV-FIRST";
1172
+ }
1173
+ else if (databaseUrl.includes(".ap-southeast-1.")) {
1174
+ return "SE";
1175
+ }
1176
+ else if (databaseUrl.includes(".us-west-1.")) {
1177
+ return "US";
1178
+ }
1179
+ else if (databaseUrl.includes(".eu-west-3.")) {
1180
+ return "EU";
1181
+ }
1182
+ else if (databaseUrl.includes("bruce-prod-au")) {
1183
+ return "AU";
1184
+ }
1185
+ else if (databaseUrl.includes("bruce-dev")) {
1186
+ return "DEV";
1187
+ }
1188
+ return null;
1189
+ }
1190
+ HostingLocation.GuessKey = GuessKey;
1191
+ function GetByAccountId(params) {
1192
+ return __awaiter(this, void 0, void 0, function* () {
1193
+ const { accountId, apiSettings, api, req } = params;
1194
+ if (!accountId && !apiSettings) {
1195
+ throw ("Invalid accountId or apiSettings");
1196
+ }
1197
+ const settings = apiSettings ? apiSettings : (yield Account.GetAppSettings({
1198
+ api,
1199
+ accountId,
1200
+ appId: Account.EAppId.BruceApi
1201
+ })).settings;
1202
+ let hostingKey = settings["HostingLocation.Key"];
1203
+ if (!hostingKey) {
1204
+ hostingKey = settings.DBServer;
1205
+ }
1206
+ if (!hostingKey) {
1207
+ hostingKey = GuessKey({
1208
+ DBServer: settings.DBServer
1209
+ });
1210
+ }
1211
+ if (!hostingKey) {
1212
+ return null;
1213
+ }
1214
+ const data = yield GetByKey({
1215
+ key: hostingKey,
1216
+ api,
1217
+ req
1218
+ });
1219
+ return data;
1220
+ });
1221
+ }
1222
+ HostingLocation.GetByAccountId = GetByAccountId;
1223
+ })(HostingLocation || (HostingLocation = {}));
1224
+
1176
1225
  var BruceApi;
1177
1226
  (function (BruceApi) {
1178
1227
  /**
@@ -1189,18 +1238,18 @@ var BruceApi;
1189
1238
  cacheId: `BRUCE_API_${params === null || params === void 0 ? void 0 : params.env}_${params === null || params === void 0 ? void 0 : params.accountId}_`
1190
1239
  });
1191
1240
  this.loadCancelled = false;
1192
- let { accountId, env, cam, loadRegionalBaseUrl, loadConfig } = params;
1241
+ let { accountId, env, guardian, loadRegionalBaseUrl, loadConfig } = params;
1193
1242
  this.accountId = accountId;
1194
1243
  this.env = env !== null && env !== void 0 ? env : Api.EEnv.PROD;
1195
1244
  if (loadRegionalBaseUrl) {
1196
1245
  loadConfig = true;
1197
1246
  }
1198
- if (!cam && loadConfig) {
1199
- cam = new CamApi.Api({
1247
+ if (!guardian && loadConfig) {
1248
+ guardian = new GuardianApi.Api({
1200
1249
  env: this.env
1201
1250
  });
1202
1251
  }
1203
- this.loadProm = this.init(cam, loadConfig);
1252
+ this.loadProm = this.init(guardian, loadConfig);
1204
1253
  }
1205
1254
  get MessageBroker() {
1206
1255
  return this.messageBroker;
@@ -1212,12 +1261,12 @@ var BruceApi;
1212
1261
  }
1213
1262
  /**
1214
1263
  * Loads regional base url and sets up message broker.
1215
- * @param cam Required for loading regional base url.
1264
+ * @param guardian Required for loading regional base url.
1216
1265
  * @param loadConfig
1217
1266
  * @returns
1218
1267
  */
1219
- init(cam, loadConfig) {
1220
- var _a, _b, _c;
1268
+ init(guardian, loadConfig) {
1269
+ var _a, _b, _c, _d;
1221
1270
  return __awaiter(this, void 0, void 0, function* () {
1222
1271
  if (!this.accountId) {
1223
1272
  throw ("accountId is required.");
@@ -1243,12 +1292,12 @@ var BruceApi;
1243
1292
  throw ("Specified Environment is not valid. SuppliedEnv=" + env);
1244
1293
  }
1245
1294
  this.baseUrl = url;
1246
- if (cam && loadConfig) {
1295
+ if (guardian && loadConfig) {
1247
1296
  // Attempt to load an account specific base url.
1248
1297
  // This could be one with a region specific endpoint.
1249
1298
  try {
1250
1299
  const settings = (yield Account.GetAppSettings({
1251
- api: cam,
1300
+ api: guardian,
1252
1301
  accountId: this.accountId,
1253
1302
  appId: Account.EAppId.BruceApi
1254
1303
  })).settings;
@@ -1263,41 +1312,24 @@ var BruceApi;
1263
1312
  }
1264
1313
  this.baseUrl = endpoint;
1265
1314
  }
1266
- let dbLocation = settings.DBLocation;
1267
- if (!dbLocation) {
1268
- dbLocation = Account.GuessDbLocation({
1269
- DBServer: settings.DBServer,
1270
- });
1271
- }
1272
- if (dbLocation) {
1273
- dbLocation = dbLocation.trim();
1274
- const api = new BruceApi.Api({
1275
- accountId: this.accountId,
1276
- cam: cam,
1277
- env: this.env,
1278
- // Must be false.
1279
- // Else we get stuck in nested init loop.
1280
- loadConfig: false
1281
- });
1282
- // CDN urls.
1283
- const regions = (yield Account.GetDbRegions({
1284
- api,
1285
- key: dbLocation
1286
- })).regions;
1287
- const region = regions.find(x => { var _a; return ((_a = x.key) === null || _a === void 0 ? void 0 : _a.trim()) == dbLocation; });
1288
- if (region === null || region === void 0 ? void 0 : region.CDN) {
1289
- this.EntityCdnUrl = (_b = region.CDN.entityURL) === null || _b === void 0 ? void 0 : _b[env];
1290
- // We need to fix our configs.
1291
- if (this.EntityCdnUrl) {
1292
- if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
1293
- this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
1294
- }
1295
- else {
1296
- this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
1297
- }
1315
+ const host = yield HostingLocation.GetByAccountId({
1316
+ accountId: this.accountId,
1317
+ apiSettings: settings,
1318
+ api: guardian
1319
+ });
1320
+ const hostSettings = (_b = host === null || host === void 0 ? void 0 : host.location) === null || _b === void 0 ? void 0 : _b.Settings;
1321
+ if (hostSettings === null || hostSettings === void 0 ? void 0 : hostSettings.CDN) {
1322
+ this.EntityCdnUrl = (_c = hostSettings.CDN.entityURL) === null || _c === void 0 ? void 0 : _c[env];
1323
+ // We need to fix our configs.
1324
+ if (this.EntityCdnUrl) {
1325
+ if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
1326
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
1327
+ }
1328
+ else {
1329
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
1298
1330
  }
1299
- this.LegacyTilesetCdnUrl = (_c = region.CDN.legacyTilesetURL) === null || _c === void 0 ? void 0 : _c[env];
1300
1331
  }
1332
+ this.LegacyTilesetCdnUrl = (_d = hostSettings.CDN.legacyTilesetURL) === null || _d === void 0 ? void 0 : _d[env];
1301
1333
  }
1302
1334
  }
1303
1335
  catch (e) {
@@ -1384,6 +1416,84 @@ var BruceApi;
1384
1416
  BruceApi.Api = Api$$1;
1385
1417
  })(BruceApi || (BruceApi = {}));
1386
1418
 
1419
+ /**
1420
+ * This is the request handler for Cam Api,
1421
+ * it should be passed to any method that wants to communicate with this particular api.
1422
+ * @deprecated Please use GuardianApi instead.
1423
+ */
1424
+ var CamApi;
1425
+ (function (CamApi) {
1426
+ class Api$$1 extends AbstractApi {
1427
+ constructor(params) {
1428
+ super({
1429
+ ssidHeader: "x-sessionid",
1430
+ cacheId: `CAM_API_${params === null || params === void 0 ? void 0 : params.env}_`
1431
+ });
1432
+ this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : Api.EEnv.PROD;
1433
+ this.setBaseUrl();
1434
+ }
1435
+ setBaseUrl() {
1436
+ let codeWord = "cam";
1437
+ let url = "https://<CODEWORD>.nextspace";
1438
+ const env = this.env.toUpperCase();
1439
+ switch (env) {
1440
+ case Api.EEnv.DEV:
1441
+ codeWord = "guardian";
1442
+ url += "-dev.net/";
1443
+ break;
1444
+ case Api.EEnv.STG:
1445
+ codeWord = "guardian";
1446
+ url += "-stg.net/";
1447
+ break;
1448
+ case Api.EEnv.UAT:
1449
+ codeWord = "guardian";
1450
+ url += "-uat.net/";
1451
+ break;
1452
+ case Api.EEnv.PROD:
1453
+ url += ".host/";
1454
+ break;
1455
+ default:
1456
+ throw ("Specified Environment is not valid. SuppliedEnv=" + env);
1457
+ }
1458
+ url = url.replace("<CODEWORD>", codeWord);
1459
+ this.baseUrl = url;
1460
+ }
1461
+ GetBaseUrl() {
1462
+ return this.baseUrl;
1463
+ }
1464
+ SetBaseUrl(url) {
1465
+ this.baseUrl = url;
1466
+ if (!this.baseUrl.endsWith("/")) {
1467
+ this.baseUrl += "/";
1468
+ }
1469
+ }
1470
+ GET(url, params) {
1471
+ return __awaiter(this, void 0, void 0, function* () {
1472
+ return this.get(this.baseUrl + url, params);
1473
+ });
1474
+ }
1475
+ DELETE(url, params) {
1476
+ return __awaiter(this, void 0, void 0, function* () {
1477
+ return this.delete(this.baseUrl + url, params);
1478
+ });
1479
+ }
1480
+ POST(url, data, params) {
1481
+ return __awaiter(this, void 0, void 0, function* () {
1482
+ return this.post(this.baseUrl + url, data, params);
1483
+ });
1484
+ }
1485
+ UPLOAD(url, blob, params) {
1486
+ return __awaiter(this, void 0, void 0, function* () {
1487
+ return this.upload(this.baseUrl + url, blob, params);
1488
+ });
1489
+ }
1490
+ }
1491
+ CamApi.Api = Api$$1;
1492
+ })(CamApi || (CamApi = {}));
1493
+
1494
+ /**
1495
+ * * @deprecated Please use GuardianApi instead.
1496
+ */
1387
1497
  var IdmApi;
1388
1498
  (function (IdmApi) {
1389
1499
  /**
@@ -1532,6 +1642,7 @@ class ApiGetters {
1532
1642
  this.bruce = {};
1533
1643
  this.idm = {};
1534
1644
  this.cam = {};
1645
+ this.guardian = {};
1535
1646
  this.global = {};
1536
1647
  this.accountId = params === null || params === void 0 ? void 0 : params.accountId;
1537
1648
  this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : Api.EEnv.PROD;
@@ -1591,6 +1702,10 @@ class ApiGetters {
1591
1702
  }
1592
1703
  };
1593
1704
  }
1705
+ /**
1706
+ * Deprecated: Use GetGuardianApi instead.
1707
+ * @returns
1708
+ */
1594
1709
  GetIdmApi(params) {
1595
1710
  let { env } = params;
1596
1711
  env = env ? env : this.env;
@@ -1603,6 +1718,10 @@ class ApiGetters {
1603
1718
  }
1604
1719
  return this.idm[key];
1605
1720
  }
1721
+ /**
1722
+ * Deprecated: Use GetGuardianGetter instead.
1723
+ * @returns
1724
+ */
1606
1725
  GetIdmGetter() {
1607
1726
  return {
1608
1727
  env: this.env,
@@ -1611,6 +1730,10 @@ class ApiGetters {
1611
1730
  }
1612
1731
  };
1613
1732
  }
1733
+ /**
1734
+ * Deprecated: Use GetGuardianApi instead.
1735
+ * @returns
1736
+ */
1614
1737
  GetCamApi(params) {
1615
1738
  let { env } = params;
1616
1739
  env = env ? env : this.env;
@@ -1623,6 +1746,10 @@ class ApiGetters {
1623
1746
  }
1624
1747
  return this.cam[key];
1625
1748
  }
1749
+ /**
1750
+ * Deprecated: Use GetGuardianGetter instead.
1751
+ * @returns
1752
+ */
1626
1753
  GetCamGetter() {
1627
1754
  return {
1628
1755
  env: this.env,
@@ -1651,6 +1778,26 @@ class ApiGetters {
1651
1778
  }
1652
1779
  };
1653
1780
  }
1781
+ GetGuardianApi(params) {
1782
+ let { env } = params;
1783
+ env = env ? env : this.env;
1784
+ const key = `${env}`;
1785
+ if (!this.guardian[key]) {
1786
+ this.guardian[key] = new GuardianApi.Api({
1787
+ env
1788
+ });
1789
+ this.cam[key].SetSessionId(this.sessionId);
1790
+ }
1791
+ return this.guardian[key];
1792
+ }
1793
+ GetGuardianGetter() {
1794
+ return {
1795
+ env: this.env,
1796
+ getApi: (env) => {
1797
+ return this.GetGuardianApi({ env });
1798
+ }
1799
+ };
1800
+ }
1654
1801
  }
1655
1802
 
1656
1803
  var Color;
@@ -7999,5 +8146,5 @@ var Plugin;
7999
8146
  Plugin.GetLoadUrl = GetLoadUrl;
8000
8147
  })(Plugin || (Plugin = {}));
8001
8148
 
8002
- export { AnnDocument, CustomForm, CustomFormContent, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, 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, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, PendingAction, MessageBroker, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin };
8149
+ export { AnnDocument, CustomForm, CustomFormContent, AbstractApi, Api, BruceApi, CamApi, IdmApi, 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, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin };
8003
8150
  //# sourceMappingURL=bruce-models.es5.js.map