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.
@@ -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,189 @@
1156
1017
  MessageBroker.WebSocketBroker = WebSocketBroker;
1157
1018
  })(exports.MessageBroker || (exports.MessageBroker = {}));
1158
1019
 
1020
+ (function (GuardianApi) {
1021
+ class Api$$1 extends AbstractApi {
1022
+ constructor(params) {
1023
+ super({
1024
+ ssidHeader: "x-sessionid",
1025
+ cacheId: `GUARDIAN_API_${params === null || params === void 0 ? void 0 : params.env}_`
1026
+ });
1027
+ this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : exports.Api.EEnv.PROD;
1028
+ this.setBaseUrl();
1029
+ }
1030
+ setBaseUrl() {
1031
+ let url = "https://guardian.nextspace";
1032
+ const env = this.env.toUpperCase();
1033
+ switch (env) {
1034
+ case exports.Api.EEnv.DEV:
1035
+ url += "-dev.net/";
1036
+ break;
1037
+ case exports.Api.EEnv.STG:
1038
+ url += "-stg.net/";
1039
+ break;
1040
+ case exports.Api.EEnv.UAT:
1041
+ url += "-uat.net/";
1042
+ break;
1043
+ case exports.Api.EEnv.PROD:
1044
+ url += ".host/";
1045
+ break;
1046
+ default:
1047
+ throw ("Specified Environment is not valid. SuppliedEnv=" + env);
1048
+ }
1049
+ this.baseUrl = url;
1050
+ }
1051
+ GetBaseUrl() {
1052
+ return this.baseUrl;
1053
+ }
1054
+ SetBaseUrl(url) {
1055
+ this.baseUrl = url;
1056
+ if (!this.baseUrl.endsWith("/")) {
1057
+ this.baseUrl += "/";
1058
+ }
1059
+ }
1060
+ GET(url, params) {
1061
+ return __awaiter(this, void 0, void 0, function* () {
1062
+ return this.get(this.baseUrl + url, params);
1063
+ });
1064
+ }
1065
+ DELETE(url, params) {
1066
+ return __awaiter(this, void 0, void 0, function* () {
1067
+ return this.delete(this.baseUrl + url, params);
1068
+ });
1069
+ }
1070
+ POST(url, data, params) {
1071
+ return __awaiter(this, void 0, void 0, function* () {
1072
+ return this.post(this.baseUrl + url, data, params);
1073
+ });
1074
+ }
1075
+ UPLOAD(url, blob, params) {
1076
+ return __awaiter(this, void 0, void 0, function* () {
1077
+ return this.upload(this.baseUrl + url, blob, params);
1078
+ });
1079
+ }
1080
+ }
1081
+ GuardianApi.Api = Api$$1;
1082
+ })(exports.GuardianApi || (exports.GuardianApi = {}));
1083
+
1084
+ (function (HostingLocation) {
1085
+ /**
1086
+ * @Warning: This will not return the Settings property.
1087
+ * @param params
1088
+ * @returns
1089
+ */
1090
+ function GetList(params) {
1091
+ return __awaiter(this, void 0, void 0, function* () {
1092
+ const res = yield params.api.GET("hostinglocations", exports.Api.PrepReqParams(params.req));
1093
+ return {
1094
+ locations: res.Items
1095
+ };
1096
+ });
1097
+ }
1098
+ HostingLocation.GetList = GetList;
1099
+ function GetById(params) {
1100
+ return __awaiter(this, void 0, void 0, function* () {
1101
+ const { id, api, req } = params;
1102
+ if (!id) {
1103
+ throw ("Invalid id");
1104
+ }
1105
+ const res = yield api.GET(`hostinglocation/id/${id}`, exports.Api.PrepReqParams(req));
1106
+ return {
1107
+ location: res
1108
+ };
1109
+ });
1110
+ }
1111
+ HostingLocation.GetById = GetById;
1112
+ function GetByKey(params) {
1113
+ return __awaiter(this, void 0, void 0, function* () {
1114
+ const { key, api, req } = params;
1115
+ if (!key) {
1116
+ throw ("Invalid key");
1117
+ }
1118
+ const res = yield api.GET(`hostinglocation/key/${key}`, exports.Api.PrepReqParams(req));
1119
+ return {
1120
+ location: res
1121
+ };
1122
+ });
1123
+ }
1124
+ HostingLocation.GetByKey = GetByKey;
1125
+ /**
1126
+ * Returns hostingLocationKey from given db url.
1127
+ * Some older accounts don't have this set, so we need to guess it.
1128
+ * @param params
1129
+ * @returns
1130
+ */
1131
+ function GuessKey(params) {
1132
+ const { DBServer: databaseUrl } = params;
1133
+ if (databaseUrl.includes("hyperfarm-prod-instance-1")) {
1134
+ return "HYPERFARM";
1135
+ }
1136
+ if (databaseUrl.includes("prod-syd1.nextspace.host")) {
1137
+ return "AU-VULTR-FIRST";
1138
+ }
1139
+ else if (databaseUrl.includes("prod-nyc1.nextspace.host")) {
1140
+ return "US-VULTR-FIRST";
1141
+ }
1142
+ else if (databaseUrl.includes("prod-ams1.nextspace.host")) {
1143
+ return "EU-VULTR-FIRST";
1144
+ }
1145
+ else if (databaseUrl.includes("prod-sing1.nextspace.host")) {
1146
+ return "SE-VULTR-FIRST";
1147
+ }
1148
+ else if (databaseUrl.includes("dev-first")) {
1149
+ return "DEV-FIRST";
1150
+ }
1151
+ else if (databaseUrl.includes(".ap-southeast-1.")) {
1152
+ return "SE";
1153
+ }
1154
+ else if (databaseUrl.includes(".us-west-1.")) {
1155
+ return "US";
1156
+ }
1157
+ else if (databaseUrl.includes(".eu-west-3.")) {
1158
+ return "EU";
1159
+ }
1160
+ else if (databaseUrl.includes("bruce-prod-au")) {
1161
+ return "AU";
1162
+ }
1163
+ else if (databaseUrl.includes("bruce-dev")) {
1164
+ return "DEV";
1165
+ }
1166
+ return null;
1167
+ }
1168
+ HostingLocation.GuessKey = GuessKey;
1169
+ function GetByAccountId(params) {
1170
+ return __awaiter(this, void 0, void 0, function* () {
1171
+ const { accountId, apiSettings, api, req } = params;
1172
+ if (!accountId && !apiSettings) {
1173
+ throw ("Invalid accountId or apiSettings");
1174
+ }
1175
+ const settings = apiSettings ? apiSettings : (yield exports.Account.GetAppSettings({
1176
+ api,
1177
+ accountId,
1178
+ appId: exports.Account.EAppId.BruceApi
1179
+ })).settings;
1180
+ let hostingKey = settings["HostingLocation.Key"];
1181
+ if (!hostingKey) {
1182
+ hostingKey = settings.DBServer;
1183
+ }
1184
+ if (!hostingKey) {
1185
+ hostingKey = GuessKey({
1186
+ DBServer: settings.DBServer
1187
+ });
1188
+ }
1189
+ if (!hostingKey) {
1190
+ return null;
1191
+ }
1192
+ const data = yield GetByKey({
1193
+ key: hostingKey,
1194
+ api,
1195
+ req
1196
+ });
1197
+ return data;
1198
+ });
1199
+ }
1200
+ HostingLocation.GetByAccountId = GetByAccountId;
1201
+ })(exports.HostingLocation || (exports.HostingLocation = {}));
1202
+
1159
1203
  (function (BruceApi) {
1160
1204
  /**
1161
1205
  * This is the request handler for Bruce Api,
@@ -1171,18 +1215,18 @@
1171
1215
  cacheId: `BRUCE_API_${params === null || params === void 0 ? void 0 : params.env}_${params === null || params === void 0 ? void 0 : params.accountId}_`
1172
1216
  });
1173
1217
  this.loadCancelled = false;
1174
- let { accountId, env, cam, loadRegionalBaseUrl, loadConfig } = params;
1218
+ let { accountId, env, guardian, loadRegionalBaseUrl, loadConfig } = params;
1175
1219
  this.accountId = accountId;
1176
1220
  this.env = env !== null && env !== void 0 ? env : exports.Api.EEnv.PROD;
1177
1221
  if (loadRegionalBaseUrl) {
1178
1222
  loadConfig = true;
1179
1223
  }
1180
- if (!cam && loadConfig) {
1181
- cam = new exports.CamApi.Api({
1224
+ if (!guardian && loadConfig) {
1225
+ guardian = new exports.GuardianApi.Api({
1182
1226
  env: this.env
1183
1227
  });
1184
1228
  }
1185
- this.loadProm = this.init(cam, loadConfig);
1229
+ this.loadProm = this.init(guardian, loadConfig);
1186
1230
  }
1187
1231
  get MessageBroker() {
1188
1232
  return this.messageBroker;
@@ -1194,12 +1238,12 @@
1194
1238
  }
1195
1239
  /**
1196
1240
  * Loads regional base url and sets up message broker.
1197
- * @param cam Required for loading regional base url.
1241
+ * @param guardian Required for loading regional base url.
1198
1242
  * @param loadConfig
1199
1243
  * @returns
1200
1244
  */
1201
- init(cam, loadConfig) {
1202
- var _a, _b, _c;
1245
+ init(guardian, loadConfig) {
1246
+ var _a, _b, _c, _d;
1203
1247
  return __awaiter(this, void 0, void 0, function* () {
1204
1248
  if (!this.accountId) {
1205
1249
  throw ("accountId is required.");
@@ -1225,12 +1269,12 @@
1225
1269
  throw ("Specified Environment is not valid. SuppliedEnv=" + env);
1226
1270
  }
1227
1271
  this.baseUrl = url;
1228
- if (cam && loadConfig) {
1272
+ if (guardian && loadConfig) {
1229
1273
  // Attempt to load an account specific base url.
1230
1274
  // This could be one with a region specific endpoint.
1231
1275
  try {
1232
1276
  const settings = (yield exports.Account.GetAppSettings({
1233
- api: cam,
1277
+ api: guardian,
1234
1278
  accountId: this.accountId,
1235
1279
  appId: exports.Account.EAppId.BruceApi
1236
1280
  })).settings;
@@ -1245,41 +1289,24 @@
1245
1289
  }
1246
1290
  this.baseUrl = endpoint;
1247
1291
  }
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
- }
1292
+ const host = yield exports.HostingLocation.GetByAccountId({
1293
+ accountId: this.accountId,
1294
+ apiSettings: settings,
1295
+ api: guardian
1296
+ });
1297
+ const hostSettings = (_b = host === null || host === void 0 ? void 0 : host.location) === null || _b === void 0 ? void 0 : _b.Settings;
1298
+ if (hostSettings === null || hostSettings === void 0 ? void 0 : hostSettings.CDN) {
1299
+ this.EntityCdnUrl = (_c = hostSettings.CDN.entityURL) === null || _c === void 0 ? void 0 : _c[env];
1300
+ // We need to fix our configs.
1301
+ if (this.EntityCdnUrl) {
1302
+ if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
1303
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
1304
+ }
1305
+ else {
1306
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
1280
1307
  }
1281
- this.LegacyTilesetCdnUrl = (_c = region.CDN.legacyTilesetURL) === null || _c === void 0 ? void 0 : _c[env];
1282
1308
  }
1309
+ this.LegacyTilesetCdnUrl = (_d = hostSettings.CDN.legacyTilesetURL) === null || _d === void 0 ? void 0 : _d[env];
1283
1310
  }
1284
1311
  }
1285
1312
  catch (e) {
@@ -1366,6 +1393,75 @@
1366
1393
  BruceApi.Api = Api$$1;
1367
1394
  })(exports.BruceApi || (exports.BruceApi = {}));
1368
1395
 
1396
+ (function (CamApi) {
1397
+ class Api$$1 extends AbstractApi {
1398
+ constructor(params) {
1399
+ super({
1400
+ ssidHeader: "x-sessionid",
1401
+ cacheId: `CAM_API_${params === null || params === void 0 ? void 0 : params.env}_`
1402
+ });
1403
+ this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : exports.Api.EEnv.PROD;
1404
+ this.setBaseUrl();
1405
+ }
1406
+ setBaseUrl() {
1407
+ let codeWord = "cam";
1408
+ let url = "https://<CODEWORD>.nextspace";
1409
+ const env = this.env.toUpperCase();
1410
+ switch (env) {
1411
+ case exports.Api.EEnv.DEV:
1412
+ codeWord = "guardian";
1413
+ url += "-dev.net/";
1414
+ break;
1415
+ case exports.Api.EEnv.STG:
1416
+ codeWord = "guardian";
1417
+ url += "-stg.net/";
1418
+ break;
1419
+ case exports.Api.EEnv.UAT:
1420
+ codeWord = "guardian";
1421
+ url += "-uat.net/";
1422
+ break;
1423
+ case exports.Api.EEnv.PROD:
1424
+ url += ".host/";
1425
+ break;
1426
+ default:
1427
+ throw ("Specified Environment is not valid. SuppliedEnv=" + env);
1428
+ }
1429
+ url = url.replace("<CODEWORD>", codeWord);
1430
+ this.baseUrl = url;
1431
+ }
1432
+ GetBaseUrl() {
1433
+ return this.baseUrl;
1434
+ }
1435
+ SetBaseUrl(url) {
1436
+ this.baseUrl = url;
1437
+ if (!this.baseUrl.endsWith("/")) {
1438
+ this.baseUrl += "/";
1439
+ }
1440
+ }
1441
+ GET(url, params) {
1442
+ return __awaiter(this, void 0, void 0, function* () {
1443
+ return this.get(this.baseUrl + url, params);
1444
+ });
1445
+ }
1446
+ DELETE(url, params) {
1447
+ return __awaiter(this, void 0, void 0, function* () {
1448
+ return this.delete(this.baseUrl + url, params);
1449
+ });
1450
+ }
1451
+ POST(url, data, params) {
1452
+ return __awaiter(this, void 0, void 0, function* () {
1453
+ return this.post(this.baseUrl + url, data, params);
1454
+ });
1455
+ }
1456
+ UPLOAD(url, blob, params) {
1457
+ return __awaiter(this, void 0, void 0, function* () {
1458
+ return this.upload(this.baseUrl + url, blob, params);
1459
+ });
1460
+ }
1461
+ }
1462
+ CamApi.Api = Api$$1;
1463
+ })(exports.CamApi || (exports.CamApi = {}));
1464
+
1369
1465
  (function (IdmApi) {
1370
1466
  /**
1371
1467
  * This is the request handler for Idm Api,
@@ -1512,6 +1608,7 @@
1512
1608
  this.bruce = {};
1513
1609
  this.idm = {};
1514
1610
  this.cam = {};
1611
+ this.guardian = {};
1515
1612
  this.global = {};
1516
1613
  this.accountId = params === null || params === void 0 ? void 0 : params.accountId;
1517
1614
  this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : exports.Api.EEnv.PROD;
@@ -1571,6 +1668,10 @@
1571
1668
  }
1572
1669
  };
1573
1670
  }
1671
+ /**
1672
+ * Deprecated: Use GetGuardianApi instead.
1673
+ * @returns
1674
+ */
1574
1675
  GetIdmApi(params) {
1575
1676
  let { env } = params;
1576
1677
  env = env ? env : this.env;
@@ -1583,6 +1684,10 @@
1583
1684
  }
1584
1685
  return this.idm[key];
1585
1686
  }
1687
+ /**
1688
+ * Deprecated: Use GetGuardianGetter instead.
1689
+ * @returns
1690
+ */
1586
1691
  GetIdmGetter() {
1587
1692
  return {
1588
1693
  env: this.env,
@@ -1591,6 +1696,10 @@
1591
1696
  }
1592
1697
  };
1593
1698
  }
1699
+ /**
1700
+ * Deprecated: Use GetGuardianApi instead.
1701
+ * @returns
1702
+ */
1594
1703
  GetCamApi(params) {
1595
1704
  let { env } = params;
1596
1705
  env = env ? env : this.env;
@@ -1603,6 +1712,10 @@
1603
1712
  }
1604
1713
  return this.cam[key];
1605
1714
  }
1715
+ /**
1716
+ * Deprecated: Use GetGuardianGetter instead.
1717
+ * @returns
1718
+ */
1606
1719
  GetCamGetter() {
1607
1720
  return {
1608
1721
  env: this.env,
@@ -1631,6 +1744,26 @@
1631
1744
  }
1632
1745
  };
1633
1746
  }
1747
+ GetGuardianApi(params) {
1748
+ let { env } = params;
1749
+ env = env ? env : this.env;
1750
+ const key = `${env}`;
1751
+ if (!this.guardian[key]) {
1752
+ this.guardian[key] = new exports.GuardianApi.Api({
1753
+ env
1754
+ });
1755
+ this.cam[key].SetSessionId(this.sessionId);
1756
+ }
1757
+ return this.guardian[key];
1758
+ }
1759
+ GetGuardianGetter() {
1760
+ return {
1761
+ env: this.env,
1762
+ getApi: (env) => {
1763
+ return this.GetGuardianApi({ env });
1764
+ }
1765
+ };
1766
+ }
1634
1767
  }
1635
1768
 
1636
1769
  (function (Color) {