bruce-models 1.3.7 → 1.3.9

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