bruce-models 1.3.7 → 1.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 +1190 -675
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +1189 -672
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js +35 -26
- package/dist/lib/account/account.js.map +1 -1
- package/dist/lib/ann-document/ann-document.js +20 -6
- package/dist/lib/ann-document/ann-document.js.map +1 -1
- package/dist/lib/api/abstract-api.js +20 -13
- package/dist/lib/api/abstract-api.js.map +1 -1
- package/dist/lib/api/api.js +0 -4
- package/dist/lib/api/api.js.map +1 -1
- package/dist/lib/api/bruce-api.js +5 -1
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/bruce-models.js +0 -8
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/calculator/calculator.js +12 -3
- package/dist/lib/calculator/calculator.js.map +1 -1
- package/dist/lib/client-file/client-file.js +77 -50
- package/dist/lib/client-file/client-file.js.map +1 -1
- package/dist/lib/common/bruce-variable.js +6 -2
- package/dist/lib/common/bruce-variable.js.map +1 -1
- package/dist/lib/common/geometry.js +5 -5
- package/dist/lib/common/geometry.js.map +1 -1
- package/dist/lib/custom-form/custom-form.js +28 -10
- package/dist/lib/custom-form/custom-form.js.map +1 -1
- package/dist/lib/data-lab/data-lab.js +26 -26
- package/dist/lib/data-lab/data-lab.js.map +1 -1
- package/dist/lib/entity/entity-attachment-type.js +13 -6
- package/dist/lib/entity/entity-attachment-type.js.map +1 -1
- package/dist/lib/entity/entity-attachment.js +23 -11
- package/dist/lib/entity/entity-attachment.js.map +1 -1
- package/dist/lib/entity/entity-comment.js +13 -6
- package/dist/lib/entity/entity-comment.js.map +1 -1
- package/dist/lib/entity/entity-coords.js +47 -14
- package/dist/lib/entity/entity-coords.js.map +1 -1
- package/dist/lib/entity/entity-link.js +13 -6
- package/dist/lib/entity/entity-link.js.map +1 -1
- package/dist/lib/entity/entity-lod-category.js +18 -8
- package/dist/lib/entity/entity-lod-category.js.map +1 -1
- package/dist/lib/entity/entity-lod.js +32 -18
- package/dist/lib/entity/entity-lod.js.map +1 -1
- package/dist/lib/entity/entity-relation-type.js +28 -10
- package/dist/lib/entity/entity-relation-type.js.map +1 -1
- package/dist/lib/entity/entity-relation.js +35 -17
- package/dist/lib/entity/entity-relation.js.map +1 -1
- package/dist/lib/entity/entity-source.js +31 -9
- package/dist/lib/entity/entity-source.js.map +1 -1
- package/dist/lib/entity/entity-tag.js +28 -11
- package/dist/lib/entity/entity-tag.js.map +1 -1
- package/dist/lib/entity/entity-type.js +28 -10
- package/dist/lib/entity/entity-type.js.map +1 -1
- package/dist/lib/entity/entity.js +88 -67
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/lib/entity/getters/entity-filter-getter.js +17 -14
- package/dist/lib/entity/getters/entity-filter-getter.js.map +1 -1
- package/dist/lib/import/import-cad.js +6 -4
- package/dist/lib/import/import-cad.js.map +1 -1
- package/dist/lib/import/import-csv.js +3 -2
- package/dist/lib/import/import-csv.js.map +1 -1
- package/dist/lib/import/import-json.js +3 -2
- package/dist/lib/import/import-json.js.map +1 -1
- package/dist/lib/import/import-kml.js +3 -2
- package/dist/lib/import/import-kml.js.map +1 -1
- package/dist/lib/import/imported-file.js +20 -6
- package/dist/lib/import/imported-file.js.map +1 -1
- package/dist/lib/markup/markup.js +98 -97
- package/dist/lib/markup/markup.js.map +1 -1
- package/dist/lib/program-key/program-key.js +28 -10
- package/dist/lib/program-key/program-key.js.map +1 -1
- package/dist/lib/project/menu-item.js.map +1 -1
- package/dist/lib/project/project-view-bookmark.js +41 -20
- package/dist/lib/project/project-view-bookmark.js.map +1 -1
- package/dist/lib/project/project-view-legacy-tile.js +15 -5
- package/dist/lib/project/project-view-legacy-tile.js.map +1 -1
- package/dist/lib/project/project-view.js +38 -20
- package/dist/lib/project/project-view.js.map +1 -1
- package/dist/lib/server/pending-action.js +17 -7
- package/dist/lib/server/pending-action.js.map +1 -1
- package/dist/lib/server/task.js +11 -6
- package/dist/lib/server/task.js.map +1 -1
- package/dist/lib/style/style.js +31 -13
- package/dist/lib/style/style.js.map +1 -1
- package/dist/lib/tileset/tileset.js +90 -30
- package/dist/lib/tileset/tileset.js.map +1 -1
- package/dist/lib/user/session.js +37 -13
- package/dist/lib/user/session.js.map +1 -1
- package/dist/lib/user/user-group.js +29 -12
- package/dist/lib/user/user-group.js.map +1 -1
- package/dist/lib/user/user.js +79 -44
- package/dist/lib/user/user.js.map +1 -1
- package/dist/lib/util/url-utils.js +3 -3
- package/dist/lib/util/url-utils.js.map +1 -1
- package/dist/types/account/account.d.ts +49 -17
- package/dist/types/ann-document/ann-document.d.ts +14 -2
- package/dist/types/api/api.d.ts +2 -3
- package/dist/types/bruce-models.d.ts +0 -8
- package/dist/types/client-file/client-file.d.ts +81 -45
- package/dist/types/common/bruce-variable.d.ts +5 -1
- package/dist/types/common/geometry.d.ts +1 -1
- package/dist/types/custom-form/custom-form.d.ts +26 -4
- package/dist/types/data-lab/data-lab.d.ts +10 -3
- package/dist/types/entity/entity-attachment-type.d.ts +18 -3
- package/dist/types/entity/entity-attachment.d.ts +42 -6
- package/dist/types/entity/entity-comment.d.ts +20 -3
- package/dist/types/entity/entity-coords.d.ts +33 -5
- package/dist/types/entity/entity-link.d.ts +20 -3
- package/dist/types/entity/entity-lod-category.d.ts +25 -4
- package/dist/types/entity/entity-lod.d.ts +51 -11
- package/dist/types/entity/entity-relation-type.d.ts +25 -4
- package/dist/types/entity/entity-relation.d.ts +28 -5
- package/dist/types/entity/entity-source.d.ts +24 -3
- package/dist/types/entity/entity-tag.d.ts +33 -5
- package/dist/types/entity/entity-type.d.ts +25 -4
- package/dist/types/entity/entity.d.ts +72 -29
- package/dist/types/import/import-cad.d.ts +10 -2
- package/dist/types/import/import-csv.d.ts +5 -1
- package/dist/types/import/import-json.d.ts +5 -1
- package/dist/types/import/import-kml.d.ts +5 -1
- package/dist/types/import/imported-file.d.ts +15 -2
- package/dist/types/markup/markup.d.ts +105 -106
- package/dist/types/program-key/program-key.d.ts +25 -4
- package/dist/types/project/menu-item.d.ts +2 -1
- package/dist/types/project/project-view-bookmark.d.ts +52 -16
- package/dist/types/project/project-view-legacy-tile.d.ts +16 -2
- package/dist/types/project/project-view.d.ts +46 -18
- package/dist/types/server/pending-action.d.ts +24 -3
- package/dist/types/server/task.d.ts +15 -2
- package/dist/types/style/style.d.ts +25 -4
- package/dist/types/tileset/tileset.d.ts +183 -24
- package/dist/types/user/session.d.ts +36 -7
- package/dist/types/user/user-group.d.ts +44 -6
- package/dist/types/user/user.d.ts +102 -29
- package/package.json +1 -1
- package/dist/lib/tileset/tileset-cad.js +0 -3
- package/dist/lib/tileset/tileset-cad.js.map +0 -1
- package/dist/lib/tileset/tileset-entities-map-tiles.js +0 -19
- package/dist/lib/tileset/tileset-entities-map-tiles.js.map +0 -1
- package/dist/lib/tileset/tileset-entities.js +0 -3
- package/dist/lib/tileset/tileset-entities.js.map +0 -1
- package/dist/lib/tileset/tileset-ext-map-tiles.js +0 -18
- package/dist/lib/tileset/tileset-ext-map-tiles.js.map +0 -1
- package/dist/lib/tileset/tileset-ext-terrain-tiles.js +0 -3
- package/dist/lib/tileset/tileset-ext-terrain-tiles.js.map +0 -1
- package/dist/lib/tileset/tileset-map-tiles.js +0 -3
- package/dist/lib/tileset/tileset-map-tiles.js.map +0 -1
- package/dist/lib/tileset/tileset-pointcloud.js +0 -3
- package/dist/lib/tileset/tileset-pointcloud.js.map +0 -1
- package/dist/lib/tileset/tileset-terrain-tiles.js +0 -3
- package/dist/lib/tileset/tileset-terrain-tiles.js.map +0 -1
- package/dist/types/tileset/tileset-cad.d.ts +0 -25
- package/dist/types/tileset/tileset-entities-map-tiles.d.ts +0 -23
- package/dist/types/tileset/tileset-entities.d.ts +0 -18
- package/dist/types/tileset/tileset-ext-map-tiles.d.ts +0 -21
- package/dist/types/tileset/tileset-ext-terrain-tiles.d.ts +0 -10
- package/dist/types/tileset/tileset-map-tiles.d.ts +0 -14
- package/dist/types/tileset/tileset-pointcloud.d.ts +0 -20
- package/dist/types/tileset/tileset-terrain-tiles.d.ts +0 -10
package/dist/bruce-models.umd.js
CHANGED
|
@@ -112,10 +112,6 @@
|
|
|
112
112
|
*/
|
|
113
113
|
function PrepReqParams(base) {
|
|
114
114
|
base = Object.assign({}, base);
|
|
115
|
-
base.response = Object.assign({}, base.response);
|
|
116
|
-
if (!base.response.encoding) {
|
|
117
|
-
base.response.encoding = Api.EEncoding.UTF16;
|
|
118
|
-
}
|
|
119
115
|
return base;
|
|
120
116
|
}
|
|
121
117
|
Api.PrepReqParams = PrepReqParams;
|
|
@@ -134,8 +130,9 @@
|
|
|
134
130
|
(function (EType) {
|
|
135
131
|
EType["SVG"] = "SVG";
|
|
136
132
|
})(EType = AnnDocument.EType || (AnnDocument.EType = {}));
|
|
137
|
-
function Get(
|
|
133
|
+
function Get(params) {
|
|
138
134
|
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
const { api, docId, req: reqParams } = params;
|
|
139
136
|
if (!docId) {
|
|
140
137
|
throw ("Doc ID is required.");
|
|
141
138
|
}
|
|
@@ -144,14 +141,25 @@
|
|
|
144
141
|
if (cacheData) {
|
|
145
142
|
return cacheData;
|
|
146
143
|
}
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
144
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
try {
|
|
146
|
+
const data = yield api.GET(`documentView/${docId}`, exports.Api.PrepReqParams(reqParams));
|
|
147
|
+
res({
|
|
148
|
+
document: data
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
catch (e) {
|
|
152
|
+
rej(e);
|
|
153
|
+
}
|
|
154
|
+
}));
|
|
155
|
+
api.Cache.Set(key, prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
156
|
+
return prom;
|
|
150
157
|
});
|
|
151
158
|
}
|
|
152
159
|
AnnDocument.Get = Get;
|
|
153
|
-
function GetList(
|
|
160
|
+
function GetList(params) {
|
|
154
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
let { api, docType: type, req: reqParams } = params;
|
|
155
163
|
if (!type) {
|
|
156
164
|
type = "";
|
|
157
165
|
}
|
|
@@ -163,7 +171,9 @@
|
|
|
163
171
|
try {
|
|
164
172
|
const url = "documentViews" + (type ? "?type=" + type : "");
|
|
165
173
|
const data = yield api.GET(url, exports.Api.PrepReqParams(reqParams));
|
|
166
|
-
res(
|
|
174
|
+
res({
|
|
175
|
+
documents: data.Items
|
|
176
|
+
});
|
|
167
177
|
}
|
|
168
178
|
catch (e) {
|
|
169
179
|
rej(e);
|
|
@@ -193,8 +203,9 @@
|
|
|
193
203
|
EType["Form"] = "GENERIC";
|
|
194
204
|
EType["Markup"] = "MARKUP";
|
|
195
205
|
})(EType = CustomForm.EType || (CustomForm.EType = {}));
|
|
196
|
-
function Get(
|
|
206
|
+
function Get(params) {
|
|
197
207
|
return __awaiter(this, void 0, void 0, function* () {
|
|
208
|
+
const { api, formId: id, req: reqParams } = params;
|
|
198
209
|
if (!id) {
|
|
199
210
|
throw ("Id is required.");
|
|
200
211
|
}
|
|
@@ -202,14 +213,25 @@
|
|
|
202
213
|
if (cacheData) {
|
|
203
214
|
return cacheData;
|
|
204
215
|
}
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
216
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
217
|
+
try {
|
|
218
|
+
const data = yield api.GET(`customForm/${id}`, exports.Api.PrepReqParams(reqParams));
|
|
219
|
+
res({
|
|
220
|
+
form: data
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
catch (err) {
|
|
224
|
+
rej(err);
|
|
225
|
+
}
|
|
226
|
+
}));
|
|
227
|
+
api.Cache.Set(GetCacheKey(id), prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
228
|
+
return prom;
|
|
208
229
|
});
|
|
209
230
|
}
|
|
210
231
|
CustomForm.Get = Get;
|
|
211
|
-
function Delete(
|
|
232
|
+
function Delete(params) {
|
|
212
233
|
return __awaiter(this, void 0, void 0, function* () {
|
|
234
|
+
const { api, formId: id, req: reqParams } = params;
|
|
213
235
|
if (!id) {
|
|
214
236
|
throw ("Id is required.");
|
|
215
237
|
}
|
|
@@ -218,8 +240,9 @@
|
|
|
218
240
|
});
|
|
219
241
|
}
|
|
220
242
|
CustomForm.Delete = Delete;
|
|
221
|
-
function GetList(
|
|
243
|
+
function GetList(params) {
|
|
222
244
|
return __awaiter(this, void 0, void 0, function* () {
|
|
245
|
+
const { api, entityTypeId: typeId, req: reqParams } = params;
|
|
223
246
|
const url = typeId ? `entityType/${typeId}/customForms` : "customForms";
|
|
224
247
|
const cacheData = api.GetCacheItem(GetListCacheKey(typeId), reqParams);
|
|
225
248
|
if (cacheData) {
|
|
@@ -227,21 +250,26 @@
|
|
|
227
250
|
}
|
|
228
251
|
const req = api.GET(url, exports.Api.PrepReqParams(reqParams));
|
|
229
252
|
const prom = req.then((data) => {
|
|
230
|
-
return
|
|
253
|
+
return {
|
|
254
|
+
forms: data.Items
|
|
255
|
+
};
|
|
231
256
|
});
|
|
232
257
|
api.Cache.Set(GetListCacheKey(typeId), prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
233
258
|
return prom;
|
|
234
259
|
});
|
|
235
260
|
}
|
|
236
261
|
CustomForm.GetList = GetList;
|
|
237
|
-
function Update(
|
|
262
|
+
function Update(params) {
|
|
238
263
|
return __awaiter(this, void 0, void 0, function* () {
|
|
264
|
+
const { api, form: data, reqParams } = params;
|
|
239
265
|
if (!data.ID) {
|
|
240
266
|
data.ID = 0;
|
|
241
267
|
}
|
|
242
|
-
|
|
268
|
+
const res = yield api.POST(`customForm/${data.ID}`, data, exports.Api.PrepReqParams(reqParams));
|
|
243
269
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.CustomForm);
|
|
244
|
-
return
|
|
270
|
+
return {
|
|
271
|
+
form: res
|
|
272
|
+
};
|
|
245
273
|
});
|
|
246
274
|
}
|
|
247
275
|
CustomForm.Update = Update;
|
|
@@ -432,15 +460,26 @@
|
|
|
432
460
|
}
|
|
433
461
|
}
|
|
434
462
|
|
|
435
|
-
function parseResult(data
|
|
463
|
+
function parseResult(data) {
|
|
436
464
|
return __awaiter(this, void 0, void 0, function* () {
|
|
437
465
|
if (data.status == 200) {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
466
|
+
let encoding = "";
|
|
467
|
+
const type = data.headers.get("Content-Type");
|
|
468
|
+
const charset = type ? type.split(";").find((x) => x.trim().toLowerCase().startsWith("charset=")) : "";
|
|
469
|
+
if (charset && charset.includes("=")) {
|
|
470
|
+
encoding = charset.split("=")[1];
|
|
471
|
+
encoding = encoding.toLowerCase();
|
|
472
|
+
}
|
|
473
|
+
// Our API has a very specific utf-16 encoding.
|
|
474
|
+
if (encoding == "utf-16") {
|
|
475
|
+
encoding = exports.Api.EEncoding.UTF16;
|
|
476
|
+
}
|
|
477
|
+
if (!encoding || encoding == "utf-8") {
|
|
478
|
+
return data.json();
|
|
441
479
|
}
|
|
442
480
|
else {
|
|
443
|
-
|
|
481
|
+
const buffer = yield data.arrayBuffer();
|
|
482
|
+
return JSON.parse(new TextDecoder(encoding).decode(buffer));
|
|
444
483
|
}
|
|
445
484
|
}
|
|
446
485
|
else {
|
|
@@ -481,7 +520,6 @@
|
|
|
481
520
|
this.ssidHeader = value;
|
|
482
521
|
}
|
|
483
522
|
get(url, params) {
|
|
484
|
-
var _a;
|
|
485
523
|
return __awaiter(this, void 0, void 0, function* () {
|
|
486
524
|
if (!params) {
|
|
487
525
|
params = {};
|
|
@@ -494,11 +532,10 @@
|
|
|
494
532
|
const res = yield fetch(url, {
|
|
495
533
|
headers: params.headers
|
|
496
534
|
});
|
|
497
|
-
return parseResult(res
|
|
535
|
+
return parseResult(res);
|
|
498
536
|
});
|
|
499
537
|
}
|
|
500
538
|
delete(url, params) {
|
|
501
|
-
var _a;
|
|
502
539
|
return __awaiter(this, void 0, void 0, function* () {
|
|
503
540
|
if (!params) {
|
|
504
541
|
params = {};
|
|
@@ -509,11 +546,10 @@
|
|
|
509
546
|
headers: params.headers,
|
|
510
547
|
method: "DELETE"
|
|
511
548
|
});
|
|
512
|
-
return parseResult(res
|
|
549
|
+
return parseResult(res);
|
|
513
550
|
});
|
|
514
551
|
}
|
|
515
552
|
post(url, data, params) {
|
|
516
|
-
var _a;
|
|
517
553
|
return __awaiter(this, void 0, void 0, function* () {
|
|
518
554
|
if (!params) {
|
|
519
555
|
params = {};
|
|
@@ -531,11 +567,10 @@
|
|
|
531
567
|
method: "POST",
|
|
532
568
|
body: data
|
|
533
569
|
});
|
|
534
|
-
return parseResult(res
|
|
570
|
+
return parseResult(res);
|
|
535
571
|
});
|
|
536
572
|
}
|
|
537
573
|
put(url, data, params) {
|
|
538
|
-
var _a;
|
|
539
574
|
return __awaiter(this, void 0, void 0, function* () {
|
|
540
575
|
if (!params) {
|
|
541
576
|
params = {};
|
|
@@ -553,7 +588,7 @@
|
|
|
553
588
|
method: "PUT",
|
|
554
589
|
body: data
|
|
555
590
|
});
|
|
556
|
-
return parseResult(res
|
|
591
|
+
return parseResult(res);
|
|
557
592
|
});
|
|
558
593
|
}
|
|
559
594
|
upload(url, blob, params) {
|
|
@@ -648,20 +683,25 @@
|
|
|
648
683
|
EStarterContent["Default"] = "default";
|
|
649
684
|
EStarterContent["None"] = "none";
|
|
650
685
|
})(EStarterContent = Account.EStarterContent || (Account.EStarterContent = {}));
|
|
651
|
-
function Get(
|
|
686
|
+
function Get(params) {
|
|
652
687
|
return __awaiter(this, void 0, void 0, function* () {
|
|
688
|
+
const { api, accountId: id, req: reqParams } = params;
|
|
653
689
|
const cacheData = api.GetCacheItem(GetCacheKey(id), reqParams);
|
|
654
690
|
if (cacheData) {
|
|
655
691
|
return cacheData;
|
|
656
692
|
}
|
|
657
693
|
const req = yield api.GET(`account/${id}`, reqParams);
|
|
658
|
-
|
|
659
|
-
|
|
694
|
+
const resData = {
|
|
695
|
+
account: req
|
|
696
|
+
};
|
|
697
|
+
api.Cache.Set(GetCacheKey(id), resData, exports.Api.DEFAULT_CACHE_DURATION);
|
|
698
|
+
return resData;
|
|
660
699
|
});
|
|
661
700
|
}
|
|
662
701
|
Account.Get = Get;
|
|
663
|
-
function GetRelatedList(
|
|
702
|
+
function GetRelatedList(params) {
|
|
664
703
|
return __awaiter(this, void 0, void 0, function* () {
|
|
704
|
+
const { api, req: reqParams } = params;
|
|
665
705
|
const cacheData = api.GetCacheItem(GetListCacheKey(api.GetSessionId()), reqParams);
|
|
666
706
|
if (cacheData) {
|
|
667
707
|
return cacheData;
|
|
@@ -671,7 +711,9 @@
|
|
|
671
711
|
try {
|
|
672
712
|
const data = yield req;
|
|
673
713
|
const items = data.Items.filter((x) => !ACCOUNT_EXCLUSIONS.includes(x.ID));
|
|
674
|
-
res(
|
|
714
|
+
res({
|
|
715
|
+
accounts: items
|
|
716
|
+
});
|
|
675
717
|
}
|
|
676
718
|
catch (e) {
|
|
677
719
|
rej(e);
|
|
@@ -682,8 +724,9 @@
|
|
|
682
724
|
});
|
|
683
725
|
}
|
|
684
726
|
Account.GetRelatedList = GetRelatedList;
|
|
685
|
-
function GetAppSettings(
|
|
727
|
+
function GetAppSettings(params) {
|
|
686
728
|
return __awaiter(this, void 0, void 0, function* () {
|
|
729
|
+
const { api, accountId: id, appId, req: reqParams } = params;
|
|
687
730
|
const cacheData = api.GetCacheItem(GetCacheKey(id, appId), reqParams);
|
|
688
731
|
if (cacheData) {
|
|
689
732
|
return cacheData;
|
|
@@ -694,7 +737,9 @@
|
|
|
694
737
|
try {
|
|
695
738
|
const data = yield req;
|
|
696
739
|
const settings = (_a = data === null || data === void 0 ? void 0 : data["Application.Settings"]) !== null && _a !== void 0 ? _a : {};
|
|
697
|
-
res(
|
|
740
|
+
res({
|
|
741
|
+
settings: settings
|
|
742
|
+
});
|
|
698
743
|
}
|
|
699
744
|
catch (e) {
|
|
700
745
|
rej(e);
|
|
@@ -707,33 +752,28 @@
|
|
|
707
752
|
Account.GetAppSettings = GetAppSettings;
|
|
708
753
|
/**
|
|
709
754
|
* WARNING: Do not update API settings without knowing what you're doing.
|
|
710
|
-
* @param
|
|
711
|
-
* @param id
|
|
712
|
-
* @param appId
|
|
713
|
-
* @param data
|
|
714
|
-
* @param reqParams
|
|
755
|
+
* @param params
|
|
715
756
|
* @returns
|
|
716
757
|
*/
|
|
717
|
-
function UpdateAppSettings(
|
|
758
|
+
function UpdateAppSettings(params) {
|
|
718
759
|
return __awaiter(this, void 0, void 0, function* () {
|
|
719
|
-
|
|
760
|
+
const { api, accountId: id, appId, settings: data, req: reqParams } = params;
|
|
761
|
+
const res = yield api.POST(`account/${id}/applicationSettings/${appId}`, data, reqParams);
|
|
720
762
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + id);
|
|
721
|
-
return
|
|
763
|
+
return {
|
|
764
|
+
settings: res
|
|
765
|
+
};
|
|
722
766
|
});
|
|
723
767
|
}
|
|
724
768
|
Account.UpdateAppSettings = UpdateAppSettings;
|
|
725
769
|
/**
|
|
726
770
|
* Creates a new Bruce account using given details.
|
|
727
|
-
* @param
|
|
728
|
-
* @param id
|
|
729
|
-
* @param name
|
|
730
|
-
* @param region
|
|
731
|
-
* @param starterContent
|
|
732
|
-
* @param reqParams
|
|
771
|
+
* @param params
|
|
733
772
|
* @returns
|
|
734
773
|
*/
|
|
735
|
-
function Create(
|
|
774
|
+
function Create(params) {
|
|
736
775
|
return __awaiter(this, void 0, void 0, function* () {
|
|
776
|
+
let { api, accountId: id, name, region, starterContent, req: reqParams } = params;
|
|
737
777
|
if (!id || !name || !region) {
|
|
738
778
|
throw new Error("Id, Name and Region are required.");
|
|
739
779
|
}
|
|
@@ -745,14 +785,18 @@
|
|
|
745
785
|
"DBLocation": region,
|
|
746
786
|
"StarterContent": starterContent
|
|
747
787
|
};
|
|
748
|
-
const res = api.POST(`clientAccount/${id}`, reqData, exports.Api.PrepReqParams(reqParams));
|
|
788
|
+
const res = yield api.POST(`clientAccount/${id}`, reqData, exports.Api.PrepReqParams(reqParams));
|
|
789
|
+
const resData = {
|
|
790
|
+
account: res
|
|
791
|
+
};
|
|
749
792
|
api.Cache.Remove(GetListCacheKey(api.GetSessionId()));
|
|
750
|
-
return
|
|
793
|
+
return resData;
|
|
751
794
|
});
|
|
752
795
|
}
|
|
753
796
|
Account.Create = Create;
|
|
754
|
-
function GetDbRegions(
|
|
797
|
+
function GetDbRegions(params) {
|
|
755
798
|
return __awaiter(this, void 0, void 0, function* () {
|
|
799
|
+
const { api, req: reqParams } = params;
|
|
756
800
|
const cacheData = api.GetCacheItem(GetDbRegionListCacheKey(), reqParams);
|
|
757
801
|
if (cacheData) {
|
|
758
802
|
return cacheData;
|
|
@@ -760,7 +804,7 @@
|
|
|
760
804
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
761
805
|
try {
|
|
762
806
|
const data = yield api.GET("config/regions", exports.Api.PrepReqParams(reqParams));
|
|
763
|
-
res(data
|
|
807
|
+
res(data);
|
|
764
808
|
}
|
|
765
809
|
catch (e) {
|
|
766
810
|
rej(e);
|
|
@@ -971,7 +1015,11 @@
|
|
|
971
1015
|
// Attempt to load an account specific base url.
|
|
972
1016
|
// This could be one with a region specific endpoint.
|
|
973
1017
|
try {
|
|
974
|
-
const settings = yield exports.Account.GetAppSettings(
|
|
1018
|
+
const { settings } = yield exports.Account.GetAppSettings({
|
|
1019
|
+
api: cam,
|
|
1020
|
+
accountId: this.accountId,
|
|
1021
|
+
appId: exports.Account.EAppId.BruceApi
|
|
1022
|
+
});
|
|
975
1023
|
if (this.loadCancelled) {
|
|
976
1024
|
console.warn("BruceApi: Loading was cancelled due to SetBaseUrl being called, not setting regional base url.");
|
|
977
1025
|
return;
|
|
@@ -1424,8 +1472,9 @@
|
|
|
1424
1472
|
return `${exports.Api.ECacheKey.Entity}${exports.Api.ECacheKey.Id}${entityId}`;
|
|
1425
1473
|
}
|
|
1426
1474
|
Entity.GetCacheKey = GetCacheKey;
|
|
1427
|
-
function Get(
|
|
1475
|
+
function Get(params) {
|
|
1428
1476
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1477
|
+
const { api, entityId, req: reqParams } = params;
|
|
1429
1478
|
if (!entityId) {
|
|
1430
1479
|
throw ("Entity ID is required.");
|
|
1431
1480
|
}
|
|
@@ -1434,14 +1483,25 @@
|
|
|
1434
1483
|
if (cacheData) {
|
|
1435
1484
|
return cacheData;
|
|
1436
1485
|
}
|
|
1437
|
-
const
|
|
1438
|
-
|
|
1439
|
-
|
|
1486
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
1487
|
+
try {
|
|
1488
|
+
const data = yield api.GET(`entity/${entityId}`, exports.Api.PrepReqParams(reqParams));
|
|
1489
|
+
res({
|
|
1490
|
+
entity: data
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
catch (e) {
|
|
1494
|
+
rej(e);
|
|
1495
|
+
}
|
|
1496
|
+
}));
|
|
1497
|
+
api.Cache.Set(key, prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
1498
|
+
return prom;
|
|
1440
1499
|
});
|
|
1441
1500
|
}
|
|
1442
1501
|
Entity.Get = Get;
|
|
1443
|
-
function GetListByIds(
|
|
1502
|
+
function GetListByIds(params) {
|
|
1444
1503
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1504
|
+
const { api, entityIds, req: reqParams } = params;
|
|
1445
1505
|
if (!entityIds.length) {
|
|
1446
1506
|
throw ("Entity IDs are required.");
|
|
1447
1507
|
}
|
|
@@ -1486,12 +1546,15 @@
|
|
|
1486
1546
|
reqs.push(prom);
|
|
1487
1547
|
}
|
|
1488
1548
|
}
|
|
1489
|
-
return
|
|
1549
|
+
return {
|
|
1550
|
+
entities: (yield Promise.all(reqs)).filter(x => !!x)
|
|
1551
|
+
};
|
|
1490
1552
|
});
|
|
1491
1553
|
}
|
|
1492
1554
|
Entity.GetListByIds = GetListByIds;
|
|
1493
|
-
function Delete(
|
|
1555
|
+
function Delete(params) {
|
|
1494
1556
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1557
|
+
const { api, entityId, req: reqParams } = params;
|
|
1495
1558
|
if (!entityId) {
|
|
1496
1559
|
throw ("Entity ID is required.");
|
|
1497
1560
|
}
|
|
@@ -1500,8 +1563,9 @@
|
|
|
1500
1563
|
});
|
|
1501
1564
|
}
|
|
1502
1565
|
Entity.Delete = Delete;
|
|
1503
|
-
function DeleteList(
|
|
1566
|
+
function DeleteList(params) {
|
|
1504
1567
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1568
|
+
const { api, entityIds, req: reqParams } = params;
|
|
1505
1569
|
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
1506
1570
|
throw ("Entity IDs are required.");
|
|
1507
1571
|
}
|
|
@@ -1515,9 +1579,10 @@
|
|
|
1515
1579
|
});
|
|
1516
1580
|
}
|
|
1517
1581
|
Entity.DeleteList = DeleteList;
|
|
1518
|
-
function Update(
|
|
1582
|
+
function Update(params) {
|
|
1519
1583
|
var _a, _b;
|
|
1520
1584
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1585
|
+
const { api, entity: data, override, req: reqParams } = params;
|
|
1521
1586
|
if (!((_a = data === null || data === void 0 ? void 0 : data.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"])) {
|
|
1522
1587
|
throw ("Entity Type ID is required.");
|
|
1523
1588
|
}
|
|
@@ -1525,14 +1590,17 @@
|
|
|
1525
1590
|
data.Bruce = Object.assign(Object.assign({}, data.Bruce), { ID: exports.ObjectUtils.UId() });
|
|
1526
1591
|
}
|
|
1527
1592
|
const reqUrl = `entity/${data.Bruce.ID}/?dataoverride=${override}&BruceEntityType=${data.Bruce["EntityType.ID"]}`;
|
|
1528
|
-
|
|
1593
|
+
const res = yield api.POST(reqUrl, data, exports.Api.PrepReqParams(reqParams));
|
|
1529
1594
|
api.Cache.Remove(GetCacheKey(data.Bruce.ID));
|
|
1530
|
-
return
|
|
1595
|
+
return {
|
|
1596
|
+
entity: res
|
|
1597
|
+
};
|
|
1531
1598
|
});
|
|
1532
1599
|
}
|
|
1533
1600
|
Entity.Update = Update;
|
|
1534
|
-
function RemoveTag(
|
|
1601
|
+
function RemoveTag(params) {
|
|
1535
1602
|
var _a;
|
|
1603
|
+
const { entity: data, tagId } = params;
|
|
1536
1604
|
const tags = (_a = data.Bruce["Layer.ID"]) !== null && _a !== void 0 ? _a : [];
|
|
1537
1605
|
const index = tags.indexOf(tagId);
|
|
1538
1606
|
if (index >= 0) {
|
|
@@ -1541,8 +1609,9 @@
|
|
|
1541
1609
|
}
|
|
1542
1610
|
}
|
|
1543
1611
|
Entity.RemoveTag = RemoveTag;
|
|
1544
|
-
function AddTag(
|
|
1612
|
+
function AddTag(params) {
|
|
1545
1613
|
var _a;
|
|
1614
|
+
const { entity: data, tagId } = params;
|
|
1546
1615
|
const tags = (_a = data.Bruce["Layer.ID"]) !== null && _a !== void 0 ? _a : [];
|
|
1547
1616
|
if (!tags.includes(tagId)) {
|
|
1548
1617
|
tags.push(tagId);
|
|
@@ -1550,7 +1619,8 @@
|
|
|
1550
1619
|
}
|
|
1551
1620
|
}
|
|
1552
1621
|
Entity.AddTag = AddTag;
|
|
1553
|
-
function SetValue(
|
|
1622
|
+
function SetValue(params) {
|
|
1623
|
+
const { entity: data, path, value } = params;
|
|
1554
1624
|
let curData = data;
|
|
1555
1625
|
for (let i = 0; i < path.length; i++) {
|
|
1556
1626
|
const step = path[i];
|
|
@@ -1565,8 +1635,9 @@
|
|
|
1565
1635
|
}
|
|
1566
1636
|
}
|
|
1567
1637
|
Entity.SetValue = SetValue;
|
|
1568
|
-
function GetValue(
|
|
1638
|
+
function GetValue(params) {
|
|
1569
1639
|
var _a;
|
|
1640
|
+
const { entity: data, path } = params;
|
|
1570
1641
|
// Backwards compatibility.
|
|
1571
1642
|
if (path.length == 1 && path[0] == "ID") {
|
|
1572
1643
|
return (_a = data.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
|
|
@@ -1587,21 +1658,23 @@
|
|
|
1587
1658
|
Entity.GetValue = GetValue;
|
|
1588
1659
|
/**
|
|
1589
1660
|
* Calculates an entity's name based on attribute priority set in the type.
|
|
1590
|
-
* @param
|
|
1591
|
-
* @param type
|
|
1592
|
-
* @param defaultToId
|
|
1661
|
+
* @param params
|
|
1593
1662
|
* If true, will return the entity ID if no name can be calculated.
|
|
1594
1663
|
* Otherwise it returns null.
|
|
1595
1664
|
* @returns
|
|
1596
1665
|
*/
|
|
1597
|
-
function CalculateName(
|
|
1666
|
+
function CalculateName(params) {
|
|
1667
|
+
const { entity, type, defaultToId = true } = params;
|
|
1598
1668
|
const attrStr = type.DisplayNameAttributePath;
|
|
1599
1669
|
if (attrStr) {
|
|
1600
1670
|
const attrPaths = attrStr.split(",");
|
|
1601
1671
|
for (let i = 0; i < attrPaths.length; i++) {
|
|
1602
1672
|
const pathStr = attrPaths[i];
|
|
1603
1673
|
const path = exports.PathUtils.Parse(pathStr);
|
|
1604
|
-
const name = Entity.GetValue(
|
|
1674
|
+
const name = Entity.GetValue({
|
|
1675
|
+
entity: entity,
|
|
1676
|
+
path
|
|
1677
|
+
});
|
|
1605
1678
|
if (name && typeof name != "object") {
|
|
1606
1679
|
return name;
|
|
1607
1680
|
}
|
|
@@ -1610,54 +1683,50 @@
|
|
|
1610
1683
|
return defaultToId ? entity.Bruce.ID : null;
|
|
1611
1684
|
}
|
|
1612
1685
|
Entity.CalculateName = CalculateName;
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
requestFilter["Bruce.Layer.ID"] = {
|
|
1625
|
-
equals: filter.layerIds
|
|
1626
|
-
};
|
|
1627
|
-
}
|
|
1628
|
-
if (filter.bounds) {
|
|
1629
|
-
requestFilter["geometry"] = {
|
|
1630
|
-
"intersects": [
|
|
1631
|
-
filter.bounds.south,
|
|
1632
|
-
filter.bounds.north,
|
|
1633
|
-
filter.bounds.west,
|
|
1634
|
-
filter.bounds.east
|
|
1635
|
-
]
|
|
1636
|
-
};
|
|
1637
|
-
}
|
|
1638
|
-
const body = {
|
|
1639
|
-
SortOrder: filter.sortOrder == exports.Api.ESortOrder.Asc ? "ASC" : "DESC",
|
|
1640
|
-
OrderBy: filter.orderBy,
|
|
1641
|
-
Filter: requestFilter,
|
|
1642
|
-
LODType: filter.lodCategoryId,
|
|
1643
|
-
BruceEntityType: filter.entityTypeId,
|
|
1644
|
-
PageIndex: filter.pageIndex,
|
|
1645
|
-
PageSize: filter.pageSize
|
|
1646
|
-
};
|
|
1647
|
-
const data = yield api.POST("entities", body, exports.Api.PrepReqParams(reqParams));
|
|
1648
|
-
const entities = data.Items;
|
|
1649
|
-
for (let i = 0; i < entities.length; i++) {
|
|
1650
|
-
const entity = entities[i];
|
|
1651
|
-
const id = entity.Bruce.ID;
|
|
1652
|
-
api.Cache.Set(GetCacheKey(id), entity, exports.Api.DEFAULT_CACHE_DURATION);
|
|
1653
|
-
}
|
|
1654
|
-
return entities;
|
|
1655
|
-
});
|
|
1686
|
+
function GetList(params) {
|
|
1687
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1688
|
+
const { api, filter, req: reqParams } = params;
|
|
1689
|
+
let requestFilter = {};
|
|
1690
|
+
if (filter.entityTypeConditions) {
|
|
1691
|
+
requestFilter = Object.assign({}, filter.entityTypeConditions);
|
|
1692
|
+
}
|
|
1693
|
+
if (filter.layerIds != null && filter.layerIds.length > 0) {
|
|
1694
|
+
requestFilter["Bruce.Layer.ID"] = {
|
|
1695
|
+
equals: filter.layerIds
|
|
1696
|
+
};
|
|
1656
1697
|
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1698
|
+
if (filter.bounds) {
|
|
1699
|
+
requestFilter["geometry"] = {
|
|
1700
|
+
"intersects": [
|
|
1701
|
+
filter.bounds.south,
|
|
1702
|
+
filter.bounds.north,
|
|
1703
|
+
filter.bounds.west,
|
|
1704
|
+
filter.bounds.east
|
|
1705
|
+
]
|
|
1706
|
+
};
|
|
1707
|
+
}
|
|
1708
|
+
const body = {
|
|
1709
|
+
SortOrder: filter.sortOrder == exports.Api.ESortOrder.Asc ? "ASC" : "DESC",
|
|
1710
|
+
OrderBy: filter.orderBy,
|
|
1711
|
+
Filter: requestFilter,
|
|
1712
|
+
LODType: filter.lodCategoryId,
|
|
1713
|
+
BruceEntityType: filter.entityTypeId,
|
|
1714
|
+
PageIndex: filter.pageIndex,
|
|
1715
|
+
PageSize: filter.pageSize
|
|
1716
|
+
};
|
|
1717
|
+
const data = yield api.POST("entities", body, exports.Api.PrepReqParams(reqParams));
|
|
1718
|
+
const entities = data.Items;
|
|
1719
|
+
for (let i = 0; i < entities.length; i++) {
|
|
1720
|
+
const entity = entities[i];
|
|
1721
|
+
const id = entity.Bruce.ID;
|
|
1722
|
+
api.Cache.Set(GetCacheKey(id), entity, exports.Api.DEFAULT_CACHE_DURATION);
|
|
1723
|
+
}
|
|
1724
|
+
return {
|
|
1725
|
+
entities: entities
|
|
1726
|
+
};
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1729
|
+
Entity.GetList = GetList;
|
|
1661
1730
|
})(exports.Entity || (exports.Entity = {}));
|
|
1662
1731
|
|
|
1663
1732
|
function getVariable(str) {
|
|
@@ -1680,7 +1749,8 @@
|
|
|
1680
1749
|
* @param legacyParse
|
|
1681
1750
|
* @returns
|
|
1682
1751
|
*/
|
|
1683
|
-
function SwapValues(
|
|
1752
|
+
function SwapValues(params) {
|
|
1753
|
+
let { str, entity: data, legacyParse } = params;
|
|
1684
1754
|
if (!legacyParse) {
|
|
1685
1755
|
legacyParse = false;
|
|
1686
1756
|
}
|
|
@@ -1690,7 +1760,10 @@
|
|
|
1690
1760
|
const path = legacyParse ? exports.PathUtils.ParseLegacy(variable.path) : exports.PathUtils.Parse(variable.path);
|
|
1691
1761
|
let value = "";
|
|
1692
1762
|
if (path.length > 0) {
|
|
1693
|
-
value = exports.Entity.GetValue(
|
|
1763
|
+
value = exports.Entity.GetValue({
|
|
1764
|
+
entity: data,
|
|
1765
|
+
path: path
|
|
1766
|
+
});
|
|
1694
1767
|
}
|
|
1695
1768
|
str = str.replace(variable.text, value);
|
|
1696
1769
|
}
|
|
@@ -1840,7 +1913,10 @@
|
|
|
1840
1913
|
Calculator.GetColor = GetColor;
|
|
1841
1914
|
function GetMappingValue(value, entity) {
|
|
1842
1915
|
const attrPath = parseLegacyPath(value.field);
|
|
1843
|
-
|
|
1916
|
+
let eValue = exports.Entity.GetValue({
|
|
1917
|
+
entity: entity,
|
|
1918
|
+
path: attrPath
|
|
1919
|
+
});
|
|
1844
1920
|
const isValueNum = !isNaN(+eValue);
|
|
1845
1921
|
for (let i = 0; i < value.values.length; i++) {
|
|
1846
1922
|
const option = value.values[i];
|
|
@@ -1881,7 +1957,10 @@
|
|
|
1881
1957
|
Calculator.GetMappingValue = GetMappingValue;
|
|
1882
1958
|
function GetGradientValue(value, entity) {
|
|
1883
1959
|
const attrPath = parseLegacyPath(value.field);
|
|
1884
|
-
let eValue = exports.Entity.GetValue(
|
|
1960
|
+
let eValue = exports.Entity.GetValue({
|
|
1961
|
+
entity: entity,
|
|
1962
|
+
path: attrPath
|
|
1963
|
+
});
|
|
1885
1964
|
eValue = Math.min(Math.max(eValue, value.min), value.max);
|
|
1886
1965
|
if (eValue < value.points[0].position) {
|
|
1887
1966
|
return exports.Color.ColorFromStr(value.points[0].color);
|
|
@@ -1910,7 +1989,10 @@
|
|
|
1910
1989
|
function GetInputValue(value, entity) {
|
|
1911
1990
|
if (typeof value == "string") {
|
|
1912
1991
|
try {
|
|
1913
|
-
value = exports.BruceVariable.SwapValues(
|
|
1992
|
+
value = exports.BruceVariable.SwapValues({
|
|
1993
|
+
str: value,
|
|
1994
|
+
entity: entity
|
|
1995
|
+
});
|
|
1914
1996
|
const eval2 = eval; // https://rollupjs.org/guide/en/#avoiding-eval
|
|
1915
1997
|
return eval2(value);
|
|
1916
1998
|
}
|
|
@@ -1977,17 +2059,17 @@
|
|
|
1977
2059
|
return filteredList;
|
|
1978
2060
|
}
|
|
1979
2061
|
Geometry.RemoveRepeatPoints = RemoveRepeatPoints;
|
|
1980
|
-
function ParsePoints(
|
|
1981
|
-
|
|
2062
|
+
function ParsePoints(pointsStr) {
|
|
2063
|
+
pointsStr = pointsStr.replace(/[^\d.,-\s]/g, "");
|
|
1982
2064
|
let splitterCoordinates = " ";
|
|
1983
2065
|
let splitterAxis = ",";
|
|
1984
|
-
const commaIndex =
|
|
1985
|
-
const spaceIndex =
|
|
2066
|
+
const commaIndex = pointsStr.indexOf(",");
|
|
2067
|
+
const spaceIndex = pointsStr.indexOf(" ");
|
|
1986
2068
|
if ((spaceIndex > -1 && commaIndex > spaceIndex) || commaIndex <= -1) {
|
|
1987
2069
|
splitterCoordinates = ",";
|
|
1988
2070
|
splitterAxis = " ";
|
|
1989
2071
|
}
|
|
1990
|
-
let points =
|
|
2072
|
+
let points = pointsStr.trim().split(splitterCoordinates);
|
|
1991
2073
|
points = points.filter(a => a != "");
|
|
1992
2074
|
const result = [];
|
|
1993
2075
|
for (let i = 0; i < points.length; i++) {
|
|
@@ -2436,8 +2518,9 @@
|
|
|
2436
2518
|
EType["Photo"] = "photo";
|
|
2437
2519
|
EType["Document"] = "document";
|
|
2438
2520
|
})(EType = EntityAttachmentType.EType || (EntityAttachmentType.EType = {}));
|
|
2439
|
-
function Delete(
|
|
2521
|
+
function Delete(params) {
|
|
2440
2522
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2523
|
+
const { api, attachmentTypeId: id, req: reqParams } = params;
|
|
2441
2524
|
if (!id) {
|
|
2442
2525
|
throw ("Type ID is required.");
|
|
2443
2526
|
}
|
|
@@ -2447,20 +2530,24 @@
|
|
|
2447
2530
|
});
|
|
2448
2531
|
}
|
|
2449
2532
|
EntityAttachmentType.Delete = Delete;
|
|
2450
|
-
function Update(
|
|
2533
|
+
function Update(params) {
|
|
2451
2534
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2535
|
+
const { api, attachmentType: data, req: reqParams } = params;
|
|
2452
2536
|
if (!(data === null || data === void 0 ? void 0 : data.ID)) {
|
|
2453
2537
|
throw ("Type ID is required.");
|
|
2454
2538
|
}
|
|
2455
|
-
|
|
2539
|
+
const res = yield api.POST(`entityAttachmentType/${data.ID}`, data, exports.Api.PrepReqParams(reqParams));
|
|
2456
2540
|
api.Cache.Remove(GetCacheKey(data.ID));
|
|
2457
2541
|
api.Cache.Remove(GetListCacheKey());
|
|
2458
|
-
return
|
|
2542
|
+
return {
|
|
2543
|
+
attachmentType: res
|
|
2544
|
+
};
|
|
2459
2545
|
});
|
|
2460
2546
|
}
|
|
2461
2547
|
EntityAttachmentType.Update = Update;
|
|
2462
|
-
function GetList(
|
|
2548
|
+
function GetList(params) {
|
|
2463
2549
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2550
|
+
const { api, reqParams } = params;
|
|
2464
2551
|
const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
|
|
2465
2552
|
if (cacheData) {
|
|
2466
2553
|
return cacheData;
|
|
@@ -2468,7 +2555,9 @@
|
|
|
2468
2555
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
2469
2556
|
try {
|
|
2470
2557
|
const data = yield api.GET(`entityAttachmentTypes`, exports.Api.PrepReqParams(reqParams));
|
|
2471
|
-
res(
|
|
2558
|
+
res({
|
|
2559
|
+
attachmentTypes: data.Items
|
|
2560
|
+
});
|
|
2472
2561
|
}
|
|
2473
2562
|
catch (e) {
|
|
2474
2563
|
rej(e);
|
|
@@ -2490,21 +2579,25 @@
|
|
|
2490
2579
|
return exports.Api.ECacheKey.Attachment + exports.Api.ECacheKey.Entity + exports.Api.ECacheKey.Id + entityId;
|
|
2491
2580
|
}
|
|
2492
2581
|
EntityAttachment.GetListCacheKey = GetListCacheKey;
|
|
2493
|
-
function Update(
|
|
2582
|
+
function Update(params) {
|
|
2494
2583
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2584
|
+
const { api, attachment: data, req: reqParams } = params;
|
|
2495
2585
|
if (!(data === null || data === void 0 ? void 0 : data["Entity.ID"]) || !(data === null || data === void 0 ? void 0 : data["EntityAttachmentType.ID"]) || !(data === null || data === void 0 ? void 0 : data["ClientFile.ID"])) {
|
|
2496
2586
|
throw ("Entity ID, Type ID, and File ID are required.");
|
|
2497
2587
|
}
|
|
2498
2588
|
const url = `entity/${data["Entity.ID"]}/attachment/${data.oldAttachmentTypeId}/${data["ClientFile.ID"]}`;
|
|
2499
|
-
|
|
2589
|
+
const res = yield api.PUT(url, data, exports.Api.PrepReqParams(reqParams));
|
|
2500
2590
|
api.Cache.Remove(GetCacheKey(data["Entity.ID"], data["EntityAttachmentType.ID"], data["ClientFile.ID"]));
|
|
2501
2591
|
api.Cache.RemoveByStartsWith(GetListCacheKey(data["Entity.ID"]));
|
|
2502
|
-
return
|
|
2592
|
+
return {
|
|
2593
|
+
attachment: res
|
|
2594
|
+
};
|
|
2503
2595
|
});
|
|
2504
2596
|
}
|
|
2505
2597
|
EntityAttachment.Update = Update;
|
|
2506
|
-
function UpdateOrder(
|
|
2598
|
+
function UpdateOrder(params) {
|
|
2507
2599
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2600
|
+
const { api, entityId, attachmentTypeId: typeId, fileIds, req: reqParams } = params;
|
|
2508
2601
|
if (!entityId || !typeId || !(fileIds === null || fileIds === void 0 ? void 0 : fileIds.length)) {
|
|
2509
2602
|
throw ("Entity ID, Type ID, and File IDs are required.");
|
|
2510
2603
|
}
|
|
@@ -2520,8 +2613,9 @@
|
|
|
2520
2613
|
});
|
|
2521
2614
|
}
|
|
2522
2615
|
EntityAttachment.UpdateOrder = UpdateOrder;
|
|
2523
|
-
function Delete(
|
|
2616
|
+
function Delete(params) {
|
|
2524
2617
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2618
|
+
const { api, attachment: data, req: reqParams } = params;
|
|
2525
2619
|
if (!(data === null || data === void 0 ? void 0 : data["Entity.ID"]) || !(data === null || data === void 0 ? void 0 : data["EntityAttachmentType.ID"]) || !(data === null || data === void 0 ? void 0 : data["ClientFile.ID"])) {
|
|
2526
2620
|
throw ("Entity ID, Type ID, and File ID are required.");
|
|
2527
2621
|
}
|
|
@@ -2534,8 +2628,9 @@
|
|
|
2534
2628
|
});
|
|
2535
2629
|
}
|
|
2536
2630
|
EntityAttachment.Delete = Delete;
|
|
2537
|
-
function DeleteByFileIds(
|
|
2631
|
+
function DeleteByFileIds(params) {
|
|
2538
2632
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2633
|
+
const { api, entityId, attachmentTypeId: typeId, fileIds, req: reqParams } = params;
|
|
2539
2634
|
if (!entityId || !typeId || !(fileIds === null || fileIds === void 0 ? void 0 : fileIds.length)) {
|
|
2540
2635
|
throw ("Entity ID, Type ID, and File IDs are required.");
|
|
2541
2636
|
}
|
|
@@ -2550,8 +2645,9 @@
|
|
|
2550
2645
|
});
|
|
2551
2646
|
}
|
|
2552
2647
|
EntityAttachment.DeleteByFileIds = DeleteByFileIds;
|
|
2553
|
-
function GetListByEntityId(
|
|
2648
|
+
function GetListByEntityId(params) {
|
|
2554
2649
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2650
|
+
const { api, entityId, req: reqParams } = params;
|
|
2555
2651
|
if (!entityId) {
|
|
2556
2652
|
throw ("Entity ID is required.");
|
|
2557
2653
|
}
|
|
@@ -2562,7 +2658,9 @@
|
|
|
2562
2658
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
2563
2659
|
try {
|
|
2564
2660
|
const data = yield api.GET(`entity/${entityId}/attachments`, exports.Api.PrepReqParams(reqParams));
|
|
2565
|
-
res(
|
|
2661
|
+
res({
|
|
2662
|
+
attachments: data.Items
|
|
2663
|
+
});
|
|
2566
2664
|
}
|
|
2567
2665
|
catch (e) {
|
|
2568
2666
|
rej(e);
|
|
@@ -2573,15 +2671,18 @@
|
|
|
2573
2671
|
});
|
|
2574
2672
|
}
|
|
2575
2673
|
EntityAttachment.GetListByEntityId = GetListByEntityId;
|
|
2576
|
-
function Upload(
|
|
2674
|
+
function Upload(params) {
|
|
2577
2675
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2676
|
+
const { api, file, entityId, attachmentTypeId: typeId, req: reqParams } = params;
|
|
2578
2677
|
if (!entityId || !typeId || !file) {
|
|
2579
2678
|
throw ("Entity ID, Type ID, and File are required.");
|
|
2580
2679
|
}
|
|
2581
2680
|
const url = `entity/${entityId}/attachment/${typeId}`;
|
|
2582
|
-
const
|
|
2681
|
+
const res = yield api.UPLOAD(url, file, reqParams);
|
|
2583
2682
|
api.Cache.RemoveByStartsWith(GetListCacheKey(entityId));
|
|
2584
|
-
return
|
|
2683
|
+
return {
|
|
2684
|
+
attachment: res
|
|
2685
|
+
};
|
|
2585
2686
|
});
|
|
2586
2687
|
}
|
|
2587
2688
|
EntityAttachment.Upload = Upload;
|
|
@@ -2596,21 +2697,25 @@
|
|
|
2596
2697
|
return exports.Api.ECacheKey.Comment + exports.Api.ECacheKey.Entity + exports.Api.ECacheKey.Id + entityId;
|
|
2597
2698
|
}
|
|
2598
2699
|
EntityComment.GetListCacheKey = GetListCacheKey;
|
|
2599
|
-
function Update(
|
|
2700
|
+
function Update(params) {
|
|
2600
2701
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2702
|
+
const { api, comment: data, req: reqParams } = params;
|
|
2601
2703
|
if (!(data === null || data === void 0 ? void 0 : data["TargetObject.ID"])) {
|
|
2602
2704
|
throw ("TargetObject.ID (entity id) is required.");
|
|
2603
2705
|
}
|
|
2604
2706
|
const url = `entity/${data["TargetObject.ID"]}/comment` + (data.ID == null ? "" : "/" + data.ID);
|
|
2605
|
-
|
|
2707
|
+
const res = yield api.POST(url, data, exports.Api.PrepReqParams(reqParams));
|
|
2606
2708
|
api.Cache.Remove(GetCacheKey(data.ID));
|
|
2607
2709
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Comment + exports.Api.ECacheKey.Entity);
|
|
2608
|
-
return
|
|
2710
|
+
return {
|
|
2711
|
+
comment: res
|
|
2712
|
+
};
|
|
2609
2713
|
});
|
|
2610
2714
|
}
|
|
2611
2715
|
EntityComment.Update = Update;
|
|
2612
|
-
function Delete(
|
|
2716
|
+
function Delete(params) {
|
|
2613
2717
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2718
|
+
const { api, entityId, commentId, req: reqParams } = params;
|
|
2614
2719
|
if (!commentId) {
|
|
2615
2720
|
throw ("Comment ID is required.");
|
|
2616
2721
|
}
|
|
@@ -2620,8 +2725,9 @@
|
|
|
2620
2725
|
});
|
|
2621
2726
|
}
|
|
2622
2727
|
EntityComment.Delete = Delete;
|
|
2623
|
-
function GetListByEntityId(
|
|
2728
|
+
function GetListByEntityId(params) {
|
|
2624
2729
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2730
|
+
const { api, entityId, req: reqParams } = params;
|
|
2625
2731
|
if (!entityId) {
|
|
2626
2732
|
throw ("Entity ID is required.");
|
|
2627
2733
|
}
|
|
@@ -2632,7 +2738,9 @@
|
|
|
2632
2738
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
2633
2739
|
try {
|
|
2634
2740
|
const data = yield api.GET(`entity/${entityId}/comments`, exports.Api.PrepReqParams(reqParams));
|
|
2635
|
-
res(
|
|
2741
|
+
res({
|
|
2742
|
+
comments: data.Items
|
|
2743
|
+
});
|
|
2636
2744
|
}
|
|
2637
2745
|
catch (e) {
|
|
2638
2746
|
rej(e);
|
|
@@ -2654,21 +2762,25 @@
|
|
|
2654
2762
|
return exports.Api.ECacheKey.Link + exports.Api.ECacheKey.Entity + exports.Api.ECacheKey.Id + entityId;
|
|
2655
2763
|
}
|
|
2656
2764
|
EntityLink.GetListCacheKey = GetListCacheKey;
|
|
2657
|
-
function Update(
|
|
2765
|
+
function Update(params) {
|
|
2658
2766
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2767
|
+
const { api, link: data, req: reqParams } = params;
|
|
2659
2768
|
if (!(data === null || data === void 0 ? void 0 : data["Entity.ID"])) {
|
|
2660
2769
|
throw ("Entity ID is required.");
|
|
2661
2770
|
}
|
|
2662
2771
|
const url = `entity/${data["Entity.ID"]}/link` + (data.ID == null ? "" : "/" + data.ID);
|
|
2663
|
-
|
|
2772
|
+
const res = yield api.POST(url, data, exports.Api.PrepReqParams(reqParams));
|
|
2664
2773
|
api.Cache.Remove(GetCacheKey(data.ID));
|
|
2665
2774
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Link + exports.Api.ECacheKey.Entity);
|
|
2666
|
-
return
|
|
2775
|
+
return {
|
|
2776
|
+
link: res
|
|
2777
|
+
};
|
|
2667
2778
|
});
|
|
2668
2779
|
}
|
|
2669
2780
|
EntityLink.Update = Update;
|
|
2670
|
-
function Delete(
|
|
2781
|
+
function Delete(params) {
|
|
2671
2782
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2783
|
+
const { api, entityId, linkId, req: reqParams } = params;
|
|
2672
2784
|
if (!linkId) {
|
|
2673
2785
|
throw ("Link ID is required.");
|
|
2674
2786
|
}
|
|
@@ -2678,8 +2790,9 @@
|
|
|
2678
2790
|
});
|
|
2679
2791
|
}
|
|
2680
2792
|
EntityLink.Delete = Delete;
|
|
2681
|
-
function GetListByEntityId(
|
|
2793
|
+
function GetListByEntityId(params) {
|
|
2682
2794
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2795
|
+
const { api, entityId, req: reqParams } = params;
|
|
2683
2796
|
if (!entityId) {
|
|
2684
2797
|
throw ("Entity ID is required.");
|
|
2685
2798
|
}
|
|
@@ -2690,7 +2803,9 @@
|
|
|
2690
2803
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
2691
2804
|
try {
|
|
2692
2805
|
const data = yield api.GET(`entity/${entityId}/links`, exports.Api.PrepReqParams(reqParams));
|
|
2693
|
-
res(
|
|
2806
|
+
res({
|
|
2807
|
+
links: data.Items
|
|
2808
|
+
});
|
|
2694
2809
|
}
|
|
2695
2810
|
catch (e) {
|
|
2696
2811
|
rej(e);
|
|
@@ -2716,7 +2831,8 @@
|
|
|
2716
2831
|
return exports.Api.ECacheKey.Lod + exports.Api.ECacheKey.Entity + entityId;
|
|
2717
2832
|
}
|
|
2718
2833
|
EntityLod.GetEntityListKey = GetEntityListKey;
|
|
2719
|
-
function GetUrl(
|
|
2834
|
+
function GetUrl(params) {
|
|
2835
|
+
let { api, entityId, categoryId, level, strict } = params;
|
|
2720
2836
|
if (!entityId) {
|
|
2721
2837
|
throw ("Entity ID is required.");
|
|
2722
2838
|
}
|
|
@@ -2730,11 +2846,14 @@
|
|
|
2730
2846
|
if (strict) {
|
|
2731
2847
|
url = url + "?strict=true";
|
|
2732
2848
|
}
|
|
2733
|
-
return
|
|
2849
|
+
return {
|
|
2850
|
+
url: url
|
|
2851
|
+
};
|
|
2734
2852
|
}
|
|
2735
2853
|
EntityLod.GetUrl = GetUrl;
|
|
2736
|
-
function GetUrlFileId(
|
|
2854
|
+
function GetUrlFileId(params) {
|
|
2737
2855
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2856
|
+
const { api, url, req: reqParams } = params;
|
|
2738
2857
|
if (!url) {
|
|
2739
2858
|
throw ("Url is required.");
|
|
2740
2859
|
}
|
|
@@ -2745,7 +2864,9 @@
|
|
|
2745
2864
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
2746
2865
|
try {
|
|
2747
2866
|
const record = yield api.get(url, exports.Api.PrepReqParams(reqParams));
|
|
2748
|
-
res(
|
|
2867
|
+
res({
|
|
2868
|
+
clientFileId: record["ClientFile.ID"]
|
|
2869
|
+
});
|
|
2749
2870
|
}
|
|
2750
2871
|
catch (e) {
|
|
2751
2872
|
rej(e);
|
|
@@ -2756,19 +2877,23 @@
|
|
|
2756
2877
|
});
|
|
2757
2878
|
}
|
|
2758
2879
|
EntityLod.GetUrlFileId = GetUrlFileId;
|
|
2759
|
-
function GetLods(
|
|
2880
|
+
function GetLods(params) {
|
|
2760
2881
|
var _a;
|
|
2761
2882
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2762
|
-
|
|
2883
|
+
const { api, filter, req: reqParams } = params;
|
|
2884
|
+
if (!((_a = filter === null || filter === void 0 ? void 0 : filter.Items) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
2763
2885
|
throw ("Items are required.");
|
|
2764
2886
|
}
|
|
2765
|
-
const data = yield api.POST("entity/getlods",
|
|
2766
|
-
return
|
|
2887
|
+
const data = yield api.POST("entity/getlods", filter, reqParams);
|
|
2888
|
+
return {
|
|
2889
|
+
lods: data.Items
|
|
2890
|
+
};
|
|
2767
2891
|
});
|
|
2768
2892
|
}
|
|
2769
2893
|
EntityLod.GetLods = GetLods;
|
|
2770
|
-
function GetEntityLods(
|
|
2894
|
+
function GetEntityLods(params) {
|
|
2771
2895
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2896
|
+
const { api, entityId, req: reqParams } = params;
|
|
2772
2897
|
if (!entityId) {
|
|
2773
2898
|
throw ("Entity id is required.");
|
|
2774
2899
|
}
|
|
@@ -2780,7 +2905,9 @@
|
|
|
2780
2905
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
2781
2906
|
try {
|
|
2782
2907
|
const data = yield req;
|
|
2783
|
-
res(
|
|
2908
|
+
res({
|
|
2909
|
+
lods: data.Items
|
|
2910
|
+
});
|
|
2784
2911
|
}
|
|
2785
2912
|
catch (e) {
|
|
2786
2913
|
rej(e);
|
|
@@ -2793,13 +2920,11 @@
|
|
|
2793
2920
|
EntityLod.GetEntityLods = GetEntityLods;
|
|
2794
2921
|
/**
|
|
2795
2922
|
* Returns lods for a specified entity type.
|
|
2796
|
-
* @param
|
|
2797
|
-
* @param typeId
|
|
2798
|
-
* @param group default is "DEFAULT".
|
|
2799
|
-
* @param reqParams
|
|
2923
|
+
* @param params
|
|
2800
2924
|
*/
|
|
2801
|
-
function GetTypeLods(
|
|
2925
|
+
function GetTypeLods(params) {
|
|
2802
2926
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2927
|
+
let { api, entityTypeId: typeId, group, req: reqParams } = params;
|
|
2803
2928
|
if (!group) {
|
|
2804
2929
|
group = "DEFAULT";
|
|
2805
2930
|
}
|
|
@@ -2812,7 +2937,9 @@
|
|
|
2812
2937
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
2813
2938
|
try {
|
|
2814
2939
|
const data = yield req;
|
|
2815
|
-
res(
|
|
2940
|
+
res({
|
|
2941
|
+
lods: data.Items
|
|
2942
|
+
});
|
|
2816
2943
|
}
|
|
2817
2944
|
catch (e) {
|
|
2818
2945
|
rej(e);
|
|
@@ -2823,8 +2950,9 @@
|
|
|
2823
2950
|
});
|
|
2824
2951
|
}
|
|
2825
2952
|
EntityLod.GetTypeLods = GetTypeLods;
|
|
2826
|
-
function Update(
|
|
2953
|
+
function Update(params) {
|
|
2827
2954
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2955
|
+
const { api, entityId, req: reqParams } = params;
|
|
2828
2956
|
if (!params["ClientFile.ID"] || !params["LODCategory.Key"] || (!params.Level && params.Level !== 0)) {
|
|
2829
2957
|
throw ("ClientFile.ID, LODCategory.Key and Level are required.");
|
|
2830
2958
|
}
|
|
@@ -2837,8 +2965,9 @@
|
|
|
2837
2965
|
});
|
|
2838
2966
|
}
|
|
2839
2967
|
EntityLod.Update = Update;
|
|
2840
|
-
function Delete(
|
|
2968
|
+
function Delete(params) {
|
|
2841
2969
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2970
|
+
let { api, entityId, lodCategoryId, level, req: reqParams } = params;
|
|
2842
2971
|
if (!entityId || !lodCategoryId) {
|
|
2843
2972
|
throw ("Entity ID and LOD Category ID are required.");
|
|
2844
2973
|
}
|
|
@@ -2864,8 +2993,9 @@
|
|
|
2864
2993
|
return exports.Api.ECacheKey.LodCategory;
|
|
2865
2994
|
}
|
|
2866
2995
|
EntityLodCategory.GetListCacheKey = GetListCacheKey;
|
|
2867
|
-
function GetList(
|
|
2996
|
+
function GetList(params) {
|
|
2868
2997
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2998
|
+
const { api, req: reqParams } = params;
|
|
2869
2999
|
const cacheKey = api.GetCacheItem(GetListCacheKey(), reqParams);
|
|
2870
3000
|
if (cacheKey) {
|
|
2871
3001
|
return cacheKey;
|
|
@@ -2873,7 +3003,9 @@
|
|
|
2873
3003
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
2874
3004
|
try {
|
|
2875
3005
|
const data = yield api.GET("lodCategories", exports.Api.PrepReqParams(reqParams));
|
|
2876
|
-
res(
|
|
3006
|
+
res({
|
|
3007
|
+
categories: data.Items
|
|
3008
|
+
});
|
|
2877
3009
|
}
|
|
2878
3010
|
catch (e) {
|
|
2879
3011
|
rej(e);
|
|
@@ -2884,8 +3016,9 @@
|
|
|
2884
3016
|
});
|
|
2885
3017
|
}
|
|
2886
3018
|
EntityLodCategory.GetList = GetList;
|
|
2887
|
-
function Get(
|
|
3019
|
+
function Get(params) {
|
|
2888
3020
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3021
|
+
const { api, categoryId: id, req: reqParams } = params;
|
|
2889
3022
|
if (!id) {
|
|
2890
3023
|
throw ("Lod category id is required.");
|
|
2891
3024
|
}
|
|
@@ -2896,7 +3029,9 @@
|
|
|
2896
3029
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
2897
3030
|
try {
|
|
2898
3031
|
const data = yield api.GET(`lodCategory/${id}`, exports.Api.PrepReqParams(reqParams));
|
|
2899
|
-
res(
|
|
3032
|
+
res({
|
|
3033
|
+
category: data
|
|
3034
|
+
});
|
|
2900
3035
|
}
|
|
2901
3036
|
catch (e) {
|
|
2902
3037
|
rej(e);
|
|
@@ -2907,8 +3042,9 @@
|
|
|
2907
3042
|
});
|
|
2908
3043
|
}
|
|
2909
3044
|
EntityLodCategory.Get = Get;
|
|
2910
|
-
function Delete(
|
|
3045
|
+
function Delete(params) {
|
|
2911
3046
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3047
|
+
const { api, categoryId: id, req: reqParams } = params;
|
|
2912
3048
|
if (!id) {
|
|
2913
3049
|
throw ("Lod category id is required.");
|
|
2914
3050
|
}
|
|
@@ -2918,15 +3054,18 @@
|
|
|
2918
3054
|
});
|
|
2919
3055
|
}
|
|
2920
3056
|
EntityLodCategory.Delete = Delete;
|
|
2921
|
-
function Update(
|
|
3057
|
+
function Update(params) {
|
|
2922
3058
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3059
|
+
const { api, category: data, req: reqParams } = params;
|
|
2923
3060
|
if (!data.Key || !data.Name) {
|
|
2924
3061
|
throw ("Lod category key and name are required.");
|
|
2925
3062
|
}
|
|
2926
|
-
|
|
3063
|
+
const res = yield api.POST(`lodCategory/${data.Key}`, data, exports.Api.PrepReqParams(reqParams));
|
|
2927
3064
|
api.Cache.Remove(GetCacheKey(data.Key));
|
|
2928
3065
|
api.Cache.Remove(GetListCacheKey());
|
|
2929
|
-
return
|
|
3066
|
+
return {
|
|
3067
|
+
category: res
|
|
3068
|
+
};
|
|
2930
3069
|
});
|
|
2931
3070
|
}
|
|
2932
3071
|
EntityLodCategory.Update = Update;
|
|
@@ -2941,8 +3080,9 @@
|
|
|
2941
3080
|
return exports.Api.ECacheKey.RelationType;
|
|
2942
3081
|
}
|
|
2943
3082
|
EntityRelationType.GetListCacheKey = GetListCacheKey;
|
|
2944
|
-
function Get(
|
|
3083
|
+
function Get(params) {
|
|
2945
3084
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3085
|
+
const { api, relationTypeId: typeId, req: reqParams } = params;
|
|
2946
3086
|
if (!typeId) {
|
|
2947
3087
|
throw ("Type ID is required.");
|
|
2948
3088
|
}
|
|
@@ -2951,14 +3091,25 @@
|
|
|
2951
3091
|
if (cacheData) {
|
|
2952
3092
|
return cacheData;
|
|
2953
3093
|
}
|
|
2954
|
-
const
|
|
2955
|
-
|
|
2956
|
-
|
|
3094
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
3095
|
+
try {
|
|
3096
|
+
const data = yield api.GET(`entityRelationType/${typeId}`, exports.Api.PrepReqParams(reqParams));
|
|
3097
|
+
res({
|
|
3098
|
+
relationType: data
|
|
3099
|
+
});
|
|
3100
|
+
}
|
|
3101
|
+
catch (e) {
|
|
3102
|
+
rej(e);
|
|
3103
|
+
}
|
|
3104
|
+
}));
|
|
3105
|
+
api.Cache.Set(key, prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
3106
|
+
return prom;
|
|
2957
3107
|
});
|
|
2958
3108
|
}
|
|
2959
3109
|
EntityRelationType.Get = Get;
|
|
2960
|
-
function Delete(
|
|
3110
|
+
function Delete(params) {
|
|
2961
3111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3112
|
+
const { api, relationTypeId: typeId, req: reqParams } = params;
|
|
2962
3113
|
if (!typeId) {
|
|
2963
3114
|
throw ("Type ID is required.");
|
|
2964
3115
|
}
|
|
@@ -2968,8 +3119,9 @@
|
|
|
2968
3119
|
});
|
|
2969
3120
|
}
|
|
2970
3121
|
EntityRelationType.Delete = Delete;
|
|
2971
|
-
function GetList(
|
|
3122
|
+
function GetList(params) {
|
|
2972
3123
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3124
|
+
const { api, req: reqParams } = params;
|
|
2973
3125
|
const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
|
|
2974
3126
|
if (cacheData) {
|
|
2975
3127
|
return cacheData;
|
|
@@ -2977,7 +3129,9 @@
|
|
|
2977
3129
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
2978
3130
|
try {
|
|
2979
3131
|
const data = yield api.GET("entityRelationTypes", exports.Api.PrepReqParams(reqParams));
|
|
2980
|
-
res(
|
|
3132
|
+
res({
|
|
3133
|
+
relationTypes: data.Items
|
|
3134
|
+
});
|
|
2981
3135
|
}
|
|
2982
3136
|
catch (e) {
|
|
2983
3137
|
rej(e);
|
|
@@ -2988,18 +3142,21 @@
|
|
|
2988
3142
|
});
|
|
2989
3143
|
}
|
|
2990
3144
|
EntityRelationType.GetList = GetList;
|
|
2991
|
-
function Update(
|
|
3145
|
+
function Update(params) {
|
|
2992
3146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3147
|
+
const { api, relationType: data, req: reqParams } = params;
|
|
2993
3148
|
if (!(data === null || data === void 0 ? void 0 : data.ForwardName) || !(data === null || data === void 0 ? void 0 : data.ReverseName)) {
|
|
2994
3149
|
throw ("Forward and reverse names are required.");
|
|
2995
3150
|
}
|
|
2996
3151
|
if (!data.ID) {
|
|
2997
3152
|
data.ID = exports.ObjectUtils.UId();
|
|
2998
3153
|
}
|
|
2999
|
-
|
|
3154
|
+
const res = yield api.POST(`entityRelationType/${data.ID}`, data, exports.Api.PrepReqParams(reqParams));
|
|
3000
3155
|
api.Cache.Remove(GetCacheKey(data.ID));
|
|
3001
3156
|
api.Cache.Remove(GetListCacheKey());
|
|
3002
|
-
return
|
|
3157
|
+
return {
|
|
3158
|
+
relationType: res
|
|
3159
|
+
};
|
|
3003
3160
|
});
|
|
3004
3161
|
}
|
|
3005
3162
|
EntityRelationType.Update = Update;
|
|
@@ -3016,14 +3173,15 @@
|
|
|
3016
3173
|
EntityRelation.GetEntityCacheKey = GetEntityCacheKey;
|
|
3017
3174
|
function GetListCacheKey(entityId, params) {
|
|
3018
3175
|
return exports.Api.ECacheKey.Relation + exports.Api.ECacheKey.RelationType +
|
|
3019
|
-
exports.Api.ECacheKey.Id + params.
|
|
3176
|
+
exports.Api.ECacheKey.Id + params.relationTypeId +
|
|
3020
3177
|
exports.Api.ECacheKey.Id + params.oneWayOnly +
|
|
3021
3178
|
exports.Api.ECacheKey.Id + params.loadEntityData +
|
|
3022
3179
|
exports.Api.ECacheKey.Entity + exports.Api.ECacheKey.Id + entityId;
|
|
3023
3180
|
}
|
|
3024
3181
|
EntityRelation.GetListCacheKey = GetListCacheKey;
|
|
3025
|
-
function Create(
|
|
3182
|
+
function Create(params) {
|
|
3026
3183
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3184
|
+
const { api, relation: data, req: reqParams } = params;
|
|
3027
3185
|
if (!data["Principal.Entity.ID"] || !data["Related.Entity.ID"] || !data["Relation.Type.ID"]) {
|
|
3028
3186
|
throw ("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
|
|
3029
3187
|
}
|
|
@@ -3041,54 +3199,61 @@
|
|
|
3041
3199
|
});
|
|
3042
3200
|
}
|
|
3043
3201
|
EntityRelation.Create = Create;
|
|
3044
|
-
function Update(
|
|
3202
|
+
function Update(params) {
|
|
3045
3203
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3204
|
+
const { api, relation: data, req: reqParams } = params;
|
|
3046
3205
|
if (!data["Principal.Entity.ID"] || !data["Related.Entity.ID"] || !data["Relation.Type.ID"]) {
|
|
3047
3206
|
throw ("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
|
|
3048
3207
|
}
|
|
3049
3208
|
const url = `entity/${data["Principal.Entity.ID"]}/otherEntityID/${data["Related.Entity.ID"]}/relation/${data["Relation.Type.ID"]}/update`;
|
|
3050
|
-
|
|
3209
|
+
const res = yield api.POST(url, data, exports.Api.PrepReqParams(reqParams));
|
|
3051
3210
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Relation + exports.Api.ECacheKey.Id + data["Principal.Entity.ID"]);
|
|
3052
3211
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Relation + exports.Api.ECacheKey.Id + data["Related.Entity.ID"]);
|
|
3053
3212
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Relation + exports.Api.ECacheKey.RelationType + exports.Api.ECacheKey.Id + data["Relation.Type.ID"]);
|
|
3054
3213
|
if (data["Data.Entity.ID"]) {
|
|
3055
3214
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Relation + exports.Api.ECacheKey.Entity + exports.Api.ECacheKey.Id + data["Data.Entity.ID"]);
|
|
3056
3215
|
}
|
|
3057
|
-
return
|
|
3216
|
+
return {
|
|
3217
|
+
relation: res
|
|
3218
|
+
};
|
|
3058
3219
|
});
|
|
3059
3220
|
}
|
|
3060
3221
|
EntityRelation.Update = Update;
|
|
3061
|
-
function GetList(
|
|
3222
|
+
function GetList(params) {
|
|
3062
3223
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3224
|
+
let { api, entityId, filter, req: reqParams } = params;
|
|
3063
3225
|
if (!entityId) {
|
|
3064
3226
|
throw ("Entity ID is required.");
|
|
3065
3227
|
}
|
|
3066
|
-
|
|
3067
|
-
const cacheData = api.GetCacheItem(GetListCacheKey(entityId,
|
|
3228
|
+
filter = Object.assign({ relationTypeId: "", oneWayOnly: false, loadEntityData: false }, filter);
|
|
3229
|
+
const cacheData = api.GetCacheItem(GetListCacheKey(entityId, filter), reqParams);
|
|
3068
3230
|
if (cacheData) {
|
|
3069
3231
|
return cacheData;
|
|
3070
3232
|
}
|
|
3071
3233
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
3072
3234
|
try {
|
|
3073
3235
|
let url = `entity/${entityId}/relations`;
|
|
3074
|
-
if (
|
|
3075
|
-
url += "/" +
|
|
3236
|
+
if (filter.relationTypeId) {
|
|
3237
|
+
url += "/" + filter.relationTypeId;
|
|
3076
3238
|
}
|
|
3077
|
-
url += `?Oneway=${
|
|
3239
|
+
url += `?Oneway=${filter.oneWayOnly}&LoadInfo=${filter.loadEntityData}`;
|
|
3078
3240
|
const data = yield api.GET(url, exports.Api.PrepReqParams(reqParams));
|
|
3079
|
-
res(
|
|
3241
|
+
res({
|
|
3242
|
+
relations: data.Items
|
|
3243
|
+
});
|
|
3080
3244
|
}
|
|
3081
3245
|
catch (e) {
|
|
3082
3246
|
rej(e);
|
|
3083
3247
|
}
|
|
3084
3248
|
}));
|
|
3085
|
-
api.Cache.Set(GetListCacheKey(entityId,
|
|
3249
|
+
api.Cache.Set(GetListCacheKey(entityId, filter), req);
|
|
3086
3250
|
return req;
|
|
3087
3251
|
});
|
|
3088
3252
|
}
|
|
3089
3253
|
EntityRelation.GetList = GetList;
|
|
3090
|
-
function GetByDataEntityId(
|
|
3254
|
+
function GetByDataEntityId(params) {
|
|
3091
3255
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3256
|
+
const { api, entityId, req: reqParams } = params;
|
|
3092
3257
|
if (!entityId) {
|
|
3093
3258
|
throw ("Entity ID is required.");
|
|
3094
3259
|
}
|
|
@@ -3096,9 +3261,19 @@
|
|
|
3096
3261
|
if (cacheData) {
|
|
3097
3262
|
return cacheData;
|
|
3098
3263
|
}
|
|
3099
|
-
const
|
|
3100
|
-
|
|
3101
|
-
|
|
3264
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
3265
|
+
try {
|
|
3266
|
+
const data = yield api.GET(`entity/relation/${entityId}/dataentity`, exports.Api.PrepReqParams(reqParams));
|
|
3267
|
+
res({
|
|
3268
|
+
relation: data
|
|
3269
|
+
});
|
|
3270
|
+
}
|
|
3271
|
+
catch (e) {
|
|
3272
|
+
rej(e);
|
|
3273
|
+
}
|
|
3274
|
+
}));
|
|
3275
|
+
api.Cache.Set(GetEntityCacheKey(entityId), prom);
|
|
3276
|
+
return prom;
|
|
3102
3277
|
});
|
|
3103
3278
|
}
|
|
3104
3279
|
EntityRelation.GetByDataEntityId = GetByDataEntityId;
|
|
@@ -3109,8 +3284,9 @@
|
|
|
3109
3284
|
return `${exports.Api.ECacheKey.EntitySource}${exports.Api.ECacheKey.Id}${sourceId}${exports.Api.ECacheKey.Id}${sourceKey}`;
|
|
3110
3285
|
}
|
|
3111
3286
|
EntitySource.GetCacheKey = GetCacheKey;
|
|
3112
|
-
function Get(
|
|
3287
|
+
function Get(params) {
|
|
3113
3288
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3289
|
+
const { api, sourceId, sourceKey, req: reqParams } = params;
|
|
3114
3290
|
if (!sourceId || !sourceKey) {
|
|
3115
3291
|
throw ("Source ID and Source Key are required.");
|
|
3116
3292
|
}
|
|
@@ -3119,14 +3295,25 @@
|
|
|
3119
3295
|
if (cacheData) {
|
|
3120
3296
|
return cacheData;
|
|
3121
3297
|
}
|
|
3122
|
-
const
|
|
3123
|
-
|
|
3124
|
-
|
|
3298
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
3299
|
+
try {
|
|
3300
|
+
const data = yield api.GET(`entitysource/${sourceId}/${sourceKey}`, exports.Api.PrepReqParams(reqParams));
|
|
3301
|
+
res({
|
|
3302
|
+
source: data
|
|
3303
|
+
});
|
|
3304
|
+
}
|
|
3305
|
+
catch (e) {
|
|
3306
|
+
rej(e);
|
|
3307
|
+
}
|
|
3308
|
+
}));
|
|
3309
|
+
api.Cache.Set(key, prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
3310
|
+
return prom;
|
|
3125
3311
|
});
|
|
3126
3312
|
}
|
|
3127
3313
|
EntitySource.Get = Get;
|
|
3128
|
-
function GetListByKeys(
|
|
3314
|
+
function GetListByKeys(params) {
|
|
3129
3315
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3316
|
+
const { api, sourceId, sourceKeys, req: reqParams } = params;
|
|
3130
3317
|
if (!sourceId || !sourceKeys.length) {
|
|
3131
3318
|
throw ("Source ID and Source Keys are required.");
|
|
3132
3319
|
}
|
|
@@ -3165,18 +3352,26 @@
|
|
|
3165
3352
|
reqs.push(req);
|
|
3166
3353
|
}
|
|
3167
3354
|
}
|
|
3168
|
-
return
|
|
3355
|
+
return {
|
|
3356
|
+
sources: (yield Promise.all(reqs)).filter(x => !!x)
|
|
3357
|
+
};
|
|
3169
3358
|
});
|
|
3170
3359
|
}
|
|
3171
3360
|
EntitySource.GetListByKeys = GetListByKeys;
|
|
3172
|
-
function GetEntityIdsBySourceKeys(
|
|
3361
|
+
function GetEntityIdsBySourceKeys(params) {
|
|
3173
3362
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3363
|
+
const { api, sourceId, sourceKeys, req: reqParams } = params;
|
|
3174
3364
|
if (!sourceId || !sourceKeys.length) {
|
|
3175
3365
|
throw ("Source ID and Source Keys are required.");
|
|
3176
3366
|
}
|
|
3177
3367
|
const result = {};
|
|
3178
3368
|
if (sourceKeys.length > 0) {
|
|
3179
|
-
const sources = yield GetListByKeys(
|
|
3369
|
+
const { sources } = yield GetListByKeys({
|
|
3370
|
+
api,
|
|
3371
|
+
sourceId,
|
|
3372
|
+
sourceKeys,
|
|
3373
|
+
req: reqParams
|
|
3374
|
+
});
|
|
3180
3375
|
for (let i = 0; i < sources.length; i++) {
|
|
3181
3376
|
const source = sources[i];
|
|
3182
3377
|
for (let i = 0; i < sourceKeys.length; i++) {
|
|
@@ -3187,7 +3382,9 @@
|
|
|
3187
3382
|
}
|
|
3188
3383
|
}
|
|
3189
3384
|
}
|
|
3190
|
-
return
|
|
3385
|
+
return {
|
|
3386
|
+
idMapping: result
|
|
3387
|
+
};
|
|
3191
3388
|
});
|
|
3192
3389
|
}
|
|
3193
3390
|
EntitySource.GetEntityIdsBySourceKeys = GetEntityIdsBySourceKeys;
|
|
@@ -3205,18 +3402,26 @@
|
|
|
3205
3402
|
return exports.Api.ECacheKey.Tag;
|
|
3206
3403
|
}
|
|
3207
3404
|
EntityTag.GetListCacheKey = GetListCacheKey;
|
|
3208
|
-
function Get(
|
|
3405
|
+
function Get(params) {
|
|
3209
3406
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3407
|
+
const { api, tagId, req: reqParams } = params;
|
|
3210
3408
|
if (!tagId) {
|
|
3211
3409
|
throw ("Tag ID is required.");
|
|
3212
3410
|
}
|
|
3213
|
-
const
|
|
3214
|
-
|
|
3411
|
+
const { tags } = yield GetListByIds({
|
|
3412
|
+
api,
|
|
3413
|
+
tagIds: [tagId],
|
|
3414
|
+
req: reqParams
|
|
3415
|
+
});
|
|
3416
|
+
return {
|
|
3417
|
+
tag: tags.length ? tags[0] : null
|
|
3418
|
+
};
|
|
3215
3419
|
});
|
|
3216
3420
|
}
|
|
3217
3421
|
EntityTag.Get = Get;
|
|
3218
|
-
function GetListByIds(
|
|
3422
|
+
function GetListByIds(params) {
|
|
3219
3423
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3424
|
+
const { api, tagIds, req: reqParams } = params;
|
|
3220
3425
|
if (!tagIds.length) {
|
|
3221
3426
|
throw ("Tag Ids are empty.");
|
|
3222
3427
|
}
|
|
@@ -3258,12 +3463,15 @@
|
|
|
3258
3463
|
reqs.push(req);
|
|
3259
3464
|
}
|
|
3260
3465
|
}
|
|
3261
|
-
return
|
|
3466
|
+
return {
|
|
3467
|
+
tags: (yield Promise.all(reqs)).filter(x => !!x)
|
|
3468
|
+
};
|
|
3262
3469
|
});
|
|
3263
3470
|
}
|
|
3264
3471
|
EntityTag.GetListByIds = GetListByIds;
|
|
3265
|
-
function GetList(
|
|
3472
|
+
function GetList(params) {
|
|
3266
3473
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3474
|
+
const { api, entityTypeId, req: reqParams } = params;
|
|
3267
3475
|
const cacheData = api.GetCacheItem(GetListCacheKey(entityTypeId), reqParams);
|
|
3268
3476
|
if (cacheData) {
|
|
3269
3477
|
return cacheData;
|
|
@@ -3271,7 +3479,9 @@
|
|
|
3271
3479
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
3272
3480
|
try {
|
|
3273
3481
|
const data = yield api.GET(entityTypeId ? `entityType/${entityTypeId}/layers` : "layers", exports.Api.PrepReqParams(reqParams));
|
|
3274
|
-
res(
|
|
3482
|
+
res({
|
|
3483
|
+
tags: data.Items
|
|
3484
|
+
});
|
|
3275
3485
|
}
|
|
3276
3486
|
catch (e) {
|
|
3277
3487
|
rej(e);
|
|
@@ -3282,8 +3492,9 @@
|
|
|
3282
3492
|
});
|
|
3283
3493
|
}
|
|
3284
3494
|
EntityTag.GetList = GetList;
|
|
3285
|
-
function Delete(
|
|
3495
|
+
function Delete(params) {
|
|
3286
3496
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3497
|
+
const { api, tagId, req: reqParams } = params;
|
|
3287
3498
|
if (!tagId) {
|
|
3288
3499
|
throw ("Tag ID is required.");
|
|
3289
3500
|
}
|
|
@@ -3293,16 +3504,19 @@
|
|
|
3293
3504
|
});
|
|
3294
3505
|
}
|
|
3295
3506
|
EntityTag.Delete = Delete;
|
|
3296
|
-
function Update(
|
|
3507
|
+
function Update(params) {
|
|
3297
3508
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3509
|
+
const { api, tag: data, req: reqParams } = params;
|
|
3298
3510
|
if (!(data === null || data === void 0 ? void 0 : data.ID)) {
|
|
3299
3511
|
throw ("Tag ID is required.");
|
|
3300
3512
|
}
|
|
3301
3513
|
const url = data.ID ? `layer/${data.ID}` : "layer";
|
|
3302
|
-
|
|
3514
|
+
const res = yield api.POST(url, data, exports.Api.PrepReqParams(reqParams));
|
|
3303
3515
|
api.Cache.Remove(GetCacheKey(data.ID));
|
|
3304
3516
|
api.Cache.RemoveByStartsWith(GetListCacheKey());
|
|
3305
|
-
return
|
|
3517
|
+
return {
|
|
3518
|
+
tag: res
|
|
3519
|
+
};
|
|
3306
3520
|
});
|
|
3307
3521
|
}
|
|
3308
3522
|
EntityTag.Update = Update;
|
|
@@ -3317,8 +3531,9 @@
|
|
|
3317
3531
|
return exports.Api.ECacheKey.EntityType;
|
|
3318
3532
|
}
|
|
3319
3533
|
EntityType.GetListCacheKey = GetListCacheKey;
|
|
3320
|
-
function Get(
|
|
3534
|
+
function Get(params) {
|
|
3321
3535
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3536
|
+
const { api, entityTypeId: typeId, req: reqParams } = params;
|
|
3322
3537
|
if (!typeId) {
|
|
3323
3538
|
throw ("Type ID is required.");
|
|
3324
3539
|
}
|
|
@@ -3327,14 +3542,25 @@
|
|
|
3327
3542
|
if (cacheData) {
|
|
3328
3543
|
return cacheData;
|
|
3329
3544
|
}
|
|
3330
|
-
const
|
|
3331
|
-
|
|
3332
|
-
|
|
3545
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
3546
|
+
try {
|
|
3547
|
+
const data = yield api.GET(`entitytype/${typeId}`, exports.Api.PrepReqParams(reqParams));
|
|
3548
|
+
res({
|
|
3549
|
+
entityType: data
|
|
3550
|
+
});
|
|
3551
|
+
}
|
|
3552
|
+
catch (e) {
|
|
3553
|
+
rej(e);
|
|
3554
|
+
}
|
|
3555
|
+
}));
|
|
3556
|
+
api.Cache.Set(key, prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
3557
|
+
return prom;
|
|
3333
3558
|
});
|
|
3334
3559
|
}
|
|
3335
3560
|
EntityType.Get = Get;
|
|
3336
|
-
function Delete(
|
|
3561
|
+
function Delete(params) {
|
|
3337
3562
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3563
|
+
const { api, entityTypeId: typeId, req: reqParams } = params;
|
|
3338
3564
|
if (!typeId) {
|
|
3339
3565
|
throw ("Type ID is required.");
|
|
3340
3566
|
}
|
|
@@ -3344,8 +3570,9 @@
|
|
|
3344
3570
|
});
|
|
3345
3571
|
}
|
|
3346
3572
|
EntityType.Delete = Delete;
|
|
3347
|
-
function GetList(
|
|
3573
|
+
function GetList(params) {
|
|
3348
3574
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3575
|
+
const { api, req: reqParams } = params;
|
|
3349
3576
|
const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
|
|
3350
3577
|
if (cacheData) {
|
|
3351
3578
|
return cacheData;
|
|
@@ -3353,7 +3580,9 @@
|
|
|
3353
3580
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
3354
3581
|
try {
|
|
3355
3582
|
const data = yield api.GET("entitytypes", exports.Api.PrepReqParams(reqParams));
|
|
3356
|
-
res(
|
|
3583
|
+
res({
|
|
3584
|
+
entityTypes: data.Items
|
|
3585
|
+
});
|
|
3357
3586
|
}
|
|
3358
3587
|
catch (e) {
|
|
3359
3588
|
rej(e);
|
|
@@ -3364,8 +3593,9 @@
|
|
|
3364
3593
|
});
|
|
3365
3594
|
}
|
|
3366
3595
|
EntityType.GetList = GetList;
|
|
3367
|
-
function Update(
|
|
3596
|
+
function Update(params) {
|
|
3368
3597
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3598
|
+
let { api, entityType: data, req: reqParams } = params;
|
|
3369
3599
|
if (!data) {
|
|
3370
3600
|
data = {};
|
|
3371
3601
|
}
|
|
@@ -3375,10 +3605,12 @@
|
|
|
3375
3605
|
if (!data.Name) {
|
|
3376
3606
|
data.Name = data.ID;
|
|
3377
3607
|
}
|
|
3378
|
-
|
|
3608
|
+
const res = yield api.POST(`entitytype/${data.ID}`, data, exports.Api.PrepReqParams(reqParams));
|
|
3379
3609
|
api.Cache.Remove(GetCacheKey(data.ID));
|
|
3380
3610
|
api.Cache.Remove(GetListCacheKey());
|
|
3381
|
-
return
|
|
3611
|
+
return {
|
|
3612
|
+
entityType: res
|
|
3613
|
+
};
|
|
3382
3614
|
});
|
|
3383
3615
|
}
|
|
3384
3616
|
EntityType.Update = Update;
|
|
@@ -3777,18 +4009,21 @@
|
|
|
3777
4009
|
continue;
|
|
3778
4010
|
}
|
|
3779
4011
|
try {
|
|
3780
|
-
const
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
4012
|
+
const { entities } = yield exports.Entity.GetList({
|
|
4013
|
+
api: this.api,
|
|
4014
|
+
filter: {
|
|
4015
|
+
pageSize: PAGE_SIZE,
|
|
4016
|
+
pageIndex: curCell.FetchPageIndex,
|
|
4017
|
+
entityTypeId: this.typeId,
|
|
4018
|
+
layerIds: this.tagIds,
|
|
4019
|
+
bounds: curCell.GetBounds(),
|
|
4020
|
+
sortOrder: exports.Api.ESortOrder.Asc,
|
|
4021
|
+
entityTypeConditions: this.attrFilter
|
|
4022
|
+
}
|
|
3788
4023
|
});
|
|
3789
4024
|
const integrity = this.getIntegrityId();
|
|
3790
|
-
if (loopIntegrity == integrity &&
|
|
3791
|
-
(_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger(
|
|
4025
|
+
if (loopIntegrity == integrity && entities) {
|
|
4026
|
+
(_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger(entities);
|
|
3792
4027
|
}
|
|
3793
4028
|
if (this.getterLoopId != loopId) {
|
|
3794
4029
|
break;
|
|
@@ -3798,15 +4033,15 @@
|
|
|
3798
4033
|
postedLoading = true;
|
|
3799
4034
|
}
|
|
3800
4035
|
// Only mark as fetched when ALL pages are done.
|
|
3801
|
-
if (
|
|
4036
|
+
if (entities.length <= 0) {
|
|
3802
4037
|
curCell.Fetched = true;
|
|
3803
4038
|
(_d = this.onScanUpdate) === null || _d === void 0 ? void 0 : _d.Trigger(cells);
|
|
3804
4039
|
continue;
|
|
3805
4040
|
}
|
|
3806
4041
|
// Checking to make sure it's not just the same batch over and over again.
|
|
3807
|
-
if (
|
|
3808
|
-
const first = (_f = (_e =
|
|
3809
|
-
const last = (_h = (_g =
|
|
4042
|
+
if (entities.length > 0) {
|
|
4043
|
+
const first = (_f = (_e = entities[0]) === null || _e === void 0 ? void 0 : _e.Bruce) === null || _f === void 0 ? void 0 : _f.ID;
|
|
4044
|
+
const last = (_h = (_g = entities[entities.length - 1]) === null || _g === void 0 ? void 0 : _g.Bruce) === null || _h === void 0 ? void 0 : _h.ID;
|
|
3810
4045
|
if (prevFirstId == first && prevLastId == last) {
|
|
3811
4046
|
break;
|
|
3812
4047
|
}
|
|
@@ -3959,22 +4194,38 @@
|
|
|
3959
4194
|
return exports.Api.ECacheKey.EntityCoords + exports.Api.ECacheKey.Entity + exports.Api.ECacheKey.Id + entityId;
|
|
3960
4195
|
}
|
|
3961
4196
|
EntityCoords.GetCacheKey = GetCacheKey;
|
|
3962
|
-
function GetEntityCoords(
|
|
4197
|
+
function GetEntityCoords(params) {
|
|
3963
4198
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4199
|
+
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
3964
4200
|
const cacheData = api.GetCacheItem(GetCacheKey(entityId), reqParams);
|
|
3965
4201
|
if (cacheData) {
|
|
3966
4202
|
return cacheData;
|
|
3967
4203
|
}
|
|
3968
|
-
const
|
|
3969
|
-
|
|
3970
|
-
|
|
4204
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
4205
|
+
try {
|
|
4206
|
+
const data = yield api.GET(`entity/${entityId}/ucs`, reqParams);
|
|
4207
|
+
res({
|
|
4208
|
+
coords: data
|
|
4209
|
+
});
|
|
4210
|
+
}
|
|
4211
|
+
catch (e) {
|
|
4212
|
+
rej(e);
|
|
4213
|
+
}
|
|
4214
|
+
}));
|
|
4215
|
+
api.Cache.Set(GetCacheKey(entityId), prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
4216
|
+
return prom;
|
|
3971
4217
|
});
|
|
3972
4218
|
}
|
|
3973
4219
|
EntityCoords.GetEntityCoords = GetEntityCoords;
|
|
3974
|
-
function EntityRelativeToPoint(
|
|
4220
|
+
function EntityRelativeToPoint(params) {
|
|
3975
4221
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4222
|
+
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
3976
4223
|
if (!params.test) {
|
|
3977
|
-
yield UnlinkCoords(
|
|
4224
|
+
yield UnlinkCoords({
|
|
4225
|
+
api,
|
|
4226
|
+
rootEntityId: entityId,
|
|
4227
|
+
req: reqParams
|
|
4228
|
+
});
|
|
3978
4229
|
}
|
|
3979
4230
|
const point = params.point;
|
|
3980
4231
|
const name = params.name || `${exports.MathUtils.Round(point.latitude, 4)}, ${exports.MathUtils.Round(point.longitude, 4)}`;
|
|
@@ -3996,15 +4247,22 @@
|
|
|
3996
4247
|
if (!params.test) {
|
|
3997
4248
|
api.Cache.Remove(GetCacheKey(entityId));
|
|
3998
4249
|
}
|
|
3999
|
-
return
|
|
4250
|
+
return {
|
|
4251
|
+
coords: res
|
|
4252
|
+
};
|
|
4000
4253
|
});
|
|
4001
4254
|
}
|
|
4002
4255
|
EntityCoords.EntityRelativeToPoint = EntityRelativeToPoint;
|
|
4003
|
-
function EntityRelativeToEpsg(
|
|
4256
|
+
function EntityRelativeToEpsg(params) {
|
|
4004
4257
|
var _a;
|
|
4005
4258
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4259
|
+
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
4006
4260
|
if (!params.test) {
|
|
4007
|
-
yield UnlinkCoords(
|
|
4261
|
+
yield UnlinkCoords({
|
|
4262
|
+
api,
|
|
4263
|
+
rootEntityId: entityId,
|
|
4264
|
+
req: reqParams
|
|
4265
|
+
});
|
|
4008
4266
|
}
|
|
4009
4267
|
const epsg = params.epsg;
|
|
4010
4268
|
const name = (_a = params.name) !== null && _a !== void 0 ? _a : "EPSG: " + epsg;
|
|
@@ -4024,14 +4282,21 @@
|
|
|
4024
4282
|
if (!params.test) {
|
|
4025
4283
|
api.Cache.Remove(GetCacheKey(entityId));
|
|
4026
4284
|
}
|
|
4027
|
-
return
|
|
4285
|
+
return {
|
|
4286
|
+
coords: res
|
|
4287
|
+
};
|
|
4028
4288
|
});
|
|
4029
4289
|
}
|
|
4030
4290
|
EntityCoords.EntityRelativeToEpsg = EntityRelativeToEpsg;
|
|
4031
|
-
function EntityRelativeToUcs(
|
|
4291
|
+
function EntityRelativeToUcs(params) {
|
|
4032
4292
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4293
|
+
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
4033
4294
|
if (!params.test) {
|
|
4034
|
-
yield UnlinkCoords(
|
|
4295
|
+
yield UnlinkCoords({
|
|
4296
|
+
api,
|
|
4297
|
+
rootEntityId: entityId,
|
|
4298
|
+
req: reqParams
|
|
4299
|
+
});
|
|
4035
4300
|
}
|
|
4036
4301
|
const ucsId = params.ucsId;
|
|
4037
4302
|
const res = yield api.POST(`entity/${entityId}/ucs`, {
|
|
@@ -4043,12 +4308,15 @@
|
|
|
4043
4308
|
if (!params.test) {
|
|
4044
4309
|
api.Cache.Remove(GetCacheKey(entityId));
|
|
4045
4310
|
}
|
|
4046
|
-
return
|
|
4311
|
+
return {
|
|
4312
|
+
coords: res
|
|
4313
|
+
};
|
|
4047
4314
|
});
|
|
4048
4315
|
}
|
|
4049
4316
|
EntityCoords.EntityRelativeToUcs = EntityRelativeToUcs;
|
|
4050
|
-
function UnlinkCoords(
|
|
4317
|
+
function UnlinkCoords(params) {
|
|
4051
4318
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4319
|
+
const { api, rootEntityId: entityId, req: reqParams } = params;
|
|
4052
4320
|
return api.DELETE(`entity/${entityId}/ucs`, reqParams);
|
|
4053
4321
|
});
|
|
4054
4322
|
}
|
|
@@ -4096,16 +4364,19 @@
|
|
|
4096
4364
|
return `${exports.Api.ECacheKey.ClientFile}${exports.Api.ECacheKey.Id}${fileId}`;
|
|
4097
4365
|
}
|
|
4098
4366
|
ClientFile.GetCacheKey = GetCacheKey;
|
|
4099
|
-
function GetUrl(
|
|
4367
|
+
function GetUrl(params) {
|
|
4368
|
+
const { api, fileId } = params;
|
|
4100
4369
|
return `${api.GetBaseUrl()}file/${fileId}`;
|
|
4101
4370
|
}
|
|
4102
4371
|
ClientFile.GetUrl = GetUrl;
|
|
4103
|
-
function GetUrlWithExt(
|
|
4372
|
+
function GetUrlWithExt(params) {
|
|
4373
|
+
const { api, file } = params;
|
|
4104
4374
|
return `${api.GetBaseUrl()}file/${file.ID}${file.FileExt ? file.FileExt : ""}`;
|
|
4105
4375
|
}
|
|
4106
4376
|
ClientFile.GetUrlWithExt = GetUrlWithExt;
|
|
4107
|
-
function Get(
|
|
4377
|
+
function Get(params) {
|
|
4108
4378
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4379
|
+
const { api, fileId, req: reqParams } = params;
|
|
4109
4380
|
if (!fileId) {
|
|
4110
4381
|
throw ("File ID is required.");
|
|
4111
4382
|
}
|
|
@@ -4114,14 +4385,25 @@
|
|
|
4114
4385
|
if (cacheData) {
|
|
4115
4386
|
return cacheData;
|
|
4116
4387
|
}
|
|
4117
|
-
const
|
|
4118
|
-
|
|
4119
|
-
|
|
4388
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
4389
|
+
try {
|
|
4390
|
+
const data = yield api.GET(`file/${fileId}/details`, exports.Api.PrepReqParams(reqParams));
|
|
4391
|
+
res({
|
|
4392
|
+
clientFile: data
|
|
4393
|
+
});
|
|
4394
|
+
}
|
|
4395
|
+
catch (e) {
|
|
4396
|
+
rej(e);
|
|
4397
|
+
}
|
|
4398
|
+
}));
|
|
4399
|
+
api.Cache.Set(key, prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
4400
|
+
return prom;
|
|
4120
4401
|
});
|
|
4121
4402
|
}
|
|
4122
4403
|
ClientFile.Get = Get;
|
|
4123
|
-
function Delete(
|
|
4404
|
+
function Delete(params) {
|
|
4124
4405
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4406
|
+
const { api, fileIds, req: reqParams } = params;
|
|
4125
4407
|
if (!fileIds.length) {
|
|
4126
4408
|
throw ("File IDs are required.");
|
|
4127
4409
|
}
|
|
@@ -4136,8 +4418,9 @@
|
|
|
4136
4418
|
});
|
|
4137
4419
|
}
|
|
4138
4420
|
ClientFile.Delete = Delete;
|
|
4139
|
-
function Upload(
|
|
4421
|
+
function Upload(params) {
|
|
4140
4422
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4423
|
+
const { api, file, purpose, req } = params;
|
|
4141
4424
|
if (!file) {
|
|
4142
4425
|
throw ("File is required.");
|
|
4143
4426
|
}
|
|
@@ -4147,30 +4430,42 @@
|
|
|
4147
4430
|
"Purpose": purpose
|
|
4148
4431
|
};
|
|
4149
4432
|
}
|
|
4150
|
-
const
|
|
4151
|
-
|
|
4152
|
-
|
|
4433
|
+
const reqParams = exports.Api.PrepReqParams(req);
|
|
4434
|
+
reqParams.formData = formData;
|
|
4435
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
4436
|
+
try {
|
|
4437
|
+
const data = yield api.UPLOAD("file/uploadNew", file, reqParams);
|
|
4438
|
+
res({
|
|
4439
|
+
clientFile: data
|
|
4440
|
+
});
|
|
4441
|
+
}
|
|
4442
|
+
catch (e) {
|
|
4443
|
+
rej(e);
|
|
4444
|
+
}
|
|
4445
|
+
}));
|
|
4446
|
+
return prom;
|
|
4153
4447
|
});
|
|
4154
4448
|
}
|
|
4155
4449
|
ClientFile.Upload = Upload;
|
|
4156
4450
|
/**
|
|
4157
4451
|
* Uploads a temp file.
|
|
4158
4452
|
* This will return a temp file id which can be used in various endpoints.
|
|
4159
|
-
* @param
|
|
4160
|
-
* @param file
|
|
4161
|
-
* @param reqParams
|
|
4453
|
+
* @param params
|
|
4162
4454
|
* @returns
|
|
4163
4455
|
*/
|
|
4164
|
-
function UploadTemp(
|
|
4456
|
+
function UploadTemp(params) {
|
|
4165
4457
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4458
|
+
const { api, file, req } = params;
|
|
4166
4459
|
if (!file) {
|
|
4167
4460
|
throw ("File is required.");
|
|
4168
4461
|
}
|
|
4169
4462
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
4170
4463
|
try {
|
|
4171
|
-
const
|
|
4172
|
-
const data = yield api.UPLOAD("file/uploadTemp", file,
|
|
4173
|
-
res(
|
|
4464
|
+
const reqParams = exports.Api.PrepReqParams(req);
|
|
4465
|
+
const data = yield api.UPLOAD("file/uploadTemp", file, reqParams);
|
|
4466
|
+
res({
|
|
4467
|
+
tempFileId: data["TempFile.ID"]
|
|
4468
|
+
});
|
|
4174
4469
|
}
|
|
4175
4470
|
catch (e) {
|
|
4176
4471
|
rej(e);
|
|
@@ -4182,38 +4477,37 @@
|
|
|
4182
4477
|
ClientFile.UploadTemp = UploadTemp;
|
|
4183
4478
|
let Filter;
|
|
4184
4479
|
(function (Filter) {
|
|
4185
|
-
let
|
|
4186
|
-
(function (
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
ERowOperator["OR"] = "OR";
|
|
4206
|
-
})(ERowOperator = V1.ERowOperator || (V1.ERowOperator = {}));
|
|
4207
|
-
function GetList(api, filter, reqParams) {
|
|
4208
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4209
|
-
const data = yield api.POST("files/filtered", filter, exports.Api.PrepReqParams(reqParams));
|
|
4210
|
-
return data.Items;
|
|
4211
|
-
});
|
|
4212
|
-
}
|
|
4213
|
-
V1.GetList = GetList;
|
|
4214
|
-
})(V1 = Filter.V1 || (Filter.V1 = {}));
|
|
4215
|
-
// TODO: Helpers for constructing the filter.
|
|
4480
|
+
let EColumn;
|
|
4481
|
+
(function (EColumn) {
|
|
4482
|
+
EColumn["ID"] = "id";
|
|
4483
|
+
EColumn["Name"] = "name";
|
|
4484
|
+
EColumn["DateTime"] = "datetime";
|
|
4485
|
+
EColumn["MIMEType"] = "mimeType";
|
|
4486
|
+
EColumn["Size"] = "size";
|
|
4487
|
+
EColumn["User"] = "user";
|
|
4488
|
+
EColumn["Extension"] = "extension";
|
|
4489
|
+
})(EColumn = Filter.EColumn || (Filter.EColumn = {}));
|
|
4490
|
+
let ESortOrder;
|
|
4491
|
+
(function (ESortOrder) {
|
|
4492
|
+
ESortOrder["ASC"] = "asc";
|
|
4493
|
+
ESortOrder["DEC"] = "desc";
|
|
4494
|
+
})(ESortOrder = Filter.ESortOrder || (Filter.ESortOrder = {}));
|
|
4495
|
+
let ERowOperator;
|
|
4496
|
+
(function (ERowOperator) {
|
|
4497
|
+
ERowOperator["AND"] = "AND";
|
|
4498
|
+
ERowOperator["OR"] = "OR";
|
|
4499
|
+
})(ERowOperator = Filter.ERowOperator || (Filter.ERowOperator = {}));
|
|
4216
4500
|
})(Filter = ClientFile.Filter || (ClientFile.Filter = {}));
|
|
4501
|
+
function GetList(params) {
|
|
4502
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4503
|
+
const { api, filter, req: reqParams } = params;
|
|
4504
|
+
const data = yield api.POST("files/filtered", filter, exports.Api.PrepReqParams(reqParams));
|
|
4505
|
+
return {
|
|
4506
|
+
clientFiles: data.Items
|
|
4507
|
+
};
|
|
4508
|
+
});
|
|
4509
|
+
}
|
|
4510
|
+
ClientFile.GetList = GetList;
|
|
4217
4511
|
let Processor;
|
|
4218
4512
|
(function (Processor) {
|
|
4219
4513
|
let EConvertExt;
|
|
@@ -4221,8 +4515,9 @@
|
|
|
4221
4515
|
EConvertExt["GLB"] = ".glb";
|
|
4222
4516
|
EConvertExt["SKP"] = ".skp";
|
|
4223
4517
|
})(EConvertExt = Processor.EConvertExt || (Processor.EConvertExt = {}));
|
|
4224
|
-
function ConvertFormat(
|
|
4518
|
+
function ConvertFormat(params) {
|
|
4225
4519
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4520
|
+
const { api, fileId: clientFileId, ext, req: reqParams } = params;
|
|
4226
4521
|
if (!clientFileId || !ext) {
|
|
4227
4522
|
throw ("Client File ID and extension are required.");
|
|
4228
4523
|
}
|
|
@@ -4252,8 +4547,9 @@
|
|
|
4252
4547
|
EProgramId["BingMaps"] = "BingMaps";
|
|
4253
4548
|
EProgramId["Mapbox"] = "Mapbox";
|
|
4254
4549
|
})(EProgramId = ProgramKey.EProgramId || (ProgramKey.EProgramId = {}));
|
|
4255
|
-
function Get(
|
|
4550
|
+
function Get(params) {
|
|
4256
4551
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4552
|
+
const { api, programId, req: reqParams } = params;
|
|
4257
4553
|
if (!programId) {
|
|
4258
4554
|
throw ("Program ID is required.");
|
|
4259
4555
|
}
|
|
@@ -4262,14 +4558,25 @@
|
|
|
4262
4558
|
if (cacheData) {
|
|
4263
4559
|
return cacheData;
|
|
4264
4560
|
}
|
|
4265
|
-
const
|
|
4266
|
-
|
|
4267
|
-
|
|
4561
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
4562
|
+
try {
|
|
4563
|
+
const data = yield api.GET(`programkey/${programId}`, exports.Api.PrepReqParams(reqParams));
|
|
4564
|
+
res({
|
|
4565
|
+
programKey: data
|
|
4566
|
+
});
|
|
4567
|
+
}
|
|
4568
|
+
catch (e) {
|
|
4569
|
+
rej(e);
|
|
4570
|
+
}
|
|
4571
|
+
}));
|
|
4572
|
+
api.Cache.Set(key, prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
4573
|
+
return prom;
|
|
4268
4574
|
});
|
|
4269
4575
|
}
|
|
4270
4576
|
ProgramKey.Get = Get;
|
|
4271
|
-
function GetList(
|
|
4577
|
+
function GetList(params) {
|
|
4272
4578
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4579
|
+
const { api, req: reqParams } = params;
|
|
4273
4580
|
const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
|
|
4274
4581
|
if (cacheData) {
|
|
4275
4582
|
return cacheData;
|
|
@@ -4277,7 +4584,9 @@
|
|
|
4277
4584
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
4278
4585
|
try {
|
|
4279
4586
|
const data = yield api.GET("programkeys", exports.Api.PrepReqParams(reqParams));
|
|
4280
|
-
res(
|
|
4587
|
+
res({
|
|
4588
|
+
programKeys: data.Items
|
|
4589
|
+
});
|
|
4281
4590
|
}
|
|
4282
4591
|
catch (e) {
|
|
4283
4592
|
rej(e);
|
|
@@ -4288,8 +4597,9 @@
|
|
|
4288
4597
|
});
|
|
4289
4598
|
}
|
|
4290
4599
|
ProgramKey.GetList = GetList;
|
|
4291
|
-
function Delete(
|
|
4600
|
+
function Delete(params) {
|
|
4292
4601
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4602
|
+
const { api, programId, req: reqParams } = params;
|
|
4293
4603
|
if (!programId) {
|
|
4294
4604
|
throw ("Program ID is required.");
|
|
4295
4605
|
}
|
|
@@ -4299,15 +4609,18 @@
|
|
|
4299
4609
|
});
|
|
4300
4610
|
}
|
|
4301
4611
|
ProgramKey.Delete = Delete;
|
|
4302
|
-
function Update(
|
|
4612
|
+
function Update(params) {
|
|
4303
4613
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4614
|
+
const { api, programKey: data, req: reqParams } = params;
|
|
4304
4615
|
if (!(data === null || data === void 0 ? void 0 : data.ProgramId)) {
|
|
4305
4616
|
throw ("Program ID is required.");
|
|
4306
4617
|
}
|
|
4307
|
-
|
|
4618
|
+
const res = yield api.POST("programkey", data, exports.Api.PrepReqParams(reqParams));
|
|
4308
4619
|
api.Cache.Remove(GetCacheKey(data.ProgramId));
|
|
4309
4620
|
api.Cache.Remove(GetListCacheKey());
|
|
4310
|
-
return
|
|
4621
|
+
return {
|
|
4622
|
+
programKey: res
|
|
4623
|
+
};
|
|
4311
4624
|
});
|
|
4312
4625
|
}
|
|
4313
4626
|
ProgramKey.Update = Update;
|
|
@@ -4354,8 +4667,9 @@
|
|
|
4354
4667
|
EPivot["Weight"] = "weight";
|
|
4355
4668
|
EPivot["UCS"] = "ucs";
|
|
4356
4669
|
})(EPivot = Tileset.EPivot || (Tileset.EPivot = {}));
|
|
4357
|
-
function Get(
|
|
4670
|
+
function Get(params) {
|
|
4358
4671
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4672
|
+
const { api, tilesetId, loadFiles, req: reqParams } = params;
|
|
4359
4673
|
if (!tilesetId) {
|
|
4360
4674
|
throw ("Tileset ID is required.");
|
|
4361
4675
|
}
|
|
@@ -4363,14 +4677,25 @@
|
|
|
4363
4677
|
if (cacheData) {
|
|
4364
4678
|
return cacheData;
|
|
4365
4679
|
}
|
|
4366
|
-
const
|
|
4367
|
-
|
|
4368
|
-
|
|
4680
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
4681
|
+
try {
|
|
4682
|
+
const data = yield api.GET(`tileset/get/${tilesetId}?noFiles=${Boolean(loadFiles) ? 0 : 1}`, reqParams);
|
|
4683
|
+
res({
|
|
4684
|
+
tileset: data
|
|
4685
|
+
});
|
|
4686
|
+
}
|
|
4687
|
+
catch (e) {
|
|
4688
|
+
rej(e);
|
|
4689
|
+
}
|
|
4690
|
+
}));
|
|
4691
|
+
api.Cache.Set(GetCacheKey(tilesetId, loadFiles), prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
4692
|
+
return prom;
|
|
4369
4693
|
});
|
|
4370
4694
|
}
|
|
4371
4695
|
Tileset.Get = Get;
|
|
4372
|
-
function GetList(
|
|
4696
|
+
function GetList(params) {
|
|
4373
4697
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4698
|
+
const { api, req: reqParams } = params;
|
|
4374
4699
|
const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
|
|
4375
4700
|
if (cacheData) {
|
|
4376
4701
|
return cacheData;
|
|
@@ -4378,7 +4703,9 @@
|
|
|
4378
4703
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
4379
4704
|
try {
|
|
4380
4705
|
const data = yield api.GET("tileset/getList", reqParams);
|
|
4381
|
-
res(
|
|
4706
|
+
res({
|
|
4707
|
+
tilesets: data
|
|
4708
|
+
});
|
|
4382
4709
|
}
|
|
4383
4710
|
catch (e) {
|
|
4384
4711
|
rej(e);
|
|
@@ -4389,8 +4716,9 @@
|
|
|
4389
4716
|
});
|
|
4390
4717
|
}
|
|
4391
4718
|
Tileset.GetList = GetList;
|
|
4392
|
-
function Delete(
|
|
4719
|
+
function Delete(params) {
|
|
4393
4720
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4721
|
+
const { api, tilesetId, req: reqParams } = params;
|
|
4394
4722
|
if (!tilesetId) {
|
|
4395
4723
|
throw ("Tileset ID is required.");
|
|
4396
4724
|
}
|
|
@@ -4400,8 +4728,9 @@
|
|
|
4400
4728
|
});
|
|
4401
4729
|
}
|
|
4402
4730
|
Tileset.Delete = Delete;
|
|
4403
|
-
function Update(
|
|
4731
|
+
function Update(params) {
|
|
4404
4732
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4733
|
+
let { api, tileset: data, req: reqParams } = params;
|
|
4405
4734
|
if (!(data === null || data === void 0 ? void 0 : data.name) || !(data === null || data === void 0 ? void 0 : data.type)) {
|
|
4406
4735
|
throw ("Tileset name and type are required.");
|
|
4407
4736
|
}
|
|
@@ -4413,22 +4742,25 @@
|
|
|
4413
4742
|
yield api.POST(`tileset/update/${data.id}`, data, exports.Api.PrepReqParams(reqParams));
|
|
4414
4743
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Tileset + exports.Api.ECacheKey.Id + data.id);
|
|
4415
4744
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Tileset);
|
|
4416
|
-
return
|
|
4745
|
+
return {
|
|
4746
|
+
tileset: data
|
|
4747
|
+
};
|
|
4417
4748
|
});
|
|
4418
4749
|
}
|
|
4419
4750
|
Tileset.Update = Update;
|
|
4420
|
-
function UploadFile(
|
|
4751
|
+
function UploadFile(params) {
|
|
4421
4752
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4753
|
+
const { api, tilesetId, file, req: reqParams } = params;
|
|
4422
4754
|
if (!tilesetId || !file) {
|
|
4423
4755
|
throw ("Tileset ID and file are required.");
|
|
4424
4756
|
}
|
|
4425
|
-
|
|
4426
|
-
return api.UPLOAD(`tileset/uploadFile/${tilesetId}/files`, file, params);
|
|
4757
|
+
return api.UPLOAD(`tileset/uploadFile/${tilesetId}/files`, file, exports.Api.PrepReqParams(reqParams));
|
|
4427
4758
|
});
|
|
4428
4759
|
}
|
|
4429
4760
|
Tileset.UploadFile = UploadFile;
|
|
4430
|
-
function DeleteFile(
|
|
4761
|
+
function DeleteFile(params) {
|
|
4431
4762
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4763
|
+
const { api, tilesetId, file, req: reqParams } = params;
|
|
4432
4764
|
if (!tilesetId || !file) {
|
|
4433
4765
|
throw ("Tileset ID and file are required.");
|
|
4434
4766
|
}
|
|
@@ -4437,19 +4769,20 @@
|
|
|
4437
4769
|
});
|
|
4438
4770
|
}
|
|
4439
4771
|
Tileset.DeleteFile = DeleteFile;
|
|
4440
|
-
function UploadSrcFile(
|
|
4772
|
+
function UploadSrcFile(params) {
|
|
4441
4773
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4774
|
+
const { api, tilesetId, file, req: reqParams } = params;
|
|
4442
4775
|
if (!tilesetId || !file) {
|
|
4443
4776
|
throw ("Tileset ID and file are required.");
|
|
4444
4777
|
}
|
|
4445
|
-
|
|
4446
|
-
yield api.UPLOAD(`tileset/uploadFile/${tilesetId}/src`, file, params);
|
|
4778
|
+
yield api.UPLOAD(`tileset/uploadFile/${tilesetId}/src`, file, exports.Api.PrepReqParams(reqParams));
|
|
4447
4779
|
api.Cache.Remove(GetCacheKey(tilesetId, true));
|
|
4448
4780
|
});
|
|
4449
4781
|
}
|
|
4450
4782
|
Tileset.UploadSrcFile = UploadSrcFile;
|
|
4451
|
-
function DeleteSrcFile(
|
|
4783
|
+
function DeleteSrcFile(params) {
|
|
4452
4784
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4785
|
+
const { api, tilesetId, file, req: reqParams } = params;
|
|
4453
4786
|
if (!tilesetId || !file) {
|
|
4454
4787
|
throw ("Tileset ID and file are required.");
|
|
4455
4788
|
}
|
|
@@ -4458,7 +4791,8 @@
|
|
|
4458
4791
|
});
|
|
4459
4792
|
}
|
|
4460
4793
|
Tileset.DeleteSrcFile = DeleteSrcFile;
|
|
4461
|
-
function GetFileUrl(
|
|
4794
|
+
function GetFileUrl(params) {
|
|
4795
|
+
let { api, tilesetId, file } = params;
|
|
4462
4796
|
if (!tilesetId) {
|
|
4463
4797
|
throw ("Tileset ID is required.");
|
|
4464
4798
|
}
|
|
@@ -4468,7 +4802,8 @@
|
|
|
4468
4802
|
return api.GetBaseUrl() + `tileset/getFile/${tilesetId}/files/${file}`;
|
|
4469
4803
|
}
|
|
4470
4804
|
Tileset.GetFileUrl = GetFileUrl;
|
|
4471
|
-
function GetSrcFileUrl(
|
|
4805
|
+
function GetSrcFileUrl(params) {
|
|
4806
|
+
let { api, tilesetId, file } = params;
|
|
4472
4807
|
if (!tilesetId) {
|
|
4473
4808
|
throw ("Tileset ID is required.");
|
|
4474
4809
|
}
|
|
@@ -4478,7 +4813,8 @@
|
|
|
4478
4813
|
return api.GetBaseUrl() + `tileset/getFile/${tilesetId}/src/${file}`;
|
|
4479
4814
|
}
|
|
4480
4815
|
Tileset.GetSrcFileUrl = GetSrcFileUrl;
|
|
4481
|
-
function GetPublicFileUrl(
|
|
4816
|
+
function GetPublicFileUrl(params) {
|
|
4817
|
+
let { api, tilesetId, file } = params;
|
|
4482
4818
|
if (!tilesetId) {
|
|
4483
4819
|
throw ("Tileset ID is required.");
|
|
4484
4820
|
}
|
|
@@ -4488,13 +4824,16 @@
|
|
|
4488
4824
|
return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
|
|
4489
4825
|
}
|
|
4490
4826
|
Tileset.GetPublicFileUrl = GetPublicFileUrl;
|
|
4491
|
-
function Generate(
|
|
4827
|
+
function Generate(params) {
|
|
4492
4828
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4829
|
+
const { api, tilesetId, req: reqParams } = params;
|
|
4493
4830
|
if (!tilesetId) {
|
|
4494
4831
|
throw ("Tileset ID is required.");
|
|
4495
4832
|
}
|
|
4496
4833
|
const res = yield api.GET(`tileset/generate/${tilesetId}`, exports.Api.PrepReqParams(reqParams));
|
|
4497
|
-
return
|
|
4834
|
+
return {
|
|
4835
|
+
pendingActionId: res.ID
|
|
4836
|
+
};
|
|
4498
4837
|
});
|
|
4499
4838
|
}
|
|
4500
4839
|
Tileset.Generate = Generate;
|
|
@@ -4507,8 +4846,9 @@
|
|
|
4507
4846
|
return exports.Api.ECacheKey.PublishTileset + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey.Id + tilesetId;
|
|
4508
4847
|
}
|
|
4509
4848
|
Publish.GetCacheKey = GetCacheKey;
|
|
4510
|
-
function Update(
|
|
4849
|
+
function Update(params) {
|
|
4511
4850
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4851
|
+
const { api, published: data, req: reqParams } = params;
|
|
4512
4852
|
if (!(data === null || data === void 0 ? void 0 : data["Tileset.ID"]) || !(data === null || data === void 0 ? void 0 : data["PublishedBy.ClientAccount.ID"]) || !(data === null || data === void 0 ? void 0 : data["PublishedBy.User.ID"])) {
|
|
4513
4853
|
throw ("Tileset ID, client account ID, and user ID are required.");
|
|
4514
4854
|
}
|
|
@@ -4523,12 +4863,15 @@
|
|
|
4523
4863
|
yield api.POST(`tileset/${data.ID}/enableForAccounts`, req, reqParams);
|
|
4524
4864
|
api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"], data["Tileset.ID"]));
|
|
4525
4865
|
api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"]));
|
|
4526
|
-
return
|
|
4866
|
+
return {
|
|
4867
|
+
published: data
|
|
4868
|
+
};
|
|
4527
4869
|
});
|
|
4528
4870
|
}
|
|
4529
4871
|
Publish.Update = Update;
|
|
4530
|
-
function Get(
|
|
4872
|
+
function Get(params) {
|
|
4531
4873
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4874
|
+
const { api, accountId, tilesetId, req: reqParams } = params;
|
|
4532
4875
|
if (!accountId || !tilesetId) {
|
|
4533
4876
|
throw ("Client account ID and tileset ID are required.");
|
|
4534
4877
|
}
|
|
@@ -4536,14 +4879,25 @@
|
|
|
4536
4879
|
if (cacheData) {
|
|
4537
4880
|
return cacheData;
|
|
4538
4881
|
}
|
|
4539
|
-
const
|
|
4540
|
-
|
|
4541
|
-
|
|
4882
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
4883
|
+
try {
|
|
4884
|
+
const data = yield api.GET(`tilesetByPublisher/${accountId}/${tilesetId}`, reqParams);
|
|
4885
|
+
res({
|
|
4886
|
+
published: data
|
|
4887
|
+
});
|
|
4888
|
+
}
|
|
4889
|
+
catch (e) {
|
|
4890
|
+
rej(e);
|
|
4891
|
+
}
|
|
4892
|
+
}));
|
|
4893
|
+
api.Cache.Set(GetCacheKey(accountId, tilesetId), prom);
|
|
4894
|
+
return prom;
|
|
4542
4895
|
});
|
|
4543
4896
|
}
|
|
4544
4897
|
Publish.Get = Get;
|
|
4545
|
-
function GetList(
|
|
4898
|
+
function GetList(params) {
|
|
4546
4899
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4900
|
+
const { api, accountId, req: reqParams } = params;
|
|
4547
4901
|
if (!accountId) {
|
|
4548
4902
|
throw ("Client account ID is required.");
|
|
4549
4903
|
}
|
|
@@ -4554,7 +4908,9 @@
|
|
|
4554
4908
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
4555
4909
|
try {
|
|
4556
4910
|
const data = yield api.GET(`tilesets/enabledForAccount/${accountId}`, reqParams);
|
|
4557
|
-
res(
|
|
4911
|
+
res({
|
|
4912
|
+
published: data.Items
|
|
4913
|
+
});
|
|
4558
4914
|
}
|
|
4559
4915
|
catch (e) {
|
|
4560
4916
|
rej(e);
|
|
@@ -4566,6 +4922,23 @@
|
|
|
4566
4922
|
}
|
|
4567
4923
|
Publish.GetList = GetList;
|
|
4568
4924
|
})(Publish = Tileset.Publish || (Tileset.Publish = {}));
|
|
4925
|
+
let Settings;
|
|
4926
|
+
(function (Settings) {
|
|
4927
|
+
let EMapTileSize;
|
|
4928
|
+
(function (EMapTileSize) {
|
|
4929
|
+
EMapTileSize[EMapTileSize["IMG_256"] = 256] = "IMG_256";
|
|
4930
|
+
EMapTileSize[EMapTileSize["IMG_512"] = 512] = "IMG_512";
|
|
4931
|
+
EMapTileSize[EMapTileSize["IMG_1024"] = 1024] = "IMG_1024";
|
|
4932
|
+
EMapTileSize[EMapTileSize["IMG_2048"] = 2048] = "IMG_2048";
|
|
4933
|
+
})(EMapTileSize = Settings.EMapTileSize || (Settings.EMapTileSize = {}));
|
|
4934
|
+
let EExternalMapType;
|
|
4935
|
+
(function (EExternalMapType) {
|
|
4936
|
+
EExternalMapType["TileMapImagery"] = "TileMapImagery";
|
|
4937
|
+
EExternalMapType["OpenStreetMapImagery"] = "OpenStreetMapImagery";
|
|
4938
|
+
EExternalMapType["MapBoxImagery"] = "MapBoxImagery";
|
|
4939
|
+
EExternalMapType["CesiumIon"] = "CesiumIon";
|
|
4940
|
+
})(EExternalMapType = Settings.EExternalMapType || (Settings.EExternalMapType = {}));
|
|
4941
|
+
})(Settings = Tileset.Settings || (Tileset.Settings = {}));
|
|
4569
4942
|
})(exports.Tileset || (exports.Tileset = {}));
|
|
4570
4943
|
|
|
4571
4944
|
(function (MenuItem) {
|
|
@@ -4684,16 +5057,17 @@
|
|
|
4684
5057
|
// This is the expected default version for the DataVersion value.
|
|
4685
5058
|
// This value should NOT be changed without looking at our API and seeing what the default value is.
|
|
4686
5059
|
ProjectViewBookmark.DEFAULT_DATA_VERSION = 1;
|
|
4687
|
-
let
|
|
4688
|
-
(function (
|
|
4689
|
-
|
|
4690
|
-
})(
|
|
4691
|
-
let
|
|
4692
|
-
(function (
|
|
4693
|
-
|
|
4694
|
-
})(
|
|
4695
|
-
function Get(
|
|
5060
|
+
let LegacyNavigator;
|
|
5061
|
+
(function (LegacyNavigator) {
|
|
5062
|
+
LegacyNavigator.DATA_VERSION = 1;
|
|
5063
|
+
})(LegacyNavigator = ProjectViewBookmark.LegacyNavigator || (ProjectViewBookmark.LegacyNavigator = {}));
|
|
5064
|
+
let Navigator;
|
|
5065
|
+
(function (Navigator) {
|
|
5066
|
+
Navigator.DATA_VERSION = 2;
|
|
5067
|
+
})(Navigator = ProjectViewBookmark.Navigator || (ProjectViewBookmark.Navigator = {}));
|
|
5068
|
+
function Get(params) {
|
|
4696
5069
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5070
|
+
const { api, viewId, bookmarkId, req: reqParams } = params;
|
|
4697
5071
|
if (!viewId || !bookmarkId) {
|
|
4698
5072
|
throw ("View ID and Bookmark ID are required.");
|
|
4699
5073
|
}
|
|
@@ -4702,14 +5076,25 @@
|
|
|
4702
5076
|
if (cacheData) {
|
|
4703
5077
|
return cacheData;
|
|
4704
5078
|
}
|
|
4705
|
-
const
|
|
4706
|
-
|
|
4707
|
-
|
|
5079
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
5080
|
+
try {
|
|
5081
|
+
const data = yield api.GET(`ui.view/${viewId}/slide/${bookmarkId}`, exports.Api.PrepReqParams(reqParams));
|
|
5082
|
+
res({
|
|
5083
|
+
bookmark: data
|
|
5084
|
+
});
|
|
5085
|
+
}
|
|
5086
|
+
catch (e) {
|
|
5087
|
+
rej(e);
|
|
5088
|
+
}
|
|
5089
|
+
}));
|
|
5090
|
+
api.Cache.Set(key, prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
5091
|
+
return prom;
|
|
4708
5092
|
});
|
|
4709
5093
|
}
|
|
4710
5094
|
ProjectViewBookmark.Get = Get;
|
|
4711
|
-
function Delete(
|
|
5095
|
+
function Delete(params) {
|
|
4712
5096
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5097
|
+
const { api, viewId, bookmarkId, req: reqParams } = params;
|
|
4713
5098
|
if (!viewId || !bookmarkId) {
|
|
4714
5099
|
throw ("View ID and Bookmark ID are required.");
|
|
4715
5100
|
}
|
|
@@ -4719,8 +5104,9 @@
|
|
|
4719
5104
|
});
|
|
4720
5105
|
}
|
|
4721
5106
|
ProjectViewBookmark.Delete = Delete;
|
|
4722
|
-
function GetList(
|
|
5107
|
+
function GetList(params) {
|
|
4723
5108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5109
|
+
const { api, viewId, req: reqParams } = params;
|
|
4724
5110
|
if (!viewId) {
|
|
4725
5111
|
throw ("View ID is required.");
|
|
4726
5112
|
}
|
|
@@ -4738,11 +5124,15 @@
|
|
|
4738
5124
|
for (let i = 0; i < items.length; i++) {
|
|
4739
5125
|
const item = items[i];
|
|
4740
5126
|
const prom = new Promise((res) => {
|
|
4741
|
-
res(
|
|
5127
|
+
res({
|
|
5128
|
+
bookmark: item
|
|
5129
|
+
});
|
|
4742
5130
|
});
|
|
4743
5131
|
api.Cache.Set(GetCacheKey(viewId, item.ID), prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
4744
5132
|
}
|
|
4745
|
-
res(
|
|
5133
|
+
res({
|
|
5134
|
+
bookmarks: items
|
|
5135
|
+
});
|
|
4746
5136
|
}
|
|
4747
5137
|
catch (e) {
|
|
4748
5138
|
rej(e);
|
|
@@ -4753,20 +5143,24 @@
|
|
|
4753
5143
|
});
|
|
4754
5144
|
}
|
|
4755
5145
|
ProjectViewBookmark.GetList = GetList;
|
|
4756
|
-
function Update(
|
|
5146
|
+
function Update(params) {
|
|
4757
5147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5148
|
+
const { api, viewId, bookmark: data, req: reqParams } = params;
|
|
4758
5149
|
if (!(data === null || data === void 0 ? void 0 : data.Title)) {
|
|
4759
5150
|
data.Title = data.ID;
|
|
4760
5151
|
}
|
|
4761
|
-
|
|
5152
|
+
const res = yield api.POST(`ui.view/${viewId}/slide/${data.ID ? data.ID : ""}`, data, exports.Api.PrepReqParams(reqParams));
|
|
4762
5153
|
api.Cache.Remove(GetCacheKey(viewId, data.ID));
|
|
4763
5154
|
api.Cache.Remove(GetListCacheKey(viewId));
|
|
4764
|
-
return
|
|
5155
|
+
return {
|
|
5156
|
+
bookmark: res
|
|
5157
|
+
};
|
|
4765
5158
|
});
|
|
4766
5159
|
}
|
|
4767
5160
|
ProjectViewBookmark.Update = Update;
|
|
4768
|
-
function SetOrder(
|
|
5161
|
+
function SetOrder(params) {
|
|
4769
5162
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5163
|
+
const { api, viewId, bookmarkIds, req: reqParams } = params;
|
|
4770
5164
|
const reqData = {
|
|
4771
5165
|
"UISlide.ID": bookmarkIds,
|
|
4772
5166
|
"DisplayOrder.Start": 0
|
|
@@ -4790,16 +5184,17 @@
|
|
|
4790
5184
|
// This is the expected default version for the DataVersion value.
|
|
4791
5185
|
// This value should NOT be changed without looking at our API and seeing what the default value is.
|
|
4792
5186
|
ProjectView.DEFAULT_DATA_VERSION = 1;
|
|
4793
|
-
let
|
|
4794
|
-
(function (
|
|
4795
|
-
|
|
4796
|
-
})(
|
|
4797
|
-
let
|
|
4798
|
-
(function (
|
|
4799
|
-
|
|
4800
|
-
})(
|
|
4801
|
-
function Get(
|
|
5187
|
+
let LegacyNavigator;
|
|
5188
|
+
(function (LegacyNavigator) {
|
|
5189
|
+
LegacyNavigator.DATA_VERSION = 1;
|
|
5190
|
+
})(LegacyNavigator = ProjectView.LegacyNavigator || (ProjectView.LegacyNavigator = {}));
|
|
5191
|
+
let Navigator;
|
|
5192
|
+
(function (Navigator) {
|
|
5193
|
+
Navigator.DATA_VERSION = 2;
|
|
5194
|
+
})(Navigator = ProjectView.Navigator || (ProjectView.Navigator = {}));
|
|
5195
|
+
function Get(params) {
|
|
4802
5196
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5197
|
+
const { api, viewId, req: reqParams } = params;
|
|
4803
5198
|
if (!viewId) {
|
|
4804
5199
|
throw ("View ID is required.");
|
|
4805
5200
|
}
|
|
@@ -4808,34 +5203,48 @@
|
|
|
4808
5203
|
if (cacheData) {
|
|
4809
5204
|
return cacheData;
|
|
4810
5205
|
}
|
|
4811
|
-
const
|
|
4812
|
-
|
|
4813
|
-
|
|
5206
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
5207
|
+
try {
|
|
5208
|
+
const data = yield api.GET(`ui.view/${viewId}`, exports.Api.PrepReqParams(reqParams));
|
|
5209
|
+
res({
|
|
5210
|
+
view: data
|
|
5211
|
+
});
|
|
5212
|
+
}
|
|
5213
|
+
catch (e) {
|
|
5214
|
+
rej(e);
|
|
5215
|
+
}
|
|
5216
|
+
}));
|
|
5217
|
+
api.Cache.Set(key, prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
5218
|
+
return prom;
|
|
4814
5219
|
});
|
|
4815
5220
|
}
|
|
4816
5221
|
ProjectView.Get = Get;
|
|
4817
|
-
function GetList(
|
|
5222
|
+
function GetList(params) {
|
|
4818
5223
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5224
|
+
const { api, req: reqParams } = params;
|
|
4819
5225
|
const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
|
|
4820
5226
|
if (cacheData) {
|
|
4821
5227
|
return cacheData;
|
|
4822
5228
|
}
|
|
4823
|
-
const
|
|
5229
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
4824
5230
|
try {
|
|
4825
5231
|
const data = yield api.GET("ui.view/list", exports.Api.PrepReqParams(reqParams));
|
|
4826
|
-
res(
|
|
5232
|
+
res({
|
|
5233
|
+
views: data.Items
|
|
5234
|
+
});
|
|
4827
5235
|
}
|
|
4828
5236
|
catch (e) {
|
|
4829
5237
|
rej(e);
|
|
4830
5238
|
}
|
|
4831
5239
|
}));
|
|
4832
|
-
api.Cache.Set(GetListCacheKey(),
|
|
4833
|
-
return
|
|
5240
|
+
api.Cache.Set(GetListCacheKey(), prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
5241
|
+
return prom;
|
|
4834
5242
|
});
|
|
4835
5243
|
}
|
|
4836
5244
|
ProjectView.GetList = GetList;
|
|
4837
|
-
function Delete(
|
|
5245
|
+
function Delete(params) {
|
|
4838
5246
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5247
|
+
const { api, viewId, req: reqParams } = params;
|
|
4839
5248
|
if (!viewId) {
|
|
4840
5249
|
throw ("View ID is required.");
|
|
4841
5250
|
}
|
|
@@ -4845,8 +5254,9 @@
|
|
|
4845
5254
|
});
|
|
4846
5255
|
}
|
|
4847
5256
|
ProjectView.Delete = Delete;
|
|
4848
|
-
function Update(
|
|
5257
|
+
function Update(params) {
|
|
4849
5258
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5259
|
+
let { api, view: data, req: reqParams } = params;
|
|
4850
5260
|
if (!data) {
|
|
4851
5261
|
data = {};
|
|
4852
5262
|
}
|
|
@@ -4868,7 +5278,9 @@
|
|
|
4868
5278
|
}
|
|
4869
5279
|
api.Cache.Remove(GetCacheKey(data.ID));
|
|
4870
5280
|
api.Cache.Remove(GetListCacheKey());
|
|
4871
|
-
return
|
|
5281
|
+
return {
|
|
5282
|
+
view: data
|
|
5283
|
+
};
|
|
4872
5284
|
});
|
|
4873
5285
|
}
|
|
4874
5286
|
ProjectView.Update = Update;
|
|
@@ -4877,7 +5289,11 @@
|
|
|
4877
5289
|
function getTemplateSettings(apiGetter, reqParams) {
|
|
4878
5290
|
var _a;
|
|
4879
5291
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4880
|
-
const view = yield exports.ProjectView.Get(
|
|
5292
|
+
const { view } = yield exports.ProjectView.Get({
|
|
5293
|
+
api: apiGetter.getApi(exports.Api.TEMPLATE_ACCOUNT_ID),
|
|
5294
|
+
viewId: "default",
|
|
5295
|
+
req: reqParams
|
|
5296
|
+
});
|
|
4881
5297
|
return (_a = view.Settings) !== null && _a !== void 0 ? _a : {};
|
|
4882
5298
|
});
|
|
4883
5299
|
}
|
|
@@ -4894,29 +5310,35 @@
|
|
|
4894
5310
|
}
|
|
4895
5311
|
}
|
|
4896
5312
|
(function (ProjectViewLegacyTile) {
|
|
4897
|
-
function MergeMapTemplateData(
|
|
5313
|
+
function MergeMapTemplateData(params) {
|
|
4898
5314
|
var _a;
|
|
4899
5315
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5316
|
+
const { getter, sources: items, addIfMissing, req: reqParams } = params;
|
|
4900
5317
|
const settings = yield getTemplateSettings(getter, reqParams);
|
|
4901
5318
|
const maps = (_a = settings.CesiumMapSources) !== null && _a !== void 0 ? _a : [];
|
|
4902
5319
|
for (let i = 0; i < maps.length; i++) {
|
|
4903
5320
|
const mapSource = maps[i];
|
|
4904
5321
|
checkSourceToTemplate(items, mapSource, addIfMissing);
|
|
4905
5322
|
}
|
|
4906
|
-
return
|
|
5323
|
+
return {
|
|
5324
|
+
sources: items
|
|
5325
|
+
};
|
|
4907
5326
|
});
|
|
4908
5327
|
}
|
|
4909
5328
|
ProjectViewLegacyTile.MergeMapTemplateData = MergeMapTemplateData;
|
|
4910
|
-
function MergeTerrainTemplateData(
|
|
5329
|
+
function MergeTerrainTemplateData(params) {
|
|
4911
5330
|
var _a;
|
|
4912
5331
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5332
|
+
const { getter, sources: items, addIfMissing, req: reqParams } = params;
|
|
4913
5333
|
const settings = yield getTemplateSettings(getter, reqParams);
|
|
4914
5334
|
const terrains = (_a = settings.CesiumTerrainSources) !== null && _a !== void 0 ? _a : [];
|
|
4915
5335
|
for (let i = 0; i < terrains.length; i++) {
|
|
4916
5336
|
const terrainSource = terrains[i];
|
|
4917
5337
|
checkSourceToTemplate(items, terrainSource, addIfMissing);
|
|
4918
5338
|
}
|
|
4919
|
-
return
|
|
5339
|
+
return {
|
|
5340
|
+
sources: items
|
|
5341
|
+
};
|
|
4920
5342
|
});
|
|
4921
5343
|
}
|
|
4922
5344
|
ProjectViewLegacyTile.MergeTerrainTemplateData = MergeTerrainTemplateData;
|
|
@@ -5046,24 +5468,32 @@
|
|
|
5046
5468
|
EStatus["Complete"] = "COMPLETE";
|
|
5047
5469
|
EStatus["Failed"] = "FAILED";
|
|
5048
5470
|
})(EStatus = PendingAction.EStatus || (PendingAction.EStatus = {}));
|
|
5049
|
-
function Get(
|
|
5471
|
+
function Get(params) {
|
|
5050
5472
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5473
|
+
const { api, actionId, req: reqParams } = params;
|
|
5051
5474
|
if (!actionId) {
|
|
5052
5475
|
throw ("Action ID is required.");
|
|
5053
5476
|
}
|
|
5054
|
-
|
|
5477
|
+
const data = yield api.GET(`pendingAction/${actionId}`, exports.Api.PrepReqParams(reqParams));
|
|
5478
|
+
return {
|
|
5479
|
+
action: data
|
|
5480
|
+
};
|
|
5055
5481
|
});
|
|
5056
5482
|
}
|
|
5057
5483
|
PendingAction.Get = Get;
|
|
5058
|
-
function GetRelevantList(
|
|
5484
|
+
function GetRelevantList(params) {
|
|
5059
5485
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5060
|
-
const
|
|
5061
|
-
|
|
5486
|
+
const { api, stricter, reqParams } = params;
|
|
5487
|
+
const data = yield api.GET(`pendingActions/important?Update=${Boolean(stricter)}`, exports.Api.PrepReqParams(reqParams));
|
|
5488
|
+
return {
|
|
5489
|
+
actions: data.Items
|
|
5490
|
+
};
|
|
5062
5491
|
});
|
|
5063
5492
|
}
|
|
5064
5493
|
PendingAction.GetRelevantList = GetRelevantList;
|
|
5065
|
-
function GetMessages(
|
|
5494
|
+
function GetMessages(params) {
|
|
5066
5495
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5496
|
+
let { api, actionId, order, startIndex, amount, req: reqParams } = params;
|
|
5067
5497
|
if (amount == null) {
|
|
5068
5498
|
amount = 500;
|
|
5069
5499
|
}
|
|
@@ -5075,7 +5505,9 @@
|
|
|
5075
5505
|
}
|
|
5076
5506
|
const args = `?SortOrder=${order == exports.Api.ESortOrder.Desc ? "DESC" : "ASC"}&PageSize=${amount}&PageIndex=${startIndex}`;
|
|
5077
5507
|
const data = yield api.GET(`pendingAction/${actionId}/progressMessages` + args, exports.Api.PrepReqParams(reqParams));
|
|
5078
|
-
return
|
|
5508
|
+
return {
|
|
5509
|
+
messages: data.Items
|
|
5510
|
+
};
|
|
5079
5511
|
});
|
|
5080
5512
|
}
|
|
5081
5513
|
PendingAction.GetMessages = GetMessages;
|
|
@@ -5101,25 +5533,29 @@
|
|
|
5101
5533
|
EPointType["Icon"] = "ICON";
|
|
5102
5534
|
EPointType["Cylinder"] = "CYLINDER";
|
|
5103
5535
|
})(EPointType = Style.EPointType || (Style.EPointType = {}));
|
|
5104
|
-
function GetList(
|
|
5536
|
+
function GetList(params) {
|
|
5537
|
+
const { api, req: reqParams } = params;
|
|
5105
5538
|
const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
|
|
5106
5539
|
if (cacheData) {
|
|
5107
5540
|
return cacheData;
|
|
5108
5541
|
}
|
|
5109
|
-
const
|
|
5542
|
+
const res = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
5110
5543
|
try {
|
|
5111
5544
|
const data = yield api.GET("ui.entityDisplaySettings", exports.Api.PrepReqParams(reqParams));
|
|
5112
|
-
res(
|
|
5545
|
+
res({
|
|
5546
|
+
styles: data.Items
|
|
5547
|
+
});
|
|
5113
5548
|
}
|
|
5114
5549
|
catch (e) {
|
|
5115
5550
|
rej(e);
|
|
5116
5551
|
}
|
|
5117
5552
|
}));
|
|
5118
|
-
api.Cache.Set(GetListCacheKey(),
|
|
5119
|
-
return
|
|
5553
|
+
api.Cache.Set(GetListCacheKey(), res, exports.Api.DEFAULT_CACHE_DURATION);
|
|
5554
|
+
return res;
|
|
5120
5555
|
}
|
|
5121
5556
|
Style.GetList = GetList;
|
|
5122
|
-
function Get(
|
|
5557
|
+
function Get(params) {
|
|
5558
|
+
const { api, styleId: id, req: reqParams } = params;
|
|
5123
5559
|
if (!id) {
|
|
5124
5560
|
throw ("Style ID is required.");
|
|
5125
5561
|
}
|
|
@@ -5127,28 +5563,42 @@
|
|
|
5127
5563
|
if (cacheData) {
|
|
5128
5564
|
return cacheData;
|
|
5129
5565
|
}
|
|
5130
|
-
const
|
|
5131
|
-
|
|
5132
|
-
|
|
5566
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
5567
|
+
try {
|
|
5568
|
+
const data = yield api.GET(`ui.entityDisplaySetting/${id}`, exports.Api.PrepReqParams(reqParams));
|
|
5569
|
+
res({
|
|
5570
|
+
style: data
|
|
5571
|
+
});
|
|
5572
|
+
}
|
|
5573
|
+
catch (e) {
|
|
5574
|
+
rej(e);
|
|
5575
|
+
}
|
|
5576
|
+
}));
|
|
5577
|
+
api.Cache.Set(GetCacheKey(id), prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
5578
|
+
return prom;
|
|
5133
5579
|
}
|
|
5134
5580
|
Style.Get = Get;
|
|
5135
|
-
function Update(
|
|
5581
|
+
function Update(params) {
|
|
5136
5582
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5583
|
+
const { api, style: data, req: reqParams } = params;
|
|
5137
5584
|
if (!(data === null || data === void 0 ? void 0 : data.Name)) {
|
|
5138
5585
|
throw ("Style name is required.");
|
|
5139
5586
|
}
|
|
5140
5587
|
if (!data.ID) {
|
|
5141
5588
|
data.ID = 0;
|
|
5142
5589
|
}
|
|
5143
|
-
|
|
5590
|
+
const res = yield api.POST(`ui.entityDisplaySetting/${data.ID}`, data, exports.Api.PrepReqParams(reqParams));
|
|
5144
5591
|
api.Cache.Remove(GetCacheKey(data.ID));
|
|
5145
5592
|
api.Cache.Remove(GetListCacheKey());
|
|
5146
|
-
return
|
|
5593
|
+
return {
|
|
5594
|
+
style: res
|
|
5595
|
+
};
|
|
5147
5596
|
});
|
|
5148
5597
|
}
|
|
5149
5598
|
Style.Update = Update;
|
|
5150
|
-
function Delete(
|
|
5599
|
+
function Delete(params) {
|
|
5151
5600
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5601
|
+
const { api, styleId: id, req: reqParams } = params;
|
|
5152
5602
|
if (!id) {
|
|
5153
5603
|
throw ("Style ID is required.");
|
|
5154
5604
|
}
|
|
@@ -5160,35 +5610,6 @@
|
|
|
5160
5610
|
Style.Delete = Delete;
|
|
5161
5611
|
})(exports.Style || (exports.Style = {}));
|
|
5162
5612
|
|
|
5163
|
-
/**
|
|
5164
|
-
* Describes expected settings for an entities-map tileset.
|
|
5165
|
-
* This is the kind of tileset generated from arbitrary Bruce entities-
|
|
5166
|
-
* which produced map tiles of the entity vector geometry.
|
|
5167
|
-
*/
|
|
5168
|
-
(function (TilesetEntitiesMapTiles) {
|
|
5169
|
-
let ETileSize;
|
|
5170
|
-
(function (ETileSize) {
|
|
5171
|
-
ETileSize[ETileSize["IMG_256"] = 256] = "IMG_256";
|
|
5172
|
-
ETileSize[ETileSize["IMG_512"] = 512] = "IMG_512";
|
|
5173
|
-
ETileSize[ETileSize["IMG_1024"] = 1024] = "IMG_1024";
|
|
5174
|
-
ETileSize[ETileSize["IMG_2048"] = 2048] = "IMG_2048";
|
|
5175
|
-
})(ETileSize = TilesetEntitiesMapTiles.ETileSize || (TilesetEntitiesMapTiles.ETileSize = {}));
|
|
5176
|
-
})(exports.TilesetEntitiesMapTiles || (exports.TilesetEntitiesMapTiles = {}));
|
|
5177
|
-
|
|
5178
|
-
/**
|
|
5179
|
-
* Describes settings for an external map-tiles tileset.
|
|
5180
|
-
* This will serve content from elsewhere with the assumption that the data is valid map tiles.
|
|
5181
|
-
*/
|
|
5182
|
-
(function (TilesetExtMapTiles) {
|
|
5183
|
-
let EType;
|
|
5184
|
-
(function (EType) {
|
|
5185
|
-
EType["TileMapImagery"] = "TileMapImagery";
|
|
5186
|
-
EType["OpenStreetMapImagery"] = "OpenStreetMapImagery";
|
|
5187
|
-
EType["MapBoxImagery"] = "MapBoxImagery";
|
|
5188
|
-
EType["CesiumIon"] = "CesiumIon";
|
|
5189
|
-
})(EType = TilesetExtMapTiles.EType || (TilesetExtMapTiles.EType = {}));
|
|
5190
|
-
})(exports.TilesetExtMapTiles || (exports.TilesetExtMapTiles = {}));
|
|
5191
|
-
|
|
5192
5613
|
(function (Permission) {
|
|
5193
5614
|
let EPerm;
|
|
5194
5615
|
(function (EPerm) {
|
|
@@ -5210,8 +5631,9 @@
|
|
|
5210
5631
|
function GetCacheKey(sessionId) {
|
|
5211
5632
|
return `${exports.Api.ECacheKey.Session}${exports.Api.ECacheKey.Id}${sessionId}`;
|
|
5212
5633
|
}
|
|
5213
|
-
function Get(
|
|
5634
|
+
function Get(params) {
|
|
5214
5635
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5636
|
+
const { api, sessionId, req: reqParams } = params;
|
|
5215
5637
|
if (!sessionId) {
|
|
5216
5638
|
throw ("Session ID is required.");
|
|
5217
5639
|
}
|
|
@@ -5220,14 +5642,25 @@
|
|
|
5220
5642
|
if (cacheData) {
|
|
5221
5643
|
return cacheData;
|
|
5222
5644
|
}
|
|
5223
|
-
const
|
|
5224
|
-
|
|
5225
|
-
|
|
5645
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
5646
|
+
try {
|
|
5647
|
+
const data = yield api.GET(`session/${sessionId}`, reqParams);
|
|
5648
|
+
res({
|
|
5649
|
+
session: data
|
|
5650
|
+
});
|
|
5651
|
+
}
|
|
5652
|
+
catch (e) {
|
|
5653
|
+
rej(e);
|
|
5654
|
+
}
|
|
5655
|
+
}));
|
|
5656
|
+
api.Cache.Set(key, prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
5657
|
+
return prom;
|
|
5226
5658
|
});
|
|
5227
5659
|
}
|
|
5228
5660
|
Session.Get = Get;
|
|
5229
|
-
function Login(
|
|
5661
|
+
function Login(params) {
|
|
5230
5662
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5663
|
+
const { api, username, password, accountId, req: reqParams } = params;
|
|
5231
5664
|
if (!username || !password) {
|
|
5232
5665
|
throw ("Username and password are required.");
|
|
5233
5666
|
}
|
|
@@ -5240,12 +5673,15 @@
|
|
|
5240
5673
|
const ssid = session === null || session === void 0 ? void 0 : session.ID;
|
|
5241
5674
|
api.SetSessionId(ssid);
|
|
5242
5675
|
api.Cache.Remove(GetCacheKey(ssid));
|
|
5243
|
-
return
|
|
5676
|
+
return {
|
|
5677
|
+
session: session
|
|
5678
|
+
};
|
|
5244
5679
|
});
|
|
5245
5680
|
}
|
|
5246
5681
|
Session.Login = Login;
|
|
5247
|
-
function Logout(
|
|
5682
|
+
function Logout(params) {
|
|
5248
5683
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5684
|
+
const { api, req: reqParams } = params;
|
|
5249
5685
|
const ssid = api.GetSessionId();
|
|
5250
5686
|
if (ssid) {
|
|
5251
5687
|
yield api.POST("logout", null, reqParams);
|
|
@@ -5255,8 +5691,9 @@
|
|
|
5255
5691
|
});
|
|
5256
5692
|
}
|
|
5257
5693
|
Session.Logout = Logout;
|
|
5258
|
-
function IsPermEnabled(
|
|
5694
|
+
function IsPermEnabled(params) {
|
|
5259
5695
|
var _a, _b;
|
|
5696
|
+
let { session, accountId, perm } = params;
|
|
5260
5697
|
if (!perm) {
|
|
5261
5698
|
throw ("Perm is required.");
|
|
5262
5699
|
}
|
|
@@ -5280,8 +5717,9 @@
|
|
|
5280
5717
|
return false;
|
|
5281
5718
|
}
|
|
5282
5719
|
Session.IsPermEnabled = IsPermEnabled;
|
|
5283
|
-
function IsSuperPermEnabled(
|
|
5720
|
+
function IsSuperPermEnabled(params) {
|
|
5284
5721
|
var _a, _b;
|
|
5722
|
+
let { session, perm } = params;
|
|
5285
5723
|
if (!perm) {
|
|
5286
5724
|
throw ("Perm is required.");
|
|
5287
5725
|
}
|
|
@@ -5290,58 +5728,79 @@
|
|
|
5290
5728
|
return accessPerms.findIndex(x => x.toLocaleUpperCase() == perm) > -1;
|
|
5291
5729
|
}
|
|
5292
5730
|
Session.IsSuperPermEnabled = IsSuperPermEnabled;
|
|
5293
|
-
function IsAccountAdmin(
|
|
5294
|
-
return IsPermEnabled(
|
|
5731
|
+
function IsAccountAdmin(params) {
|
|
5732
|
+
return IsPermEnabled({
|
|
5733
|
+
perm: exports.Permission.EPerm.ADMIN,
|
|
5734
|
+
accountId: params.accountId,
|
|
5735
|
+
session: params.session
|
|
5736
|
+
});
|
|
5295
5737
|
}
|
|
5296
5738
|
Session.IsAccountAdmin = IsAccountAdmin;
|
|
5297
|
-
function IsSuperAdmin(
|
|
5298
|
-
return IsSuperPermEnabled(
|
|
5739
|
+
function IsSuperAdmin(params) {
|
|
5740
|
+
return IsSuperPermEnabled({
|
|
5741
|
+
session: params.session,
|
|
5742
|
+
perm: exports.Permission.EPerm.ADMIN
|
|
5743
|
+
});
|
|
5299
5744
|
}
|
|
5300
5745
|
Session.IsSuperAdmin = IsSuperAdmin;
|
|
5301
5746
|
})(exports.Session || (exports.Session = {}));
|
|
5302
5747
|
|
|
5303
5748
|
(function (UserGroup) {
|
|
5304
|
-
function GetByName(
|
|
5749
|
+
function GetByName(params) {
|
|
5305
5750
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5751
|
+
const { api, accountId, name, req: reqParams } = params;
|
|
5306
5752
|
if (!name || !accountId) {
|
|
5307
5753
|
throw ("Name and AccountID are required.");
|
|
5308
5754
|
}
|
|
5309
|
-
|
|
5755
|
+
const data = yield api.GET(`account/${accountId}/userGroupByName/${name}`, reqParams);
|
|
5756
|
+
return {
|
|
5757
|
+
group: data
|
|
5758
|
+
};
|
|
5310
5759
|
});
|
|
5311
5760
|
}
|
|
5312
5761
|
UserGroup.GetByName = GetByName;
|
|
5313
|
-
function GetUsers(
|
|
5762
|
+
function GetUsers(params) {
|
|
5314
5763
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5764
|
+
const { api, accountId, groupId: id, req: reqParams } = params;
|
|
5315
5765
|
if (!accountId || !id) {
|
|
5316
5766
|
throw ("AccountID and ID are required.");
|
|
5317
5767
|
}
|
|
5318
5768
|
const data = yield api.GET(`userGroup/${accountId}/${id}/users`, reqParams);
|
|
5319
|
-
return
|
|
5769
|
+
return {
|
|
5770
|
+
users: data.Items
|
|
5771
|
+
};
|
|
5320
5772
|
});
|
|
5321
5773
|
}
|
|
5322
5774
|
UserGroup.GetUsers = GetUsers;
|
|
5323
|
-
function GetListByPerm(
|
|
5775
|
+
function GetListByPerm(params) {
|
|
5324
5776
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5777
|
+
const { api, accountId, perm, req: reqParams } = params;
|
|
5325
5778
|
if (!accountId || !perm) {
|
|
5326
5779
|
throw ("AccountID and Perm are required.");
|
|
5327
5780
|
}
|
|
5328
5781
|
const data = yield api.GET(`userGroupsByFeature/${accountId}/${perm}`, reqParams);
|
|
5329
|
-
return
|
|
5782
|
+
return {
|
|
5783
|
+
groups: data.Items
|
|
5784
|
+
};
|
|
5330
5785
|
});
|
|
5331
5786
|
}
|
|
5332
5787
|
UserGroup.GetListByPerm = GetListByPerm;
|
|
5333
|
-
function GetList(
|
|
5788
|
+
function GetList(params) {
|
|
5334
5789
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5790
|
+
const { api, accountId, req: reqParams } = params;
|
|
5335
5791
|
if (!accountId) {
|
|
5336
5792
|
throw ("AccountID is required.");
|
|
5337
5793
|
}
|
|
5338
5794
|
const data = yield api.GET(`userGroups/${accountId}`, reqParams);
|
|
5339
|
-
return
|
|
5795
|
+
return {
|
|
5796
|
+
groups: data.Items
|
|
5797
|
+
};
|
|
5340
5798
|
});
|
|
5341
5799
|
}
|
|
5342
5800
|
UserGroup.GetList = GetList;
|
|
5343
|
-
function Delete(
|
|
5801
|
+
function Delete(params) {
|
|
5344
5802
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5803
|
+
const { api, accountId, groupId: id, req: reqParams } = params;
|
|
5345
5804
|
if (!accountId || !id) {
|
|
5346
5805
|
throw ("AccountID and ID are required.");
|
|
5347
5806
|
}
|
|
@@ -5349,13 +5808,16 @@
|
|
|
5349
5808
|
});
|
|
5350
5809
|
}
|
|
5351
5810
|
UserGroup.Delete = Delete;
|
|
5352
|
-
function Update(
|
|
5811
|
+
function Update(params) {
|
|
5353
5812
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5813
|
+
const { api, group: data, reqParams } = params;
|
|
5354
5814
|
if (!data.Name || !data["ClientAccount.ID"]) {
|
|
5355
5815
|
throw ("User group name and client account ID are required.");
|
|
5356
5816
|
}
|
|
5357
|
-
|
|
5358
|
-
return
|
|
5817
|
+
const res = yield api.POST(`userGroup${data.ID ? ("/" + data.ID) : ""}`, data, reqParams);
|
|
5818
|
+
return {
|
|
5819
|
+
group: res
|
|
5820
|
+
};
|
|
5359
5821
|
});
|
|
5360
5822
|
}
|
|
5361
5823
|
UserGroup.Update = Update;
|
|
@@ -5385,8 +5847,9 @@
|
|
|
5385
5847
|
EType["User"] = "LOGIN_USER";
|
|
5386
5848
|
EType["AccessToken"] = "ACCESS_TOKEN";
|
|
5387
5849
|
})(EType = User.EType || (User.EType = {}));
|
|
5388
|
-
function Get(
|
|
5850
|
+
function Get(params) {
|
|
5389
5851
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5852
|
+
const { api, userId: id, accountId, req: reqParams } = params;
|
|
5390
5853
|
if (!id) {
|
|
5391
5854
|
throw ("ID is required.");
|
|
5392
5855
|
}
|
|
@@ -5396,13 +5859,16 @@
|
|
|
5396
5859
|
}
|
|
5397
5860
|
const req = yield api.GET(`user/${id}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
|
|
5398
5861
|
api.Cache.Set(GetCacheKey(id, accountId), req, exports.Api.DEFAULT_CACHE_DURATION);
|
|
5399
|
-
return
|
|
5862
|
+
return {
|
|
5863
|
+
user: req
|
|
5864
|
+
};
|
|
5400
5865
|
});
|
|
5401
5866
|
}
|
|
5402
5867
|
User.Get = Get;
|
|
5403
|
-
function Update(
|
|
5868
|
+
function Update(params) {
|
|
5404
5869
|
var _a;
|
|
5405
5870
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5871
|
+
const { api, user: data, req: reqParams } = params;
|
|
5406
5872
|
if (!(data === null || data === void 0 ? void 0 : data.ID) || !(data === null || data === void 0 ? void 0 : data.Type)) {
|
|
5407
5873
|
throw ("ID and Type are required.");
|
|
5408
5874
|
}
|
|
@@ -5419,7 +5885,7 @@
|
|
|
5419
5885
|
}
|
|
5420
5886
|
}
|
|
5421
5887
|
}
|
|
5422
|
-
|
|
5888
|
+
const res = yield api.POST(`user/${data.ID}`, data, reqParams);
|
|
5423
5889
|
api.Cache.RemoveByContains(exports.Api.ECacheKey.User + exports.Api.ECacheKey.Id + data.ID);
|
|
5424
5890
|
if (data.Type == EType.AccessToken) {
|
|
5425
5891
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.AccessToken + exports.Api.ECacheKey.Account);
|
|
@@ -5427,7 +5893,9 @@
|
|
|
5427
5893
|
else if (data.Type == EType.User) {
|
|
5428
5894
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.User + exports.Api.ECacheKey.Account);
|
|
5429
5895
|
}
|
|
5430
|
-
return
|
|
5896
|
+
return {
|
|
5897
|
+
user: res
|
|
5898
|
+
};
|
|
5431
5899
|
});
|
|
5432
5900
|
}
|
|
5433
5901
|
User.Update = Update;
|
|
@@ -5450,14 +5918,18 @@
|
|
|
5450
5918
|
try {
|
|
5451
5919
|
const data = yield api.GET(`user/${userId}/application/${appId}/settings`);
|
|
5452
5920
|
const settings = (data === null || data === void 0 ? void 0 : data.Settings) ? data.Settings : {};
|
|
5453
|
-
res(
|
|
5921
|
+
res({
|
|
5922
|
+
settings: settings
|
|
5923
|
+
});
|
|
5454
5924
|
}
|
|
5455
5925
|
catch (e) {
|
|
5456
5926
|
// It will complain if an app id hasn't been used yet.
|
|
5457
5927
|
// We need to suppress that error.
|
|
5458
5928
|
if (e && typeof e == "object") {
|
|
5459
5929
|
if (e.ERROR && typeof e.ERROR == "object" && e.ERROR.Type == "NotFound") {
|
|
5460
|
-
res({
|
|
5930
|
+
res({
|
|
5931
|
+
settings: {}
|
|
5932
|
+
});
|
|
5461
5933
|
return;
|
|
5462
5934
|
}
|
|
5463
5935
|
}
|
|
@@ -5492,8 +5964,9 @@
|
|
|
5492
5964
|
});
|
|
5493
5965
|
}
|
|
5494
5966
|
User.UpdateSettings = UpdateSettings;
|
|
5495
|
-
function GetUsernameAvailable(
|
|
5967
|
+
function GetUsernameAvailable(params) {
|
|
5496
5968
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5969
|
+
const { api, username, excludeUserId, req: reqParams } = params;
|
|
5497
5970
|
if (!username) {
|
|
5498
5971
|
throw ("Username is required.");
|
|
5499
5972
|
}
|
|
@@ -5501,7 +5974,9 @@
|
|
|
5501
5974
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
5502
5975
|
try {
|
|
5503
5976
|
const data = yield req;
|
|
5504
|
-
res(
|
|
5977
|
+
res({
|
|
5978
|
+
isAvailable: data.IsAvailable
|
|
5979
|
+
});
|
|
5505
5980
|
}
|
|
5506
5981
|
catch (e) {
|
|
5507
5982
|
rej(e);
|
|
@@ -5517,8 +5992,9 @@
|
|
|
5517
5992
|
return exports.Api.ECacheKey.User + exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId;
|
|
5518
5993
|
}
|
|
5519
5994
|
LoginUser.GetListCacheKey = GetListCacheKey;
|
|
5520
|
-
function GetByEmail(
|
|
5995
|
+
function GetByEmail(params) {
|
|
5521
5996
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5997
|
+
const { api, email, accountId, req: reqParams } = params;
|
|
5522
5998
|
if (!email) {
|
|
5523
5999
|
throw ("Email is required.");
|
|
5524
6000
|
}
|
|
@@ -5528,12 +6004,15 @@
|
|
|
5528
6004
|
}
|
|
5529
6005
|
const req = yield api.GET(`userByEmail/${email}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
|
|
5530
6006
|
api.Cache.Set(GetEmailCacheKey(email, accountId), req, exports.Api.DEFAULT_CACHE_DURATION);
|
|
5531
|
-
return
|
|
6007
|
+
return {
|
|
6008
|
+
user: req
|
|
6009
|
+
};
|
|
5532
6010
|
});
|
|
5533
6011
|
}
|
|
5534
6012
|
LoginUser.GetByEmail = GetByEmail;
|
|
5535
|
-
function GetList(
|
|
6013
|
+
function GetList(params) {
|
|
5536
6014
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6015
|
+
let { api, accountId, exclusive, req: reqParams } = params;
|
|
5537
6016
|
if (!accountId) {
|
|
5538
6017
|
throw ("Client account ID is required.");
|
|
5539
6018
|
}
|
|
@@ -5547,13 +6026,16 @@
|
|
|
5547
6026
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
5548
6027
|
try {
|
|
5549
6028
|
const data = yield api.GET(`users?clientAccountID=${accountId}${exclusive ? "&allExcludingClientAccount=true" : ""}`, reqParams);
|
|
5550
|
-
res(
|
|
6029
|
+
res({
|
|
6030
|
+
users: data.Items
|
|
6031
|
+
});
|
|
5551
6032
|
}
|
|
5552
6033
|
catch (e) {
|
|
5553
6034
|
rej(e);
|
|
5554
6035
|
}
|
|
5555
6036
|
}));
|
|
5556
|
-
req.then((
|
|
6037
|
+
req.then((data) => {
|
|
6038
|
+
const users = data.users;
|
|
5557
6039
|
for (let i = 0; i < users.length; i++) {
|
|
5558
6040
|
api.Cache.Set(GetCacheKey(users[i].ID, accountId), users[i]);
|
|
5559
6041
|
}
|
|
@@ -5567,12 +6049,12 @@
|
|
|
5567
6049
|
LoginUser.GetList = GetList;
|
|
5568
6050
|
/**
|
|
5569
6051
|
* Sends a signup email to the specified email address.
|
|
5570
|
-
* @param
|
|
5571
|
-
* @param email
|
|
6052
|
+
* @param params
|
|
5572
6053
|
* @returns
|
|
5573
6054
|
*/
|
|
5574
|
-
function Signup(
|
|
6055
|
+
function Signup(params) {
|
|
5575
6056
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6057
|
+
const { api, email, req: reqParams } = params;
|
|
5576
6058
|
if (!email) {
|
|
5577
6059
|
throw ("Email is required.");
|
|
5578
6060
|
}
|
|
@@ -5584,12 +6066,12 @@
|
|
|
5584
6066
|
LoginUser.Signup = Signup;
|
|
5585
6067
|
/**
|
|
5586
6068
|
* Sends a new signup email using a previous one's expired code.
|
|
5587
|
-
* @param
|
|
5588
|
-
* @param expiredCode
|
|
6069
|
+
* @param params
|
|
5589
6070
|
* @returns
|
|
5590
6071
|
*/
|
|
5591
|
-
function SignupResend(
|
|
6072
|
+
function SignupResend(params) {
|
|
5592
6073
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6074
|
+
const { api, expiredCode, req: reqParams } = params;
|
|
5593
6075
|
if (!expiredCode) {
|
|
5594
6076
|
throw ("Expired activation code is required.");
|
|
5595
6077
|
}
|
|
@@ -5599,14 +6081,12 @@
|
|
|
5599
6081
|
LoginUser.SignupResend = SignupResend;
|
|
5600
6082
|
/**
|
|
5601
6083
|
* Completes signup using user data and a signup code.
|
|
5602
|
-
* @param
|
|
5603
|
-
* @param code
|
|
5604
|
-
* @param data
|
|
5605
|
-
* @param accountId
|
|
6084
|
+
* @param params
|
|
5606
6085
|
* @returns
|
|
5607
6086
|
*/
|
|
5608
|
-
function SignupComplete(
|
|
6087
|
+
function SignupComplete(params) {
|
|
5609
6088
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6089
|
+
let { api, code, user: data, accountId, req: reqParams } = params;
|
|
5610
6090
|
if (!code || !(data === null || data === void 0 ? void 0 : data.Login) || !(data === null || data === void 0 ? void 0 : data.Password)) {
|
|
5611
6091
|
throw ("Login, password, and activation code are required.");
|
|
5612
6092
|
}
|
|
@@ -5619,19 +6099,20 @@
|
|
|
5619
6099
|
if (data.Email) {
|
|
5620
6100
|
api.Cache.RemoveByContains(exports.Api.ECacheKey.User + exports.Api.ECacheKey.UserEmail + data.Email);
|
|
5621
6101
|
}
|
|
5622
|
-
return
|
|
6102
|
+
return {
|
|
6103
|
+
user: res
|
|
6104
|
+
};
|
|
5623
6105
|
});
|
|
5624
6106
|
}
|
|
5625
6107
|
LoginUser.SignupComplete = SignupComplete;
|
|
5626
6108
|
/**
|
|
5627
6109
|
* Sends a password reset email to the specified email address.
|
|
5628
|
-
* @param
|
|
5629
|
-
* @param accountId
|
|
5630
|
-
* @param email
|
|
6110
|
+
* @param params
|
|
5631
6111
|
* @returns user id associated with provided email.
|
|
5632
6112
|
*/
|
|
5633
|
-
function ForgotPassword(
|
|
6113
|
+
function ForgotPassword(params) {
|
|
5634
6114
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6115
|
+
const { api, accountId, email, req: reqParams } = params;
|
|
5635
6116
|
if (!accountId || !email) {
|
|
5636
6117
|
throw ("Account ID and email are required.");
|
|
5637
6118
|
}
|
|
@@ -5641,7 +6122,9 @@
|
|
|
5641
6122
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
5642
6123
|
try {
|
|
5643
6124
|
const data = yield req;
|
|
5644
|
-
res(
|
|
6125
|
+
res({
|
|
6126
|
+
userId: data.ID
|
|
6127
|
+
});
|
|
5645
6128
|
}
|
|
5646
6129
|
catch (e) {
|
|
5647
6130
|
rej(e);
|
|
@@ -5653,22 +6136,28 @@
|
|
|
5653
6136
|
LoginUser.ForgotPassword = ForgotPassword;
|
|
5654
6137
|
/**
|
|
5655
6138
|
* Completes password reset using a password reset code and new password.
|
|
5656
|
-
* @param
|
|
5657
|
-
* @param code
|
|
5658
|
-
* @param userId
|
|
5659
|
-
* @param password
|
|
6139
|
+
* @param params
|
|
5660
6140
|
* @returns
|
|
5661
6141
|
*/
|
|
5662
|
-
function ForgotPasswordComplete(
|
|
6142
|
+
function ForgotPasswordComplete(params) {
|
|
5663
6143
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5664
|
-
const
|
|
5665
|
-
|
|
6144
|
+
const { api, code, userId, password, req: reqParams } = params;
|
|
6145
|
+
const { user } = yield Get({
|
|
6146
|
+
api: api,
|
|
6147
|
+
userId: userId,
|
|
6148
|
+
accountId: "",
|
|
6149
|
+
req: reqParams
|
|
6150
|
+
});
|
|
6151
|
+
const res = yield api.POST("UserSetNameAndPassword", {
|
|
5666
6152
|
ID: userId,
|
|
5667
6153
|
Email: user.Email,
|
|
5668
6154
|
ActivationCode: code,
|
|
5669
6155
|
Password: password,
|
|
5670
6156
|
FullName: user.FullName
|
|
5671
6157
|
}, reqParams);
|
|
6158
|
+
return {
|
|
6159
|
+
user: res
|
|
6160
|
+
};
|
|
5672
6161
|
});
|
|
5673
6162
|
}
|
|
5674
6163
|
LoginUser.ForgotPasswordComplete = ForgotPasswordComplete;
|
|
@@ -5679,8 +6168,9 @@
|
|
|
5679
6168
|
return exports.Api.ECacheKey.AccessToken + exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId;
|
|
5680
6169
|
}
|
|
5681
6170
|
AccessToken.GetListCacheKey = GetListCacheKey;
|
|
5682
|
-
function GetList(
|
|
6171
|
+
function GetList(params) {
|
|
5683
6172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6173
|
+
const { api, accountId, req: reqParams } = params;
|
|
5684
6174
|
const cacheData = api.GetCacheItem(GetListCacheKey(accountId), reqParams);
|
|
5685
6175
|
if (cacheData) {
|
|
5686
6176
|
return cacheData;
|
|
@@ -5688,13 +6178,16 @@
|
|
|
5688
6178
|
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
5689
6179
|
try {
|
|
5690
6180
|
const data = yield api.GET("usersByClientAccount/accessTokens", reqParams);
|
|
5691
|
-
res(
|
|
6181
|
+
res({
|
|
6182
|
+
tokens: data.Items
|
|
6183
|
+
});
|
|
5692
6184
|
}
|
|
5693
6185
|
catch (e) {
|
|
5694
6186
|
rej(e);
|
|
5695
6187
|
}
|
|
5696
6188
|
}));
|
|
5697
|
-
req.then((
|
|
6189
|
+
req.then((data) => {
|
|
6190
|
+
const users = data.tokens;
|
|
5698
6191
|
for (let i = 0; i < users.length; i++) {
|
|
5699
6192
|
api.Cache.Set(GetCacheKey(users[i].ID, accountId), users[i]);
|
|
5700
6193
|
}
|
|
@@ -5704,16 +6197,18 @@
|
|
|
5704
6197
|
});
|
|
5705
6198
|
}
|
|
5706
6199
|
AccessToken.GetList = GetList;
|
|
5707
|
-
function Delete(
|
|
6200
|
+
function Delete(params) {
|
|
5708
6201
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6202
|
+
const { api, tokenId: id, req: reqParams } = params;
|
|
5709
6203
|
yield api.DELETE(`accessToken/${id}`, reqParams);
|
|
5710
6204
|
api.Cache.RemoveByContains(exports.Api.ECacheKey.User + exports.Api.ECacheKey.Id + id);
|
|
5711
6205
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.AccessToken + exports.Api.ECacheKey.Account);
|
|
5712
6206
|
});
|
|
5713
6207
|
}
|
|
5714
6208
|
AccessToken.Delete = Delete;
|
|
5715
|
-
function Create(
|
|
6209
|
+
function Create(params) {
|
|
5716
6210
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6211
|
+
let { api, token: data, req: reqParams } = params;
|
|
5717
6212
|
if (!data) {
|
|
5718
6213
|
data = {};
|
|
5719
6214
|
}
|
|
@@ -5725,7 +6220,9 @@
|
|
|
5725
6220
|
}
|
|
5726
6221
|
data = yield api.POST("accessToken", data, reqParams);
|
|
5727
6222
|
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.AccessToken + exports.Api.ECacheKey.Account);
|
|
5728
|
-
return
|
|
6223
|
+
return {
|
|
6224
|
+
token: data
|
|
6225
|
+
};
|
|
5729
6226
|
});
|
|
5730
6227
|
}
|
|
5731
6228
|
AccessToken.Create = Create;
|
|
@@ -5816,13 +6313,13 @@
|
|
|
5816
6313
|
Clear() {
|
|
5817
6314
|
this.refresh({});
|
|
5818
6315
|
}
|
|
5819
|
-
refresh(
|
|
6316
|
+
refresh(urlParams) {
|
|
5820
6317
|
const params = [];
|
|
5821
|
-
const keys = Object.keys(
|
|
6318
|
+
const keys = Object.keys(urlParams);
|
|
5822
6319
|
for (let i = 0; i < keys.length; i++) {
|
|
5823
6320
|
const key = keys[i];
|
|
5824
6321
|
if (this._allowedKeys == null || this._allowedKeys.includes(key)) {
|
|
5825
|
-
const val =
|
|
6322
|
+
const val = urlParams[key];
|
|
5826
6323
|
if (!!val || val == 0) {
|
|
5827
6324
|
params.push(`${key}=${val}`);
|
|
5828
6325
|
}
|
|
@@ -5845,46 +6342,48 @@
|
|
|
5845
6342
|
EReqKey["Primary"] = "PrimarySelection";
|
|
5846
6343
|
EReqKey["Secondary"] = "SecondarySelection";
|
|
5847
6344
|
})(EReqKey = DataLab.EReqKey || (DataLab.EReqKey = {}));
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
6345
|
+
function Run(params) {
|
|
6346
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6347
|
+
let { api, query, key, skip, load, req: reqParams } = params;
|
|
6348
|
+
if (!key) {
|
|
6349
|
+
key = EReqKey.Primary;
|
|
6350
|
+
}
|
|
6351
|
+
if (!skip) {
|
|
6352
|
+
skip = 0;
|
|
6353
|
+
}
|
|
6354
|
+
if (!load) {
|
|
6355
|
+
load = 50;
|
|
6356
|
+
}
|
|
6357
|
+
const req = api.POST(`entities/datalab/getMatchingEntities/${key}?skip=${skip}&load=${load}`, query, exports.Api.PrepReqParams(reqParams));
|
|
6358
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
6359
|
+
try {
|
|
6360
|
+
const data = yield req;
|
|
6361
|
+
res({
|
|
6362
|
+
entities: data.Items
|
|
6363
|
+
});
|
|
5857
6364
|
}
|
|
5858
|
-
|
|
5859
|
-
|
|
6365
|
+
catch (e) {
|
|
6366
|
+
rej(e);
|
|
5860
6367
|
}
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
}
|
|
5867
|
-
catch (e) {
|
|
5868
|
-
rej(e);
|
|
5869
|
-
}
|
|
5870
|
-
}));
|
|
5871
|
-
return prom;
|
|
5872
|
-
});
|
|
5873
|
-
}
|
|
5874
|
-
Entity.GetList = GetList;
|
|
5875
|
-
})(Entity = DataLab.Entity || (DataLab.Entity = {}));
|
|
6368
|
+
}));
|
|
6369
|
+
return prom;
|
|
6370
|
+
});
|
|
6371
|
+
}
|
|
6372
|
+
DataLab.Run = Run;
|
|
5876
6373
|
})(exports.DataLab || (exports.DataLab = {}));
|
|
5877
6374
|
|
|
5878
6375
|
(function (ImportCad) {
|
|
5879
|
-
function Analyze(
|
|
6376
|
+
function Analyze(params) {
|
|
5880
6377
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5881
|
-
|
|
6378
|
+
const { api, fileAnalyze, req: reqParams } = params;
|
|
6379
|
+
return api.POST("entities/PrepareIFCForImport", fileAnalyze, exports.Api.PrepReqParams(reqParams));
|
|
5882
6380
|
});
|
|
5883
6381
|
}
|
|
5884
6382
|
ImportCad.Analyze = Analyze;
|
|
5885
|
-
function ImportEntities(
|
|
6383
|
+
function ImportEntities(params) {
|
|
5886
6384
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5887
|
-
|
|
6385
|
+
const { api, fileImport, req: reqParams } = params;
|
|
6386
|
+
return api.POST("entities/importIFCWithProgress", fileImport, exports.Api.PrepReqParams(reqParams));
|
|
5888
6387
|
});
|
|
5889
6388
|
}
|
|
5890
6389
|
ImportCad.ImportEntities = ImportEntities;
|
|
@@ -5910,27 +6409,30 @@
|
|
|
5910
6409
|
})(exports.ImportCad || (exports.ImportCad = {}));
|
|
5911
6410
|
|
|
5912
6411
|
(function (ImportCsv) {
|
|
5913
|
-
function ImportEntities(
|
|
6412
|
+
function ImportEntities(params) {
|
|
5914
6413
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5915
|
-
|
|
6414
|
+
const { api, fileImport, req: reqParams } = params;
|
|
6415
|
+
return api.POST("entities/importCSVWithProgress2", fileImport, exports.Api.PrepReqParams(reqParams));
|
|
5916
6416
|
});
|
|
5917
6417
|
}
|
|
5918
6418
|
ImportCsv.ImportEntities = ImportEntities;
|
|
5919
6419
|
})(exports.ImportCsv || (exports.ImportCsv = {}));
|
|
5920
6420
|
|
|
5921
6421
|
(function (ImportJson) {
|
|
5922
|
-
function ImportEntities(
|
|
6422
|
+
function ImportEntities(params) {
|
|
5923
6423
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5924
|
-
|
|
6424
|
+
const { api, fileImport, req: reqParams } = params;
|
|
6425
|
+
return api.POST("entities/importJsonWithProgress", fileImport, exports.Api.PrepReqParams(reqParams));
|
|
5925
6426
|
});
|
|
5926
6427
|
}
|
|
5927
6428
|
ImportJson.ImportEntities = ImportEntities;
|
|
5928
6429
|
})(exports.ImportJson || (exports.ImportJson = {}));
|
|
5929
6430
|
|
|
5930
6431
|
(function (ImportKml) {
|
|
5931
|
-
function ImportEntities(
|
|
6432
|
+
function ImportEntities(params) {
|
|
5932
6433
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5933
|
-
|
|
6434
|
+
const { api, fileImport, req: reqParams } = params;
|
|
6435
|
+
return api.POST("entities/importKMLWithProgress2", fileImport, exports.Api.PrepReqParams(reqParams));
|
|
5934
6436
|
});
|
|
5935
6437
|
}
|
|
5936
6438
|
ImportKml.ImportEntities = ImportEntities;
|
|
@@ -5950,8 +6452,9 @@
|
|
|
5950
6452
|
EFileType["CAD"] = "CAD";
|
|
5951
6453
|
EFileType["All"] = "All";
|
|
5952
6454
|
})(EFileType = ImportedFile.EFileType || (ImportedFile.EFileType = {}));
|
|
5953
|
-
function GetList(
|
|
6455
|
+
function GetList(params) {
|
|
5954
6456
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6457
|
+
let { api, fileType: type, pageIndex, req: reqParams } = params;
|
|
5955
6458
|
if (!type) {
|
|
5956
6459
|
type = EFileType.All;
|
|
5957
6460
|
}
|
|
@@ -5975,7 +6478,9 @@
|
|
|
5975
6478
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
5976
6479
|
try {
|
|
5977
6480
|
const data = yield req;
|
|
5978
|
-
res(
|
|
6481
|
+
res({
|
|
6482
|
+
importedFiles: data.Items
|
|
6483
|
+
});
|
|
5979
6484
|
}
|
|
5980
6485
|
catch (e) {
|
|
5981
6486
|
rej(e);
|
|
@@ -5986,15 +6491,26 @@
|
|
|
5986
6491
|
});
|
|
5987
6492
|
}
|
|
5988
6493
|
ImportedFile.GetList = GetList;
|
|
5989
|
-
function Get(
|
|
6494
|
+
function Get(params) {
|
|
5990
6495
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6496
|
+
const { api, importedFileId: fileId, req: reqParams } = params;
|
|
5991
6497
|
const cacheData = api.GetCacheItem(GetCacheKey(fileId), reqParams);
|
|
5992
6498
|
if (cacheData) {
|
|
5993
6499
|
return cacheData;
|
|
5994
6500
|
}
|
|
5995
|
-
const
|
|
5996
|
-
|
|
5997
|
-
|
|
6501
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
6502
|
+
try {
|
|
6503
|
+
const data = yield api.GET(`entityImportFile/${fileId}`, exports.Api.PrepReqParams(reqParams));
|
|
6504
|
+
res({
|
|
6505
|
+
importedFile: data
|
|
6506
|
+
});
|
|
6507
|
+
}
|
|
6508
|
+
catch (e) {
|
|
6509
|
+
rej(e);
|
|
6510
|
+
}
|
|
6511
|
+
}));
|
|
6512
|
+
api.Cache.Set(GetCacheKey(fileId), prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
6513
|
+
return prom;
|
|
5998
6514
|
});
|
|
5999
6515
|
}
|
|
6000
6516
|
ImportedFile.Get = Get;
|
|
@@ -6077,104 +6593,105 @@
|
|
|
6077
6593
|
type: EType.Default
|
|
6078
6594
|
};
|
|
6079
6595
|
})(Div = Markup.Div || (Markup.Div = {}));
|
|
6080
|
-
let
|
|
6081
|
-
(function (
|
|
6596
|
+
let Line;
|
|
6597
|
+
(function (Line) {
|
|
6082
6598
|
// Describes a line end's head.
|
|
6083
|
-
let
|
|
6084
|
-
(function (
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
})(
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6599
|
+
let ELineHead;
|
|
6600
|
+
(function (ELineHead) {
|
|
6601
|
+
ELineHead["None"] = "NONE";
|
|
6602
|
+
ELineHead["Circle"] = "CIRCLE";
|
|
6603
|
+
ELineHead["Arrow"] = "ARROW";
|
|
6604
|
+
})(ELineHead = Line.ELineHead || (Line.ELineHead = {}));
|
|
6605
|
+
// Dictates where on a DIV an anchor should snap to.
|
|
6606
|
+
let EAnchorDivSide;
|
|
6607
|
+
(function (EAnchorDivSide) {
|
|
6608
|
+
EAnchorDivSide[EAnchorDivSide["TopLeft"] = 0] = "TopLeft";
|
|
6609
|
+
EAnchorDivSide[EAnchorDivSide["TopRight"] = 1] = "TopRight";
|
|
6610
|
+
EAnchorDivSide[EAnchorDivSide["BottomLeft"] = 2] = "BottomLeft";
|
|
6611
|
+
EAnchorDivSide[EAnchorDivSide["BottomRight"] = 3] = "BottomRight";
|
|
6612
|
+
EAnchorDivSide[EAnchorDivSide["Center"] = 4] = "Center";
|
|
6613
|
+
EAnchorDivSide[EAnchorDivSide["CenterLeft"] = 5] = "CenterLeft";
|
|
6614
|
+
EAnchorDivSide[EAnchorDivSide["CenterRight"] = 6] = "CenterRight";
|
|
6615
|
+
EAnchorDivSide[EAnchorDivSide["CenterTop"] = 7] = "CenterTop";
|
|
6616
|
+
EAnchorDivSide[EAnchorDivSide["CenterBottom"] = 8] = "CenterBottom";
|
|
6617
|
+
})(EAnchorDivSide = Line.EAnchorDivSide || (Line.EAnchorDivSide = {}));
|
|
6618
|
+
// Dictates what end of the line an anchor should render on.
|
|
6619
|
+
let EAnchorLineSide;
|
|
6620
|
+
(function (EAnchorLineSide) {
|
|
6621
|
+
EAnchorLineSide[EAnchorLineSide["Start"] = 0] = "Start";
|
|
6622
|
+
EAnchorLineSide[EAnchorLineSide["End"] = 1] = "End";
|
|
6623
|
+
})(EAnchorLineSide = Line.EAnchorLineSide || (Line.EAnchorLineSide = {}));
|
|
6624
|
+
Line.DEFAULT = {
|
|
6625
|
+
brushColor: "rgba(255, 255, 255, 1)",
|
|
6626
|
+
brushSize: 4,
|
|
6627
|
+
path: null,
|
|
6628
|
+
pathType: "LINE",
|
|
6629
|
+
transform: null,
|
|
6630
|
+
snaps: null,
|
|
6631
|
+
id: null
|
|
6632
|
+
};
|
|
6633
|
+
})(Line = Markup.Line || (Markup.Line = {}));
|
|
6634
|
+
let FreePaint;
|
|
6635
|
+
(function (FreePaint) {
|
|
6636
|
+
// Describes a free-paint end's head.
|
|
6637
|
+
let EPaintHead;
|
|
6638
|
+
(function (EPaintHead) {
|
|
6639
|
+
EPaintHead["None"] = "NONE";
|
|
6640
|
+
EPaintHead["Circle"] = "CIRCLE";
|
|
6641
|
+
EPaintHead["Arrow"] = "ARROW";
|
|
6642
|
+
})(EPaintHead = FreePaint.EPaintHead || (FreePaint.EPaintHead = {}));
|
|
6643
|
+
FreePaint.DEFAULT = {
|
|
6644
|
+
brushColor: "rgba(255, 255, 255, 1)",
|
|
6645
|
+
brushSize: 4,
|
|
6646
|
+
path: null,
|
|
6647
|
+
pathType: "PLAIN",
|
|
6648
|
+
transform: null,
|
|
6649
|
+
id: null
|
|
6650
|
+
};
|
|
6651
|
+
})(FreePaint = Markup.FreePaint || (Markup.FreePaint = {}));
|
|
6652
|
+
let Polygon;
|
|
6653
|
+
(function (Polygon) {
|
|
6654
|
+
// Determines if terrain and 3d models should be overlapped or not.
|
|
6655
|
+
let EClassificationType;
|
|
6656
|
+
(function (EClassificationType) {
|
|
6657
|
+
// 3d models and terrain are overlapped.
|
|
6658
|
+
EClassificationType["Both"] = "BOTH";
|
|
6659
|
+
// Only terrain is overlapped.
|
|
6660
|
+
EClassificationType["Terrain"] = "TERRAIN";
|
|
6661
|
+
})(EClassificationType = Polygon.EClassificationType || (Polygon.EClassificationType = {}));
|
|
6662
|
+
Polygon.DEFAULT = {
|
|
6663
|
+
type: "POLYGON",
|
|
6664
|
+
id: null,
|
|
6665
|
+
positions: null,
|
|
6666
|
+
color: "rgba(254, 234, 57, 0.54)",
|
|
6667
|
+
outlineColor: "rgba(215, 215, 215, 0)",
|
|
6668
|
+
outlineWidth: 2,
|
|
6669
|
+
extrudedHeight: 0,
|
|
6670
|
+
classificationType: EClassificationType.Both,
|
|
6671
|
+
smoothen: 0
|
|
6672
|
+
};
|
|
6673
|
+
})(Polygon = Markup.Polygon || (Markup.Polygon = {}));
|
|
6674
|
+
let Polyline;
|
|
6675
|
+
(function (Polyline) {
|
|
6676
|
+
Polyline.DEFAULT = {
|
|
6677
|
+
type: "POLYLINE",
|
|
6678
|
+
id: null,
|
|
6679
|
+
positions: null,
|
|
6680
|
+
color: "rgba(254, 234, 57, 0.54)",
|
|
6681
|
+
outlineWidth: 4,
|
|
6682
|
+
smoothen: 0
|
|
6683
|
+
};
|
|
6684
|
+
})(Polyline = Markup.Polyline || (Markup.Polyline = {}));
|
|
6685
|
+
let Circle;
|
|
6686
|
+
(function (Circle) {
|
|
6687
|
+
Circle.DEFAULT = {
|
|
6688
|
+
type: "CIRCLE",
|
|
6689
|
+
id: null,
|
|
6690
|
+
position: null,
|
|
6691
|
+
radius: 50,
|
|
6692
|
+
color: "rgba(254, 234, 57, 0.54)"
|
|
6693
|
+
};
|
|
6694
|
+
})(Circle = Markup.Circle || (Markup.Circle = {}));
|
|
6178
6695
|
})(exports.Markup || (exports.Markup = {}));
|
|
6179
6696
|
|
|
6180
6697
|
exports.AbstractApi = AbstractApi;
|