bruce-models 2.2.4 → 2.2.6

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.
@@ -744,13 +744,6 @@
744
744
  return exports.Api.ECacheKey.DatabaseRegion;
745
745
  }
746
746
  Account.GetDbRegionListCacheKey = GetDbRegionListCacheKey;
747
- let EDbRegion;
748
- (function (EDbRegion) {
749
- EDbRegion["USA"] = "US";
750
- EDbRegion["Paris"] = "EU";
751
- EDbRegion["Singapore"] = "SE";
752
- EDbRegion["Australia"] = "AU";
753
- })(EDbRegion = Account.EDbRegion || (Account.EDbRegion = {}));
754
747
  let EAppId;
755
748
  (function (EAppId) {
756
749
  EAppId["BruceApi"] = "BruceAPI";
@@ -863,16 +856,16 @@
863
856
  */
864
857
  function Create(params) {
865
858
  return __awaiter(this, void 0, void 0, function* () {
866
- let { api, accountId: id, name, region, starterContent, req: reqParams } = params;
867
- if (!id || !name || !region) {
868
- throw new Error("Id, Name and Region are required.");
859
+ let { api, accountId: id, name, hostingLocationKey, starterContent, req: reqParams } = params;
860
+ if (!id || !name || !hostingLocationKey) {
861
+ throw new Error("Id, Name and hostingLocationKey are required.");
869
862
  }
870
863
  if (!starterContent) {
871
864
  starterContent = EStarterContent.None;
872
865
  }
873
866
  const reqData = {
874
867
  "Name": name,
875
- "DBLocation": region,
868
+ "HostingLocation.Key": hostingLocationKey,
876
869
  "StarterContent": starterContent
877
870
  };
878
871
  const res = yield api.POST(`clientAccount/${id}`, reqData, exports.Api.PrepReqParams(reqParams));
@@ -884,140 +877,8 @@
884
877
  });
885
878
  }
886
879
  Account.Create = Create;
887
- function GetDbRegions(params) {
888
- return __awaiter(this, void 0, void 0, function* () {
889
- const { api, req: reqParams, key } = params;
890
- const cacheData = yield api.GetCacheItem(GetDbRegionListCacheKey(), reqParams);
891
- if (cacheData) {
892
- return cacheData;
893
- }
894
- const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
895
- try {
896
- const data = yield api.GET(`config/regions${key ? "?Key=" + key : ""}`, exports.Api.PrepReqParams(reqParams));
897
- res(data);
898
- }
899
- catch (e) {
900
- rej(e);
901
- }
902
- }));
903
- yield api.SetCacheItem({
904
- key: GetDbRegionListCacheKey(),
905
- value: prom,
906
- req: reqParams
907
- });
908
- return prom;
909
- });
910
- }
911
- Account.GetDbRegions = GetDbRegions;
912
- function GuessDbLocation(params) {
913
- const { DBServer: databaseUrl } = params;
914
- if (databaseUrl.includes("hyperfarm-prod-instance-1")) {
915
- return "HYPERFARM";
916
- }
917
- if (databaseUrl.includes("prod-syd1.nextspace.host")) {
918
- return "AU-VULTR-FIRST";
919
- }
920
- else if (databaseUrl.includes("prod-nyc1.nextspace.host")) {
921
- return "US-VULTR-FIRST";
922
- }
923
- else if (databaseUrl.includes("prod-ams1.nextspace.host")) {
924
- return "EU-VULTR-FIRST";
925
- }
926
- else if (databaseUrl.includes("prod-sing1.nextspace.host")) {
927
- return "SE-VULTR-FIRST";
928
- }
929
- else if (databaseUrl.includes("dev-first")) {
930
- return "DEV-FIRST";
931
- }
932
- else if (databaseUrl.includes(".ap-southeast-1.")) {
933
- return "SE";
934
- }
935
- else if (databaseUrl.includes(".us-west-1.")) {
936
- return "US";
937
- }
938
- else if (databaseUrl.includes(".eu-west-3.")) {
939
- return "EU";
940
- }
941
- else if (databaseUrl.includes("bruce-prod-au")) {
942
- return "AU";
943
- }
944
- else if (databaseUrl.includes("bruce-dev")) {
945
- return "DEV";
946
- }
947
- return null;
948
- }
949
- Account.GuessDbLocation = GuessDbLocation;
950
880
  })(exports.Account || (exports.Account = {}));
951
881
 
952
- (function (CamApi) {
953
- class Api$$1 extends AbstractApi {
954
- constructor(params) {
955
- super({
956
- ssidHeader: "x-sessionid",
957
- cacheId: `CAM_API_${params === null || params === void 0 ? void 0 : params.env}_`
958
- });
959
- this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : exports.Api.EEnv.PROD;
960
- this.setBaseUrl();
961
- }
962
- setBaseUrl() {
963
- let codeWord = "cam";
964
- let url = "https://<CODEWORD>.nextspace";
965
- const env = this.env.toUpperCase();
966
- switch (env) {
967
- case exports.Api.EEnv.DEV:
968
- codeWord = "guardian";
969
- url += "-dev.net/";
970
- break;
971
- case exports.Api.EEnv.STG:
972
- codeWord = "guardian";
973
- url += "-stg.net/";
974
- break;
975
- case exports.Api.EEnv.UAT:
976
- codeWord = "guardian";
977
- url += "-uat.net/";
978
- break;
979
- case exports.Api.EEnv.PROD:
980
- url += ".host/";
981
- break;
982
- default:
983
- throw ("Specified Environment is not valid. SuppliedEnv=" + env);
984
- }
985
- url = url.replace("<CODEWORD>", codeWord);
986
- this.baseUrl = url;
987
- }
988
- GetBaseUrl() {
989
- return this.baseUrl;
990
- }
991
- SetBaseUrl(url) {
992
- this.baseUrl = url;
993
- if (!this.baseUrl.endsWith("/")) {
994
- this.baseUrl += "/";
995
- }
996
- }
997
- GET(url, params) {
998
- return __awaiter(this, void 0, void 0, function* () {
999
- return this.get(this.baseUrl + url, params);
1000
- });
1001
- }
1002
- DELETE(url, params) {
1003
- return __awaiter(this, void 0, void 0, function* () {
1004
- return this.delete(this.baseUrl + url, params);
1005
- });
1006
- }
1007
- POST(url, data, params) {
1008
- return __awaiter(this, void 0, void 0, function* () {
1009
- return this.post(this.baseUrl + url, data, params);
1010
- });
1011
- }
1012
- UPLOAD(url, blob, params) {
1013
- return __awaiter(this, void 0, void 0, function* () {
1014
- return this.upload(this.baseUrl + url, blob, params);
1015
- });
1016
- }
1017
- }
1018
- CamApi.Api = Api$$1;
1019
- })(exports.CamApi || (exports.CamApi = {}));
1020
-
1021
882
  (function (MessageBroker) {
1022
883
  let EAction;
1023
884
  (function (EAction) {
@@ -1156,6 +1017,194 @@
1156
1017
  MessageBroker.WebSocketBroker = WebSocketBroker;
1157
1018
  })(exports.MessageBroker || (exports.MessageBroker = {}));
1158
1019
 
1020
+ /**
1021
+ * This is the request handler for Cam/Idm Api,
1022
+ * it should be passed to any method that wants to communicate with this particular api.
1023
+ */
1024
+ var GuardianApi;
1025
+ (function (GuardianApi) {
1026
+ class Api$$1 extends AbstractApi {
1027
+ constructor(params) {
1028
+ super({
1029
+ ssidHeader: "x-sessionid",
1030
+ cacheId: `GUARDIAN_API_${params === null || params === void 0 ? void 0 : params.env}_`
1031
+ });
1032
+ this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : exports.Api.EEnv.PROD;
1033
+ this.setBaseUrl();
1034
+ }
1035
+ setBaseUrl() {
1036
+ let url = "https://guardian.nextspace";
1037
+ const env = this.env.toUpperCase();
1038
+ switch (env) {
1039
+ case exports.Api.EEnv.DEV:
1040
+ url += "-dev.net/";
1041
+ break;
1042
+ case exports.Api.EEnv.STG:
1043
+ url += "-stg.net/";
1044
+ break;
1045
+ case exports.Api.EEnv.UAT:
1046
+ url += "-uat.net/";
1047
+ break;
1048
+ case exports.Api.EEnv.PROD:
1049
+ url += ".host/";
1050
+ break;
1051
+ default:
1052
+ throw ("Specified Environment is not valid. SuppliedEnv=" + env);
1053
+ }
1054
+ this.baseUrl = url;
1055
+ }
1056
+ GetBaseUrl() {
1057
+ return this.baseUrl;
1058
+ }
1059
+ SetBaseUrl(url) {
1060
+ this.baseUrl = url;
1061
+ if (!this.baseUrl.endsWith("/")) {
1062
+ this.baseUrl += "/";
1063
+ }
1064
+ }
1065
+ GET(url, params) {
1066
+ return __awaiter(this, void 0, void 0, function* () {
1067
+ return this.get(this.baseUrl + url, params);
1068
+ });
1069
+ }
1070
+ DELETE(url, params) {
1071
+ return __awaiter(this, void 0, void 0, function* () {
1072
+ return this.delete(this.baseUrl + url, params);
1073
+ });
1074
+ }
1075
+ POST(url, data, params) {
1076
+ return __awaiter(this, void 0, void 0, function* () {
1077
+ return this.post(this.baseUrl + url, data, params);
1078
+ });
1079
+ }
1080
+ UPLOAD(url, blob, params) {
1081
+ return __awaiter(this, void 0, void 0, function* () {
1082
+ return this.upload(this.baseUrl + url, blob, params);
1083
+ });
1084
+ }
1085
+ }
1086
+ GuardianApi.Api = Api$$1;
1087
+ })(GuardianApi || (GuardianApi = {}));
1088
+
1089
+ (function (HostingLocation) {
1090
+ /**
1091
+ * @Warning: This will not return the Settings property.
1092
+ * @param params
1093
+ * @returns
1094
+ */
1095
+ function GetList(params) {
1096
+ return __awaiter(this, void 0, void 0, function* () {
1097
+ const res = yield params.api.GET("hostinglocations", exports.Api.PrepReqParams(params.req));
1098
+ return {
1099
+ locations: res.Items
1100
+ };
1101
+ });
1102
+ }
1103
+ HostingLocation.GetList = GetList;
1104
+ function GetById(params) {
1105
+ return __awaiter(this, void 0, void 0, function* () {
1106
+ const { id, api, req } = params;
1107
+ if (!id) {
1108
+ throw ("Invalid id");
1109
+ }
1110
+ const res = yield api.GET(`hostinglocation/id/${id}`, exports.Api.PrepReqParams(req));
1111
+ return {
1112
+ location: res
1113
+ };
1114
+ });
1115
+ }
1116
+ HostingLocation.GetById = GetById;
1117
+ function GetByKey(params) {
1118
+ return __awaiter(this, void 0, void 0, function* () {
1119
+ const { key, api, req } = params;
1120
+ if (!key) {
1121
+ throw ("Invalid key");
1122
+ }
1123
+ const res = yield api.GET(`hostinglocation/key/${key}`, exports.Api.PrepReqParams(req));
1124
+ return {
1125
+ location: res
1126
+ };
1127
+ });
1128
+ }
1129
+ HostingLocation.GetByKey = GetByKey;
1130
+ /**
1131
+ * Returns hostingLocationKey from given db url.
1132
+ * Some older accounts don't have this set, so we need to guess it.
1133
+ * @param params
1134
+ * @returns
1135
+ */
1136
+ function GuessKey(params) {
1137
+ const { DBServer: databaseUrl } = params;
1138
+ if (databaseUrl.includes("hyperfarm-prod-instance-1")) {
1139
+ return "HYPERFARM";
1140
+ }
1141
+ if (databaseUrl.includes("prod-syd1.nextspace.host")) {
1142
+ return "AU-VULTR-FIRST";
1143
+ }
1144
+ else if (databaseUrl.includes("prod-nyc1.nextspace.host")) {
1145
+ return "US-VULTR-FIRST";
1146
+ }
1147
+ else if (databaseUrl.includes("prod-ams1.nextspace.host")) {
1148
+ return "EU-VULTR-FIRST";
1149
+ }
1150
+ else if (databaseUrl.includes("prod-sing1.nextspace.host")) {
1151
+ return "SE-VULTR-FIRST";
1152
+ }
1153
+ else if (databaseUrl.includes("dev-first")) {
1154
+ return "DEV-FIRST";
1155
+ }
1156
+ else if (databaseUrl.includes(".ap-southeast-1.")) {
1157
+ return "SE";
1158
+ }
1159
+ else if (databaseUrl.includes(".us-west-1.")) {
1160
+ return "US";
1161
+ }
1162
+ else if (databaseUrl.includes(".eu-west-3.")) {
1163
+ return "EU";
1164
+ }
1165
+ else if (databaseUrl.includes("bruce-prod-au")) {
1166
+ return "AU";
1167
+ }
1168
+ else if (databaseUrl.includes("bruce-dev")) {
1169
+ return "DEV";
1170
+ }
1171
+ return null;
1172
+ }
1173
+ HostingLocation.GuessKey = GuessKey;
1174
+ function GetByAccountId(params) {
1175
+ return __awaiter(this, void 0, void 0, function* () {
1176
+ const { accountId, apiSettings, api, req } = params;
1177
+ if (!accountId && !apiSettings) {
1178
+ throw ("Invalid accountId or apiSettings");
1179
+ }
1180
+ const settings = apiSettings ? apiSettings : (yield exports.Account.GetAppSettings({
1181
+ api,
1182
+ accountId,
1183
+ appId: exports.Account.EAppId.BruceApi
1184
+ })).settings;
1185
+ let hostingKey = settings["HostingLocation.Key"];
1186
+ if (!hostingKey) {
1187
+ hostingKey = settings.DBServer;
1188
+ }
1189
+ if (!hostingKey) {
1190
+ hostingKey = GuessKey({
1191
+ DBServer: settings.DBServer
1192
+ });
1193
+ }
1194
+ if (!hostingKey) {
1195
+ return null;
1196
+ }
1197
+ const data = yield GetByKey({
1198
+ key: hostingKey,
1199
+ api,
1200
+ req
1201
+ });
1202
+ return data;
1203
+ });
1204
+ }
1205
+ HostingLocation.GetByAccountId = GetByAccountId;
1206
+ })(exports.HostingLocation || (exports.HostingLocation = {}));
1207
+
1159
1208
  (function (BruceApi) {
1160
1209
  /**
1161
1210
  * This is the request handler for Bruce Api,
@@ -1171,18 +1220,18 @@
1171
1220
  cacheId: `BRUCE_API_${params === null || params === void 0 ? void 0 : params.env}_${params === null || params === void 0 ? void 0 : params.accountId}_`
1172
1221
  });
1173
1222
  this.loadCancelled = false;
1174
- let { accountId, env, cam, loadRegionalBaseUrl, loadConfig } = params;
1223
+ let { accountId, env, guardian, loadRegionalBaseUrl, loadConfig } = params;
1175
1224
  this.accountId = accountId;
1176
1225
  this.env = env !== null && env !== void 0 ? env : exports.Api.EEnv.PROD;
1177
1226
  if (loadRegionalBaseUrl) {
1178
1227
  loadConfig = true;
1179
1228
  }
1180
- if (!cam && loadConfig) {
1181
- cam = new exports.CamApi.Api({
1229
+ if (!guardian && loadConfig) {
1230
+ guardian = new GuardianApi.Api({
1182
1231
  env: this.env
1183
1232
  });
1184
1233
  }
1185
- this.loadProm = this.init(cam, loadConfig);
1234
+ this.loadProm = this.init(guardian, loadConfig);
1186
1235
  }
1187
1236
  get MessageBroker() {
1188
1237
  return this.messageBroker;
@@ -1194,12 +1243,12 @@
1194
1243
  }
1195
1244
  /**
1196
1245
  * Loads regional base url and sets up message broker.
1197
- * @param cam Required for loading regional base url.
1246
+ * @param guardian Required for loading regional base url.
1198
1247
  * @param loadConfig
1199
1248
  * @returns
1200
1249
  */
1201
- init(cam, loadConfig) {
1202
- var _a, _b, _c;
1250
+ init(guardian, loadConfig) {
1251
+ var _a, _b, _c, _d;
1203
1252
  return __awaiter(this, void 0, void 0, function* () {
1204
1253
  if (!this.accountId) {
1205
1254
  throw ("accountId is required.");
@@ -1225,12 +1274,12 @@
1225
1274
  throw ("Specified Environment is not valid. SuppliedEnv=" + env);
1226
1275
  }
1227
1276
  this.baseUrl = url;
1228
- if (cam && loadConfig) {
1277
+ if (guardian && loadConfig) {
1229
1278
  // Attempt to load an account specific base url.
1230
1279
  // This could be one with a region specific endpoint.
1231
1280
  try {
1232
1281
  const settings = (yield exports.Account.GetAppSettings({
1233
- api: cam,
1282
+ api: guardian,
1234
1283
  accountId: this.accountId,
1235
1284
  appId: exports.Account.EAppId.BruceApi
1236
1285
  })).settings;
@@ -1245,41 +1294,24 @@
1245
1294
  }
1246
1295
  this.baseUrl = endpoint;
1247
1296
  }
1248
- let dbLocation = settings.DBLocation;
1249
- if (!dbLocation) {
1250
- dbLocation = exports.Account.GuessDbLocation({
1251
- DBServer: settings.DBServer,
1252
- });
1253
- }
1254
- if (dbLocation) {
1255
- dbLocation = dbLocation.trim();
1256
- const api = new BruceApi.Api({
1257
- accountId: this.accountId,
1258
- cam: cam,
1259
- env: this.env,
1260
- // Must be false.
1261
- // Else we get stuck in nested init loop.
1262
- loadConfig: false
1263
- });
1264
- // CDN urls.
1265
- const regions = (yield exports.Account.GetDbRegions({
1266
- api,
1267
- key: dbLocation
1268
- })).regions;
1269
- const region = regions.find(x => { var _a; return ((_a = x.key) === null || _a === void 0 ? void 0 : _a.trim()) == dbLocation; });
1270
- if (region === null || region === void 0 ? void 0 : region.CDN) {
1271
- this.EntityCdnUrl = (_b = region.CDN.entityURL) === null || _b === void 0 ? void 0 : _b[env];
1272
- // We need to fix our configs.
1273
- if (this.EntityCdnUrl) {
1274
- if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
1275
- this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
1276
- }
1277
- else {
1278
- this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
1279
- }
1297
+ const host = yield exports.HostingLocation.GetByAccountId({
1298
+ accountId: this.accountId,
1299
+ apiSettings: settings,
1300
+ api: guardian
1301
+ });
1302
+ const hostSettings = (_b = host === null || host === void 0 ? void 0 : host.location) === null || _b === void 0 ? void 0 : _b.Settings;
1303
+ if (hostSettings === null || hostSettings === void 0 ? void 0 : hostSettings.CDN) {
1304
+ this.EntityCdnUrl = (_c = hostSettings.CDN.entityURL) === null || _c === void 0 ? void 0 : _c[env];
1305
+ // We need to fix our configs.
1306
+ if (this.EntityCdnUrl) {
1307
+ if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
1308
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
1309
+ }
1310
+ else {
1311
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
1280
1312
  }
1281
- this.LegacyTilesetCdnUrl = (_c = region.CDN.legacyTilesetURL) === null || _c === void 0 ? void 0 : _c[env];
1282
1313
  }
1314
+ this.LegacyTilesetCdnUrl = (_d = hostSettings.CDN.legacyTilesetURL) === null || _d === void 0 ? void 0 : _d[env];
1283
1315
  }
1284
1316
  }
1285
1317
  catch (e) {
@@ -1366,6 +1398,75 @@
1366
1398
  BruceApi.Api = Api$$1;
1367
1399
  })(exports.BruceApi || (exports.BruceApi = {}));
1368
1400
 
1401
+ (function (CamApi) {
1402
+ class Api$$1 extends AbstractApi {
1403
+ constructor(params) {
1404
+ super({
1405
+ ssidHeader: "x-sessionid",
1406
+ cacheId: `CAM_API_${params === null || params === void 0 ? void 0 : params.env}_`
1407
+ });
1408
+ this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : exports.Api.EEnv.PROD;
1409
+ this.setBaseUrl();
1410
+ }
1411
+ setBaseUrl() {
1412
+ let codeWord = "cam";
1413
+ let url = "https://<CODEWORD>.nextspace";
1414
+ const env = this.env.toUpperCase();
1415
+ switch (env) {
1416
+ case exports.Api.EEnv.DEV:
1417
+ codeWord = "guardian";
1418
+ url += "-dev.net/";
1419
+ break;
1420
+ case exports.Api.EEnv.STG:
1421
+ codeWord = "guardian";
1422
+ url += "-stg.net/";
1423
+ break;
1424
+ case exports.Api.EEnv.UAT:
1425
+ codeWord = "guardian";
1426
+ url += "-uat.net/";
1427
+ break;
1428
+ case exports.Api.EEnv.PROD:
1429
+ url += ".host/";
1430
+ break;
1431
+ default:
1432
+ throw ("Specified Environment is not valid. SuppliedEnv=" + env);
1433
+ }
1434
+ url = url.replace("<CODEWORD>", codeWord);
1435
+ this.baseUrl = url;
1436
+ }
1437
+ GetBaseUrl() {
1438
+ return this.baseUrl;
1439
+ }
1440
+ SetBaseUrl(url) {
1441
+ this.baseUrl = url;
1442
+ if (!this.baseUrl.endsWith("/")) {
1443
+ this.baseUrl += "/";
1444
+ }
1445
+ }
1446
+ GET(url, params) {
1447
+ return __awaiter(this, void 0, void 0, function* () {
1448
+ return this.get(this.baseUrl + url, params);
1449
+ });
1450
+ }
1451
+ DELETE(url, params) {
1452
+ return __awaiter(this, void 0, void 0, function* () {
1453
+ return this.delete(this.baseUrl + url, params);
1454
+ });
1455
+ }
1456
+ POST(url, data, params) {
1457
+ return __awaiter(this, void 0, void 0, function* () {
1458
+ return this.post(this.baseUrl + url, data, params);
1459
+ });
1460
+ }
1461
+ UPLOAD(url, blob, params) {
1462
+ return __awaiter(this, void 0, void 0, function* () {
1463
+ return this.upload(this.baseUrl + url, blob, params);
1464
+ });
1465
+ }
1466
+ }
1467
+ CamApi.Api = Api$$1;
1468
+ })(exports.CamApi || (exports.CamApi = {}));
1469
+
1369
1470
  (function (IdmApi) {
1370
1471
  /**
1371
1472
  * This is the request handler for Idm Api,
@@ -1512,6 +1613,7 @@
1512
1613
  this.bruce = {};
1513
1614
  this.idm = {};
1514
1615
  this.cam = {};
1616
+ this.guardian = {};
1515
1617
  this.global = {};
1516
1618
  this.accountId = params === null || params === void 0 ? void 0 : params.accountId;
1517
1619
  this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : exports.Api.EEnv.PROD;
@@ -1571,6 +1673,10 @@
1571
1673
  }
1572
1674
  };
1573
1675
  }
1676
+ /**
1677
+ * Deprecated: Use GetGuardianApi instead.
1678
+ * @returns
1679
+ */
1574
1680
  GetIdmApi(params) {
1575
1681
  let { env } = params;
1576
1682
  env = env ? env : this.env;
@@ -1583,6 +1689,10 @@
1583
1689
  }
1584
1690
  return this.idm[key];
1585
1691
  }
1692
+ /**
1693
+ * Deprecated: Use GetGuardianGetter instead.
1694
+ * @returns
1695
+ */
1586
1696
  GetIdmGetter() {
1587
1697
  return {
1588
1698
  env: this.env,
@@ -1591,6 +1701,10 @@
1591
1701
  }
1592
1702
  };
1593
1703
  }
1704
+ /**
1705
+ * Deprecated: Use GetGuardianApi instead.
1706
+ * @returns
1707
+ */
1594
1708
  GetCamApi(params) {
1595
1709
  let { env } = params;
1596
1710
  env = env ? env : this.env;
@@ -1603,6 +1717,10 @@
1603
1717
  }
1604
1718
  return this.cam[key];
1605
1719
  }
1720
+ /**
1721
+ * Deprecated: Use GetGuardianGetter instead.
1722
+ * @returns
1723
+ */
1606
1724
  GetCamGetter() {
1607
1725
  return {
1608
1726
  env: this.env,
@@ -1631,6 +1749,26 @@
1631
1749
  }
1632
1750
  };
1633
1751
  }
1752
+ GetGuardianApi(params) {
1753
+ let { env } = params;
1754
+ env = env ? env : this.env;
1755
+ const key = `${env}`;
1756
+ if (!this.guardian[key]) {
1757
+ this.guardian[key] = new GuardianApi.Api({
1758
+ env
1759
+ });
1760
+ this.cam[key].SetSessionId(this.sessionId);
1761
+ }
1762
+ return this.guardian[key];
1763
+ }
1764
+ GetGuardianGetter() {
1765
+ return {
1766
+ env: this.env,
1767
+ getApi: (env) => {
1768
+ return this.GetGuardianApi({ env });
1769
+ }
1770
+ };
1771
+ }
1634
1772
  }
1635
1773
 
1636
1774
  (function (Color) {