bruce-models 2.2.5 → 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.
- package/dist/bruce-models.es5.js +338 -191
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +323 -185
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js +4 -74
- package/dist/lib/account/account.js.map +1 -1
- package/dist/lib/api/api-getters.js +38 -0
- package/dist/lib/api/api-getters.js.map +1 -1
- package/dist/lib/api/bruce-api.js +27 -43
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/api/cam-api.js +1 -0
- package/dist/lib/api/cam-api.js.map +1 -1
- package/dist/lib/api/guardian-api.js +83 -0
- package/dist/lib/api/guardian-api.js.map +1 -0
- package/dist/lib/api/idm-api.js +3 -0
- package/dist/lib/api/idm-api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -0
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/server/hosting-location.js +138 -0
- package/dist/lib/server/hosting-location.js.map +1 -0
- package/dist/types/account/account-settings.d.ts +2 -0
- package/dist/types/account/account.d.ts +5 -30
- package/dist/types/api/api-getters.d.ts +22 -0
- package/dist/types/api/bruce-api.d.ts +3 -3
- package/dist/types/api/cam-api.d.ts +1 -0
- package/dist/types/api/guardian-api.d.ts +25 -0
- package/dist/types/api/idm-api.d.ts +3 -0
- package/dist/types/bruce-models.d.ts +1 -0
- package/dist/types/server/hosting-location.d.ts +65 -0
- package/package.json +1 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.HostingLocation = void 0;
|
|
13
|
+
const account_1 = require("../account/account");
|
|
14
|
+
const api_1 = require("../api/api");
|
|
15
|
+
/**
|
|
16
|
+
* A hosting location is a record for a possible bruce-api server configuration.
|
|
17
|
+
* A hosting location will have one or many database servers as well, this is an additional setting.
|
|
18
|
+
*/
|
|
19
|
+
var HostingLocation;
|
|
20
|
+
(function (HostingLocation) {
|
|
21
|
+
/**
|
|
22
|
+
* @Warning: This will not return the Settings property.
|
|
23
|
+
* @param params
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
function GetList(params) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const res = yield params.api.GET("hostinglocations", api_1.Api.PrepReqParams(params.req));
|
|
29
|
+
return {
|
|
30
|
+
locations: res.Items
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
HostingLocation.GetList = GetList;
|
|
35
|
+
function GetById(params) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const { id, api, req } = params;
|
|
38
|
+
if (!id) {
|
|
39
|
+
throw ("Invalid id");
|
|
40
|
+
}
|
|
41
|
+
const res = yield api.GET(`hostinglocation/id/${id}`, api_1.Api.PrepReqParams(req));
|
|
42
|
+
return {
|
|
43
|
+
location: res
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
HostingLocation.GetById = GetById;
|
|
48
|
+
function GetByKey(params) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const { key, api, req } = params;
|
|
51
|
+
if (!key) {
|
|
52
|
+
throw ("Invalid key");
|
|
53
|
+
}
|
|
54
|
+
const res = yield api.GET(`hostinglocation/key/${key}`, api_1.Api.PrepReqParams(req));
|
|
55
|
+
return {
|
|
56
|
+
location: res
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
HostingLocation.GetByKey = GetByKey;
|
|
61
|
+
/**
|
|
62
|
+
* Returns hostingLocationKey from given db url.
|
|
63
|
+
* Some older accounts don't have this set, so we need to guess it.
|
|
64
|
+
* @param params
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
function GuessKey(params) {
|
|
68
|
+
const { DBServer: databaseUrl } = params;
|
|
69
|
+
if (databaseUrl.includes("hyperfarm-prod-instance-1")) {
|
|
70
|
+
return "HYPERFARM";
|
|
71
|
+
}
|
|
72
|
+
if (databaseUrl.includes("prod-syd1.nextspace.host")) {
|
|
73
|
+
return "AU-VULTR-FIRST";
|
|
74
|
+
}
|
|
75
|
+
else if (databaseUrl.includes("prod-nyc1.nextspace.host")) {
|
|
76
|
+
return "US-VULTR-FIRST";
|
|
77
|
+
}
|
|
78
|
+
else if (databaseUrl.includes("prod-ams1.nextspace.host")) {
|
|
79
|
+
return "EU-VULTR-FIRST";
|
|
80
|
+
}
|
|
81
|
+
else if (databaseUrl.includes("prod-sing1.nextspace.host")) {
|
|
82
|
+
return "SE-VULTR-FIRST";
|
|
83
|
+
}
|
|
84
|
+
else if (databaseUrl.includes("dev-first")) {
|
|
85
|
+
return "DEV-FIRST";
|
|
86
|
+
}
|
|
87
|
+
else if (databaseUrl.includes(".ap-southeast-1.")) {
|
|
88
|
+
return "SE";
|
|
89
|
+
}
|
|
90
|
+
else if (databaseUrl.includes(".us-west-1.")) {
|
|
91
|
+
return "US";
|
|
92
|
+
}
|
|
93
|
+
else if (databaseUrl.includes(".eu-west-3.")) {
|
|
94
|
+
return "EU";
|
|
95
|
+
}
|
|
96
|
+
else if (databaseUrl.includes("bruce-prod-au")) {
|
|
97
|
+
return "AU";
|
|
98
|
+
}
|
|
99
|
+
else if (databaseUrl.includes("bruce-dev")) {
|
|
100
|
+
return "DEV";
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
HostingLocation.GuessKey = GuessKey;
|
|
105
|
+
function GetByAccountId(params) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
const { accountId, apiSettings, api, req } = params;
|
|
108
|
+
if (!accountId && !apiSettings) {
|
|
109
|
+
throw ("Invalid accountId or apiSettings");
|
|
110
|
+
}
|
|
111
|
+
const settings = apiSettings ? apiSettings : (yield account_1.Account.GetAppSettings({
|
|
112
|
+
api,
|
|
113
|
+
accountId,
|
|
114
|
+
appId: account_1.Account.EAppId.BruceApi
|
|
115
|
+
})).settings;
|
|
116
|
+
let hostingKey = settings["HostingLocation.Key"];
|
|
117
|
+
if (!hostingKey) {
|
|
118
|
+
hostingKey = settings.DBServer;
|
|
119
|
+
}
|
|
120
|
+
if (!hostingKey) {
|
|
121
|
+
hostingKey = GuessKey({
|
|
122
|
+
DBServer: settings.DBServer
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
if (!hostingKey) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
const data = yield GetByKey({
|
|
129
|
+
key: hostingKey,
|
|
130
|
+
api,
|
|
131
|
+
req
|
|
132
|
+
});
|
|
133
|
+
return data;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
HostingLocation.GetByAccountId = GetByAccountId;
|
|
137
|
+
})(HostingLocation = exports.HostingLocation || (exports.HostingLocation = {}));
|
|
138
|
+
//# sourceMappingURL=hosting-location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosting-location.js","sourceRoot":"","sources":["../../../src/server/hosting-location.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA6C;AAE7C,oCAAiC;AAGjC;;;GAGG;AACH,IAAiB,eAAe,CAoK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D,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,iBAAO,CAAC,cAAc,CAAC;gBACvE,GAAG;gBACH,SAAS;gBACT,KAAK,EAAE,iBAAO,CAAC,MAAM,CAAC,QAAQ;aACjC,CAAC,CAAC,CAAC,QAAqC,CAAC;YAC1C,IAAI,UAAU,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAC;YACjD,IAAI,CAAC,UAAU,EAAE;gBACb,UAAU,GAAG,QAAQ,CAAC,QAAQ,CAAC;aAClC;YACD,IAAI,CAAC,UAAU,EAAE;gBACb,UAAU,GAAG,QAAQ,CAAC;oBAClB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;iBAC9B,CAAC,CAAC;aACN;YACD,IAAI,CAAC,UAAU,EAAE;gBACb,OAAO,IAAI,CAAC;aACf;YACD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC;gBACxB,GAAG,EAAE,UAAU;gBACf,GAAG;gBACH,GAAG;aACN,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;IApCqB,8BAAc,iBAoCnC,CAAA;AACL,CAAC,EApKgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAoK/B"}
|
|
@@ -2,6 +2,8 @@ import { Api } from "../bruce-models";
|
|
|
2
2
|
export declare namespace AccountSettings {
|
|
3
3
|
type Settings = IBruceApi | INavigator | any;
|
|
4
4
|
interface IBruceApi {
|
|
5
|
+
"HostingLocation.Key"?: string;
|
|
6
|
+
"DatabaseServer.ID"?: number;
|
|
5
7
|
DBLocation?: string;
|
|
6
8
|
DBServer?: string;
|
|
7
9
|
DBReadonlyServers?: string[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Api } from "../api/api";
|
|
2
2
|
import { BruceApi } from "../api/bruce-api";
|
|
3
3
|
import { CamApi } from "../api/cam-api";
|
|
4
|
+
import { GuardianApi } from "../api/guardian-api";
|
|
4
5
|
import { IdmApi } from "../api/idm-api";
|
|
5
6
|
import { AccountSettings } from "./account-settings";
|
|
6
7
|
/**
|
|
@@ -11,21 +12,6 @@ export declare namespace Account {
|
|
|
11
12
|
function GetCacheKey(accountId: string, appSettingsId?: string): string;
|
|
12
13
|
function GetListCacheKey(ssid: string): string;
|
|
13
14
|
function GetDbRegionListCacheKey(): Api.ECacheKey;
|
|
14
|
-
interface IDbRegion {
|
|
15
|
-
key: EDbRegion | string;
|
|
16
|
-
name?: string;
|
|
17
|
-
allowCreation?: boolean;
|
|
18
|
-
CDN?: {
|
|
19
|
-
legacyTilesetURL?: Record<Api.Env, string>;
|
|
20
|
-
entityURL?: Record<Api.Env, string>;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
enum EDbRegion {
|
|
24
|
-
USA = "US",
|
|
25
|
-
Paris = "EU",
|
|
26
|
-
Singapore = "SE",
|
|
27
|
-
Australia = "AU"
|
|
28
|
-
}
|
|
29
15
|
enum EAppId {
|
|
30
16
|
BruceApi = "BruceAPI",
|
|
31
17
|
Navigator = "Navigator"
|
|
@@ -46,7 +32,7 @@ export declare namespace Account {
|
|
|
46
32
|
"Application.Settings"?: AccountSettings.Settings;
|
|
47
33
|
}
|
|
48
34
|
function Get(params: {
|
|
49
|
-
api: CamApi.Api;
|
|
35
|
+
api: CamApi.Api | GuardianApi.Api;
|
|
50
36
|
accountId: string;
|
|
51
37
|
req?: Api.IReqParams;
|
|
52
38
|
}): Promise<{
|
|
@@ -59,7 +45,7 @@ export declare namespace Account {
|
|
|
59
45
|
accounts: IAccount[];
|
|
60
46
|
}>;
|
|
61
47
|
function GetAppSettings(params: {
|
|
62
|
-
api: CamApi.Api;
|
|
48
|
+
api: CamApi.Api | GuardianApi.Api;
|
|
63
49
|
accountId: string;
|
|
64
50
|
appId: AppId;
|
|
65
51
|
req?: Api.IReqParams;
|
|
@@ -72,7 +58,7 @@ export declare namespace Account {
|
|
|
72
58
|
* @returns
|
|
73
59
|
*/
|
|
74
60
|
function UpdateAppSettings(params: {
|
|
75
|
-
api: CamApi.Api;
|
|
61
|
+
api: CamApi.Api | GuardianApi.Api;
|
|
76
62
|
accountId: string;
|
|
77
63
|
appId: string;
|
|
78
64
|
settings: AccountSettings.Settings;
|
|
@@ -89,21 +75,10 @@ export declare namespace Account {
|
|
|
89
75
|
api: BruceApi.Api;
|
|
90
76
|
accountId: string;
|
|
91
77
|
name: string;
|
|
92
|
-
|
|
78
|
+
hostingLocationKey: string;
|
|
93
79
|
starterContent?: EStarterContent;
|
|
94
80
|
req?: Api.IReqParams;
|
|
95
81
|
}): Promise<{
|
|
96
82
|
account: IAccount;
|
|
97
83
|
}>;
|
|
98
|
-
function GetDbRegions(params: {
|
|
99
|
-
api: BruceApi.Api;
|
|
100
|
-
key?: EDbRegion | string;
|
|
101
|
-
req?: Api.IReqParams;
|
|
102
|
-
}): Promise<{
|
|
103
|
-
regions: IDbRegion[];
|
|
104
|
-
errors: string[];
|
|
105
|
-
}>;
|
|
106
|
-
function GuessDbLocation(params: {
|
|
107
|
-
DBServer?: string;
|
|
108
|
-
}): "HYPERFARM" | "AU-VULTR-FIRST" | "US-VULTR-FIRST" | "EU-VULTR-FIRST" | "SE-VULTR-FIRST" | "DEV-FIRST" | "SE" | "US" | "EU" | "AU" | "DEV";
|
|
109
84
|
}
|
|
@@ -2,11 +2,13 @@ import { Api } from "./api";
|
|
|
2
2
|
import { BruceApi } from "./bruce-api";
|
|
3
3
|
import { CamApi } from "./cam-api";
|
|
4
4
|
import { GlobalApi } from "./global-api";
|
|
5
|
+
import { GuardianApi } from "./guardian-api";
|
|
5
6
|
import { IdmApi } from "./idm-api";
|
|
6
7
|
export declare class ApiGetters {
|
|
7
8
|
private bruce;
|
|
8
9
|
private idm;
|
|
9
10
|
private cam;
|
|
11
|
+
private guardian;
|
|
10
12
|
private global;
|
|
11
13
|
private accountId;
|
|
12
14
|
private env;
|
|
@@ -27,16 +29,36 @@ export declare class ApiGetters {
|
|
|
27
29
|
env?: Api.EEnv;
|
|
28
30
|
}): BruceApi.Api;
|
|
29
31
|
GetBruceGetter(): BruceApi.IGetter;
|
|
32
|
+
/**
|
|
33
|
+
* Deprecated: Use GetGuardianApi instead.
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
30
36
|
GetIdmApi(params: {
|
|
31
37
|
env?: Api.EEnv;
|
|
32
38
|
}): IdmApi.Api;
|
|
39
|
+
/**
|
|
40
|
+
* Deprecated: Use GetGuardianGetter instead.
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
33
43
|
GetIdmGetter(): IdmApi.IGetter;
|
|
44
|
+
/**
|
|
45
|
+
* Deprecated: Use GetGuardianApi instead.
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
34
48
|
GetCamApi(params: {
|
|
35
49
|
env?: Api.EEnv;
|
|
36
50
|
}): CamApi.Api;
|
|
51
|
+
/**
|
|
52
|
+
* Deprecated: Use GetGuardianGetter instead.
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
37
55
|
GetCamGetter(): CamApi.IGetter;
|
|
38
56
|
GetGlobalApi(params: {
|
|
39
57
|
env?: Api.EEnv;
|
|
40
58
|
}): GlobalApi.Api;
|
|
41
59
|
GetGlobalGetter(): GlobalApi.IGetter;
|
|
60
|
+
GetGuardianApi(params: {
|
|
61
|
+
env?: Api.EEnv;
|
|
62
|
+
}): GuardianApi.Api;
|
|
63
|
+
GetGuardianGetter(): GuardianApi.IGetter;
|
|
42
64
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AbstractApi } from "./abstract-api";
|
|
2
2
|
import { Api as A } from "./api";
|
|
3
|
-
import { CamApi } from "./cam-api";
|
|
4
3
|
import { MessageBroker } from "../server/message-broker";
|
|
4
|
+
import { GuardianApi } from "./guardian-api";
|
|
5
5
|
export declare namespace BruceApi {
|
|
6
6
|
interface IGetter {
|
|
7
7
|
env: A.EEnv;
|
|
@@ -30,11 +30,11 @@ export declare namespace BruceApi {
|
|
|
30
30
|
env?: A.Env;
|
|
31
31
|
loadRegionalBaseUrl?: boolean;
|
|
32
32
|
loadConfig?: boolean;
|
|
33
|
-
|
|
33
|
+
guardian?: GuardianApi.Api;
|
|
34
34
|
});
|
|
35
35
|
/**
|
|
36
36
|
* Loads regional base url and sets up message broker.
|
|
37
|
-
* @param
|
|
37
|
+
* @param guardian Required for loading regional base url.
|
|
38
38
|
* @param loadConfig
|
|
39
39
|
* @returns
|
|
40
40
|
*/
|
|
@@ -3,6 +3,7 @@ import { Api as A } from "./api";
|
|
|
3
3
|
/**
|
|
4
4
|
* This is the request handler for Cam Api,
|
|
5
5
|
* it should be passed to any method that wants to communicate with this particular api.
|
|
6
|
+
* @deprecated Please use GuardianApi instead.
|
|
6
7
|
*/
|
|
7
8
|
export declare namespace CamApi {
|
|
8
9
|
interface IGetter {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AbstractApi } from "./abstract-api";
|
|
2
|
+
import { Api as A } from "./api";
|
|
3
|
+
/**
|
|
4
|
+
* This is the request handler for Cam/Idm Api,
|
|
5
|
+
* it should be passed to any method that wants to communicate with this particular api.
|
|
6
|
+
*/
|
|
7
|
+
export declare namespace GuardianApi {
|
|
8
|
+
interface IGetter {
|
|
9
|
+
env: A.EEnv;
|
|
10
|
+
getApi: (env?: A.EEnv) => GuardianApi.Api;
|
|
11
|
+
}
|
|
12
|
+
class Api extends AbstractApi {
|
|
13
|
+
private env;
|
|
14
|
+
constructor(params: {
|
|
15
|
+
env?: A.Env;
|
|
16
|
+
});
|
|
17
|
+
private setBaseUrl;
|
|
18
|
+
GetBaseUrl(): string;
|
|
19
|
+
SetBaseUrl(url: string): void;
|
|
20
|
+
GET(url: string, params?: A.IReqParams): Promise<any>;
|
|
21
|
+
DELETE(url: string, params?: A.IReqParams): Promise<any>;
|
|
22
|
+
POST(url: string, data: any, params?: A.IReqParams): Promise<any>;
|
|
23
|
+
UPLOAD(url: string, blob: Blob, params?: A.IUploadReqParams): Promise<any>;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -52,6 +52,7 @@ export * from "./project/project-view-legacy-tile";
|
|
|
52
52
|
export * from "./project/project-view-tile";
|
|
53
53
|
export * from "./server/pending-action";
|
|
54
54
|
export * from "./server/message-broker";
|
|
55
|
+
export * from "./server/hosting-location";
|
|
55
56
|
export * from "./style/style";
|
|
56
57
|
export * from "./tileset/tileset";
|
|
57
58
|
export * from "./user/permission";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { AccountSettings } from "../account/account-settings";
|
|
2
|
+
import { Api } from "../api/api";
|
|
3
|
+
import { GuardianApi } from "../api/guardian-api";
|
|
4
|
+
/**
|
|
5
|
+
* A hosting location is a record for a possible bruce-api server configuration.
|
|
6
|
+
* A hosting location will have one or many database servers as well, this is an additional setting.
|
|
7
|
+
*/
|
|
8
|
+
export declare namespace HostingLocation {
|
|
9
|
+
interface ILocation {
|
|
10
|
+
ID: number;
|
|
11
|
+
Key: string;
|
|
12
|
+
IsEnabledForNewAccounts: boolean;
|
|
13
|
+
DisplayName?: string;
|
|
14
|
+
Description?: string;
|
|
15
|
+
AWSRegion?: string;
|
|
16
|
+
Country?: string;
|
|
17
|
+
Hoster?: string;
|
|
18
|
+
City?: string;
|
|
19
|
+
BruceAPIURL?: string;
|
|
20
|
+
Environment?: string;
|
|
21
|
+
Settings?: any;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @Warning: This will not return the Settings property.
|
|
25
|
+
* @param params
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
function GetList(params: {
|
|
29
|
+
api: GuardianApi.Api;
|
|
30
|
+
req?: Api.IReqParams;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
locations: ILocation[];
|
|
33
|
+
}>;
|
|
34
|
+
function GetById(params: {
|
|
35
|
+
id: number;
|
|
36
|
+
api: GuardianApi.Api;
|
|
37
|
+
req?: Api.IReqParams;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
location: ILocation;
|
|
40
|
+
}>;
|
|
41
|
+
function GetByKey(params: {
|
|
42
|
+
key: string;
|
|
43
|
+
api: GuardianApi.Api;
|
|
44
|
+
req?: Api.IReqParams;
|
|
45
|
+
}): Promise<{
|
|
46
|
+
location: ILocation;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns hostingLocationKey from given db url.
|
|
50
|
+
* Some older accounts don't have this set, so we need to guess it.
|
|
51
|
+
* @param params
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
function GuessKey(params: {
|
|
55
|
+
DBServer?: string;
|
|
56
|
+
}): "HYPERFARM" | "AU-VULTR-FIRST" | "US-VULTR-FIRST" | "EU-VULTR-FIRST" | "SE-VULTR-FIRST" | "DEV-FIRST" | "SE" | "US" | "EU" | "AU" | "DEV";
|
|
57
|
+
function GetByAccountId(params: {
|
|
58
|
+
accountId?: string;
|
|
59
|
+
apiSettings?: AccountSettings.IBruceApi;
|
|
60
|
+
api: GuardianApi.Api;
|
|
61
|
+
req?: Api.IReqParams;
|
|
62
|
+
}): Promise<{
|
|
63
|
+
location: ILocation;
|
|
64
|
+
}>;
|
|
65
|
+
}
|