bruce-models 0.1.6 → 0.1.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 +759 -17
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +607 -16
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js +213 -0
- package/dist/lib/account/account.js.map +1 -0
- package/dist/lib/ann-document/ann-document.js +4 -0
- package/dist/lib/ann-document/ann-document.js.map +1 -1
- package/dist/lib/api/abstract-api.js +3 -0
- package/dist/lib/api/abstract-api.js.map +1 -1
- package/dist/lib/api/api.js +25 -7
- package/dist/lib/api/api.js.map +1 -1
- package/dist/lib/api/bruce-api.js +10 -0
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/api/cam-api.js +10 -0
- package/dist/lib/api/cam-api.js.map +1 -1
- package/dist/lib/api/global-api.js +10 -0
- package/dist/lib/api/global-api.js.map +1 -1
- package/dist/lib/api/idm-api.js +10 -0
- package/dist/lib/api/idm-api.js.map +1 -1
- package/dist/lib/bruce-models.js +2 -0
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/calculator/calculator.js +12 -0
- package/dist/lib/calculator/calculator.js.map +1 -1
- package/dist/lib/common/bruce-event.js +4 -0
- package/dist/lib/common/bruce-event.js.map +1 -1
- package/dist/lib/common/bruce-variable.js +13 -0
- package/dist/lib/common/bruce-variable.js.map +1 -1
- package/dist/lib/common/cache.js +3 -0
- package/dist/lib/common/cache.js.map +1 -1
- package/dist/lib/common/cartes.js +6 -0
- package/dist/lib/common/cartes.js.map +1 -1
- package/dist/lib/common/carto.js +5 -0
- package/dist/lib/common/carto.js.map +1 -1
- package/dist/lib/common/color.js +5 -0
- package/dist/lib/common/color.js.map +1 -1
- package/dist/lib/common/delay-queue.js +4 -0
- package/dist/lib/common/delay-queue.js.map +1 -1
- package/dist/lib/common/geometry.js +21 -0
- package/dist/lib/common/geometry.js.map +1 -1
- package/dist/lib/common/utc.js +3 -0
- package/dist/lib/common/utc.js.map +1 -1
- package/dist/lib/custom-form/custom-form.js +137 -0
- package/dist/lib/custom-form/custom-form.js.map +1 -0
- package/dist/lib/entity/entity-attachment-type.js +4 -3
- package/dist/lib/entity/entity-attachment-type.js.map +1 -1
- package/dist/lib/entity/entity-attachment.js +5 -0
- package/dist/lib/entity/entity-attachment.js.map +1 -1
- package/dist/lib/entity/entity-comment.js +4 -0
- package/dist/lib/entity/entity-comment.js.map +1 -1
- package/dist/lib/entity/entity-link.js +4 -0
- package/dist/lib/entity/entity-link.js.map +1 -1
- package/dist/lib/entity/entity-lod.js +6 -0
- package/dist/lib/entity/entity-lod.js.map +1 -1
- package/dist/lib/entity/entity-relation-type.js +4 -0
- package/dist/lib/entity/entity-relation-type.js.map +1 -1
- package/dist/lib/entity/entity-relation.js +5 -0
- package/dist/lib/entity/entity-relation.js.map +1 -1
- package/dist/lib/entity/entity-source.js +5 -0
- package/dist/lib/entity/entity-source.js.map +1 -1
- package/dist/lib/entity/entity-tag.js +5 -0
- package/dist/lib/entity/entity-tag.js.map +1 -1
- package/dist/lib/entity/entity-type.js +5 -0
- package/dist/lib/entity/entity-type.js.map +1 -1
- package/dist/lib/entity/entity.js +5 -0
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/lib/entity/getters/batched-data-getter.js +4 -0
- package/dist/lib/entity/getters/batched-data-getter.js.map +1 -1
- package/dist/lib/entity/getters/entity-filter-getter.js +5 -0
- package/dist/lib/entity/getters/entity-filter-getter.js.map +1 -1
- package/dist/lib/entity/getters/entity-globe.js +5 -0
- package/dist/lib/entity/getters/entity-globe.js.map +1 -1
- package/dist/lib/file/client-file.js +4 -0
- package/dist/lib/file/client-file.js.map +1 -1
- package/dist/lib/markup/markup.js +3 -0
- package/dist/lib/markup/markup.js.map +1 -1
- package/dist/lib/program-key/program-key.js +4 -0
- package/dist/lib/program-key/program-key.js.map +1 -1
- package/dist/lib/project/menu-item.js +5 -0
- package/dist/lib/project/menu-item.js.map +1 -1
- package/dist/lib/project/project-view-bookmark.js +6 -0
- package/dist/lib/project/project-view-bookmark.js.map +1 -1
- package/dist/lib/project/project-view-tile-source.js +5 -0
- package/dist/lib/project/project-view-tile-source.js.map +1 -1
- package/dist/lib/project/project-view.js +5 -0
- package/dist/lib/project/project-view.js.map +1 -1
- package/dist/lib/project/zoom-control.js +4 -0
- package/dist/lib/project/zoom-control.js.map +1 -1
- package/dist/lib/server/pending-action.js +5 -0
- package/dist/lib/server/pending-action.js.map +1 -1
- package/dist/lib/style/style.js +7 -0
- package/dist/lib/style/style.js.map +1 -1
- package/dist/lib/tileset/tileset-entities-map-tiles.js +5 -0
- package/dist/lib/tileset/tileset-entities-map-tiles.js.map +1 -1
- package/dist/lib/tileset/tileset-ext-map-tiles.js +4 -0
- package/dist/lib/tileset/tileset-ext-map-tiles.js.map +1 -1
- package/dist/lib/tileset/tileset.js +10 -0
- package/dist/lib/tileset/tileset.js.map +1 -1
- package/dist/lib/ucs/ucs.js +5 -0
- package/dist/lib/ucs/ucs.js.map +1 -1
- package/dist/lib/user/session.js +5 -0
- package/dist/lib/user/session.js.map +1 -1
- package/dist/lib/user/user-group.js +4 -0
- package/dist/lib/user/user-group.js.map +1 -1
- package/dist/lib/user/user.js +186 -6
- package/dist/lib/user/user.js.map +1 -1
- package/dist/lib/util/math-utils.js +12 -0
- package/dist/lib/util/math-utils.js.map +1 -1
- package/dist/lib/util/object-utils.js +4 -0
- package/dist/lib/util/object-utils.js.map +1 -1
- package/dist/lib/util/path-utils.js +3 -0
- package/dist/lib/util/path-utils.js.map +1 -1
- package/dist/lib/util/url-utils.js +6 -0
- package/dist/lib/util/url-utils.js.map +1 -1
- package/dist/types/account/account.d.ts +46 -0
- package/dist/types/ann-document/ann-document.d.ts +4 -0
- package/dist/types/api/abstract-api.d.ts +3 -0
- package/dist/types/api/api.d.ts +26 -8
- package/dist/types/api/bruce-api.d.ts +5 -0
- package/dist/types/api/cam-api.d.ts +5 -0
- package/dist/types/api/global-api.d.ts +5 -0
- package/dist/types/api/idm-api.d.ts +5 -0
- package/dist/types/bruce-models.d.ts +2 -0
- package/dist/types/calculator/calculator.d.ts +12 -0
- package/dist/types/common/bounds.d.ts +6 -0
- package/dist/types/common/bruce-event.d.ts +4 -0
- package/dist/types/common/bruce-variable.d.ts +13 -0
- package/dist/types/common/cache.d.ts +3 -0
- package/dist/types/common/cartes.d.ts +6 -0
- package/dist/types/common/carto.d.ts +5 -0
- package/dist/types/common/color.d.ts +5 -0
- package/dist/types/common/delay-queue.d.ts +4 -0
- package/dist/types/common/geometry.d.ts +21 -0
- package/dist/types/common/transform.d.ts +4 -0
- package/dist/types/common/utc.d.ts +3 -0
- package/dist/types/custom-form/custom-form.d.ts +25 -0
- package/dist/types/entity/entity-attachment-type.d.ts +5 -4
- package/dist/types/entity/entity-attachment.d.ts +5 -0
- package/dist/types/entity/entity-comment.d.ts +4 -0
- package/dist/types/entity/entity-link.d.ts +4 -0
- package/dist/types/entity/entity-lod.d.ts +6 -0
- package/dist/types/entity/entity-relation-type.d.ts +4 -0
- package/dist/types/entity/entity-relation.d.ts +5 -0
- package/dist/types/entity/entity-source.d.ts +5 -0
- package/dist/types/entity/entity-tag.d.ts +5 -0
- package/dist/types/entity/entity-type.d.ts +5 -0
- package/dist/types/entity/entity.d.ts +5 -0
- package/dist/types/entity/getters/batched-data-getter.d.ts +4 -0
- package/dist/types/entity/getters/entity-filter-getter.d.ts +5 -0
- package/dist/types/entity/getters/entity-globe.d.ts +5 -0
- package/dist/types/file/client-file.d.ts +4 -0
- package/dist/types/markup/markup.d.ts +3 -0
- package/dist/types/program-key/program-key.d.ts +4 -0
- package/dist/types/project/menu-item.d.ts +5 -0
- package/dist/types/project/project-view-bookmark.d.ts +6 -0
- package/dist/types/project/project-view-tile-source.d.ts +5 -0
- package/dist/types/project/project-view.d.ts +5 -0
- package/dist/types/project/zoom-control.d.ts +4 -0
- package/dist/types/server/pending-action.d.ts +5 -0
- package/dist/types/style/style.d.ts +7 -0
- package/dist/types/tileset/tileset-cad.d.ts +4 -0
- package/dist/types/tileset/tileset-entities-map-tiles.d.ts +5 -0
- package/dist/types/tileset/tileset-entities.d.ts +4 -0
- package/dist/types/tileset/tileset-ext-map-tiles.d.ts +4 -0
- package/dist/types/tileset/tileset-ext-terrain-tiles.d.ts +4 -0
- package/dist/types/tileset/tileset-map-tiles.d.ts +4 -0
- package/dist/types/tileset/tileset-pointcloud.d.ts +4 -0
- package/dist/types/tileset/tileset-terrain-tiles.d.ts +4 -0
- package/dist/types/tileset/tileset.d.ts +10 -0
- package/dist/types/ucs/ucs.d.ts +5 -0
- package/dist/types/user/session.d.ts +5 -0
- package/dist/types/user/user-group.d.ts +4 -0
- package/dist/types/user/user.d.ts +48 -0
- package/dist/types/util/math-utils.d.ts +12 -0
- package/dist/types/util/object-utils.d.ts +4 -0
- package/dist/types/util/path-utils.d.ts +3 -0
- package/dist/types/util/url-utils.d.ts +6 -0
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -75,6 +75,9 @@ function __generator(thisArg, body) {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Contains generic descriptions used for Bruce requests.
|
|
80
|
+
*/
|
|
78
81
|
var Api;
|
|
79
82
|
(function (Api) {
|
|
80
83
|
var ECacheKey;
|
|
@@ -106,10 +109,27 @@ var Api;
|
|
|
106
109
|
ECacheKey["AccessToken"] = "accesstoken";
|
|
107
110
|
ECacheKey["UserGroup"] = "usergroup";
|
|
108
111
|
ECacheKey["Account"] = "account";
|
|
112
|
+
ECacheKey["CustomForm"] = "customform";
|
|
109
113
|
})(ECacheKey = Api.ECacheKey || (Api.ECacheKey = {}));
|
|
110
114
|
Api.DEFAULT_CACHE_DURATION = 60 * 5; // 5 minutes.
|
|
111
115
|
Api.TEMPLATE_ACCOUNT_ID = "template";
|
|
112
116
|
Api.ACCESS_TOKEN_HEADER = "X-Access-Token";
|
|
117
|
+
/**
|
|
118
|
+
* Possible environments we host Bruce apps on.
|
|
119
|
+
* When these are matched, they should be case-insensitive.
|
|
120
|
+
*/
|
|
121
|
+
var EEnv;
|
|
122
|
+
(function (EEnv) {
|
|
123
|
+
EEnv["DEV"] = "DEV";
|
|
124
|
+
EEnv["STG"] = "STG";
|
|
125
|
+
EEnv["UAT"] = "UAT";
|
|
126
|
+
EEnv["PROD"] = "PROD";
|
|
127
|
+
})(EEnv = Api.EEnv || (Api.EEnv = {}));
|
|
128
|
+
/**
|
|
129
|
+
* Prepares a string to be included in a url.
|
|
130
|
+
* @param str
|
|
131
|
+
* @returns
|
|
132
|
+
*/
|
|
113
133
|
function Encode(str) {
|
|
114
134
|
return encodeURIComponent(str.replace(/\+/g, "%2B").replace(/\./g, "%2E"));
|
|
115
135
|
}
|
|
@@ -125,19 +145,21 @@ var Api;
|
|
|
125
145
|
EEncoding["UTF8"] = "UTF-8";
|
|
126
146
|
EEncoding["UTF16"] = "UTF-16BE";
|
|
127
147
|
})(EEncoding = Api.EEncoding || (Api.EEncoding = {}));
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
EEnv["PROD"] = "PROD";
|
|
134
|
-
})(EEnv = Api.EEnv || (Api.EEnv = {}));
|
|
148
|
+
/**
|
|
149
|
+
* Prepares default settings for a request to Bruce Api.
|
|
150
|
+
* Our requests WRONGLY have utf-16 for 95% of them. Please be wary of that.
|
|
151
|
+
* @returns
|
|
152
|
+
*/
|
|
135
153
|
function PrepReqParams() {
|
|
136
154
|
return { response: { encoding: Api.EEncoding.UTF16 } };
|
|
137
155
|
}
|
|
138
156
|
Api.PrepReqParams = PrepReqParams;
|
|
139
157
|
})(Api || (Api = {}));
|
|
140
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Describes communication with the "Annotated Document" concept in Bruce.
|
|
161
|
+
* Annotated documents are files with hotspots that can link to Entity records.
|
|
162
|
+
*/
|
|
141
163
|
var AnnDocument;
|
|
142
164
|
(function (AnnDocument) {
|
|
143
165
|
function GetCacheKey(id) {
|
|
@@ -211,6 +233,103 @@ var AnnDocument;
|
|
|
211
233
|
AnnDocument.GetList = GetList;
|
|
212
234
|
})(AnnDocument || (AnnDocument = {}));
|
|
213
235
|
|
|
236
|
+
/**
|
|
237
|
+
* Describes the "Custom Form" concept within Bruce.
|
|
238
|
+
* Custom forms are dynamic dialogs that get populated with Entity data.
|
|
239
|
+
*/
|
|
240
|
+
var CustomForm;
|
|
241
|
+
(function (CustomForm) {
|
|
242
|
+
function GetCacheKey(id) {
|
|
243
|
+
return Api.ECacheKey.CustomForm + Api.ECacheKey.Id + id;
|
|
244
|
+
}
|
|
245
|
+
CustomForm.GetCacheKey = GetCacheKey;
|
|
246
|
+
function GetListCacheKey(typeId) {
|
|
247
|
+
if (typeId) {
|
|
248
|
+
return Api.ECacheKey.CustomForm + Api.ECacheKey.EntityType + Api.ECacheKey.Id + typeId;
|
|
249
|
+
}
|
|
250
|
+
return Api.ECacheKey.CustomForm;
|
|
251
|
+
}
|
|
252
|
+
CustomForm.GetListCacheKey = GetListCacheKey;
|
|
253
|
+
var EType;
|
|
254
|
+
(function (EType) {
|
|
255
|
+
EType["Form"] = "GENERIC";
|
|
256
|
+
EType["Markup"] = "MARKUP";
|
|
257
|
+
})(EType = CustomForm.EType || (CustomForm.EType = {}));
|
|
258
|
+
function Get(api, id) {
|
|
259
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
260
|
+
var cacheData, req;
|
|
261
|
+
return __generator(this, function (_a) {
|
|
262
|
+
if (!id) {
|
|
263
|
+
throw ("Id is required.");
|
|
264
|
+
}
|
|
265
|
+
cacheData = api.Cache.Get(GetCacheKey(id));
|
|
266
|
+
if (cacheData) {
|
|
267
|
+
return [2 /*return*/, cacheData];
|
|
268
|
+
}
|
|
269
|
+
req = api.GET("customForm/" + id, Api.PrepReqParams());
|
|
270
|
+
api.Cache.Set(GetCacheKey(id), req, Api.DEFAULT_CACHE_DURATION);
|
|
271
|
+
return [2 /*return*/, req];
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
CustomForm.Get = Get;
|
|
276
|
+
function Delete(api, id) {
|
|
277
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
278
|
+
return __generator(this, function (_a) {
|
|
279
|
+
switch (_a.label) {
|
|
280
|
+
case 0:
|
|
281
|
+
if (!id) {
|
|
282
|
+
throw ("Id is required.");
|
|
283
|
+
}
|
|
284
|
+
return [4 /*yield*/, api.DELETE("customForm/" + id, Api.PrepReqParams())];
|
|
285
|
+
case 1:
|
|
286
|
+
_a.sent();
|
|
287
|
+
api.Cache.RemoveByStartsWith(Api.ECacheKey.CustomForm);
|
|
288
|
+
return [2 /*return*/];
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
CustomForm.Delete = Delete;
|
|
294
|
+
function GetList(api, typeId) {
|
|
295
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
296
|
+
var url, cacheData, req, prom;
|
|
297
|
+
return __generator(this, function (_a) {
|
|
298
|
+
url = typeId ? "entityType/" + typeId + "/customForms" : "customForms";
|
|
299
|
+
cacheData = api.Cache.Get(GetListCacheKey(typeId));
|
|
300
|
+
if (cacheData) {
|
|
301
|
+
return [2 /*return*/, cacheData];
|
|
302
|
+
}
|
|
303
|
+
req = api.GET(url, Api.PrepReqParams());
|
|
304
|
+
prom = req.then(function (data) {
|
|
305
|
+
return data.Items;
|
|
306
|
+
});
|
|
307
|
+
api.Cache.Set(GetListCacheKey(typeId), prom, Api.DEFAULT_CACHE_DURATION);
|
|
308
|
+
return [2 /*return*/, prom];
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
CustomForm.GetList = GetList;
|
|
313
|
+
function Update(api, data) {
|
|
314
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
315
|
+
return __generator(this, function (_a) {
|
|
316
|
+
switch (_a.label) {
|
|
317
|
+
case 0:
|
|
318
|
+
if (!data.ID) {
|
|
319
|
+
data.ID = 0;
|
|
320
|
+
}
|
|
321
|
+
return [4 /*yield*/, api.POST("customForm/" + data.ID, data, Api.PrepReqParams())];
|
|
322
|
+
case 1:
|
|
323
|
+
data = _a.sent();
|
|
324
|
+
api.Cache.RemoveByStartsWith(Api.ECacheKey.CustomForm);
|
|
325
|
+
return [2 /*return*/, data];
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
CustomForm.Update = Update;
|
|
331
|
+
})(CustomForm || (CustomForm = {}));
|
|
332
|
+
|
|
214
333
|
var CacheItem = /** @class */ (function () {
|
|
215
334
|
function CacheItem(id, data, duration) {
|
|
216
335
|
this.Id = id;
|
|
@@ -226,6 +345,9 @@ var CacheItem = /** @class */ (function () {
|
|
|
226
345
|
};
|
|
227
346
|
return CacheItem;
|
|
228
347
|
}());
|
|
348
|
+
/**
|
|
349
|
+
* Simple local cache controller.
|
|
350
|
+
*/
|
|
229
351
|
var CacheControl = /** @class */ (function () {
|
|
230
352
|
function CacheControl() {
|
|
231
353
|
this.data = {};
|
|
@@ -314,6 +436,9 @@ function parseResult(data, encoding) {
|
|
|
314
436
|
});
|
|
315
437
|
});
|
|
316
438
|
}
|
|
439
|
+
/**
|
|
440
|
+
* This is a base class for communication with an arbitrary Bruce Api.
|
|
441
|
+
*/
|
|
317
442
|
var AbstractApi = /** @class */ (function () {
|
|
318
443
|
function AbstractApi(ssidHeader) {
|
|
319
444
|
this.ssid = "";
|
|
@@ -468,6 +593,10 @@ var AbstractApi = /** @class */ (function () {
|
|
|
468
593
|
return AbstractApi;
|
|
469
594
|
}());
|
|
470
595
|
|
|
596
|
+
/**
|
|
597
|
+
* This is the request handler for Bruce Api,
|
|
598
|
+
* it should be passed to any method that wants to communicate with this particular api.
|
|
599
|
+
*/
|
|
471
600
|
var BruceApi = /** @class */ (function (_super) {
|
|
472
601
|
__extends(BruceApi, _super);
|
|
473
602
|
function BruceApi(accountId, env) {
|
|
@@ -503,6 +632,12 @@ var BruceApi = /** @class */ (function (_super) {
|
|
|
503
632
|
BruceApi.prototype.GetBaseUrl = function () {
|
|
504
633
|
return this.baseUrl;
|
|
505
634
|
};
|
|
635
|
+
BruceApi.prototype.SetBaseUrl = function (url) {
|
|
636
|
+
this.baseUrl = url;
|
|
637
|
+
if (!this.baseUrl.endsWith("/")) {
|
|
638
|
+
this.baseUrl += "/";
|
|
639
|
+
}
|
|
640
|
+
};
|
|
506
641
|
BruceApi.prototype.GET = function (url, params) {
|
|
507
642
|
return __awaiter(this, void 0, void 0, function () {
|
|
508
643
|
return __generator(this, function (_a) {
|
|
@@ -534,6 +669,10 @@ var BruceApi = /** @class */ (function (_super) {
|
|
|
534
669
|
return BruceApi;
|
|
535
670
|
}(AbstractApi));
|
|
536
671
|
|
|
672
|
+
/**
|
|
673
|
+
* This is the request handler for Cam Api,
|
|
674
|
+
* it should be passed to any method that wants to communicate with this particular api.
|
|
675
|
+
*/
|
|
537
676
|
var CamApi = /** @class */ (function (_super) {
|
|
538
677
|
__extends(CamApi, _super);
|
|
539
678
|
function CamApi(env) {
|
|
@@ -568,6 +707,12 @@ var CamApi = /** @class */ (function (_super) {
|
|
|
568
707
|
CamApi.prototype.GetBaseUrl = function () {
|
|
569
708
|
return this.baseUrl;
|
|
570
709
|
};
|
|
710
|
+
CamApi.prototype.SetBaseUrl = function (url) {
|
|
711
|
+
this.baseUrl = url;
|
|
712
|
+
if (!this.baseUrl.endsWith("/")) {
|
|
713
|
+
this.baseUrl += "/";
|
|
714
|
+
}
|
|
715
|
+
};
|
|
571
716
|
CamApi.prototype.GET = function (url, params) {
|
|
572
717
|
return __awaiter(this, void 0, void 0, function () {
|
|
573
718
|
return __generator(this, function (_a) {
|
|
@@ -599,6 +744,10 @@ var CamApi = /** @class */ (function (_super) {
|
|
|
599
744
|
return CamApi;
|
|
600
745
|
}(AbstractApi));
|
|
601
746
|
|
|
747
|
+
/**
|
|
748
|
+
* This is the request handler for Idm Api,
|
|
749
|
+
* it should be passed to any method that wants to communicate with this particular api.
|
|
750
|
+
*/
|
|
602
751
|
var IdmApi = /** @class */ (function (_super) {
|
|
603
752
|
__extends(IdmApi, _super);
|
|
604
753
|
function IdmApi(env) {
|
|
@@ -633,6 +782,12 @@ var IdmApi = /** @class */ (function (_super) {
|
|
|
633
782
|
IdmApi.prototype.GetBaseUrl = function () {
|
|
634
783
|
return this.baseUrl;
|
|
635
784
|
};
|
|
785
|
+
IdmApi.prototype.SetBaseUrl = function (url) {
|
|
786
|
+
this.baseUrl = url;
|
|
787
|
+
if (!this.baseUrl.endsWith("/")) {
|
|
788
|
+
this.baseUrl += "/";
|
|
789
|
+
}
|
|
790
|
+
};
|
|
636
791
|
IdmApi.prototype.GET = function (url, params) {
|
|
637
792
|
return __awaiter(this, void 0, void 0, function () {
|
|
638
793
|
return __generator(this, function (_a) {
|
|
@@ -684,6 +839,11 @@ var Color;
|
|
|
684
839
|
return ColorFromStr(str);
|
|
685
840
|
}
|
|
686
841
|
Color.RandomColor = RandomColor;
|
|
842
|
+
/**
|
|
843
|
+
* Attempts to parse a given color string into a model.
|
|
844
|
+
* @param str
|
|
845
|
+
* @returns
|
|
846
|
+
*/
|
|
687
847
|
function ColorFromStr(str) {
|
|
688
848
|
var r, g, b, a;
|
|
689
849
|
var rgba = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([^\)]+)\s*)?\)$/.exec(str);
|
|
@@ -745,6 +905,10 @@ var Color;
|
|
|
745
905
|
|
|
746
906
|
var ObjectUtils;
|
|
747
907
|
(function (ObjectUtils) {
|
|
908
|
+
/**
|
|
909
|
+
* Generates a Bruce compatible UID.
|
|
910
|
+
* @returns
|
|
911
|
+
*/
|
|
748
912
|
function UId() {
|
|
749
913
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
750
914
|
var r = Math.random() * 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8);
|
|
@@ -754,6 +918,9 @@ var ObjectUtils;
|
|
|
754
918
|
ObjectUtils.UId = UId;
|
|
755
919
|
})(ObjectUtils || (ObjectUtils = {}));
|
|
756
920
|
|
|
921
|
+
/**
|
|
922
|
+
* Utility to help with parsing and wrapping Bruce paths.
|
|
923
|
+
*/
|
|
757
924
|
var PathUtils;
|
|
758
925
|
(function (PathUtils) {
|
|
759
926
|
function Parse(str) {
|
|
@@ -810,6 +977,11 @@ var PathUtils;
|
|
|
810
977
|
PathUtils.ParseLegacy = ParseLegacy;
|
|
811
978
|
})(PathUtils || (PathUtils = {}));
|
|
812
979
|
|
|
980
|
+
/**
|
|
981
|
+
* Describes the "Entity" concept within Bruce.
|
|
982
|
+
* An entity is a JSON blob containing both internal data and user-defined data.
|
|
983
|
+
* Entity records have many thinks linked to them through their UIDs such as links, files and relationships.
|
|
984
|
+
*/
|
|
813
985
|
var Entity;
|
|
814
986
|
(function (Entity) {
|
|
815
987
|
function GetCacheKey(entityId) {
|
|
@@ -1090,8 +1262,21 @@ function getVariable(str) {
|
|
|
1090
1262
|
}
|
|
1091
1263
|
return null;
|
|
1092
1264
|
}
|
|
1265
|
+
/**
|
|
1266
|
+
* Utilities for parsing "Bruce variables", typically within strings.
|
|
1267
|
+
*
|
|
1268
|
+
* A Bruce variable is a string that starts with "${" and ends with "}".
|
|
1269
|
+
* Within those brackets is a path to an attribute in an entity.
|
|
1270
|
+
*/
|
|
1093
1271
|
var BruceVariable;
|
|
1094
1272
|
(function (BruceVariable) {
|
|
1273
|
+
/**
|
|
1274
|
+
* Replaces all Bruce variables in a string with the value of the attribute.
|
|
1275
|
+
* @param str
|
|
1276
|
+
* @param data
|
|
1277
|
+
* @param legacyParse
|
|
1278
|
+
* @returns
|
|
1279
|
+
*/
|
|
1095
1280
|
function SwapValues(str, data, legacyParse) {
|
|
1096
1281
|
if (!legacyParse) {
|
|
1097
1282
|
legacyParse = false;
|
|
@@ -1115,6 +1300,10 @@ var BruceVariable;
|
|
|
1115
1300
|
BruceVariable.SwapValues = SwapValues;
|
|
1116
1301
|
})(BruceVariable || (BruceVariable = {}));
|
|
1117
1302
|
|
|
1303
|
+
/**
|
|
1304
|
+
* Utility for calculating values from Bruce fields.
|
|
1305
|
+
* These fields are typically found in entity styles.
|
|
1306
|
+
*/
|
|
1118
1307
|
var Calculator;
|
|
1119
1308
|
(function (Calculator) {
|
|
1120
1309
|
var EValueType;
|
|
@@ -1126,6 +1315,14 @@ var Calculator;
|
|
|
1126
1315
|
EValueType[EValueType["TagColor"] = 4] = "TagColor";
|
|
1127
1316
|
EValueType[EValueType["RandomColor"] = 5] = "RandomColor";
|
|
1128
1317
|
})(EValueType = Calculator.EValueType || (Calculator.EValueType = {}));
|
|
1318
|
+
/**
|
|
1319
|
+
* Calculates the value of arbitrary field options.
|
|
1320
|
+
* The context calling this should validate results and parse stuff if needed.
|
|
1321
|
+
* @param fields
|
|
1322
|
+
* @param entity
|
|
1323
|
+
* @param tags
|
|
1324
|
+
* @returns
|
|
1325
|
+
*/
|
|
1129
1326
|
function GetValue(fields, entity, tags) {
|
|
1130
1327
|
if (!tags) {
|
|
1131
1328
|
tags = [];
|
|
@@ -1247,6 +1444,10 @@ var Calculator;
|
|
|
1247
1444
|
Calculator.GetInputValue = GetInputValue;
|
|
1248
1445
|
})(Calculator || (Calculator = {}));
|
|
1249
1446
|
|
|
1447
|
+
/**
|
|
1448
|
+
* Simple event utility.
|
|
1449
|
+
* Instantiate the model, then subscribe and trigger events.
|
|
1450
|
+
*/
|
|
1250
1451
|
var BruceEvent = /** @class */ (function () {
|
|
1251
1452
|
function BruceEvent() {
|
|
1252
1453
|
// Counter to help differentiate subscriptions.
|
|
@@ -1297,6 +1498,12 @@ var Camera;
|
|
|
1297
1498
|
})(EFrustum = Camera.EFrustum || (Camera.EFrustum = {}));
|
|
1298
1499
|
})(Camera || (Camera = {}));
|
|
1299
1500
|
|
|
1501
|
+
/**
|
|
1502
|
+
* Describes 2d and 3d coordinates.
|
|
1503
|
+
*
|
|
1504
|
+
* In 2d the x/y typically refers to a window left/top offset.
|
|
1505
|
+
* In 3d the x/y/z, the units are in meters.
|
|
1506
|
+
*/
|
|
1300
1507
|
var Cartes;
|
|
1301
1508
|
(function (Cartes) {
|
|
1302
1509
|
function ValidateCartes2(cartes) {
|
|
@@ -1344,6 +1551,11 @@ var Cartes;
|
|
|
1344
1551
|
Cartes.IsEqualCartes3 = IsEqualCartes3;
|
|
1345
1552
|
})(Cartes || (Cartes = {}));
|
|
1346
1553
|
|
|
1554
|
+
/**
|
|
1555
|
+
* Describes a geographic point.
|
|
1556
|
+
* The units of the stored data should be in Degrees.
|
|
1557
|
+
* Utilities may use this in Radians for temporary calculations.
|
|
1558
|
+
*/
|
|
1347
1559
|
var Carto;
|
|
1348
1560
|
(function (Carto) {
|
|
1349
1561
|
function ValidateCarto(carto) {
|
|
@@ -1397,6 +1609,10 @@ var Carto;
|
|
|
1397
1609
|
Carto.GetCenter = GetCenter;
|
|
1398
1610
|
})(Carto || (Carto = {}));
|
|
1399
1611
|
|
|
1612
|
+
/**
|
|
1613
|
+
* Controls the flow of method calls.
|
|
1614
|
+
* If you have a method that may be called often, but you don't want it to run often, use this.
|
|
1615
|
+
*/
|
|
1400
1616
|
var DelayQueue = /** @class */ (function () {
|
|
1401
1617
|
function DelayQueue(callback, delay) {
|
|
1402
1618
|
if (delay === void 0) { delay = 200; }
|
|
@@ -1450,6 +1666,9 @@ var DelayQueue = /** @class */ (function () {
|
|
|
1450
1666
|
return DelayQueue;
|
|
1451
1667
|
}());
|
|
1452
1668
|
|
|
1669
|
+
/**
|
|
1670
|
+
* Describes vector geometry that Bruce uses.
|
|
1671
|
+
*/
|
|
1453
1672
|
var Geometry;
|
|
1454
1673
|
(function (Geometry) {
|
|
1455
1674
|
var EPolygonRingType;
|
|
@@ -1457,6 +1676,12 @@ var Geometry;
|
|
|
1457
1676
|
EPolygonRingType["Boundaries"] = "out";
|
|
1458
1677
|
EPolygonRingType["Hole"] = "in";
|
|
1459
1678
|
})(EPolygonRingType = Geometry.EPolygonRingType || (Geometry.EPolygonRingType = {}));
|
|
1679
|
+
/**
|
|
1680
|
+
* Turns an array of points into string vector geometry that Bruce can use.
|
|
1681
|
+
* This is used for saving polyline and polygon data.
|
|
1682
|
+
* @param points
|
|
1683
|
+
* @returns
|
|
1684
|
+
*/
|
|
1460
1685
|
function LineStrFromPoints(points) {
|
|
1461
1686
|
if (!points.length) {
|
|
1462
1687
|
throw ("points is empty.");
|
|
@@ -1470,6 +1695,12 @@ var Geometry;
|
|
|
1470
1695
|
return lineString;
|
|
1471
1696
|
}
|
|
1472
1697
|
Geometry.LineStrFromPoints = LineStrFromPoints;
|
|
1698
|
+
/**
|
|
1699
|
+
* Removes same points that occur in a row.
|
|
1700
|
+
* This will not modify the original array.
|
|
1701
|
+
* @param positions
|
|
1702
|
+
* @returns
|
|
1703
|
+
*/
|
|
1473
1704
|
function RemoveRepeatPoints(positions) {
|
|
1474
1705
|
var filteredList = [];
|
|
1475
1706
|
for (var i = 0; i < positions.length; i++) {
|
|
@@ -1517,6 +1748,12 @@ var Geometry;
|
|
|
1517
1748
|
return result;
|
|
1518
1749
|
}
|
|
1519
1750
|
Geometry.ParsePoints = ParsePoints;
|
|
1751
|
+
/**
|
|
1752
|
+
* Parses both string and object Bruce geometry.
|
|
1753
|
+
* String geometry is legacy Bruce data.
|
|
1754
|
+
* @param geometry
|
|
1755
|
+
* @returns
|
|
1756
|
+
*/
|
|
1520
1757
|
function ParseGeometry(geometry) {
|
|
1521
1758
|
if (typeof geometry == "string") {
|
|
1522
1759
|
var positions = [];
|
|
@@ -1547,6 +1784,9 @@ var Geometry;
|
|
|
1547
1784
|
Geometry.ParseGeometry = ParseGeometry;
|
|
1548
1785
|
})(Geometry || (Geometry = {}));
|
|
1549
1786
|
|
|
1787
|
+
/**
|
|
1788
|
+
* Describes a Bruce stored date.
|
|
1789
|
+
*/
|
|
1550
1790
|
var UTC;
|
|
1551
1791
|
(function (UTC) {
|
|
1552
1792
|
var EMonth;
|
|
@@ -1581,6 +1821,10 @@ var UTC;
|
|
|
1581
1821
|
UTC.FromDate = FromDate;
|
|
1582
1822
|
})(UTC || (UTC = {}));
|
|
1583
1823
|
|
|
1824
|
+
/**
|
|
1825
|
+
* Describes the "Entity Attachment Type" concept within Bruce.
|
|
1826
|
+
* It is a record that describes the purpose of an attachment.
|
|
1827
|
+
*/
|
|
1584
1828
|
var EntityAttachmentType;
|
|
1585
1829
|
(function (EntityAttachmentType) {
|
|
1586
1830
|
function GetCacheKey(id) {
|
|
@@ -1595,9 +1839,6 @@ var EntityAttachmentType;
|
|
|
1595
1839
|
(function (EType) {
|
|
1596
1840
|
EType["Photo"] = "photo";
|
|
1597
1841
|
EType["Document"] = "document";
|
|
1598
|
-
EType["Video"] = "video";
|
|
1599
|
-
EType["Drawing"] = "drawing";
|
|
1600
|
-
EType["Model"] = "model";
|
|
1601
1842
|
})(EType = EntityAttachmentType.EType || (EntityAttachmentType.EType = {}));
|
|
1602
1843
|
function Delete(api, id) {
|
|
1603
1844
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1673,6 +1914,11 @@ var EntityAttachmentType;
|
|
|
1673
1914
|
EntityAttachmentType.GetList = GetList;
|
|
1674
1915
|
})(EntityAttachmentType || (EntityAttachmentType = {}));
|
|
1675
1916
|
|
|
1917
|
+
/**
|
|
1918
|
+
* Describes the "Entity Attachment" concept within Bruce.
|
|
1919
|
+
* An entity attachment is an arbitrary file record that is linked to an entity record.
|
|
1920
|
+
* The same file can be attached to multiple entities.
|
|
1921
|
+
*/
|
|
1676
1922
|
var EntityAttachment;
|
|
1677
1923
|
(function (EntityAttachment) {
|
|
1678
1924
|
function GetCacheKey(entityId, typeId, fileId) {
|
|
@@ -1837,6 +2083,10 @@ var EntityAttachment;
|
|
|
1837
2083
|
EntityAttachment.Upload = Upload;
|
|
1838
2084
|
})(EntityAttachment || (EntityAttachment = {}));
|
|
1839
2085
|
|
|
2086
|
+
/**
|
|
2087
|
+
* Describes the "Entity Comment" concept within Bruce.
|
|
2088
|
+
* An entity comment is a user written message that is linked to an entity record.
|
|
2089
|
+
*/
|
|
1840
2090
|
var EntityComment;
|
|
1841
2091
|
(function (EntityComment) {
|
|
1842
2092
|
function GetCacheKey(id) {
|
|
@@ -1926,6 +2176,10 @@ var EntityComment;
|
|
|
1926
2176
|
EntityComment.GetListByEntityId = GetListByEntityId;
|
|
1927
2177
|
})(EntityComment || (EntityComment = {}));
|
|
1928
2178
|
|
|
2179
|
+
/**
|
|
2180
|
+
* Describes the "Entity Link" concept within Bruce.
|
|
2181
|
+
* An entity link is a URL linked to an entity record.
|
|
2182
|
+
*/
|
|
1929
2183
|
var EntityLink;
|
|
1930
2184
|
(function (EntityLink) {
|
|
1931
2185
|
function GetCacheKey(id) {
|
|
@@ -2015,6 +2269,12 @@ var EntityLink;
|
|
|
2015
2269
|
EntityLink.GetListByEntityId = GetListByEntityId;
|
|
2016
2270
|
})(EntityLink || (EntityLink = {}));
|
|
2017
2271
|
|
|
2272
|
+
/**
|
|
2273
|
+
* Describes the "Entity LOD" concept within Bruce.
|
|
2274
|
+
* LOD stands for Level of Detail.
|
|
2275
|
+
* An lod record is a possible 2d/3d visualization of the entity record.
|
|
2276
|
+
* The most common kind is a GLB.
|
|
2277
|
+
*/
|
|
2018
2278
|
var EntityLod;
|
|
2019
2279
|
(function (EntityLod) {
|
|
2020
2280
|
function GetCacheKey(url) {
|
|
@@ -2096,6 +2356,10 @@ var EntityLod;
|
|
|
2096
2356
|
EntityLod.GetLods = GetLods;
|
|
2097
2357
|
})(EntityLod || (EntityLod = {}));
|
|
2098
2358
|
|
|
2359
|
+
/**
|
|
2360
|
+
* Describes the "Entity Relationship Type" concept within Bruce.
|
|
2361
|
+
* A relationship type record describes the purpose of a relationship.
|
|
2362
|
+
*/
|
|
2099
2363
|
var EntityRelationType;
|
|
2100
2364
|
(function (EntityRelationType) {
|
|
2101
2365
|
function GetCacheKey(id) {
|
|
@@ -2202,6 +2466,11 @@ var EntityRelationType;
|
|
|
2202
2466
|
EntityRelationType.Update = Update;
|
|
2203
2467
|
})(EntityRelationType || (EntityRelationType = {}));
|
|
2204
2468
|
|
|
2469
|
+
/**
|
|
2470
|
+
* Describes the "Entity Relationship" concept within Bruce.
|
|
2471
|
+
* An entity relationship is an arbitrary link between two entity records.
|
|
2472
|
+
* The relationship can have a "data entity" linked to it as well for the relationship to store arbitrary data about itself.
|
|
2473
|
+
*/
|
|
2205
2474
|
var EntityRelation;
|
|
2206
2475
|
(function (EntityRelation) {
|
|
2207
2476
|
function GetCacheKey(entityA, entityB, typeId) {
|
|
@@ -2304,6 +2573,11 @@ var EntityRelation;
|
|
|
2304
2573
|
EntityRelation.GetByDataEntityId = GetByDataEntityId;
|
|
2305
2574
|
})(EntityRelation || (EntityRelation = {}));
|
|
2306
2575
|
|
|
2576
|
+
/**
|
|
2577
|
+
* Describes the "Entity Source" concept within Bruce.
|
|
2578
|
+
* An entity source is a record which links an arbitrary source id to a Bruce entity id.
|
|
2579
|
+
* For example an OSM building id to a Bruce entity id.
|
|
2580
|
+
*/
|
|
2307
2581
|
var EntitySource;
|
|
2308
2582
|
(function (EntitySource) {
|
|
2309
2583
|
function GetCacheKey(sourceId, sourceKey) {
|
|
@@ -2436,6 +2710,11 @@ var EntitySource;
|
|
|
2436
2710
|
EntitySource.GetEntityIdsBySourceKeys = GetEntityIdsBySourceKeys;
|
|
2437
2711
|
})(EntitySource || (EntitySource = {}));
|
|
2438
2712
|
|
|
2713
|
+
/**
|
|
2714
|
+
* Describes the "Entity Tag" concept within Bruce.
|
|
2715
|
+
* An entity tag is used to categorize an entity record.
|
|
2716
|
+
* Entity tags can be used in filters, or to restrict entity access.
|
|
2717
|
+
*/
|
|
2439
2718
|
var EntityTag;
|
|
2440
2719
|
(function (EntityTag) {
|
|
2441
2720
|
function GetCacheKey(tagId) {
|
|
@@ -2621,6 +2900,11 @@ var EntityTag;
|
|
|
2621
2900
|
EntityTag.Update = Update;
|
|
2622
2901
|
})(EntityTag || (EntityTag = {}));
|
|
2623
2902
|
|
|
2903
|
+
/**
|
|
2904
|
+
* Describes the "Entity Type" concept within Bruce.
|
|
2905
|
+
* An entity type is an "expectation" of what data "should" look like in a particular entity record.
|
|
2906
|
+
* The schema is stencils onto entity data to filter out what we should display or search against.
|
|
2907
|
+
*/
|
|
2624
2908
|
var EntityType;
|
|
2625
2909
|
(function (EntityType) {
|
|
2626
2910
|
function GetCacheKey(typeId) {
|
|
@@ -2831,6 +3115,11 @@ function getOrCreateCell(cells, cellSize, lon, maxLon, lat, maxLat) {
|
|
|
2831
3115
|
}
|
|
2832
3116
|
return cell;
|
|
2833
3117
|
}
|
|
3118
|
+
/**
|
|
3119
|
+
* This is a helper for making entity requests based on a grid area.
|
|
3120
|
+
* It will return grid cells based on given view-area then will remember when stuff-
|
|
3121
|
+
* was fully-fetched for those cells to avoid making duplicate requests.
|
|
3122
|
+
*/
|
|
2834
3123
|
var EntityGlobe;
|
|
2835
3124
|
(function (EntityGlobe) {
|
|
2836
3125
|
var Grid = /** @class */ (function () {
|
|
@@ -2890,6 +3179,11 @@ function delay(milliseconds) {
|
|
|
2890
3179
|
});
|
|
2891
3180
|
});
|
|
2892
3181
|
}
|
|
3182
|
+
/**
|
|
3183
|
+
* This is a batched entity getter.
|
|
3184
|
+
* It will scan for entity records in a view-area and emit them in batches.
|
|
3185
|
+
* It will restart scanning if the camera moves.
|
|
3186
|
+
*/
|
|
2893
3187
|
var EntityFilterGetter;
|
|
2894
3188
|
(function (EntityFilterGetter) {
|
|
2895
3189
|
var EStatus;
|
|
@@ -3165,6 +3459,10 @@ var EntityFilterGetter;
|
|
|
3165
3459
|
|
|
3166
3460
|
var MAX_AREA_IN_DEGREES$1 = 90;
|
|
3167
3461
|
var GETTER_DELAY = 50;
|
|
3462
|
+
/**
|
|
3463
|
+
* This is a batched "arbitrary data" getter.
|
|
3464
|
+
* You feed it an array of data, then it will emit that data in batches when the view changes.
|
|
3465
|
+
*/
|
|
3168
3466
|
var BatchedDataGetter;
|
|
3169
3467
|
(function (BatchedDataGetter) {
|
|
3170
3468
|
var Getter = /** @class */ (function () {
|
|
@@ -3236,6 +3534,10 @@ var BatchedDataGetter;
|
|
|
3236
3534
|
BatchedDataGetter.Getter = Getter;
|
|
3237
3535
|
})(BatchedDataGetter || (BatchedDataGetter = {}));
|
|
3238
3536
|
|
|
3537
|
+
/**
|
|
3538
|
+
* Describes the "Client File" concept within Bruce.
|
|
3539
|
+
* A client file is a record of a file uploaded to Bruce.
|
|
3540
|
+
*/
|
|
3239
3541
|
var ClientFile;
|
|
3240
3542
|
(function (ClientFile) {
|
|
3241
3543
|
function GetCacheKey(fileId) {
|
|
@@ -3348,6 +3650,10 @@ var ClientFile;
|
|
|
3348
3650
|
})(Filter = ClientFile.Filter || (ClientFile.Filter = {}));
|
|
3349
3651
|
})(ClientFile || (ClientFile = {}));
|
|
3350
3652
|
|
|
3653
|
+
/**
|
|
3654
|
+
* Describes the "Program Key" concept within Bruce.
|
|
3655
|
+
* A program key is an access token for an arbitrary software.
|
|
3656
|
+
*/
|
|
3351
3657
|
var ProgramKey;
|
|
3352
3658
|
(function (ProgramKey) {
|
|
3353
3659
|
function GetCacheKey(programId) {
|
|
@@ -3457,6 +3763,10 @@ var ProgramKey;
|
|
|
3457
3763
|
ProgramKey.Update = Update;
|
|
3458
3764
|
})(ProgramKey || (ProgramKey = {}));
|
|
3459
3765
|
|
|
3766
|
+
/**
|
|
3767
|
+
* Describes an expectation on what should be rendered for a menu item-
|
|
3768
|
+
* between a min-max distance of an entity to the camera.
|
|
3769
|
+
*/
|
|
3460
3770
|
var ZoomControl;
|
|
3461
3771
|
(function (ZoomControl) {
|
|
3462
3772
|
var EDisplayType;
|
|
@@ -3468,6 +3778,16 @@ var ZoomControl;
|
|
|
3468
3778
|
})(EDisplayType = ZoomControl.EDisplayType || (ZoomControl.EDisplayType = {}));
|
|
3469
3779
|
})(ZoomControl || (ZoomControl = {}));
|
|
3470
3780
|
|
|
3781
|
+
/**
|
|
3782
|
+
* Describes the "Tileset" concept in Bruce.
|
|
3783
|
+
*
|
|
3784
|
+
* Tilesets come in three possible variants,
|
|
3785
|
+
* 1- A set of instructions to generate a tileset.
|
|
3786
|
+
* 2- Settings to load a tileset hosted elsewhere.
|
|
3787
|
+
* 3- A set of user-provided files to serve.
|
|
3788
|
+
*
|
|
3789
|
+
* Read the individual tileset-type settings for each variant.
|
|
3790
|
+
*/
|
|
3471
3791
|
var Tileset;
|
|
3472
3792
|
(function (Tileset) {
|
|
3473
3793
|
function GetCacheKey(tilesetId, loadFiles) {
|
|
@@ -3805,6 +4125,11 @@ var Tileset;
|
|
|
3805
4125
|
})(Publish = Tileset.Publish || (Tileset.Publish = {}));
|
|
3806
4126
|
})(Tileset || (Tileset = {}));
|
|
3807
4127
|
|
|
4128
|
+
/**
|
|
4129
|
+
* Describes a menu item found in project views.
|
|
4130
|
+
* Menu items are used to dictate what data to load in a scene.
|
|
4131
|
+
* A menu item may be a container for other items.
|
|
4132
|
+
*/
|
|
3808
4133
|
var MenuItem;
|
|
3809
4134
|
(function (MenuItem) {
|
|
3810
4135
|
var EType;
|
|
@@ -3910,6 +4235,12 @@ var MenuItem;
|
|
|
3910
4235
|
MenuItem.CreateFromTilesetId = CreateFromTilesetId;
|
|
3911
4236
|
})(MenuItem || (MenuItem = {}));
|
|
3912
4237
|
|
|
4238
|
+
/**
|
|
4239
|
+
* Describe the "Project View Bookmark" concept within Bruce.
|
|
4240
|
+
* This is referred to as "slides" in older code.
|
|
4241
|
+
*
|
|
4242
|
+
* A bookmark is a snapshot of what should be displayed and how in a particular project view.
|
|
4243
|
+
*/
|
|
3913
4244
|
var ProjectViewBookmark;
|
|
3914
4245
|
(function (ProjectViewBookmark) {
|
|
3915
4246
|
function GetCacheKey(viewId, bookmarkId) {
|
|
@@ -4019,6 +4350,11 @@ var ProjectViewBookmark;
|
|
|
4019
4350
|
ProjectViewBookmark.Update = Update;
|
|
4020
4351
|
})(ProjectViewBookmark || (ProjectViewBookmark = {}));
|
|
4021
4352
|
|
|
4353
|
+
/**
|
|
4354
|
+
* Describes the "Project View" concept within Bruce.
|
|
4355
|
+
* A project view is a collection of settings for a visualization application we support.
|
|
4356
|
+
* It will describe what panels to show and how, it will also describe all possible ways data can be displayed.
|
|
4357
|
+
*/
|
|
4022
4358
|
var ProjectView;
|
|
4023
4359
|
(function (ProjectView) {
|
|
4024
4360
|
function GetCacheKey(viewId) {
|
|
@@ -4125,6 +4461,11 @@ var ProjectView;
|
|
|
4125
4461
|
ProjectView.Update = Update;
|
|
4126
4462
|
})(ProjectView || (ProjectView = {}));
|
|
4127
4463
|
|
|
4464
|
+
/**
|
|
4465
|
+
* Describes the "Pending Action" concept within Bruce.
|
|
4466
|
+
* A pending action is a record of a server-side background process.
|
|
4467
|
+
* This record is used to monitor its progress and completion state.
|
|
4468
|
+
*/
|
|
4128
4469
|
var PendingAction;
|
|
4129
4470
|
(function (PendingAction) {
|
|
4130
4471
|
var EStatus;
|
|
@@ -4187,6 +4528,13 @@ var PendingAction;
|
|
|
4187
4528
|
PendingAction.GetMessages = GetMessages;
|
|
4188
4529
|
})(PendingAction || (PendingAction = {}));
|
|
4189
4530
|
|
|
4531
|
+
/**
|
|
4532
|
+
* Describes the "Style" concept within Bruce.
|
|
4533
|
+
* A legacy way of referring to styles is "entity display settings".
|
|
4534
|
+
*
|
|
4535
|
+
* A style is a collection of settings (which can be calculations to perform on entity data) that
|
|
4536
|
+
* describe how an entity should be displayed.
|
|
4537
|
+
*/
|
|
4190
4538
|
var Style;
|
|
4191
4539
|
(function (Style) {
|
|
4192
4540
|
function GetCacheKey(id) {
|
|
@@ -4293,6 +4641,11 @@ var Style;
|
|
|
4293
4641
|
Style.Delete = Delete;
|
|
4294
4642
|
})(Style || (Style = {}));
|
|
4295
4643
|
|
|
4644
|
+
/**
|
|
4645
|
+
* Describes expected settings for an entities-map tileset.
|
|
4646
|
+
* This is the kind of tileset generated from arbitrary Bruce entities-
|
|
4647
|
+
* which produced map tiles of the entity vector geometry.
|
|
4648
|
+
*/
|
|
4296
4649
|
var TilesetEntitiesMapTiles;
|
|
4297
4650
|
(function (TilesetEntitiesMapTiles) {
|
|
4298
4651
|
var ETileSize;
|
|
@@ -4304,6 +4657,10 @@ var TilesetEntitiesMapTiles;
|
|
|
4304
4657
|
})(ETileSize = TilesetEntitiesMapTiles.ETileSize || (TilesetEntitiesMapTiles.ETileSize = {}));
|
|
4305
4658
|
})(TilesetEntitiesMapTiles || (TilesetEntitiesMapTiles = {}));
|
|
4306
4659
|
|
|
4660
|
+
/**
|
|
4661
|
+
* Describes settings for an external map-tiles tileset.
|
|
4662
|
+
* This will serve content from elsewhere with the assumption that the data is valid map tiles.
|
|
4663
|
+
*/
|
|
4307
4664
|
var TilesetExtMapTiles;
|
|
4308
4665
|
(function (TilesetExtMapTiles) {
|
|
4309
4666
|
var EType;
|
|
@@ -4315,6 +4672,11 @@ var TilesetExtMapTiles;
|
|
|
4315
4672
|
})(EType = TilesetExtMapTiles.EType || (TilesetExtMapTiles.EType = {}));
|
|
4316
4673
|
})(TilesetExtMapTiles || (TilesetExtMapTiles = {}));
|
|
4317
4674
|
|
|
4675
|
+
/**
|
|
4676
|
+
* Describes the "UCS" concept within Bruce.
|
|
4677
|
+
* A UCS is a user-coordinate-system.
|
|
4678
|
+
* It is a description of an offset to apply to tilesets so that they can all align with each other.
|
|
4679
|
+
*/
|
|
4318
4680
|
var Ucs;
|
|
4319
4681
|
(function (Ucs) {
|
|
4320
4682
|
function GetCacheKey(id, expandUsage) {
|
|
@@ -4424,6 +4786,11 @@ var Permission;
|
|
|
4424
4786
|
})(EPermPrefix = Permission.EPermPrefix || (Permission.EPermPrefix = {}));
|
|
4425
4787
|
})(Permission || (Permission = {}));
|
|
4426
4788
|
|
|
4789
|
+
/**
|
|
4790
|
+
* Describes the "Session" concept within Bruce.
|
|
4791
|
+
* A session is a set of settings produced from a user or access token login.
|
|
4792
|
+
* The session describes what the access should be allowed to do.
|
|
4793
|
+
*/
|
|
4427
4794
|
var Session;
|
|
4428
4795
|
(function (Session) {
|
|
4429
4796
|
function GetCacheKey(sessionId) {
|
|
@@ -4523,6 +4890,10 @@ var Session;
|
|
|
4523
4890
|
Session.IsSuperAdmin = IsSuperAdmin;
|
|
4524
4891
|
})(Session || (Session = {}));
|
|
4525
4892
|
|
|
4893
|
+
/**
|
|
4894
|
+
* Describes the "User Group" concept within Bruce.
|
|
4895
|
+
* A user group is a collection of permissions ("Features") and what users should be in the group.
|
|
4896
|
+
*/
|
|
4526
4897
|
var UserGroup;
|
|
4527
4898
|
(function (UserGroup) {
|
|
4528
4899
|
function GetByName(api, accountId, name) {
|
|
@@ -4620,6 +4991,13 @@ var UserGroup;
|
|
|
4620
4991
|
UserGroup.Update = Update;
|
|
4621
4992
|
})(UserGroup || (UserGroup = {}));
|
|
4622
4993
|
|
|
4994
|
+
/**
|
|
4995
|
+
* Describes the "User" concept within Bruce.
|
|
4996
|
+
* A user is either a login-user or an access-token.
|
|
4997
|
+
*
|
|
4998
|
+
* You cannot login using an access-token, but both concepts are-
|
|
4999
|
+
* treated the same way in terms of permissions and user groups.
|
|
5000
|
+
*/
|
|
4623
5001
|
var User;
|
|
4624
5002
|
(function (User) {
|
|
4625
5003
|
function GetCacheKey(userId, accountId) {
|
|
@@ -4678,6 +5056,39 @@ var User;
|
|
|
4678
5056
|
});
|
|
4679
5057
|
}
|
|
4680
5058
|
User.Update = Update;
|
|
5059
|
+
function GetUsernameAvailable(api, username) {
|
|
5060
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5061
|
+
var req, prom;
|
|
5062
|
+
var _this = this;
|
|
5063
|
+
return __generator(this, function (_a) {
|
|
5064
|
+
if (!username) {
|
|
5065
|
+
throw ("Username is required.");
|
|
5066
|
+
}
|
|
5067
|
+
req = api.GET("user/loginavailable/" + username);
|
|
5068
|
+
prom = new Promise(function (rej, res) { return __awaiter(_this, void 0, void 0, function () {
|
|
5069
|
+
var data, e_1;
|
|
5070
|
+
return __generator(this, function (_a) {
|
|
5071
|
+
switch (_a.label) {
|
|
5072
|
+
case 0:
|
|
5073
|
+
_a.trys.push([0, 2, , 3]);
|
|
5074
|
+
return [4 /*yield*/, req];
|
|
5075
|
+
case 1:
|
|
5076
|
+
data = _a.sent();
|
|
5077
|
+
res(data.IsAvailable);
|
|
5078
|
+
return [3 /*break*/, 3];
|
|
5079
|
+
case 2:
|
|
5080
|
+
e_1 = _a.sent();
|
|
5081
|
+
rej(e_1);
|
|
5082
|
+
return [3 /*break*/, 3];
|
|
5083
|
+
case 3: return [2 /*return*/];
|
|
5084
|
+
}
|
|
5085
|
+
});
|
|
5086
|
+
}); });
|
|
5087
|
+
return [2 /*return*/, prom];
|
|
5088
|
+
});
|
|
5089
|
+
});
|
|
5090
|
+
}
|
|
5091
|
+
User.GetUsernameAvailable = GetUsernameAvailable;
|
|
4681
5092
|
var LoginUser;
|
|
4682
5093
|
(function (LoginUser) {
|
|
4683
5094
|
function GetListCacheKey(accountId) {
|
|
@@ -4700,7 +5111,7 @@ var User;
|
|
|
4700
5111
|
return [2 /*return*/, cacheData];
|
|
4701
5112
|
}
|
|
4702
5113
|
req = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
|
|
4703
|
-
var data,
|
|
5114
|
+
var data, e_2;
|
|
4704
5115
|
return __generator(this, function (_a) {
|
|
4705
5116
|
switch (_a.label) {
|
|
4706
5117
|
case 0:
|
|
@@ -4711,8 +5122,8 @@ var User;
|
|
|
4711
5122
|
res(data.Items);
|
|
4712
5123
|
return [3 /*break*/, 3];
|
|
4713
5124
|
case 2:
|
|
4714
|
-
|
|
4715
|
-
rej(
|
|
5125
|
+
e_2 = _a.sent();
|
|
5126
|
+
rej(e_2);
|
|
4716
5127
|
return [3 /*break*/, 3];
|
|
4717
5128
|
case 3: return [2 /*return*/];
|
|
4718
5129
|
}
|
|
@@ -4731,6 +5142,146 @@ var User;
|
|
|
4731
5142
|
});
|
|
4732
5143
|
}
|
|
4733
5144
|
LoginUser.GetList = GetList;
|
|
5145
|
+
/**
|
|
5146
|
+
* Sends a signup email to the specified email address.
|
|
5147
|
+
* @param api
|
|
5148
|
+
* @param email
|
|
5149
|
+
* @returns
|
|
5150
|
+
*/
|
|
5151
|
+
function Signup(api, email) {
|
|
5152
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5153
|
+
return __generator(this, function (_a) {
|
|
5154
|
+
if (!email) {
|
|
5155
|
+
throw ("Email is required.");
|
|
5156
|
+
}
|
|
5157
|
+
return [2 /*return*/, api.POST("clientaccount/signup", {
|
|
5158
|
+
Email: email
|
|
5159
|
+
})];
|
|
5160
|
+
});
|
|
5161
|
+
});
|
|
5162
|
+
}
|
|
5163
|
+
LoginUser.Signup = Signup;
|
|
5164
|
+
/**
|
|
5165
|
+
* Sends a new signup email using a previous one's expired code.
|
|
5166
|
+
* @param api
|
|
5167
|
+
* @param expiredCode
|
|
5168
|
+
* @returns
|
|
5169
|
+
*/
|
|
5170
|
+
function SignupResend(api, expiredCode) {
|
|
5171
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5172
|
+
return __generator(this, function (_a) {
|
|
5173
|
+
if (!expiredCode) {
|
|
5174
|
+
throw ("Expired activation code is required.");
|
|
5175
|
+
}
|
|
5176
|
+
return [2 /*return*/, api.POST("clientaccount/signup/resend?activationKey=" + Api.Encode(expiredCode), null)];
|
|
5177
|
+
});
|
|
5178
|
+
});
|
|
5179
|
+
}
|
|
5180
|
+
LoginUser.SignupResend = SignupResend;
|
|
5181
|
+
/**
|
|
5182
|
+
* Completes signup using user data and a signup code.
|
|
5183
|
+
* @param api
|
|
5184
|
+
* @param accountId
|
|
5185
|
+
* @param code
|
|
5186
|
+
* @param data
|
|
5187
|
+
* @returns
|
|
5188
|
+
*/
|
|
5189
|
+
function SignupComplete(api, accountId, code, data) {
|
|
5190
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5191
|
+
var res;
|
|
5192
|
+
return __generator(this, function (_a) {
|
|
5193
|
+
switch (_a.label) {
|
|
5194
|
+
case 0:
|
|
5195
|
+
if (!code || !accountId) {
|
|
5196
|
+
throw ("Activation code and account ID are required.");
|
|
5197
|
+
}
|
|
5198
|
+
if (!(data === null || data === void 0 ? void 0 : data.Login) || !(data === null || data === void 0 ? void 0 : data.Password)) {
|
|
5199
|
+
throw ("Login and password are required.");
|
|
5200
|
+
}
|
|
5201
|
+
data = JSON.parse(JSON.stringify(data));
|
|
5202
|
+
data.IsActivated = true;
|
|
5203
|
+
data.IsDisabled = false;
|
|
5204
|
+
data.key = code;
|
|
5205
|
+
return [4 /*yield*/, api.POST("UserActivate/" + accountId, data)];
|
|
5206
|
+
case 1:
|
|
5207
|
+
res = _a.sent();
|
|
5208
|
+
api.Cache.RemoveByContains(Api.ECacheKey.User + Api.ECacheKey.Id + res.ID);
|
|
5209
|
+
return [2 /*return*/, res];
|
|
5210
|
+
}
|
|
5211
|
+
});
|
|
5212
|
+
});
|
|
5213
|
+
}
|
|
5214
|
+
LoginUser.SignupComplete = SignupComplete;
|
|
5215
|
+
/**
|
|
5216
|
+
* Sends a password reset email to the specified email address.
|
|
5217
|
+
* @param api
|
|
5218
|
+
* @param accountId
|
|
5219
|
+
* @param email
|
|
5220
|
+
* @returns user id associated with provided email.
|
|
5221
|
+
*/
|
|
5222
|
+
function ForgotPassword(api, accountId, email) {
|
|
5223
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5224
|
+
var req, prom;
|
|
5225
|
+
var _this = this;
|
|
5226
|
+
return __generator(this, function (_a) {
|
|
5227
|
+
if (!accountId || !email) {
|
|
5228
|
+
throw ("Account ID and email are required.");
|
|
5229
|
+
}
|
|
5230
|
+
req = api.POST("UserForgotPassword/" + accountId, {
|
|
5231
|
+
Email: email
|
|
5232
|
+
});
|
|
5233
|
+
prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
|
|
5234
|
+
var data, e_3;
|
|
5235
|
+
return __generator(this, function (_a) {
|
|
5236
|
+
switch (_a.label) {
|
|
5237
|
+
case 0:
|
|
5238
|
+
_a.trys.push([0, 2, , 3]);
|
|
5239
|
+
return [4 /*yield*/, req];
|
|
5240
|
+
case 1:
|
|
5241
|
+
data = _a.sent();
|
|
5242
|
+
res(data.ID);
|
|
5243
|
+
return [3 /*break*/, 3];
|
|
5244
|
+
case 2:
|
|
5245
|
+
e_3 = _a.sent();
|
|
5246
|
+
rej(e_3);
|
|
5247
|
+
return [3 /*break*/, 3];
|
|
5248
|
+
case 3: return [2 /*return*/];
|
|
5249
|
+
}
|
|
5250
|
+
});
|
|
5251
|
+
}); });
|
|
5252
|
+
return [2 /*return*/, prom];
|
|
5253
|
+
});
|
|
5254
|
+
});
|
|
5255
|
+
}
|
|
5256
|
+
LoginUser.ForgotPassword = ForgotPassword;
|
|
5257
|
+
/**
|
|
5258
|
+
* Completes password reset using a password reset code and new password.
|
|
5259
|
+
* @param api
|
|
5260
|
+
* @param code
|
|
5261
|
+
* @param userId
|
|
5262
|
+
* @param password
|
|
5263
|
+
* @returns
|
|
5264
|
+
*/
|
|
5265
|
+
function ForgotPasswordComplete(api, code, userId, password) {
|
|
5266
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5267
|
+
var user;
|
|
5268
|
+
return __generator(this, function (_a) {
|
|
5269
|
+
switch (_a.label) {
|
|
5270
|
+
case 0: return [4 /*yield*/, Get(api, userId, "")];
|
|
5271
|
+
case 1:
|
|
5272
|
+
user = _a.sent();
|
|
5273
|
+
return [2 /*return*/, api.POST("UserSetNameAndPassword", {
|
|
5274
|
+
ID: userId,
|
|
5275
|
+
Email: user.Email,
|
|
5276
|
+
ActivationCode: code,
|
|
5277
|
+
Password: password,
|
|
5278
|
+
FullName: user.FullName
|
|
5279
|
+
})];
|
|
5280
|
+
}
|
|
5281
|
+
});
|
|
5282
|
+
});
|
|
5283
|
+
}
|
|
5284
|
+
LoginUser.ForgotPasswordComplete = ForgotPasswordComplete;
|
|
4734
5285
|
})(LoginUser = User.LoginUser || (User.LoginUser = {}));
|
|
4735
5286
|
var AccessToken;
|
|
4736
5287
|
(function (AccessToken) {
|
|
@@ -4748,7 +5299,7 @@ var User;
|
|
|
4748
5299
|
return [2 /*return*/, cacheData];
|
|
4749
5300
|
}
|
|
4750
5301
|
req = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
|
|
4751
|
-
var data,
|
|
5302
|
+
var data, e_4;
|
|
4752
5303
|
return __generator(this, function (_a) {
|
|
4753
5304
|
switch (_a.label) {
|
|
4754
5305
|
case 0:
|
|
@@ -4759,8 +5310,8 @@ var User;
|
|
|
4759
5310
|
res(data.Items);
|
|
4760
5311
|
return [3 /*break*/, 3];
|
|
4761
5312
|
case 2:
|
|
4762
|
-
|
|
4763
|
-
rej(
|
|
5313
|
+
e_4 = _a.sent();
|
|
5314
|
+
rej(e_4);
|
|
4764
5315
|
return [3 /*break*/, 3];
|
|
4765
5316
|
case 3: return [2 /*return*/];
|
|
4766
5317
|
}
|
|
@@ -4839,6 +5390,12 @@ var EncryptUtils;
|
|
|
4839
5390
|
|
|
4840
5391
|
var MathUtils;
|
|
4841
5392
|
(function (MathUtils) {
|
|
5393
|
+
/**
|
|
5394
|
+
* Rounds a number to a given number of decimal places.
|
|
5395
|
+
* @param num
|
|
5396
|
+
* @param decimals
|
|
5397
|
+
* @returns
|
|
5398
|
+
*/
|
|
4842
5399
|
function Round(num, decimals) {
|
|
4843
5400
|
if (decimals === void 0) { decimals = 0; }
|
|
4844
5401
|
if (decimals <= 0) {
|
|
@@ -4852,6 +5409,12 @@ var MathUtils;
|
|
|
4852
5409
|
return Math.round((num + Number.EPSILON) * d) / d;
|
|
4853
5410
|
}
|
|
4854
5411
|
MathUtils.Round = Round;
|
|
5412
|
+
/**
|
|
5413
|
+
* Returns a random integer between min (inclusive) and max (inclusive).
|
|
5414
|
+
* @param min
|
|
5415
|
+
* @param max
|
|
5416
|
+
* @returns
|
|
5417
|
+
*/
|
|
4855
5418
|
function RandInt(min, max) {
|
|
4856
5419
|
if (min == max) {
|
|
4857
5420
|
return min;
|
|
@@ -4864,6 +5427,9 @@ var MathUtils;
|
|
|
4864
5427
|
MathUtils.RandInt = RandInt;
|
|
4865
5428
|
})(MathUtils || (MathUtils = {}));
|
|
4866
5429
|
|
|
5430
|
+
/**
|
|
5431
|
+
* Utility to help with url manipulation.
|
|
5432
|
+
*/
|
|
4867
5433
|
var UrlUtils;
|
|
4868
5434
|
(function (UrlUtils) {
|
|
4869
5435
|
function GetQueryString(doc) {
|
|
@@ -4882,6 +5448,9 @@ var UrlUtils;
|
|
|
4882
5448
|
return qs;
|
|
4883
5449
|
}
|
|
4884
5450
|
UrlUtils.GetQueryString = GetQueryString;
|
|
5451
|
+
/**
|
|
5452
|
+
* Helper to get and set url params for a given window.
|
|
5453
|
+
*/
|
|
4885
5454
|
var Handler = /** @class */ (function () {
|
|
4886
5455
|
function Handler(window, allowedKeys) {
|
|
4887
5456
|
this._allowedKeys = null;
|
|
@@ -4963,5 +5532,178 @@ var UrlUtils;
|
|
|
4963
5532
|
UrlUtils.Handler = Handler;
|
|
4964
5533
|
})(UrlUtils || (UrlUtils = {}));
|
|
4965
5534
|
|
|
4966
|
-
|
|
5535
|
+
var ACCOUNT_EXCLUSIONS = ["hyperportal", "hypeportal", "bviewer"];
|
|
5536
|
+
/**
|
|
5537
|
+
* Describes the "Client Account" concept within Bruce.
|
|
5538
|
+
* A client account is a database instance that holds one or many users.
|
|
5539
|
+
*/
|
|
5540
|
+
var Account;
|
|
5541
|
+
(function (Account$$1) {
|
|
5542
|
+
function GetCacheKey(accountId, appSettingsId) {
|
|
5543
|
+
if (appSettingsId) {
|
|
5544
|
+
return Api.ECacheKey.Account + Api.ECacheKey.Id + accountId + Api.ECacheKey + appSettingsId;
|
|
5545
|
+
}
|
|
5546
|
+
return Api.ECacheKey.Account + Api.ECacheKey.Id + accountId;
|
|
5547
|
+
}
|
|
5548
|
+
Account$$1.GetCacheKey = GetCacheKey;
|
|
5549
|
+
function GetListCacheKey(ssid) {
|
|
5550
|
+
return Api.ECacheKey.Account + Api.ECacheKey.Session + Api.ECacheKey.Id + ssid;
|
|
5551
|
+
}
|
|
5552
|
+
Account$$1.GetListCacheKey = GetListCacheKey;
|
|
5553
|
+
var EDbRegion;
|
|
5554
|
+
(function (EDbRegion) {
|
|
5555
|
+
EDbRegion["USA"] = "US";
|
|
5556
|
+
EDbRegion["Paris"] = "EU";
|
|
5557
|
+
EDbRegion["Singapore"] = "SE";
|
|
5558
|
+
EDbRegion["Australia"] = "AU";
|
|
5559
|
+
})(EDbRegion || (EDbRegion = {}));
|
|
5560
|
+
function Get(api, id) {
|
|
5561
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5562
|
+
var cacheData, req;
|
|
5563
|
+
return __generator(this, function (_a) {
|
|
5564
|
+
switch (_a.label) {
|
|
5565
|
+
case 0:
|
|
5566
|
+
cacheData = api.Cache.Get(GetCacheKey(id));
|
|
5567
|
+
if (cacheData) {
|
|
5568
|
+
return [2 /*return*/, cacheData];
|
|
5569
|
+
}
|
|
5570
|
+
return [4 /*yield*/, api.GET("account/" + id)];
|
|
5571
|
+
case 1:
|
|
5572
|
+
req = _a.sent();
|
|
5573
|
+
api.Cache.Set(GetCacheKey(id), req, Api.DEFAULT_CACHE_DURATION);
|
|
5574
|
+
return [2 /*return*/, req];
|
|
5575
|
+
}
|
|
5576
|
+
});
|
|
5577
|
+
});
|
|
5578
|
+
}
|
|
5579
|
+
Account$$1.Get = Get;
|
|
5580
|
+
function GetRelatedList(api) {
|
|
5581
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5582
|
+
var cacheData, req, prom;
|
|
5583
|
+
var _this = this;
|
|
5584
|
+
return __generator(this, function (_a) {
|
|
5585
|
+
cacheData = api.Cache.Get(GetListCacheKey(api.GetSessionId()));
|
|
5586
|
+
if (cacheData) {
|
|
5587
|
+
return [2 /*return*/, cacheData];
|
|
5588
|
+
}
|
|
5589
|
+
req = api.GET("user/relatedClientAccounts");
|
|
5590
|
+
prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
|
|
5591
|
+
var data, items, e_1;
|
|
5592
|
+
return __generator(this, function (_a) {
|
|
5593
|
+
switch (_a.label) {
|
|
5594
|
+
case 0:
|
|
5595
|
+
_a.trys.push([0, 2, , 3]);
|
|
5596
|
+
return [4 /*yield*/, req];
|
|
5597
|
+
case 1:
|
|
5598
|
+
data = _a.sent();
|
|
5599
|
+
items = data.Items.filter(function (x) { return !ACCOUNT_EXCLUSIONS.includes(x.ID); });
|
|
5600
|
+
res(items);
|
|
5601
|
+
return [3 /*break*/, 3];
|
|
5602
|
+
case 2:
|
|
5603
|
+
e_1 = _a.sent();
|
|
5604
|
+
rej(e_1);
|
|
5605
|
+
return [3 /*break*/, 3];
|
|
5606
|
+
case 3: return [2 /*return*/];
|
|
5607
|
+
}
|
|
5608
|
+
});
|
|
5609
|
+
}); });
|
|
5610
|
+
api.Cache.Set(GetListCacheKey(api.GetSessionId()), prom, Api.DEFAULT_CACHE_DURATION);
|
|
5611
|
+
return [2 /*return*/, prom];
|
|
5612
|
+
});
|
|
5613
|
+
});
|
|
5614
|
+
}
|
|
5615
|
+
Account$$1.GetRelatedList = GetRelatedList;
|
|
5616
|
+
function GetAppSettings(api, id, appId) {
|
|
5617
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5618
|
+
var cacheData, req, prom;
|
|
5619
|
+
var _this = this;
|
|
5620
|
+
return __generator(this, function (_a) {
|
|
5621
|
+
switch (_a.label) {
|
|
5622
|
+
case 0:
|
|
5623
|
+
cacheData = api.Cache.Get(GetCacheKey(id, appId));
|
|
5624
|
+
if (cacheData) {
|
|
5625
|
+
return [2 /*return*/, cacheData];
|
|
5626
|
+
}
|
|
5627
|
+
return [4 /*yield*/, api.GET("account/" + id + "?ApplicationID=" + appId)];
|
|
5628
|
+
case 1:
|
|
5629
|
+
req = _a.sent();
|
|
5630
|
+
prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
|
|
5631
|
+
var data, settings, e_2;
|
|
5632
|
+
var _a;
|
|
5633
|
+
return __generator(this, function (_b) {
|
|
5634
|
+
switch (_b.label) {
|
|
5635
|
+
case 0:
|
|
5636
|
+
_b.trys.push([0, 2, , 3]);
|
|
5637
|
+
return [4 /*yield*/, req];
|
|
5638
|
+
case 1:
|
|
5639
|
+
data = _b.sent();
|
|
5640
|
+
settings = (_a = data === null || data === void 0 ? void 0 : data["Application.Settings"]) !== null && _a !== void 0 ? _a : {};
|
|
5641
|
+
res(settings);
|
|
5642
|
+
return [3 /*break*/, 3];
|
|
5643
|
+
case 2:
|
|
5644
|
+
e_2 = _b.sent();
|
|
5645
|
+
rej(e_2);
|
|
5646
|
+
return [3 /*break*/, 3];
|
|
5647
|
+
case 3: return [2 /*return*/];
|
|
5648
|
+
}
|
|
5649
|
+
});
|
|
5650
|
+
}); });
|
|
5651
|
+
api.Cache.Set(GetCacheKey(id, appId), prom, Api.DEFAULT_CACHE_DURATION);
|
|
5652
|
+
return [2 /*return*/, prom];
|
|
5653
|
+
}
|
|
5654
|
+
});
|
|
5655
|
+
});
|
|
5656
|
+
}
|
|
5657
|
+
Account$$1.GetAppSettings = GetAppSettings;
|
|
5658
|
+
/**
|
|
5659
|
+
* WARNING: Do not update API settings without knowing what you're doing.
|
|
5660
|
+
* @param api
|
|
5661
|
+
* @param id
|
|
5662
|
+
* @param appId
|
|
5663
|
+
* @param data
|
|
5664
|
+
* @returns
|
|
5665
|
+
*/
|
|
5666
|
+
function UpdateAppSettings(api, id, appId, data) {
|
|
5667
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5668
|
+
return __generator(this, function (_a) {
|
|
5669
|
+
switch (_a.label) {
|
|
5670
|
+
case 0: return [4 /*yield*/, api.POST("account/" + id + "/applicationSettings/" + appId, data)];
|
|
5671
|
+
case 1:
|
|
5672
|
+
data = _a.sent();
|
|
5673
|
+
api.Cache.RemoveByStartsWith(Api.ECacheKey.Account + Api.ECacheKey.Id + id);
|
|
5674
|
+
return [2 /*return*/, data];
|
|
5675
|
+
}
|
|
5676
|
+
});
|
|
5677
|
+
});
|
|
5678
|
+
}
|
|
5679
|
+
Account$$1.UpdateAppSettings = UpdateAppSettings;
|
|
5680
|
+
/**
|
|
5681
|
+
* Creates a new Bruce account using given details.
|
|
5682
|
+
* @param api
|
|
5683
|
+
* @param id
|
|
5684
|
+
* @param name
|
|
5685
|
+
* @param region
|
|
5686
|
+
* @returns
|
|
5687
|
+
*/
|
|
5688
|
+
function Create(api, id, name, region) {
|
|
5689
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5690
|
+
var reqData, res;
|
|
5691
|
+
return __generator(this, function (_a) {
|
|
5692
|
+
if (!id || !name || !region) {
|
|
5693
|
+
throw new Error("Id, Name and Region are required.");
|
|
5694
|
+
}
|
|
5695
|
+
reqData = {
|
|
5696
|
+
"Name": name,
|
|
5697
|
+
"DBLocation": region
|
|
5698
|
+
};
|
|
5699
|
+
res = api.POST("clientAccount/" + id, reqData);
|
|
5700
|
+
api.Cache.Remove(GetListCacheKey(api.GetSessionId()));
|
|
5701
|
+
return [2 /*return*/, res];
|
|
5702
|
+
});
|
|
5703
|
+
});
|
|
5704
|
+
}
|
|
5705
|
+
Account$$1.Create = Create;
|
|
5706
|
+
})(Account || (Account = {}));
|
|
5707
|
+
|
|
5708
|
+
export { AnnDocument, CustomForm, AbstractApi, Api, BruceApi, CamApi, IdmApi, Calculator, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, PendingAction, Style, TilesetEntitiesMapTiles, TilesetExtMapTiles, Tileset, Ucs, Permission, Session, UserGroup, User, Account, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils };
|
|
4967
5709
|
//# sourceMappingURL=bruce-models.es5.js.map
|