bruce-models 2.3.6 → 2.3.8
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 +8041 -8033
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +7805 -7797
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account-invite.js +81 -81
- package/dist/lib/account/account-settings.js +2 -2
- package/dist/lib/account/account.js +169 -169
- package/dist/lib/account/account.js.map +1 -1
- package/dist/lib/ann-document/ann-document.js +94 -94
- package/dist/lib/api/abstract-api.js +269 -269
- package/dist/lib/api/api-getters.js +172 -172
- package/dist/lib/api/api.js +93 -93
- package/dist/lib/api/bruce-api.js +224 -220
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/api/cam-api.js +88 -88
- package/dist/lib/api/global-api.js +82 -82
- package/dist/lib/api/guardian-api.js +82 -82
- package/dist/lib/api/idm-api.js +90 -90
- package/dist/lib/bruce-models.js +95 -91
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/calculator/calculator.js +341 -341
- package/dist/lib/client-file/client-file.js +255 -255
- package/dist/lib/client-file/client-file.js.map +1 -1
- package/dist/lib/common/bounds.js +61 -61
- package/dist/lib/common/bruce-event.js +46 -46
- package/dist/lib/common/bruce-variable.js +60 -60
- package/dist/lib/common/cache.js +188 -188
- package/dist/lib/common/cache.js.map +1 -1
- package/dist/lib/common/camera.js +11 -11
- package/dist/lib/common/cartes.js +123 -123
- package/dist/lib/common/carto.js +60 -60
- package/dist/lib/common/color.js +86 -86
- package/dist/lib/common/delay-queue.js +56 -56
- package/dist/lib/common/dictionary.js +2 -2
- package/dist/lib/common/geometry.js +120 -120
- package/dist/lib/common/lru-cache.js +25 -25
- package/dist/lib/common/transform.js +2 -2
- package/dist/lib/common/utc.js +39 -39
- package/dist/lib/custom-form/custom-form-content.js +26 -26
- package/dist/lib/custom-form/custom-form.js +114 -114
- package/dist/lib/data-lab/data-lab.js +49 -49
- package/dist/lib/entity/entity-attachment-type.js +87 -87
- package/dist/lib/entity/entity-attachment-type.js.map +1 -1
- package/dist/lib/entity/entity-attachment.js +126 -126
- package/dist/lib/entity/entity-attachment.js.map +1 -1
- package/dist/lib/entity/entity-attribute.js +29 -29
- package/dist/lib/entity/entity-comment.js +86 -86
- package/dist/lib/entity/entity-comment.js.map +1 -1
- package/dist/lib/entity/entity-coords.js +153 -153
- package/dist/lib/entity/entity-coords.js.map +1 -1
- package/dist/lib/entity/entity-link.js +86 -86
- package/dist/lib/entity/entity-link.js.map +1 -1
- package/dist/lib/entity/entity-lod-category.js +108 -108
- package/dist/lib/entity/entity-lod.js +197 -197
- package/dist/lib/entity/entity-lod.js.map +1 -1
- package/dist/lib/entity/entity-relation-type.js +117 -117
- package/dist/lib/entity/entity-relation-type.js.map +1 -1
- package/dist/lib/entity/entity-relation.js +157 -157
- package/dist/lib/entity/entity-source.js +136 -136
- package/dist/lib/entity/entity-source.js.map +1 -1
- package/dist/lib/entity/entity-tag.js +157 -157
- package/dist/lib/entity/entity-type-visual-settings.js +13 -13
- package/dist/lib/entity/entity-type.js +122 -122
- package/dist/lib/entity/entity.js +341 -341
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/lib/entity/getters/batched-data-getter.js +84 -84
- package/dist/lib/entity/getters/batched-data-getter.js.map +1 -1
- package/dist/lib/entity/getters/entity-filter-getter.js +316 -316
- package/dist/lib/entity/getters/entity-filter-getter.js.map +1 -1
- package/dist/lib/entity/getters/entity-globe.js +175 -175
- package/dist/lib/entity/getters/view-monitor.js +2 -2
- package/dist/lib/import/import-cad.js +53 -53
- package/dist/lib/import/import-cad.js.map +1 -1
- package/dist/lib/import/import-csv.js +23 -23
- package/dist/lib/import/import-json.js +23 -23
- package/dist/lib/import/import-kml.js +23 -23
- package/dist/lib/import/imported-file.js +130 -130
- package/dist/lib/internal/uploader.js +76 -76
- package/dist/lib/internal/uploader.js.map +1 -1
- package/dist/lib/markup/markup.js +185 -185
- package/dist/lib/plugin/plugin.js +91 -91
- package/dist/lib/program-key/program-key.js +120 -120
- package/dist/lib/program-key/program-key.js.map +1 -1
- package/dist/lib/project/menu-item.js +122 -122
- package/dist/lib/project/project-view-bookmark.js +159 -159
- package/dist/lib/project/project-view-bookmark.js.map +1 -1
- package/dist/lib/project/project-view-legacy-tile.js +77 -77
- package/dist/lib/project/project-view-legacy-tile.js.map +1 -1
- package/dist/lib/project/project-view-tile.js +125 -125
- package/dist/lib/project/project-view.js +141 -141
- package/dist/lib/project/zoom-control.js +17 -17
- package/dist/lib/server/hosting-location.js +156 -156
- package/dist/lib/server/hosting-location.js.map +1 -1
- package/dist/lib/server/message-broker.js +142 -142
- package/dist/lib/server/message-broker.js.map +1 -1
- package/dist/lib/server/pending-action.js +83 -83
- package/dist/lib/server/task.js +63 -63
- package/dist/lib/style/style.js +129 -129
- package/dist/lib/style/style.js.map +1 -1
- package/dist/lib/tileset/tileset.js +431 -431
- package/dist/lib/tileset/tileset.js.map +1 -1
- package/dist/lib/user/permission.js +20 -20
- package/dist/lib/user/session.js +145 -142
- package/dist/lib/user/session.js.map +1 -1
- package/dist/lib/user/user-group.js +94 -94
- package/dist/lib/user/user.js +475 -474
- package/dist/lib/user/user.js.map +1 -1
- package/dist/lib/util/encrypt-utils.js +19 -19
- package/dist/lib/util/math-utils.js +40 -40
- 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 +94 -94
- package/dist/lib/util/url-utils.js.map +1 -1
- package/dist/types/account/account-invite.d.ts +68 -68
- package/dist/types/account/account-settings.d.ts +24 -24
- package/dist/types/account/account.d.ts +84 -84
- package/dist/types/ann-document/ann-document.d.ts +50 -50
- package/dist/types/api/abstract-api.d.ts +36 -36
- package/dist/types/api/api-getters.d.ts +64 -64
- package/dist/types/api/api.d.ts +93 -93
- package/dist/types/api/bruce-api.d.ts +64 -63
- package/dist/types/api/cam-api.d.ts +26 -26
- package/dist/types/api/global-api.d.ts +25 -25
- package/dist/types/api/guardian-api.d.ts +25 -25
- package/dist/types/api/idm-api.d.ts +28 -28
- package/dist/types/bruce-models.d.ts +79 -79
- package/dist/types/calculator/calculator.d.ts +61 -61
- package/dist/types/client-file/client-file.d.ts +130 -130
- package/dist/types/common/bounds.d.ts +30 -30
- package/dist/types/common/bruce-event.d.ts +12 -12
- package/dist/types/common/bruce-variable.d.ts +21 -21
- package/dist/types/common/cache.d.ts +57 -57
- package/dist/types/common/camera.d.ts +6 -6
- package/dist/types/common/cartes.d.ts +51 -51
- package/dist/types/common/carto.d.ts +15 -15
- package/dist/types/common/color.d.ts +24 -24
- package/dist/types/common/delay-queue.d.ts +14 -14
- package/dist/types/common/dictionary.d.ts +3 -3
- package/dist/types/common/geometry.d.ts +44 -44
- package/dist/types/common/lru-cache.d.ts +7 -7
- package/dist/types/common/transform.d.ts +15 -15
- package/dist/types/common/utc.d.ts +29 -29
- package/dist/types/custom-form/custom-form-content.d.ts +60 -60
- package/dist/types/custom-form/custom-form.d.ts +49 -49
- package/dist/types/data-lab/data-lab.d.ts +28 -28
- package/dist/types/entity/entity-attachment-type.d.ts +39 -39
- package/dist/types/entity/entity-attachment.d.ts +61 -61
- package/dist/types/entity/entity-attribute.d.ts +39 -39
- package/dist/types/entity/entity-comment.d.ts +40 -40
- package/dist/types/entity/entity-coords.d.ts +66 -66
- package/dist/types/entity/entity-link.d.ts +36 -36
- package/dist/types/entity/entity-lod-category.d.ts +36 -36
- package/dist/types/entity/entity-lod.d.ts +99 -99
- package/dist/types/entity/entity-relation-type.d.ts +44 -44
- package/dist/types/entity/entity-relation.d.ts +59 -59
- package/dist/types/entity/entity-source.d.ts +45 -45
- package/dist/types/entity/entity-tag.d.ts +53 -53
- package/dist/types/entity/entity-type-visual-settings.d.ts +16 -16
- package/dist/types/entity/entity-type.d.ts +63 -63
- package/dist/types/entity/entity.d.ts +118 -118
- package/dist/types/entity/getters/batched-data-getter.d.ts +26 -26
- package/dist/types/entity/getters/entity-filter-getter.d.ts +61 -61
- package/dist/types/entity/getters/entity-globe.d.ts +21 -21
- package/dist/types/entity/getters/view-monitor.d.ts +13 -13
- package/dist/types/import/import-cad.d.ts +49 -49
- package/dist/types/import/import-csv.d.ts +31 -31
- package/dist/types/import/import-json.d.ts +26 -26
- package/dist/types/import/import-kml.d.ts +19 -19
- package/dist/types/import/imported-file.d.ts +47 -47
- package/dist/types/internal/uploader.d.ts +16 -16
- package/dist/types/markup/markup.d.ts +227 -227
- package/dist/types/plugin/plugin.d.ts +39 -39
- package/dist/types/program-key/program-key.d.ts +48 -48
- package/dist/types/project/menu-item.d.ts +169 -169
- package/dist/types/project/project-view-bookmark.d.ts +179 -179
- package/dist/types/project/project-view-legacy-tile.d.ts +48 -48
- package/dist/types/project/project-view-tile.d.ts +65 -65
- package/dist/types/project/project-view.d.ts +136 -136
- package/dist/types/project/zoom-control.d.ts +22 -22
- package/dist/types/server/hosting-location.d.ts +74 -74
- package/dist/types/server/message-broker.d.ts +86 -86
- package/dist/types/server/pending-action.d.ts +66 -66
- package/dist/types/server/task.d.ts +36 -36
- package/dist/types/style/style.d.ts +107 -107
- package/dist/types/tileset/tileset.d.ts +264 -264
- package/dist/types/user/permission.d.ts +15 -15
- package/dist/types/user/session.d.ts +72 -66
- package/dist/types/user/user-group.d.ts +58 -58
- package/dist/types/user/user.d.ts +189 -188
- package/dist/types/util/encrypt-utils.d.ts +3 -3
- package/dist/types/util/math-utils.d.ts +16 -16
- package/dist/types/util/object-utils.d.ts +7 -7
- package/dist/types/util/path-utils.d.ts +8 -8
- package/dist/types/util/url-utils.d.ts +26 -26
- package/package.json +79 -78
|
@@ -1,221 +1,225 @@
|
|
|
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.BruceApi = void 0;
|
|
13
|
-
const abstract_api_1 = require("./abstract-api");
|
|
14
|
-
const api_1 = require("./api");
|
|
15
|
-
const message_broker_1 = require("../server/message-broker");
|
|
16
|
-
const guardian_api_1 = require("./guardian-api");
|
|
17
|
-
const hosting_location_1 = require("../server/hosting-location");
|
|
18
|
-
var BruceApi;
|
|
19
|
-
(function (BruceApi) {
|
|
20
|
-
/**
|
|
21
|
-
* This is the request handler for Bruce Api,
|
|
22
|
-
* it should be passed to any method that wants to communicate with this particular api.
|
|
23
|
-
*/
|
|
24
|
-
class Api extends abstract_api_1.AbstractApi {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Loads regional base url and sets up message broker.
|
|
57
|
-
* @param guardian Required for loading regional base url.
|
|
58
|
-
* @param loadConfig
|
|
59
|
-
* @returns
|
|
60
|
-
*/
|
|
61
|
-
init(guardian, loadConfig) {
|
|
62
|
-
var _a, _b;
|
|
63
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
if (!this.accountId) {
|
|
65
|
-
throw ("accountId is required.");
|
|
66
|
-
}
|
|
67
|
-
const env = this.env.toUpperCase();
|
|
68
|
-
let domain = "nextspace.host";
|
|
69
|
-
switch (env) {
|
|
70
|
-
case api_1.Api.EEnv.DEV:
|
|
71
|
-
domain = "nextspace-dev.net";
|
|
72
|
-
break;
|
|
73
|
-
case api_1.Api.EEnv.STG:
|
|
74
|
-
domain = "nextspace-stg.net";
|
|
75
|
-
break;
|
|
76
|
-
case api_1.Api.EEnv.UAT:
|
|
77
|
-
domain = "nextspace-uat.net";
|
|
78
|
-
break;
|
|
79
|
-
case api_1.Api.EEnv.PROD:
|
|
80
|
-
domain = "nextspace.host";
|
|
81
|
-
break;
|
|
82
|
-
default:
|
|
83
|
-
console.error("Specified Environment is not valid. SuppliedEnv=" + env);
|
|
84
|
-
}
|
|
85
|
-
// Set using a stable default.
|
|
86
|
-
this.baseUrl = `https://${this.accountId}.api.${domain}/`;
|
|
87
|
-
if (guardian && loadConfig) {
|
|
88
|
-
try {
|
|
89
|
-
const host = yield hosting_location_1.HostingLocation.GetByAccountId({
|
|
90
|
-
accountId: this.accountId,
|
|
91
|
-
api: guardian
|
|
92
|
-
});
|
|
93
|
-
if (host === null || host === void 0 ? void 0 : host.location) {
|
|
94
|
-
const settings = host.location.Settings;
|
|
95
|
-
// Attempt to load regional base url.
|
|
96
|
-
// First try go through settings.
|
|
97
|
-
let urlSet = false;
|
|
98
|
-
if (settings === null || settings === void 0 ? void 0 : settings.BruceAPIURL) {
|
|
99
|
-
let envUrl = settings.BruceAPIURL[env];
|
|
100
|
-
if (envUrl) {
|
|
101
|
-
envUrl = envUrl
|
|
102
|
-
.replace("<ACCOUNTID>", this.accountId)
|
|
103
|
-
.replace("<ACCOUNT>", this.accountId);
|
|
104
|
-
if (envUrl && envUrl.length > 1) {
|
|
105
|
-
this.baseUrl = envUrl;
|
|
106
|
-
urlSet = true;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
// Try go through host location's base url.
|
|
111
|
-
// This may be wrong env which is why it's used as fallback right now.
|
|
112
|
-
if (!urlSet && host.location.BruceAPIURL) {
|
|
113
|
-
const regionalUrl = host.location.BruceAPIURL
|
|
114
|
-
.replace("<ACCOUNTID>", this.accountId)
|
|
115
|
-
.replace("<ACCOUNT>", this.accountId)
|
|
116
|
-
.replace("<DOMAIN>", domain);
|
|
117
|
-
if (regionalUrl && regionalUrl.length > 1) {
|
|
118
|
-
this.baseUrl = regionalUrl;
|
|
119
|
-
urlSet = true;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
// Attempt to load CDN settings.
|
|
123
|
-
if (settings === null || settings === void 0 ? void 0 : settings.CDN) {
|
|
124
|
-
this.EntityCdnUrl = (_a = settings.CDN.entityURL) === null || _a === void 0 ? void 0 : _a[env];
|
|
125
|
-
// We need to fix our configs.
|
|
126
|
-
if (this.EntityCdnUrl) {
|
|
127
|
-
if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
|
|
128
|
-
this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
this.LegacyTilesetCdnUrl = (_b = settings.CDN.legacyTilesetURL) === null || _b === void 0 ? void 0 : _b[env];
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
*
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
this.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
})
|
|
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.BruceApi = void 0;
|
|
13
|
+
const abstract_api_1 = require("./abstract-api");
|
|
14
|
+
const api_1 = require("./api");
|
|
15
|
+
const message_broker_1 = require("../server/message-broker");
|
|
16
|
+
const guardian_api_1 = require("./guardian-api");
|
|
17
|
+
const hosting_location_1 = require("../server/hosting-location");
|
|
18
|
+
var BruceApi;
|
|
19
|
+
(function (BruceApi) {
|
|
20
|
+
/**
|
|
21
|
+
* This is the request handler for Bruce Api,
|
|
22
|
+
* it should be passed to any method that wants to communicate with this particular api.
|
|
23
|
+
*/
|
|
24
|
+
class Api extends abstract_api_1.AbstractApi {
|
|
25
|
+
get MessageBroker() {
|
|
26
|
+
return this.messageBroker;
|
|
27
|
+
}
|
|
28
|
+
// Indicates if the init process has finished loading.
|
|
29
|
+
// This means the regional base url has been set and message broker is ready.
|
|
30
|
+
get Loading() {
|
|
31
|
+
return this.loadProm;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @param params
|
|
35
|
+
*/
|
|
36
|
+
constructor(params) {
|
|
37
|
+
super({
|
|
38
|
+
ssidHeader: "x-sessionid",
|
|
39
|
+
cacheId: `BRUCE_API_${params === null || params === void 0 ? void 0 : params.env}_${params === null || params === void 0 ? void 0 : params.accountId}_`
|
|
40
|
+
});
|
|
41
|
+
this.loadCancelled = false;
|
|
42
|
+
let { accountId, env, guardian, loadRegionalBaseUrl, loadConfig } = params;
|
|
43
|
+
this.accountId = accountId;
|
|
44
|
+
this.env = env !== null && env !== void 0 ? env : api_1.Api.EEnv.PROD;
|
|
45
|
+
if (loadRegionalBaseUrl) {
|
|
46
|
+
loadConfig = true;
|
|
47
|
+
}
|
|
48
|
+
if (!guardian && loadConfig) {
|
|
49
|
+
guardian = new guardian_api_1.GuardianApi.Api({
|
|
50
|
+
env: this.env
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
this.loadProm = this.init(guardian, loadConfig);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Loads regional base url and sets up message broker.
|
|
57
|
+
* @param guardian Required for loading regional base url.
|
|
58
|
+
* @param loadConfig
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
init(guardian, loadConfig) {
|
|
62
|
+
var _a, _b, _c;
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
if (!this.accountId) {
|
|
65
|
+
throw ("accountId is required.");
|
|
66
|
+
}
|
|
67
|
+
const env = this.env.toUpperCase();
|
|
68
|
+
let domain = "nextspace.host";
|
|
69
|
+
switch (env) {
|
|
70
|
+
case api_1.Api.EEnv.DEV:
|
|
71
|
+
domain = "nextspace-dev.net";
|
|
72
|
+
break;
|
|
73
|
+
case api_1.Api.EEnv.STG:
|
|
74
|
+
domain = "nextspace-stg.net";
|
|
75
|
+
break;
|
|
76
|
+
case api_1.Api.EEnv.UAT:
|
|
77
|
+
domain = "nextspace-uat.net";
|
|
78
|
+
break;
|
|
79
|
+
case api_1.Api.EEnv.PROD:
|
|
80
|
+
domain = "nextspace.host";
|
|
81
|
+
break;
|
|
82
|
+
default:
|
|
83
|
+
console.error("Specified Environment is not valid. SuppliedEnv=" + env);
|
|
84
|
+
}
|
|
85
|
+
// Set using a stable default.
|
|
86
|
+
this.baseUrl = `https://${this.accountId}.api.${domain}/`;
|
|
87
|
+
if (guardian && loadConfig) {
|
|
88
|
+
try {
|
|
89
|
+
const host = yield hosting_location_1.HostingLocation.GetByAccountId({
|
|
90
|
+
accountId: this.accountId,
|
|
91
|
+
api: guardian
|
|
92
|
+
});
|
|
93
|
+
if (host === null || host === void 0 ? void 0 : host.location) {
|
|
94
|
+
const settings = host.location.Settings;
|
|
95
|
+
// Attempt to load regional base url.
|
|
96
|
+
// First try go through settings.
|
|
97
|
+
let urlSet = false;
|
|
98
|
+
if (settings === null || settings === void 0 ? void 0 : settings.BruceAPIURL) {
|
|
99
|
+
let envUrl = settings.BruceAPIURL[env];
|
|
100
|
+
if (envUrl) {
|
|
101
|
+
envUrl = envUrl
|
|
102
|
+
.replace("<ACCOUNTID>", this.accountId)
|
|
103
|
+
.replace("<ACCOUNT>", this.accountId);
|
|
104
|
+
if (envUrl && envUrl.length > 1) {
|
|
105
|
+
this.baseUrl = envUrl;
|
|
106
|
+
urlSet = true;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Try go through host location's base url.
|
|
111
|
+
// This may be wrong env which is why it's used as fallback right now.
|
|
112
|
+
if (!urlSet && host.location.BruceAPIURL) {
|
|
113
|
+
const regionalUrl = host.location.BruceAPIURL
|
|
114
|
+
.replace("<ACCOUNTID>", this.accountId)
|
|
115
|
+
.replace("<ACCOUNT>", this.accountId)
|
|
116
|
+
.replace("<DOMAIN>", domain);
|
|
117
|
+
if (regionalUrl && regionalUrl.length > 1) {
|
|
118
|
+
this.baseUrl = regionalUrl;
|
|
119
|
+
urlSet = true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// Attempt to load CDN settings.
|
|
123
|
+
if (settings === null || settings === void 0 ? void 0 : settings.CDN) {
|
|
124
|
+
this.EntityCdnUrl = (_a = settings.CDN.entityURL) === null || _a === void 0 ? void 0 : _a[env];
|
|
125
|
+
// We need to fix our configs.
|
|
126
|
+
if (this.EntityCdnUrl) {
|
|
127
|
+
if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
|
|
128
|
+
this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
this.LegacyTilesetCdnUrl = (_b = settings.CDN.legacyTilesetURL) === null || _b === void 0 ? void 0 : _b[env];
|
|
135
|
+
this.TilesetCdnUrl = (_c = settings.CDN.tilesetURL) === null || _c === void 0 ? void 0 : _c[env];
|
|
136
|
+
if (this.TilesetCdnUrl) {
|
|
137
|
+
this.TilesetCdnUrl = this.TilesetCdnUrl.replace("<ACCOUNT>", this.accountId);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
catch (e) {
|
|
143
|
+
console.error(e);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
try {
|
|
147
|
+
this.messageBroker = new message_broker_1.MessageBroker.WebSocketBroker(this.baseUrl, this.env);
|
|
148
|
+
}
|
|
149
|
+
catch (e) {
|
|
150
|
+
console.warn("BruceApi: Failed to create message broker.", e);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Warning: This method does not wait for init to finish loading.
|
|
156
|
+
* This means the url could be changed once fully initialized.
|
|
157
|
+
* The url will be valid either way, but the loaded one may be faster as it is region specific.
|
|
158
|
+
* Await the "Loading" promise if you care about this.
|
|
159
|
+
* @returns
|
|
160
|
+
*/
|
|
161
|
+
GetBaseUrl() {
|
|
162
|
+
return this.baseUrl;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Warning: This will cancel the init process.
|
|
166
|
+
* The init process loads a region specific endpoint.
|
|
167
|
+
* Setting a base url will stop that process from completing.
|
|
168
|
+
* @param url
|
|
169
|
+
*/
|
|
170
|
+
SetBaseUrl(url) {
|
|
171
|
+
this.baseUrl = url;
|
|
172
|
+
if (!this.baseUrl.endsWith("/")) {
|
|
173
|
+
this.baseUrl += "/";
|
|
174
|
+
}
|
|
175
|
+
this.loadCancelled = true;
|
|
176
|
+
}
|
|
177
|
+
GET(url, params) {
|
|
178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
return new Promise((res, rej) => {
|
|
180
|
+
this.loadProm.then(() => {
|
|
181
|
+
this.get(this.baseUrl + url, params).then(res).catch(rej);
|
|
182
|
+
}).catch(rej);
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
DELETE(url, params) {
|
|
187
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
+
return new Promise((res, rej) => {
|
|
189
|
+
this.loadProm.then(() => {
|
|
190
|
+
this.delete(this.baseUrl + url, params).then(res).catch(rej);
|
|
191
|
+
}).catch(rej);
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
POST(url, data, params) {
|
|
196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
return new Promise((res, rej) => {
|
|
198
|
+
this.loadProm.then(() => {
|
|
199
|
+
this.post(this.baseUrl + url, data, params).then(res).catch(rej);
|
|
200
|
+
}).catch(rej);
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
PUT(url, data, params) {
|
|
205
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
return new Promise((res, rej) => {
|
|
207
|
+
this.loadProm.then(() => {
|
|
208
|
+
this.put(this.baseUrl + url, data, params).then(res).catch(rej);
|
|
209
|
+
}).catch(rej);
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
UPLOAD(url, blob, params) {
|
|
214
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
215
|
+
return new Promise((res, rej) => {
|
|
216
|
+
this.loadProm.then(() => {
|
|
217
|
+
this.upload(this.baseUrl + url, blob, params).then(res).catch(rej);
|
|
218
|
+
}).catch(rej);
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
BruceApi.Api = Api;
|
|
224
|
+
})(BruceApi = exports.BruceApi || (exports.BruceApi = {}));
|
|
221
225
|
//# sourceMappingURL=bruce-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bruce-api.js","sourceRoot":"","sources":["../../../src/api/bruce-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,iDAA6C;AAC7C,+BAAiC;AACjC,6DAAyD;AAEzD,iDAA6C;AAC7C,i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