bruce-models 1.3.6 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/bruce-models.es5.js +1190 -675
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +1189 -672
  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 +88 -67
  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 +53 -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
@@ -107,10 +107,6 @@ var Api;
107
107
  */
108
108
  function PrepReqParams(base) {
109
109
  base = Object.assign({}, base);
110
- base.response = Object.assign({}, base.response);
111
- if (!base.response.encoding) {
112
- base.response.encoding = Api.EEncoding.UTF16;
113
- }
114
110
  return base;
115
111
  }
116
112
  Api.PrepReqParams = PrepReqParams;
@@ -134,8 +130,9 @@ var AnnDocument;
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 @@ var AnnDocument;
144
141
  if (cacheData) {
145
142
  return cacheData;
146
143
  }
147
- const req = api.GET(`documentView/${docId}`, Api.PrepReqParams(reqParams));
148
- api.Cache.Set(key, req, 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}`, Api.PrepReqParams(reqParams));
147
+ res({
148
+ document: data
149
+ });
150
+ }
151
+ catch (e) {
152
+ rej(e);
153
+ }
154
+ }));
155
+ api.Cache.Set(key, prom, 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 @@ var AnnDocument;
163
171
  try {
164
172
  const url = "documentViews" + (type ? "?type=" + type : "");
165
173
  const data = yield api.GET(url, Api.PrepReqParams(reqParams));
166
- res(data.Items);
174
+ res({
175
+ documents: data.Items
176
+ });
167
177
  }
168
178
  catch (e) {
169
179
  rej(e);
@@ -198,8 +208,9 @@ var CustomForm;
198
208
  EType["Form"] = "GENERIC";
199
209
  EType["Markup"] = "MARKUP";
200
210
  })(EType = CustomForm.EType || (CustomForm.EType = {}));
201
- function Get(api, id, reqParams) {
211
+ function Get(params) {
202
212
  return __awaiter(this, void 0, void 0, function* () {
213
+ const { api, formId: id, req: reqParams } = params;
203
214
  if (!id) {
204
215
  throw ("Id is required.");
205
216
  }
@@ -207,14 +218,25 @@ var CustomForm;
207
218
  if (cacheData) {
208
219
  return cacheData;
209
220
  }
210
- const req = api.GET(`customForm/${id}`, Api.PrepReqParams(reqParams));
211
- api.Cache.Set(GetCacheKey(id), req, Api.DEFAULT_CACHE_DURATION);
212
- return req;
221
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
222
+ try {
223
+ const data = yield api.GET(`customForm/${id}`, Api.PrepReqParams(reqParams));
224
+ res({
225
+ form: data
226
+ });
227
+ }
228
+ catch (err) {
229
+ rej(err);
230
+ }
231
+ }));
232
+ api.Cache.Set(GetCacheKey(id), prom, Api.DEFAULT_CACHE_DURATION);
233
+ return prom;
213
234
  });
214
235
  }
215
236
  CustomForm.Get = Get;
216
- function Delete(api, id, reqParams) {
237
+ function Delete(params) {
217
238
  return __awaiter(this, void 0, void 0, function* () {
239
+ const { api, formId: id, req: reqParams } = params;
218
240
  if (!id) {
219
241
  throw ("Id is required.");
220
242
  }
@@ -223,8 +245,9 @@ var CustomForm;
223
245
  });
224
246
  }
225
247
  CustomForm.Delete = Delete;
226
- function GetList(api, typeId, reqParams) {
248
+ function GetList(params) {
227
249
  return __awaiter(this, void 0, void 0, function* () {
250
+ const { api, entityTypeId: typeId, req: reqParams } = params;
228
251
  const url = typeId ? `entityType/${typeId}/customForms` : "customForms";
229
252
  const cacheData = api.GetCacheItem(GetListCacheKey(typeId), reqParams);
230
253
  if (cacheData) {
@@ -232,21 +255,26 @@ var CustomForm;
232
255
  }
233
256
  const req = api.GET(url, Api.PrepReqParams(reqParams));
234
257
  const prom = req.then((data) => {
235
- return data.Items;
258
+ return {
259
+ forms: data.Items
260
+ };
236
261
  });
237
262
  api.Cache.Set(GetListCacheKey(typeId), prom, Api.DEFAULT_CACHE_DURATION);
238
263
  return prom;
239
264
  });
240
265
  }
241
266
  CustomForm.GetList = GetList;
242
- function Update(api, data, reqParams) {
267
+ function Update(params) {
243
268
  return __awaiter(this, void 0, void 0, function* () {
269
+ const { api, form: data, reqParams } = params;
244
270
  if (!data.ID) {
245
271
  data.ID = 0;
246
272
  }
247
- data = yield api.POST(`customForm/${data.ID}`, data, Api.PrepReqParams(reqParams));
273
+ const res = yield api.POST(`customForm/${data.ID}`, data, Api.PrepReqParams(reqParams));
248
274
  api.Cache.RemoveByStartsWith(Api.ECacheKey.CustomForm);
249
- return data;
275
+ return {
276
+ form: res
277
+ };
250
278
  });
251
279
  }
252
280
  CustomForm.Update = Update;
@@ -438,15 +466,26 @@ class CacheControl {
438
466
  }
439
467
  }
440
468
 
441
- function parseResult(data, encoding) {
469
+ function parseResult(data) {
442
470
  return __awaiter(this, void 0, void 0, function* () {
443
471
  if (data.status == 200) {
444
- if (encoding) {
445
- const buffer = yield data.arrayBuffer();
446
- return JSON.parse(new TextDecoder(encoding).decode(buffer));
472
+ let encoding = "";
473
+ const type = data.headers.get("Content-Type");
474
+ const charset = type ? type.split(";").find((x) => x.trim().toLowerCase().startsWith("charset=")) : "";
475
+ if (charset && charset.includes("=")) {
476
+ encoding = charset.split("=")[1];
477
+ encoding = encoding.toLowerCase();
478
+ }
479
+ // Our API has a very specific utf-16 encoding.
480
+ if (encoding == "utf-16") {
481
+ encoding = Api.EEncoding.UTF16;
482
+ }
483
+ if (!encoding || encoding == "utf-8") {
484
+ return data.json();
447
485
  }
448
486
  else {
449
- return data.json();
487
+ const buffer = yield data.arrayBuffer();
488
+ return JSON.parse(new TextDecoder(encoding).decode(buffer));
450
489
  }
451
490
  }
452
491
  else {
@@ -487,7 +526,6 @@ class AbstractApi {
487
526
  this.ssidHeader = value;
488
527
  }
489
528
  get(url, params) {
490
- var _a;
491
529
  return __awaiter(this, void 0, void 0, function* () {
492
530
  if (!params) {
493
531
  params = {};
@@ -500,11 +538,10 @@ class AbstractApi {
500
538
  const res = yield fetch(url, {
501
539
  headers: params.headers
502
540
  });
503
- return parseResult(res, (_a = params.response) === null || _a === void 0 ? void 0 : _a.encoding);
541
+ return parseResult(res);
504
542
  });
505
543
  }
506
544
  delete(url, params) {
507
- var _a;
508
545
  return __awaiter(this, void 0, void 0, function* () {
509
546
  if (!params) {
510
547
  params = {};
@@ -515,11 +552,10 @@ class AbstractApi {
515
552
  headers: params.headers,
516
553
  method: "DELETE"
517
554
  });
518
- return parseResult(res, (_a = params.response) === null || _a === void 0 ? void 0 : _a.encoding);
555
+ return parseResult(res);
519
556
  });
520
557
  }
521
558
  post(url, data, params) {
522
- var _a;
523
559
  return __awaiter(this, void 0, void 0, function* () {
524
560
  if (!params) {
525
561
  params = {};
@@ -537,11 +573,10 @@ class AbstractApi {
537
573
  method: "POST",
538
574
  body: data
539
575
  });
540
- return parseResult(res, (_a = params.response) === null || _a === void 0 ? void 0 : _a.encoding);
576
+ return parseResult(res);
541
577
  });
542
578
  }
543
579
  put(url, data, params) {
544
- var _a;
545
580
  return __awaiter(this, void 0, void 0, function* () {
546
581
  if (!params) {
547
582
  params = {};
@@ -559,7 +594,7 @@ class AbstractApi {
559
594
  method: "PUT",
560
595
  body: data
561
596
  });
562
- return parseResult(res, (_a = params.response) === null || _a === void 0 ? void 0 : _a.encoding);
597
+ return parseResult(res);
563
598
  });
564
599
  }
565
600
  upload(url, blob, params) {
@@ -659,20 +694,25 @@ var Account;
659
694
  EStarterContent["Default"] = "default";
660
695
  EStarterContent["None"] = "none";
661
696
  })(EStarterContent = Account.EStarterContent || (Account.EStarterContent = {}));
662
- function Get(api, id, reqParams) {
697
+ function Get(params) {
663
698
  return __awaiter(this, void 0, void 0, function* () {
699
+ const { api, accountId: id, req: reqParams } = params;
664
700
  const cacheData = api.GetCacheItem(GetCacheKey(id), reqParams);
665
701
  if (cacheData) {
666
702
  return cacheData;
667
703
  }
668
704
  const req = yield api.GET(`account/${id}`, reqParams);
669
- api.Cache.Set(GetCacheKey(id), req, Api.DEFAULT_CACHE_DURATION);
670
- return req;
705
+ const resData = {
706
+ account: req
707
+ };
708
+ api.Cache.Set(GetCacheKey(id), resData, Api.DEFAULT_CACHE_DURATION);
709
+ return resData;
671
710
  });
672
711
  }
673
712
  Account.Get = Get;
674
- function GetRelatedList(api, reqParams) {
713
+ function GetRelatedList(params) {
675
714
  return __awaiter(this, void 0, void 0, function* () {
715
+ const { api, req: reqParams } = params;
676
716
  const cacheData = api.GetCacheItem(GetListCacheKey(api.GetSessionId()), reqParams);
677
717
  if (cacheData) {
678
718
  return cacheData;
@@ -682,7 +722,9 @@ var Account;
682
722
  try {
683
723
  const data = yield req;
684
724
  const items = data.Items.filter((x) => !ACCOUNT_EXCLUSIONS.includes(x.ID));
685
- res(items);
725
+ res({
726
+ accounts: items
727
+ });
686
728
  }
687
729
  catch (e) {
688
730
  rej(e);
@@ -693,8 +735,9 @@ var Account;
693
735
  });
694
736
  }
695
737
  Account.GetRelatedList = GetRelatedList;
696
- function GetAppSettings(api, id, appId, reqParams) {
738
+ function GetAppSettings(params) {
697
739
  return __awaiter(this, void 0, void 0, function* () {
740
+ const { api, accountId: id, appId, req: reqParams } = params;
698
741
  const cacheData = api.GetCacheItem(GetCacheKey(id, appId), reqParams);
699
742
  if (cacheData) {
700
743
  return cacheData;
@@ -705,7 +748,9 @@ var Account;
705
748
  try {
706
749
  const data = yield req;
707
750
  const settings = (_a = data === null || data === void 0 ? void 0 : data["Application.Settings"]) !== null && _a !== void 0 ? _a : {};
708
- res(settings);
751
+ res({
752
+ settings: settings
753
+ });
709
754
  }
710
755
  catch (e) {
711
756
  rej(e);
@@ -718,33 +763,28 @@ var Account;
718
763
  Account.GetAppSettings = GetAppSettings;
719
764
  /**
720
765
  * WARNING: Do not update API settings without knowing what you're doing.
721
- * @param api
722
- * @param id
723
- * @param appId
724
- * @param data
725
- * @param reqParams
766
+ * @param params
726
767
  * @returns
727
768
  */
728
- function UpdateAppSettings(api, id, appId, data, reqParams) {
769
+ function UpdateAppSettings(params) {
729
770
  return __awaiter(this, void 0, void 0, function* () {
730
- data = yield api.POST(`account/${id}/applicationSettings/${appId}`, data, reqParams);
771
+ const { api, accountId: id, appId, settings: data, req: reqParams } = params;
772
+ const res = yield api.POST(`account/${id}/applicationSettings/${appId}`, data, reqParams);
731
773
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Account + Api.ECacheKey.Id + id);
732
- return data;
774
+ return {
775
+ settings: res
776
+ };
733
777
  });
734
778
  }
735
779
  Account.UpdateAppSettings = UpdateAppSettings;
736
780
  /**
737
781
  * Creates a new Bruce account using given details.
738
- * @param api
739
- * @param id
740
- * @param name
741
- * @param region
742
- * @param starterContent
743
- * @param reqParams
782
+ * @param params
744
783
  * @returns
745
784
  */
746
- function Create(api, id, name, region, starterContent, reqParams) {
785
+ function Create(params) {
747
786
  return __awaiter(this, void 0, void 0, function* () {
787
+ let { api, accountId: id, name, region, starterContent, req: reqParams } = params;
748
788
  if (!id || !name || !region) {
749
789
  throw new Error("Id, Name and Region are required.");
750
790
  }
@@ -756,14 +796,18 @@ var Account;
756
796
  "DBLocation": region,
757
797
  "StarterContent": starterContent
758
798
  };
759
- const res = api.POST(`clientAccount/${id}`, reqData, Api.PrepReqParams(reqParams));
799
+ const res = yield api.POST(`clientAccount/${id}`, reqData, Api.PrepReqParams(reqParams));
800
+ const resData = {
801
+ account: res
802
+ };
760
803
  api.Cache.Remove(GetListCacheKey(api.GetSessionId()));
761
- return res;
804
+ return resData;
762
805
  });
763
806
  }
764
807
  Account.Create = Create;
765
- function GetDbRegions(api, reqParams) {
808
+ function GetDbRegions(params) {
766
809
  return __awaiter(this, void 0, void 0, function* () {
810
+ const { api, req: reqParams } = params;
767
811
  const cacheData = api.GetCacheItem(GetDbRegionListCacheKey(), reqParams);
768
812
  if (cacheData) {
769
813
  return cacheData;
@@ -771,7 +815,7 @@ var Account;
771
815
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
772
816
  try {
773
817
  const data = yield api.GET("config/regions", Api.PrepReqParams(reqParams));
774
- res(data.regions);
818
+ res(data);
775
819
  }
776
820
  catch (e) {
777
821
  rej(e);
@@ -984,7 +1028,11 @@ var BruceApi;
984
1028
  // Attempt to load an account specific base url.
985
1029
  // This could be one with a region specific endpoint.
986
1030
  try {
987
- const settings = yield Account.GetAppSettings(cam, this.accountId, Account.EAppId.BruceApi);
1031
+ const { settings } = yield Account.GetAppSettings({
1032
+ api: cam,
1033
+ accountId: this.accountId,
1034
+ appId: Account.EAppId.BruceApi
1035
+ });
988
1036
  if (this.loadCancelled) {
989
1037
  console.warn("BruceApi: Loading was cancelled due to SetBaseUrl being called, not setting regional base url.");
990
1038
  return;
@@ -1453,8 +1501,9 @@ var Entity;
1453
1501
  return `${Api.ECacheKey.Entity}${Api.ECacheKey.Id}${entityId}`;
1454
1502
  }
1455
1503
  Entity.GetCacheKey = GetCacheKey;
1456
- function Get(api, entityId, reqParams) {
1504
+ function Get(params) {
1457
1505
  return __awaiter(this, void 0, void 0, function* () {
1506
+ const { api, entityId, req: reqParams } = params;
1458
1507
  if (!entityId) {
1459
1508
  throw ("Entity ID is required.");
1460
1509
  }
@@ -1463,14 +1512,25 @@ var Entity;
1463
1512
  if (cacheData) {
1464
1513
  return cacheData;
1465
1514
  }
1466
- const req = api.GET(`entity/${entityId}`, Api.PrepReqParams(reqParams));
1467
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
1468
- return req;
1515
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
1516
+ try {
1517
+ const data = yield api.GET(`entity/${entityId}`, Api.PrepReqParams(reqParams));
1518
+ res({
1519
+ entity: data
1520
+ });
1521
+ }
1522
+ catch (e) {
1523
+ rej(e);
1524
+ }
1525
+ }));
1526
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
1527
+ return prom;
1469
1528
  });
1470
1529
  }
1471
1530
  Entity.Get = Get;
1472
- function GetListByIds(api, entityIds, reqParams) {
1531
+ function GetListByIds(params) {
1473
1532
  return __awaiter(this, void 0, void 0, function* () {
1533
+ const { api, entityIds, req: reqParams } = params;
1474
1534
  if (!entityIds.length) {
1475
1535
  throw ("Entity IDs are required.");
1476
1536
  }
@@ -1515,12 +1575,15 @@ var Entity;
1515
1575
  reqs.push(prom);
1516
1576
  }
1517
1577
  }
1518
- return (yield Promise.all(reqs)).filter(x => !!x);
1578
+ return {
1579
+ entities: (yield Promise.all(reqs)).filter(x => !!x)
1580
+ };
1519
1581
  });
1520
1582
  }
1521
1583
  Entity.GetListByIds = GetListByIds;
1522
- function Delete(api, entityId, reqParams) {
1584
+ function Delete(params) {
1523
1585
  return __awaiter(this, void 0, void 0, function* () {
1586
+ const { api, entityId, req: reqParams } = params;
1524
1587
  if (!entityId) {
1525
1588
  throw ("Entity ID is required.");
1526
1589
  }
@@ -1529,8 +1592,9 @@ var Entity;
1529
1592
  });
1530
1593
  }
1531
1594
  Entity.Delete = Delete;
1532
- function DeleteList(api, entityIds, reqParams) {
1595
+ function DeleteList(params) {
1533
1596
  return __awaiter(this, void 0, void 0, function* () {
1597
+ const { api, entityIds, req: reqParams } = params;
1534
1598
  if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
1535
1599
  throw ("Entity IDs are required.");
1536
1600
  }
@@ -1544,9 +1608,10 @@ var Entity;
1544
1608
  });
1545
1609
  }
1546
1610
  Entity.DeleteList = DeleteList;
1547
- function Update(api, data, override, reqParams) {
1611
+ function Update(params) {
1548
1612
  var _a, _b;
1549
1613
  return __awaiter(this, void 0, void 0, function* () {
1614
+ const { api, entity: data, override, req: reqParams } = params;
1550
1615
  if (!((_a = data === null || data === void 0 ? void 0 : data.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"])) {
1551
1616
  throw ("Entity Type ID is required.");
1552
1617
  }
@@ -1554,14 +1619,17 @@ var Entity;
1554
1619
  data.Bruce = Object.assign(Object.assign({}, data.Bruce), { ID: ObjectUtils.UId() });
1555
1620
  }
1556
1621
  const reqUrl = `entity/${data.Bruce.ID}/?dataoverride=${override}&BruceEntityType=${data.Bruce["EntityType.ID"]}`;
1557
- data = yield api.POST(reqUrl, data, Api.PrepReqParams(reqParams));
1622
+ const res = yield api.POST(reqUrl, data, Api.PrepReqParams(reqParams));
1558
1623
  api.Cache.Remove(GetCacheKey(data.Bruce.ID));
1559
- return data;
1624
+ return {
1625
+ entity: res
1626
+ };
1560
1627
  });
1561
1628
  }
1562
1629
  Entity.Update = Update;
1563
- function RemoveTag(data, tagId) {
1630
+ function RemoveTag(params) {
1564
1631
  var _a;
1632
+ const { entity: data, tagId } = params;
1565
1633
  const tags = (_a = data.Bruce["Layer.ID"]) !== null && _a !== void 0 ? _a : [];
1566
1634
  const index = tags.indexOf(tagId);
1567
1635
  if (index >= 0) {
@@ -1570,8 +1638,9 @@ var Entity;
1570
1638
  }
1571
1639
  }
1572
1640
  Entity.RemoveTag = RemoveTag;
1573
- function AddTag(data, tagId) {
1641
+ function AddTag(params) {
1574
1642
  var _a;
1643
+ const { entity: data, tagId } = params;
1575
1644
  const tags = (_a = data.Bruce["Layer.ID"]) !== null && _a !== void 0 ? _a : [];
1576
1645
  if (!tags.includes(tagId)) {
1577
1646
  tags.push(tagId);
@@ -1579,7 +1648,8 @@ var Entity;
1579
1648
  }
1580
1649
  }
1581
1650
  Entity.AddTag = AddTag;
1582
- function SetValue(data, path, value) {
1651
+ function SetValue(params) {
1652
+ const { entity: data, path, value } = params;
1583
1653
  let curData = data;
1584
1654
  for (let i = 0; i < path.length; i++) {
1585
1655
  const step = path[i];
@@ -1594,8 +1664,9 @@ var Entity;
1594
1664
  }
1595
1665
  }
1596
1666
  Entity.SetValue = SetValue;
1597
- function GetValue(data, path) {
1667
+ function GetValue(params) {
1598
1668
  var _a;
1669
+ const { entity: data, path } = params;
1599
1670
  // Backwards compatibility.
1600
1671
  if (path.length == 1 && path[0] == "ID") {
1601
1672
  return (_a = data.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
@@ -1616,21 +1687,23 @@ var Entity;
1616
1687
  Entity.GetValue = GetValue;
1617
1688
  /**
1618
1689
  * Calculates an entity's name based on attribute priority set in the type.
1619
- * @param entity
1620
- * @param type
1621
- * @param defaultToId
1690
+ * @param params
1622
1691
  * If true, will return the entity ID if no name can be calculated.
1623
1692
  * Otherwise it returns null.
1624
1693
  * @returns
1625
1694
  */
1626
- function CalculateName(entity, type, defaultToId) {
1695
+ function CalculateName(params) {
1696
+ const { entity, type, defaultToId = true } = params;
1627
1697
  const attrStr = type.DisplayNameAttributePath;
1628
1698
  if (attrStr) {
1629
1699
  const attrPaths = attrStr.split(",");
1630
1700
  for (let i = 0; i < attrPaths.length; i++) {
1631
1701
  const pathStr = attrPaths[i];
1632
1702
  const path = PathUtils.Parse(pathStr);
1633
- const name = Entity.GetValue(entity, path);
1703
+ const name = Entity.GetValue({
1704
+ entity: entity,
1705
+ path
1706
+ });
1634
1707
  if (name && typeof name != "object") {
1635
1708
  return name;
1636
1709
  }
@@ -1639,54 +1712,50 @@ var Entity;
1639
1712
  return defaultToId ? entity.Bruce.ID : null;
1640
1713
  }
1641
1714
  Entity.CalculateName = CalculateName;
1642
- let Filter;
1643
- (function (Filter) {
1644
- let V1;
1645
- (function (V1) {
1646
- function GetList(api, filter, reqParams) {
1647
- return __awaiter(this, void 0, void 0, function* () {
1648
- let requestFilter = {};
1649
- if (filter.entityTypeConditions) {
1650
- requestFilter = Object.assign({}, filter.entityTypeConditions);
1651
- }
1652
- if (filter.layerIds != null && filter.layerIds.length > 0) {
1653
- requestFilter["Bruce.Layer.ID"] = {
1654
- equals: filter.layerIds
1655
- };
1656
- }
1657
- if (filter.bounds) {
1658
- requestFilter["geometry"] = {
1659
- "intersects": [
1660
- filter.bounds.south,
1661
- filter.bounds.north,
1662
- filter.bounds.west,
1663
- filter.bounds.east
1664
- ]
1665
- };
1666
- }
1667
- const body = {
1668
- SortOrder: filter.sortOrder == Api.ESortOrder.Asc ? "ASC" : "DESC",
1669
- OrderBy: filter.orderBy,
1670
- Filter: requestFilter,
1671
- LODType: filter.lodCategoryId,
1672
- BruceEntityType: filter.entityTypeId,
1673
- PageIndex: filter.pageIndex,
1674
- PageSize: filter.pageSize
1675
- };
1676
- const data = yield api.POST("entities", body, Api.PrepReqParams(reqParams));
1677
- const entities = data.Items;
1678
- for (let i = 0; i < entities.length; i++) {
1679
- const entity = entities[i];
1680
- const id = entity.Bruce.ID;
1681
- api.Cache.Set(GetCacheKey(id), entity, Api.DEFAULT_CACHE_DURATION);
1682
- }
1683
- return entities;
1684
- });
1715
+ function GetList(params) {
1716
+ return __awaiter(this, void 0, void 0, function* () {
1717
+ const { api, filter, req: reqParams } = params;
1718
+ let requestFilter = {};
1719
+ if (filter.entityTypeConditions) {
1720
+ requestFilter = Object.assign({}, filter.entityTypeConditions);
1721
+ }
1722
+ if (filter.layerIds != null && filter.layerIds.length > 0) {
1723
+ requestFilter["Bruce.Layer.ID"] = {
1724
+ equals: filter.layerIds
1725
+ };
1685
1726
  }
1686
- V1.GetList = GetList;
1687
- })(V1 = Filter.V1 || (Filter.V1 = {}));
1688
- // TODO: Helpers for constructing the filter.
1689
- })(Filter = Entity.Filter || (Entity.Filter = {}));
1727
+ if (filter.bounds) {
1728
+ requestFilter["geometry"] = {
1729
+ "intersects": [
1730
+ filter.bounds.south,
1731
+ filter.bounds.north,
1732
+ filter.bounds.west,
1733
+ filter.bounds.east
1734
+ ]
1735
+ };
1736
+ }
1737
+ const body = {
1738
+ SortOrder: filter.sortOrder == Api.ESortOrder.Asc ? "ASC" : "DESC",
1739
+ OrderBy: filter.orderBy,
1740
+ Filter: requestFilter,
1741
+ LODType: filter.lodCategoryId,
1742
+ BruceEntityType: filter.entityTypeId,
1743
+ PageIndex: filter.pageIndex,
1744
+ PageSize: filter.pageSize
1745
+ };
1746
+ const data = yield api.POST("entities", body, Api.PrepReqParams(reqParams));
1747
+ const entities = data.Items;
1748
+ for (let i = 0; i < entities.length; i++) {
1749
+ const entity = entities[i];
1750
+ const id = entity.Bruce.ID;
1751
+ api.Cache.Set(GetCacheKey(id), entity, Api.DEFAULT_CACHE_DURATION);
1752
+ }
1753
+ return {
1754
+ entities: entities
1755
+ };
1756
+ });
1757
+ }
1758
+ Entity.GetList = GetList;
1690
1759
  })(Entity || (Entity = {}));
1691
1760
 
1692
1761
  function getVariable(str) {
@@ -1716,7 +1785,8 @@ var BruceVariable;
1716
1785
  * @param legacyParse
1717
1786
  * @returns
1718
1787
  */
1719
- function SwapValues(str, data, legacyParse) {
1788
+ function SwapValues(params) {
1789
+ let { str, entity: data, legacyParse } = params;
1720
1790
  if (!legacyParse) {
1721
1791
  legacyParse = false;
1722
1792
  }
@@ -1726,7 +1796,10 @@ var BruceVariable;
1726
1796
  const path = legacyParse ? PathUtils.ParseLegacy(variable.path) : PathUtils.Parse(variable.path);
1727
1797
  let value = "";
1728
1798
  if (path.length > 0) {
1729
- value = Entity.GetValue(data, path);
1799
+ value = Entity.GetValue({
1800
+ entity: data,
1801
+ path: path
1802
+ });
1730
1803
  }
1731
1804
  str = str.replace(variable.text, value);
1732
1805
  }
@@ -1881,7 +1954,10 @@ var Calculator;
1881
1954
  Calculator.GetColor = GetColor;
1882
1955
  function GetMappingValue(value, entity) {
1883
1956
  const attrPath = parseLegacyPath(value.field);
1884
- const eValue = Entity.GetValue(entity, attrPath);
1957
+ let eValue = Entity.GetValue({
1958
+ entity: entity,
1959
+ path: attrPath
1960
+ });
1885
1961
  const isValueNum = !isNaN(+eValue);
1886
1962
  for (let i = 0; i < value.values.length; i++) {
1887
1963
  const option = value.values[i];
@@ -1922,7 +1998,10 @@ var Calculator;
1922
1998
  Calculator.GetMappingValue = GetMappingValue;
1923
1999
  function GetGradientValue(value, entity) {
1924
2000
  const attrPath = parseLegacyPath(value.field);
1925
- let eValue = Entity.GetValue(entity, attrPath);
2001
+ let eValue = Entity.GetValue({
2002
+ entity: entity,
2003
+ path: attrPath
2004
+ });
1926
2005
  eValue = Math.min(Math.max(eValue, value.min), value.max);
1927
2006
  if (eValue < value.points[0].position) {
1928
2007
  return Color.ColorFromStr(value.points[0].color);
@@ -1951,7 +2030,10 @@ var Calculator;
1951
2030
  function GetInputValue(value, entity) {
1952
2031
  if (typeof value == "string") {
1953
2032
  try {
1954
- value = BruceVariable.SwapValues(value, entity);
2033
+ value = BruceVariable.SwapValues({
2034
+ str: value,
2035
+ entity: entity
2036
+ });
1955
2037
  const eval2 = eval; // https://rollupjs.org/guide/en/#avoiding-eval
1956
2038
  return eval2(value);
1957
2039
  }
@@ -2019,17 +2101,17 @@ var Geometry;
2019
2101
  return filteredList;
2020
2102
  }
2021
2103
  Geometry.RemoveRepeatPoints = RemoveRepeatPoints;
2022
- function ParsePoints(data) {
2023
- data = data.replace(/[^\d.,-\s]/g, "");
2104
+ function ParsePoints(pointsStr) {
2105
+ pointsStr = pointsStr.replace(/[^\d.,-\s]/g, "");
2024
2106
  let splitterCoordinates = " ";
2025
2107
  let splitterAxis = ",";
2026
- const commaIndex = data.indexOf(",");
2027
- const spaceIndex = data.indexOf(" ");
2108
+ const commaIndex = pointsStr.indexOf(",");
2109
+ const spaceIndex = pointsStr.indexOf(" ");
2028
2110
  if ((spaceIndex > -1 && commaIndex > spaceIndex) || commaIndex <= -1) {
2029
2111
  splitterCoordinates = ",";
2030
2112
  splitterAxis = " ";
2031
2113
  }
2032
- let points = data.trim().split(splitterCoordinates);
2114
+ let points = pointsStr.trim().split(splitterCoordinates);
2033
2115
  points = points.filter(a => a != "");
2034
2116
  const result = [];
2035
2117
  for (let i = 0; i < points.length; i++) {
@@ -2488,8 +2570,9 @@ var EntityAttachmentType;
2488
2570
  EType["Photo"] = "photo";
2489
2571
  EType["Document"] = "document";
2490
2572
  })(EType = EntityAttachmentType.EType || (EntityAttachmentType.EType = {}));
2491
- function Delete(api, id, reqParams) {
2573
+ function Delete(params) {
2492
2574
  return __awaiter(this, void 0, void 0, function* () {
2575
+ const { api, attachmentTypeId: id, req: reqParams } = params;
2493
2576
  if (!id) {
2494
2577
  throw ("Type ID is required.");
2495
2578
  }
@@ -2499,20 +2582,24 @@ var EntityAttachmentType;
2499
2582
  });
2500
2583
  }
2501
2584
  EntityAttachmentType.Delete = Delete;
2502
- function Update(api, data, reqParams) {
2585
+ function Update(params) {
2503
2586
  return __awaiter(this, void 0, void 0, function* () {
2587
+ const { api, attachmentType: data, req: reqParams } = params;
2504
2588
  if (!(data === null || data === void 0 ? void 0 : data.ID)) {
2505
2589
  throw ("Type ID is required.");
2506
2590
  }
2507
- data = yield api.POST(`entityAttachmentType/${data.ID}`, data, Api.PrepReqParams(reqParams));
2591
+ const res = yield api.POST(`entityAttachmentType/${data.ID}`, data, Api.PrepReqParams(reqParams));
2508
2592
  api.Cache.Remove(GetCacheKey(data.ID));
2509
2593
  api.Cache.Remove(GetListCacheKey());
2510
- return data;
2594
+ return {
2595
+ attachmentType: res
2596
+ };
2511
2597
  });
2512
2598
  }
2513
2599
  EntityAttachmentType.Update = Update;
2514
- function GetList(api, reqParams) {
2600
+ function GetList(params) {
2515
2601
  return __awaiter(this, void 0, void 0, function* () {
2602
+ const { api, reqParams } = params;
2516
2603
  const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
2517
2604
  if (cacheData) {
2518
2605
  return cacheData;
@@ -2520,7 +2607,9 @@ var EntityAttachmentType;
2520
2607
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2521
2608
  try {
2522
2609
  const data = yield api.GET(`entityAttachmentTypes`, Api.PrepReqParams(reqParams));
2523
- res(data.Items);
2610
+ res({
2611
+ attachmentTypes: data.Items
2612
+ });
2524
2613
  }
2525
2614
  catch (e) {
2526
2615
  rej(e);
@@ -2548,21 +2637,25 @@ var EntityAttachment;
2548
2637
  return Api.ECacheKey.Attachment + Api.ECacheKey.Entity + Api.ECacheKey.Id + entityId;
2549
2638
  }
2550
2639
  EntityAttachment.GetListCacheKey = GetListCacheKey;
2551
- function Update(api, data, reqParams) {
2640
+ function Update(params) {
2552
2641
  return __awaiter(this, void 0, void 0, function* () {
2642
+ const { api, attachment: data, req: reqParams } = params;
2553
2643
  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"])) {
2554
2644
  throw ("Entity ID, Type ID, and File ID are required.");
2555
2645
  }
2556
2646
  const url = `entity/${data["Entity.ID"]}/attachment/${data.oldAttachmentTypeId}/${data["ClientFile.ID"]}`;
2557
- data = yield api.PUT(url, data, Api.PrepReqParams(reqParams));
2647
+ const res = yield api.PUT(url, data, Api.PrepReqParams(reqParams));
2558
2648
  api.Cache.Remove(GetCacheKey(data["Entity.ID"], data["EntityAttachmentType.ID"], data["ClientFile.ID"]));
2559
2649
  api.Cache.RemoveByStartsWith(GetListCacheKey(data["Entity.ID"]));
2560
- return data;
2650
+ return {
2651
+ attachment: res
2652
+ };
2561
2653
  });
2562
2654
  }
2563
2655
  EntityAttachment.Update = Update;
2564
- function UpdateOrder(api, entityId, typeId, fileIds, reqParams) {
2656
+ function UpdateOrder(params) {
2565
2657
  return __awaiter(this, void 0, void 0, function* () {
2658
+ const { api, entityId, attachmentTypeId: typeId, fileIds, req: reqParams } = params;
2566
2659
  if (!entityId || !typeId || !(fileIds === null || fileIds === void 0 ? void 0 : fileIds.length)) {
2567
2660
  throw ("Entity ID, Type ID, and File IDs are required.");
2568
2661
  }
@@ -2578,8 +2671,9 @@ var EntityAttachment;
2578
2671
  });
2579
2672
  }
2580
2673
  EntityAttachment.UpdateOrder = UpdateOrder;
2581
- function Delete(api, data, reqParams) {
2674
+ function Delete(params) {
2582
2675
  return __awaiter(this, void 0, void 0, function* () {
2676
+ const { api, attachment: data, req: reqParams } = params;
2583
2677
  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"])) {
2584
2678
  throw ("Entity ID, Type ID, and File ID are required.");
2585
2679
  }
@@ -2592,8 +2686,9 @@ var EntityAttachment;
2592
2686
  });
2593
2687
  }
2594
2688
  EntityAttachment.Delete = Delete;
2595
- function DeleteByFileIds(api, entityId, typeId, fileIds, reqParams) {
2689
+ function DeleteByFileIds(params) {
2596
2690
  return __awaiter(this, void 0, void 0, function* () {
2691
+ const { api, entityId, attachmentTypeId: typeId, fileIds, req: reqParams } = params;
2597
2692
  if (!entityId || !typeId || !(fileIds === null || fileIds === void 0 ? void 0 : fileIds.length)) {
2598
2693
  throw ("Entity ID, Type ID, and File IDs are required.");
2599
2694
  }
@@ -2608,8 +2703,9 @@ var EntityAttachment;
2608
2703
  });
2609
2704
  }
2610
2705
  EntityAttachment.DeleteByFileIds = DeleteByFileIds;
2611
- function GetListByEntityId(api, entityId, reqParams) {
2706
+ function GetListByEntityId(params) {
2612
2707
  return __awaiter(this, void 0, void 0, function* () {
2708
+ const { api, entityId, req: reqParams } = params;
2613
2709
  if (!entityId) {
2614
2710
  throw ("Entity ID is required.");
2615
2711
  }
@@ -2620,7 +2716,9 @@ var EntityAttachment;
2620
2716
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2621
2717
  try {
2622
2718
  const data = yield api.GET(`entity/${entityId}/attachments`, Api.PrepReqParams(reqParams));
2623
- res(data.Items);
2719
+ res({
2720
+ attachments: data.Items
2721
+ });
2624
2722
  }
2625
2723
  catch (e) {
2626
2724
  rej(e);
@@ -2631,15 +2729,18 @@ var EntityAttachment;
2631
2729
  });
2632
2730
  }
2633
2731
  EntityAttachment.GetListByEntityId = GetListByEntityId;
2634
- function Upload(api, file, entityId, typeId, reqParams) {
2732
+ function Upload(params) {
2635
2733
  return __awaiter(this, void 0, void 0, function* () {
2734
+ const { api, file, entityId, attachmentTypeId: typeId, req: reqParams } = params;
2636
2735
  if (!entityId || !typeId || !file) {
2637
2736
  throw ("Entity ID, Type ID, and File are required.");
2638
2737
  }
2639
2738
  const url = `entity/${entityId}/attachment/${typeId}`;
2640
- const req = yield api.UPLOAD(url, file, reqParams);
2739
+ const res = yield api.UPLOAD(url, file, reqParams);
2641
2740
  api.Cache.RemoveByStartsWith(GetListCacheKey(entityId));
2642
- return req;
2741
+ return {
2742
+ attachment: res
2743
+ };
2643
2744
  });
2644
2745
  }
2645
2746
  EntityAttachment.Upload = Upload;
@@ -2659,21 +2760,25 @@ var EntityComment;
2659
2760
  return Api.ECacheKey.Comment + Api.ECacheKey.Entity + Api.ECacheKey.Id + entityId;
2660
2761
  }
2661
2762
  EntityComment.GetListCacheKey = GetListCacheKey;
2662
- function Update(api, data, reqParams) {
2763
+ function Update(params) {
2663
2764
  return __awaiter(this, void 0, void 0, function* () {
2765
+ const { api, comment: data, req: reqParams } = params;
2664
2766
  if (!(data === null || data === void 0 ? void 0 : data["TargetObject.ID"])) {
2665
2767
  throw ("TargetObject.ID (entity id) is required.");
2666
2768
  }
2667
2769
  const url = `entity/${data["TargetObject.ID"]}/comment` + (data.ID == null ? "" : "/" + data.ID);
2668
- data = yield api.POST(url, data, Api.PrepReqParams(reqParams));
2770
+ const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
2669
2771
  api.Cache.Remove(GetCacheKey(data.ID));
2670
2772
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Comment + Api.ECacheKey.Entity);
2671
- return data;
2773
+ return {
2774
+ comment: res
2775
+ };
2672
2776
  });
2673
2777
  }
2674
2778
  EntityComment.Update = Update;
2675
- function Delete(api, entityId, commentId, reqParams) {
2779
+ function Delete(params) {
2676
2780
  return __awaiter(this, void 0, void 0, function* () {
2781
+ const { api, entityId, commentId, req: reqParams } = params;
2677
2782
  if (!commentId) {
2678
2783
  throw ("Comment ID is required.");
2679
2784
  }
@@ -2683,8 +2788,9 @@ var EntityComment;
2683
2788
  });
2684
2789
  }
2685
2790
  EntityComment.Delete = Delete;
2686
- function GetListByEntityId(api, entityId, reqParams) {
2791
+ function GetListByEntityId(params) {
2687
2792
  return __awaiter(this, void 0, void 0, function* () {
2793
+ const { api, entityId, req: reqParams } = params;
2688
2794
  if (!entityId) {
2689
2795
  throw ("Entity ID is required.");
2690
2796
  }
@@ -2695,7 +2801,9 @@ var EntityComment;
2695
2801
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2696
2802
  try {
2697
2803
  const data = yield api.GET(`entity/${entityId}/comments`, Api.PrepReqParams(reqParams));
2698
- res(data.Items);
2804
+ res({
2805
+ comments: data.Items
2806
+ });
2699
2807
  }
2700
2808
  catch (e) {
2701
2809
  rej(e);
@@ -2722,21 +2830,25 @@ var EntityLink;
2722
2830
  return Api.ECacheKey.Link + Api.ECacheKey.Entity + Api.ECacheKey.Id + entityId;
2723
2831
  }
2724
2832
  EntityLink.GetListCacheKey = GetListCacheKey;
2725
- function Update(api, data, reqParams) {
2833
+ function Update(params) {
2726
2834
  return __awaiter(this, void 0, void 0, function* () {
2835
+ const { api, link: data, req: reqParams } = params;
2727
2836
  if (!(data === null || data === void 0 ? void 0 : data["Entity.ID"])) {
2728
2837
  throw ("Entity ID is required.");
2729
2838
  }
2730
2839
  const url = `entity/${data["Entity.ID"]}/link` + (data.ID == null ? "" : "/" + data.ID);
2731
- data = yield api.POST(url, data, Api.PrepReqParams(reqParams));
2840
+ const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
2732
2841
  api.Cache.Remove(GetCacheKey(data.ID));
2733
2842
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Link + Api.ECacheKey.Entity);
2734
- return data;
2843
+ return {
2844
+ link: res
2845
+ };
2735
2846
  });
2736
2847
  }
2737
2848
  EntityLink.Update = Update;
2738
- function Delete(api, entityId, linkId, reqParams) {
2849
+ function Delete(params) {
2739
2850
  return __awaiter(this, void 0, void 0, function* () {
2851
+ const { api, entityId, linkId, req: reqParams } = params;
2740
2852
  if (!linkId) {
2741
2853
  throw ("Link ID is required.");
2742
2854
  }
@@ -2746,8 +2858,9 @@ var EntityLink;
2746
2858
  });
2747
2859
  }
2748
2860
  EntityLink.Delete = Delete;
2749
- function GetListByEntityId(api, entityId, reqParams) {
2861
+ function GetListByEntityId(params) {
2750
2862
  return __awaiter(this, void 0, void 0, function* () {
2863
+ const { api, entityId, req: reqParams } = params;
2751
2864
  if (!entityId) {
2752
2865
  throw ("Entity ID is required.");
2753
2866
  }
@@ -2758,7 +2871,9 @@ var EntityLink;
2758
2871
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2759
2872
  try {
2760
2873
  const data = yield api.GET(`entity/${entityId}/links`, Api.PrepReqParams(reqParams));
2761
- res(data.Items);
2874
+ res({
2875
+ links: data.Items
2876
+ });
2762
2877
  }
2763
2878
  catch (e) {
2764
2879
  rej(e);
@@ -2791,7 +2906,8 @@ var EntityLod;
2791
2906
  return Api.ECacheKey.Lod + Api.ECacheKey.Entity + entityId;
2792
2907
  }
2793
2908
  EntityLod.GetEntityListKey = GetEntityListKey;
2794
- function GetUrl(api, entityId, categoryId, level, strict) {
2909
+ function GetUrl(params) {
2910
+ let { api, entityId, categoryId, level, strict } = params;
2795
2911
  if (!entityId) {
2796
2912
  throw ("Entity ID is required.");
2797
2913
  }
@@ -2805,11 +2921,14 @@ var EntityLod;
2805
2921
  if (strict) {
2806
2922
  url = url + "?strict=true";
2807
2923
  }
2808
- return url;
2924
+ return {
2925
+ url: url
2926
+ };
2809
2927
  }
2810
2928
  EntityLod.GetUrl = GetUrl;
2811
- function GetUrlFileId(api, url, reqParams) {
2929
+ function GetUrlFileId(params) {
2812
2930
  return __awaiter(this, void 0, void 0, function* () {
2931
+ const { api, url, req: reqParams } = params;
2813
2932
  if (!url) {
2814
2933
  throw ("Url is required.");
2815
2934
  }
@@ -2820,7 +2939,9 @@ var EntityLod;
2820
2939
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2821
2940
  try {
2822
2941
  const record = yield api.get(url, Api.PrepReqParams(reqParams));
2823
- res(record["ClientFile.ID"]);
2942
+ res({
2943
+ clientFileId: record["ClientFile.ID"]
2944
+ });
2824
2945
  }
2825
2946
  catch (e) {
2826
2947
  rej(e);
@@ -2831,19 +2952,23 @@ var EntityLod;
2831
2952
  });
2832
2953
  }
2833
2954
  EntityLod.GetUrlFileId = GetUrlFileId;
2834
- function GetLods(api, params, reqParams) {
2955
+ function GetLods(params) {
2835
2956
  var _a;
2836
2957
  return __awaiter(this, void 0, void 0, function* () {
2837
- if (!((_a = params === null || params === void 0 ? void 0 : params.Items) === null || _a === void 0 ? void 0 : _a.length)) {
2958
+ const { api, filter, req: reqParams } = params;
2959
+ if (!((_a = filter === null || filter === void 0 ? void 0 : filter.Items) === null || _a === void 0 ? void 0 : _a.length)) {
2838
2960
  throw ("Items are required.");
2839
2961
  }
2840
- const data = yield api.POST("entity/getlods", params, reqParams);
2841
- return data.Items;
2962
+ const data = yield api.POST("entity/getlods", filter, reqParams);
2963
+ return {
2964
+ lods: data.Items
2965
+ };
2842
2966
  });
2843
2967
  }
2844
2968
  EntityLod.GetLods = GetLods;
2845
- function GetEntityLods(api, entityId, reqParams) {
2969
+ function GetEntityLods(params) {
2846
2970
  return __awaiter(this, void 0, void 0, function* () {
2971
+ const { api, entityId, req: reqParams } = params;
2847
2972
  if (!entityId) {
2848
2973
  throw ("Entity id is required.");
2849
2974
  }
@@ -2855,7 +2980,9 @@ var EntityLod;
2855
2980
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2856
2981
  try {
2857
2982
  const data = yield req;
2858
- res(data.Items);
2983
+ res({
2984
+ lods: data.Items
2985
+ });
2859
2986
  }
2860
2987
  catch (e) {
2861
2988
  rej(e);
@@ -2868,13 +2995,11 @@ var EntityLod;
2868
2995
  EntityLod.GetEntityLods = GetEntityLods;
2869
2996
  /**
2870
2997
  * Returns lods for a specified entity type.
2871
- * @param api
2872
- * @param typeId
2873
- * @param group default is "DEFAULT".
2874
- * @param reqParams
2998
+ * @param params
2875
2999
  */
2876
- function GetTypeLods(api, typeId, group, reqParams) {
3000
+ function GetTypeLods(params) {
2877
3001
  return __awaiter(this, void 0, void 0, function* () {
3002
+ let { api, entityTypeId: typeId, group, req: reqParams } = params;
2878
3003
  if (!group) {
2879
3004
  group = "DEFAULT";
2880
3005
  }
@@ -2887,7 +3012,9 @@ var EntityLod;
2887
3012
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2888
3013
  try {
2889
3014
  const data = yield req;
2890
- res(data.Items);
3015
+ res({
3016
+ lods: data.Items
3017
+ });
2891
3018
  }
2892
3019
  catch (e) {
2893
3020
  rej(e);
@@ -2898,8 +3025,9 @@ var EntityLod;
2898
3025
  });
2899
3026
  }
2900
3027
  EntityLod.GetTypeLods = GetTypeLods;
2901
- function Update(api, entityId, params, reqParams) {
3028
+ function Update(params) {
2902
3029
  return __awaiter(this, void 0, void 0, function* () {
3030
+ const { api, entityId, req: reqParams } = params;
2903
3031
  if (!params["ClientFile.ID"] || !params["LODCategory.Key"] || (!params.Level && params.Level !== 0)) {
2904
3032
  throw ("ClientFile.ID, LODCategory.Key and Level are required.");
2905
3033
  }
@@ -2912,8 +3040,9 @@ var EntityLod;
2912
3040
  });
2913
3041
  }
2914
3042
  EntityLod.Update = Update;
2915
- function Delete(api, entityId, lodCategoryId, level, reqParams) {
3043
+ function Delete(params) {
2916
3044
  return __awaiter(this, void 0, void 0, function* () {
3045
+ let { api, entityId, lodCategoryId, level, req: reqParams } = params;
2917
3046
  if (!entityId || !lodCategoryId) {
2918
3047
  throw ("Entity ID and LOD Category ID are required.");
2919
3048
  }
@@ -2940,8 +3069,9 @@ var EntityLodCategory;
2940
3069
  return Api.ECacheKey.LodCategory;
2941
3070
  }
2942
3071
  EntityLodCategory.GetListCacheKey = GetListCacheKey;
2943
- function GetList(api, reqParams) {
3072
+ function GetList(params) {
2944
3073
  return __awaiter(this, void 0, void 0, function* () {
3074
+ const { api, req: reqParams } = params;
2945
3075
  const cacheKey = api.GetCacheItem(GetListCacheKey(), reqParams);
2946
3076
  if (cacheKey) {
2947
3077
  return cacheKey;
@@ -2949,7 +3079,9 @@ var EntityLodCategory;
2949
3079
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2950
3080
  try {
2951
3081
  const data = yield api.GET("lodCategories", Api.PrepReqParams(reqParams));
2952
- res(data.Items);
3082
+ res({
3083
+ categories: data.Items
3084
+ });
2953
3085
  }
2954
3086
  catch (e) {
2955
3087
  rej(e);
@@ -2960,8 +3092,9 @@ var EntityLodCategory;
2960
3092
  });
2961
3093
  }
2962
3094
  EntityLodCategory.GetList = GetList;
2963
- function Get(api, id, reqParams) {
3095
+ function Get(params) {
2964
3096
  return __awaiter(this, void 0, void 0, function* () {
3097
+ const { api, categoryId: id, req: reqParams } = params;
2965
3098
  if (!id) {
2966
3099
  throw ("Lod category id is required.");
2967
3100
  }
@@ -2972,7 +3105,9 @@ var EntityLodCategory;
2972
3105
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2973
3106
  try {
2974
3107
  const data = yield api.GET(`lodCategory/${id}`, Api.PrepReqParams(reqParams));
2975
- res(data);
3108
+ res({
3109
+ category: data
3110
+ });
2976
3111
  }
2977
3112
  catch (e) {
2978
3113
  rej(e);
@@ -2983,8 +3118,9 @@ var EntityLodCategory;
2983
3118
  });
2984
3119
  }
2985
3120
  EntityLodCategory.Get = Get;
2986
- function Delete(api, id, reqParams) {
3121
+ function Delete(params) {
2987
3122
  return __awaiter(this, void 0, void 0, function* () {
3123
+ const { api, categoryId: id, req: reqParams } = params;
2988
3124
  if (!id) {
2989
3125
  throw ("Lod category id is required.");
2990
3126
  }
@@ -2994,15 +3130,18 @@ var EntityLodCategory;
2994
3130
  });
2995
3131
  }
2996
3132
  EntityLodCategory.Delete = Delete;
2997
- function Update(api, data, reqParams) {
3133
+ function Update(params) {
2998
3134
  return __awaiter(this, void 0, void 0, function* () {
3135
+ const { api, category: data, req: reqParams } = params;
2999
3136
  if (!data.Key || !data.Name) {
3000
3137
  throw ("Lod category key and name are required.");
3001
3138
  }
3002
- data = yield api.POST(`lodCategory/${data.Key}`, data, Api.PrepReqParams(reqParams));
3139
+ const res = yield api.POST(`lodCategory/${data.Key}`, data, Api.PrepReqParams(reqParams));
3003
3140
  api.Cache.Remove(GetCacheKey(data.Key));
3004
3141
  api.Cache.Remove(GetListCacheKey());
3005
- return data;
3142
+ return {
3143
+ category: res
3144
+ };
3006
3145
  });
3007
3146
  }
3008
3147
  EntityLodCategory.Update = Update;
@@ -3022,8 +3161,9 @@ var EntityRelationType;
3022
3161
  return Api.ECacheKey.RelationType;
3023
3162
  }
3024
3163
  EntityRelationType.GetListCacheKey = GetListCacheKey;
3025
- function Get(api, typeId, reqParams) {
3164
+ function Get(params) {
3026
3165
  return __awaiter(this, void 0, void 0, function* () {
3166
+ const { api, relationTypeId: typeId, req: reqParams } = params;
3027
3167
  if (!typeId) {
3028
3168
  throw ("Type ID is required.");
3029
3169
  }
@@ -3032,14 +3172,25 @@ var EntityRelationType;
3032
3172
  if (cacheData) {
3033
3173
  return cacheData;
3034
3174
  }
3035
- const req = api.GET(`entityRelationType/${typeId}`, Api.PrepReqParams(reqParams));
3036
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
3037
- return req;
3175
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3176
+ try {
3177
+ const data = yield api.GET(`entityRelationType/${typeId}`, Api.PrepReqParams(reqParams));
3178
+ res({
3179
+ relationType: data
3180
+ });
3181
+ }
3182
+ catch (e) {
3183
+ rej(e);
3184
+ }
3185
+ }));
3186
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
3187
+ return prom;
3038
3188
  });
3039
3189
  }
3040
3190
  EntityRelationType.Get = Get;
3041
- function Delete(api, typeId, reqParams) {
3191
+ function Delete(params) {
3042
3192
  return __awaiter(this, void 0, void 0, function* () {
3193
+ const { api, relationTypeId: typeId, req: reqParams } = params;
3043
3194
  if (!typeId) {
3044
3195
  throw ("Type ID is required.");
3045
3196
  }
@@ -3049,8 +3200,9 @@ var EntityRelationType;
3049
3200
  });
3050
3201
  }
3051
3202
  EntityRelationType.Delete = Delete;
3052
- function GetList(api, reqParams) {
3203
+ function GetList(params) {
3053
3204
  return __awaiter(this, void 0, void 0, function* () {
3205
+ const { api, req: reqParams } = params;
3054
3206
  const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
3055
3207
  if (cacheData) {
3056
3208
  return cacheData;
@@ -3058,7 +3210,9 @@ var EntityRelationType;
3058
3210
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3059
3211
  try {
3060
3212
  const data = yield api.GET("entityRelationTypes", Api.PrepReqParams(reqParams));
3061
- res(data.Items);
3213
+ res({
3214
+ relationTypes: data.Items
3215
+ });
3062
3216
  }
3063
3217
  catch (e) {
3064
3218
  rej(e);
@@ -3069,18 +3223,21 @@ var EntityRelationType;
3069
3223
  });
3070
3224
  }
3071
3225
  EntityRelationType.GetList = GetList;
3072
- function Update(api, data, reqParams) {
3226
+ function Update(params) {
3073
3227
  return __awaiter(this, void 0, void 0, function* () {
3228
+ const { api, relationType: data, req: reqParams } = params;
3074
3229
  if (!(data === null || data === void 0 ? void 0 : data.ForwardName) || !(data === null || data === void 0 ? void 0 : data.ReverseName)) {
3075
3230
  throw ("Forward and reverse names are required.");
3076
3231
  }
3077
3232
  if (!data.ID) {
3078
3233
  data.ID = ObjectUtils.UId();
3079
3234
  }
3080
- data = yield api.POST(`entityRelationType/${data.ID}`, data, Api.PrepReqParams(reqParams));
3235
+ const res = yield api.POST(`entityRelationType/${data.ID}`, data, Api.PrepReqParams(reqParams));
3081
3236
  api.Cache.Remove(GetCacheKey(data.ID));
3082
3237
  api.Cache.Remove(GetListCacheKey());
3083
- return data;
3238
+ return {
3239
+ relationType: res
3240
+ };
3084
3241
  });
3085
3242
  }
3086
3243
  EntityRelationType.Update = Update;
@@ -3103,14 +3260,15 @@ var EntityRelation;
3103
3260
  EntityRelation.GetEntityCacheKey = GetEntityCacheKey;
3104
3261
  function GetListCacheKey(entityId, params) {
3105
3262
  return Api.ECacheKey.Relation + Api.ECacheKey.RelationType +
3106
- Api.ECacheKey.Id + params.typeId +
3263
+ Api.ECacheKey.Id + params.relationTypeId +
3107
3264
  Api.ECacheKey.Id + params.oneWayOnly +
3108
3265
  Api.ECacheKey.Id + params.loadEntityData +
3109
3266
  Api.ECacheKey.Entity + Api.ECacheKey.Id + entityId;
3110
3267
  }
3111
3268
  EntityRelation.GetListCacheKey = GetListCacheKey;
3112
- function Create(api, data, reqParams) {
3269
+ function Create(params) {
3113
3270
  return __awaiter(this, void 0, void 0, function* () {
3271
+ const { api, relation: data, req: reqParams } = params;
3114
3272
  if (!data["Principal.Entity.ID"] || !data["Related.Entity.ID"] || !data["Relation.Type.ID"]) {
3115
3273
  throw ("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
3116
3274
  }
@@ -3128,54 +3286,61 @@ var EntityRelation;
3128
3286
  });
3129
3287
  }
3130
3288
  EntityRelation.Create = Create;
3131
- function Update(api, data, reqParams) {
3289
+ function Update(params) {
3132
3290
  return __awaiter(this, void 0, void 0, function* () {
3291
+ const { api, relation: data, req: reqParams } = params;
3133
3292
  if (!data["Principal.Entity.ID"] || !data["Related.Entity.ID"] || !data["Relation.Type.ID"]) {
3134
3293
  throw ("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
3135
3294
  }
3136
3295
  const url = `entity/${data["Principal.Entity.ID"]}/otherEntityID/${data["Related.Entity.ID"]}/relation/${data["Relation.Type.ID"]}/update`;
3137
- data = yield api.POST(url, data, Api.PrepReqParams(reqParams));
3296
+ const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
3138
3297
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + data["Principal.Entity.ID"]);
3139
3298
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + data["Related.Entity.ID"]);
3140
3299
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.RelationType + Api.ECacheKey.Id + data["Relation.Type.ID"]);
3141
3300
  if (data["Data.Entity.ID"]) {
3142
3301
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Entity + Api.ECacheKey.Id + data["Data.Entity.ID"]);
3143
3302
  }
3144
- return data;
3303
+ return {
3304
+ relation: res
3305
+ };
3145
3306
  });
3146
3307
  }
3147
3308
  EntityRelation.Update = Update;
3148
- function GetList(api, entityId, params, reqParams) {
3309
+ function GetList(params) {
3149
3310
  return __awaiter(this, void 0, void 0, function* () {
3311
+ let { api, entityId, filter, req: reqParams } = params;
3150
3312
  if (!entityId) {
3151
3313
  throw ("Entity ID is required.");
3152
3314
  }
3153
- params = Object.assign({ typeId: "", oneWayOnly: false, loadEntityData: false }, params);
3154
- const cacheData = api.GetCacheItem(GetListCacheKey(entityId, params), reqParams);
3315
+ filter = Object.assign({ relationTypeId: "", oneWayOnly: false, loadEntityData: false }, filter);
3316
+ const cacheData = api.GetCacheItem(GetListCacheKey(entityId, filter), reqParams);
3155
3317
  if (cacheData) {
3156
3318
  return cacheData;
3157
3319
  }
3158
3320
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3159
3321
  try {
3160
3322
  let url = `entity/${entityId}/relations`;
3161
- if (params.typeId) {
3162
- url += "/" + params.typeId;
3323
+ if (filter.relationTypeId) {
3324
+ url += "/" + filter.relationTypeId;
3163
3325
  }
3164
- url += `?Oneway=${params.oneWayOnly}&LoadInfo=${params.loadEntityData}`;
3326
+ url += `?Oneway=${filter.oneWayOnly}&LoadInfo=${filter.loadEntityData}`;
3165
3327
  const data = yield api.GET(url, Api.PrepReqParams(reqParams));
3166
- res(data.Items);
3328
+ res({
3329
+ relations: data.Items
3330
+ });
3167
3331
  }
3168
3332
  catch (e) {
3169
3333
  rej(e);
3170
3334
  }
3171
3335
  }));
3172
- api.Cache.Set(GetListCacheKey(entityId, params), req);
3336
+ api.Cache.Set(GetListCacheKey(entityId, filter), req);
3173
3337
  return req;
3174
3338
  });
3175
3339
  }
3176
3340
  EntityRelation.GetList = GetList;
3177
- function GetByDataEntityId(api, entityId, reqParams) {
3341
+ function GetByDataEntityId(params) {
3178
3342
  return __awaiter(this, void 0, void 0, function* () {
3343
+ const { api, entityId, req: reqParams } = params;
3179
3344
  if (!entityId) {
3180
3345
  throw ("Entity ID is required.");
3181
3346
  }
@@ -3183,9 +3348,19 @@ var EntityRelation;
3183
3348
  if (cacheData) {
3184
3349
  return cacheData;
3185
3350
  }
3186
- const req = api.GET(`entity/relation/${entityId}/dataentity`, Api.PrepReqParams(reqParams));
3187
- api.Cache.Set(GetEntityCacheKey(entityId), req);
3188
- return req;
3351
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3352
+ try {
3353
+ const data = yield api.GET(`entity/relation/${entityId}/dataentity`, Api.PrepReqParams(reqParams));
3354
+ res({
3355
+ relation: data
3356
+ });
3357
+ }
3358
+ catch (e) {
3359
+ rej(e);
3360
+ }
3361
+ }));
3362
+ api.Cache.Set(GetEntityCacheKey(entityId), prom);
3363
+ return prom;
3189
3364
  });
3190
3365
  }
3191
3366
  EntityRelation.GetByDataEntityId = GetByDataEntityId;
@@ -3202,8 +3377,9 @@ var EntitySource;
3202
3377
  return `${Api.ECacheKey.EntitySource}${Api.ECacheKey.Id}${sourceId}${Api.ECacheKey.Id}${sourceKey}`;
3203
3378
  }
3204
3379
  EntitySource.GetCacheKey = GetCacheKey;
3205
- function Get(api, sourceId, sourceKey, reqParams) {
3380
+ function Get(params) {
3206
3381
  return __awaiter(this, void 0, void 0, function* () {
3382
+ const { api, sourceId, sourceKey, req: reqParams } = params;
3207
3383
  if (!sourceId || !sourceKey) {
3208
3384
  throw ("Source ID and Source Key are required.");
3209
3385
  }
@@ -3212,14 +3388,25 @@ var EntitySource;
3212
3388
  if (cacheData) {
3213
3389
  return cacheData;
3214
3390
  }
3215
- const req = api.GET(`entitysource/${sourceId}/${sourceKey}`, Api.PrepReqParams(reqParams));
3216
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
3217
- return req;
3391
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3392
+ try {
3393
+ const data = yield api.GET(`entitysource/${sourceId}/${sourceKey}`, Api.PrepReqParams(reqParams));
3394
+ res({
3395
+ source: data
3396
+ });
3397
+ }
3398
+ catch (e) {
3399
+ rej(e);
3400
+ }
3401
+ }));
3402
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
3403
+ return prom;
3218
3404
  });
3219
3405
  }
3220
3406
  EntitySource.Get = Get;
3221
- function GetListByKeys(api, sourceId, sourceKeys, reqParams) {
3407
+ function GetListByKeys(params) {
3222
3408
  return __awaiter(this, void 0, void 0, function* () {
3409
+ const { api, sourceId, sourceKeys, req: reqParams } = params;
3223
3410
  if (!sourceId || !sourceKeys.length) {
3224
3411
  throw ("Source ID and Source Keys are required.");
3225
3412
  }
@@ -3258,18 +3445,26 @@ var EntitySource;
3258
3445
  reqs.push(req);
3259
3446
  }
3260
3447
  }
3261
- return (yield Promise.all(reqs)).filter(x => !!x);
3448
+ return {
3449
+ sources: (yield Promise.all(reqs)).filter(x => !!x)
3450
+ };
3262
3451
  });
3263
3452
  }
3264
3453
  EntitySource.GetListByKeys = GetListByKeys;
3265
- function GetEntityIdsBySourceKeys(api, sourceId, sourceKeys, reqParams) {
3454
+ function GetEntityIdsBySourceKeys(params) {
3266
3455
  return __awaiter(this, void 0, void 0, function* () {
3456
+ const { api, sourceId, sourceKeys, req: reqParams } = params;
3267
3457
  if (!sourceId || !sourceKeys.length) {
3268
3458
  throw ("Source ID and Source Keys are required.");
3269
3459
  }
3270
3460
  const result = {};
3271
3461
  if (sourceKeys.length > 0) {
3272
- const sources = yield GetListByKeys(api, sourceId, sourceKeys, reqParams);
3462
+ const { sources } = yield GetListByKeys({
3463
+ api,
3464
+ sourceId,
3465
+ sourceKeys,
3466
+ req: reqParams
3467
+ });
3273
3468
  for (let i = 0; i < sources.length; i++) {
3274
3469
  const source = sources[i];
3275
3470
  for (let i = 0; i < sourceKeys.length; i++) {
@@ -3280,7 +3475,9 @@ var EntitySource;
3280
3475
  }
3281
3476
  }
3282
3477
  }
3283
- return result;
3478
+ return {
3479
+ idMapping: result
3480
+ };
3284
3481
  });
3285
3482
  }
3286
3483
  EntitySource.GetEntityIdsBySourceKeys = GetEntityIdsBySourceKeys;
@@ -3304,18 +3501,26 @@ var EntityTag;
3304
3501
  return Api.ECacheKey.Tag;
3305
3502
  }
3306
3503
  EntityTag.GetListCacheKey = GetListCacheKey;
3307
- function Get(api, tagId, reqParams) {
3504
+ function Get(params) {
3308
3505
  return __awaiter(this, void 0, void 0, function* () {
3506
+ const { api, tagId, req: reqParams } = params;
3309
3507
  if (!tagId) {
3310
3508
  throw ("Tag ID is required.");
3311
3509
  }
3312
- const data = yield GetListByIds(api, [tagId], reqParams);
3313
- return data.length ? data[0] : null;
3510
+ const { tags } = yield GetListByIds({
3511
+ api,
3512
+ tagIds: [tagId],
3513
+ req: reqParams
3514
+ });
3515
+ return {
3516
+ tag: tags.length ? tags[0] : null
3517
+ };
3314
3518
  });
3315
3519
  }
3316
3520
  EntityTag.Get = Get;
3317
- function GetListByIds(api, tagIds, reqParams) {
3521
+ function GetListByIds(params) {
3318
3522
  return __awaiter(this, void 0, void 0, function* () {
3523
+ const { api, tagIds, req: reqParams } = params;
3319
3524
  if (!tagIds.length) {
3320
3525
  throw ("Tag Ids are empty.");
3321
3526
  }
@@ -3357,12 +3562,15 @@ var EntityTag;
3357
3562
  reqs.push(req);
3358
3563
  }
3359
3564
  }
3360
- return (yield Promise.all(reqs)).filter(x => !!x);
3565
+ return {
3566
+ tags: (yield Promise.all(reqs)).filter(x => !!x)
3567
+ };
3361
3568
  });
3362
3569
  }
3363
3570
  EntityTag.GetListByIds = GetListByIds;
3364
- function GetList(api, entityTypeId, reqParams) {
3571
+ function GetList(params) {
3365
3572
  return __awaiter(this, void 0, void 0, function* () {
3573
+ const { api, entityTypeId, req: reqParams } = params;
3366
3574
  const cacheData = api.GetCacheItem(GetListCacheKey(entityTypeId), reqParams);
3367
3575
  if (cacheData) {
3368
3576
  return cacheData;
@@ -3370,7 +3578,9 @@ var EntityTag;
3370
3578
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3371
3579
  try {
3372
3580
  const data = yield api.GET(entityTypeId ? `entityType/${entityTypeId}/layers` : "layers", Api.PrepReqParams(reqParams));
3373
- res(data.Items);
3581
+ res({
3582
+ tags: data.Items
3583
+ });
3374
3584
  }
3375
3585
  catch (e) {
3376
3586
  rej(e);
@@ -3381,8 +3591,9 @@ var EntityTag;
3381
3591
  });
3382
3592
  }
3383
3593
  EntityTag.GetList = GetList;
3384
- function Delete(api, tagId, reqParams) {
3594
+ function Delete(params) {
3385
3595
  return __awaiter(this, void 0, void 0, function* () {
3596
+ const { api, tagId, req: reqParams } = params;
3386
3597
  if (!tagId) {
3387
3598
  throw ("Tag ID is required.");
3388
3599
  }
@@ -3392,16 +3603,19 @@ var EntityTag;
3392
3603
  });
3393
3604
  }
3394
3605
  EntityTag.Delete = Delete;
3395
- function Update(api, data, reqParams) {
3606
+ function Update(params) {
3396
3607
  return __awaiter(this, void 0, void 0, function* () {
3608
+ const { api, tag: data, req: reqParams } = params;
3397
3609
  if (!(data === null || data === void 0 ? void 0 : data.ID)) {
3398
3610
  throw ("Tag ID is required.");
3399
3611
  }
3400
3612
  const url = data.ID ? `layer/${data.ID}` : "layer";
3401
- data = yield api.POST(url, data, Api.PrepReqParams(reqParams));
3613
+ const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
3402
3614
  api.Cache.Remove(GetCacheKey(data.ID));
3403
3615
  api.Cache.RemoveByStartsWith(GetListCacheKey());
3404
- return data;
3616
+ return {
3617
+ tag: res
3618
+ };
3405
3619
  });
3406
3620
  }
3407
3621
  EntityTag.Update = Update;
@@ -3422,8 +3636,9 @@ var EntityType;
3422
3636
  return Api.ECacheKey.EntityType;
3423
3637
  }
3424
3638
  EntityType.GetListCacheKey = GetListCacheKey;
3425
- function Get(api, typeId, reqParams) {
3639
+ function Get(params) {
3426
3640
  return __awaiter(this, void 0, void 0, function* () {
3641
+ const { api, entityTypeId: typeId, req: reqParams } = params;
3427
3642
  if (!typeId) {
3428
3643
  throw ("Type ID is required.");
3429
3644
  }
@@ -3432,14 +3647,25 @@ var EntityType;
3432
3647
  if (cacheData) {
3433
3648
  return cacheData;
3434
3649
  }
3435
- const req = api.GET(`entitytype/${typeId}`, Api.PrepReqParams(reqParams));
3436
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
3437
- return req;
3650
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3651
+ try {
3652
+ const data = yield api.GET(`entitytype/${typeId}`, Api.PrepReqParams(reqParams));
3653
+ res({
3654
+ entityType: data
3655
+ });
3656
+ }
3657
+ catch (e) {
3658
+ rej(e);
3659
+ }
3660
+ }));
3661
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
3662
+ return prom;
3438
3663
  });
3439
3664
  }
3440
3665
  EntityType.Get = Get;
3441
- function Delete(api, typeId, reqParams) {
3666
+ function Delete(params) {
3442
3667
  return __awaiter(this, void 0, void 0, function* () {
3668
+ const { api, entityTypeId: typeId, req: reqParams } = params;
3443
3669
  if (!typeId) {
3444
3670
  throw ("Type ID is required.");
3445
3671
  }
@@ -3449,8 +3675,9 @@ var EntityType;
3449
3675
  });
3450
3676
  }
3451
3677
  EntityType.Delete = Delete;
3452
- function GetList(api, reqParams) {
3678
+ function GetList(params) {
3453
3679
  return __awaiter(this, void 0, void 0, function* () {
3680
+ const { api, req: reqParams } = params;
3454
3681
  const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
3455
3682
  if (cacheData) {
3456
3683
  return cacheData;
@@ -3458,7 +3685,9 @@ var EntityType;
3458
3685
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3459
3686
  try {
3460
3687
  const data = yield api.GET("entitytypes", Api.PrepReqParams(reqParams));
3461
- res(data.Items);
3688
+ res({
3689
+ entityTypes: data.Items
3690
+ });
3462
3691
  }
3463
3692
  catch (e) {
3464
3693
  rej(e);
@@ -3469,8 +3698,9 @@ var EntityType;
3469
3698
  });
3470
3699
  }
3471
3700
  EntityType.GetList = GetList;
3472
- function Update(api, data, reqParams) {
3701
+ function Update(params) {
3473
3702
  return __awaiter(this, void 0, void 0, function* () {
3703
+ let { api, entityType: data, req: reqParams } = params;
3474
3704
  if (!data) {
3475
3705
  data = {};
3476
3706
  }
@@ -3480,10 +3710,12 @@ var EntityType;
3480
3710
  if (!data.Name) {
3481
3711
  data.Name = data.ID;
3482
3712
  }
3483
- data = yield api.POST(`entitytype/${data.ID}`, data, Api.PrepReqParams(reqParams));
3713
+ const res = yield api.POST(`entitytype/${data.ID}`, data, Api.PrepReqParams(reqParams));
3484
3714
  api.Cache.Remove(GetCacheKey(data.ID));
3485
3715
  api.Cache.Remove(GetListCacheKey());
3486
- return data;
3716
+ return {
3717
+ entityType: res
3718
+ };
3487
3719
  });
3488
3720
  }
3489
3721
  EntityType.Update = Update;
@@ -3889,18 +4121,21 @@ var EntityFilterGetter;
3889
4121
  continue;
3890
4122
  }
3891
4123
  try {
3892
- const page = yield Entity.Filter.V1.GetList(this.api, {
3893
- pageSize: PAGE_SIZE,
3894
- pageIndex: curCell.FetchPageIndex,
3895
- entityTypeId: this.typeId,
3896
- layerIds: this.tagIds,
3897
- bounds: curCell.GetBounds(),
3898
- sortOrder: Api.ESortOrder.Asc,
3899
- entityTypeConditions: this.attrFilter
4124
+ const { entities } = yield Entity.GetList({
4125
+ api: this.api,
4126
+ filter: {
4127
+ pageSize: PAGE_SIZE,
4128
+ pageIndex: curCell.FetchPageIndex,
4129
+ entityTypeId: this.typeId,
4130
+ layerIds: this.tagIds,
4131
+ bounds: curCell.GetBounds(),
4132
+ sortOrder: Api.ESortOrder.Asc,
4133
+ entityTypeConditions: this.attrFilter
4134
+ }
3900
4135
  });
3901
4136
  const integrity = this.getIntegrityId();
3902
- if (loopIntegrity == integrity && page) {
3903
- (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger(page);
4137
+ if (loopIntegrity == integrity && entities) {
4138
+ (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger(entities);
3904
4139
  }
3905
4140
  if (this.getterLoopId != loopId) {
3906
4141
  break;
@@ -3910,15 +4145,15 @@ var EntityFilterGetter;
3910
4145
  postedLoading = true;
3911
4146
  }
3912
4147
  // Only mark as fetched when ALL pages are done.
3913
- if (page.length <= 0) {
4148
+ if (entities.length <= 0) {
3914
4149
  curCell.Fetched = true;
3915
4150
  (_d = this.onScanUpdate) === null || _d === void 0 ? void 0 : _d.Trigger(cells);
3916
4151
  continue;
3917
4152
  }
3918
4153
  // Checking to make sure it's not just the same batch over and over again.
3919
- if (page.length > 0) {
3920
- const first = (_f = (_e = page[0]) === null || _e === void 0 ? void 0 : _e.Bruce) === null || _f === void 0 ? void 0 : _f.ID;
3921
- const last = (_h = (_g = page[page.length - 1]) === null || _g === void 0 ? void 0 : _g.Bruce) === null || _h === void 0 ? void 0 : _h.ID;
4154
+ if (entities.length > 0) {
4155
+ const first = (_f = (_e = entities[0]) === null || _e === void 0 ? void 0 : _e.Bruce) === null || _f === void 0 ? void 0 : _f.ID;
4156
+ const last = (_h = (_g = entities[entities.length - 1]) === null || _g === void 0 ? void 0 : _g.Bruce) === null || _h === void 0 ? void 0 : _h.ID;
3922
4157
  if (prevFirstId == first && prevLastId == last) {
3923
4158
  break;
3924
4159
  }
@@ -4078,22 +4313,38 @@ var EntityCoords;
4078
4313
  return Api.ECacheKey.EntityCoords + Api.ECacheKey.Entity + Api.ECacheKey.Id + entityId;
4079
4314
  }
4080
4315
  EntityCoords.GetCacheKey = GetCacheKey;
4081
- function GetEntityCoords(api, entityId, reqParams) {
4316
+ function GetEntityCoords(params) {
4082
4317
  return __awaiter(this, void 0, void 0, function* () {
4318
+ const { api, rootEntityId: entityId, req: reqParams } = params;
4083
4319
  const cacheData = api.GetCacheItem(GetCacheKey(entityId), reqParams);
4084
4320
  if (cacheData) {
4085
4321
  return cacheData;
4086
4322
  }
4087
- const req = api.GET(`entity/${entityId}/ucs`, reqParams);
4088
- api.Cache.Set(GetCacheKey(entityId), req, Api.DEFAULT_CACHE_DURATION);
4089
- return req;
4323
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4324
+ try {
4325
+ const data = yield api.GET(`entity/${entityId}/ucs`, reqParams);
4326
+ res({
4327
+ coords: data
4328
+ });
4329
+ }
4330
+ catch (e) {
4331
+ rej(e);
4332
+ }
4333
+ }));
4334
+ api.Cache.Set(GetCacheKey(entityId), prom, Api.DEFAULT_CACHE_DURATION);
4335
+ return prom;
4090
4336
  });
4091
4337
  }
4092
4338
  EntityCoords.GetEntityCoords = GetEntityCoords;
4093
- function EntityRelativeToPoint(api, entityId, params, reqParams) {
4339
+ function EntityRelativeToPoint(params) {
4094
4340
  return __awaiter(this, void 0, void 0, function* () {
4341
+ const { api, rootEntityId: entityId, req: reqParams } = params;
4095
4342
  if (!params.test) {
4096
- yield UnlinkCoords(api, entityId);
4343
+ yield UnlinkCoords({
4344
+ api,
4345
+ rootEntityId: entityId,
4346
+ req: reqParams
4347
+ });
4097
4348
  }
4098
4349
  const point = params.point;
4099
4350
  const name = params.name || `${MathUtils.Round(point.latitude, 4)}, ${MathUtils.Round(point.longitude, 4)}`;
@@ -4115,15 +4366,22 @@ var EntityCoords;
4115
4366
  if (!params.test) {
4116
4367
  api.Cache.Remove(GetCacheKey(entityId));
4117
4368
  }
4118
- return res;
4369
+ return {
4370
+ coords: res
4371
+ };
4119
4372
  });
4120
4373
  }
4121
4374
  EntityCoords.EntityRelativeToPoint = EntityRelativeToPoint;
4122
- function EntityRelativeToEpsg(api, entityId, params, reqParams) {
4375
+ function EntityRelativeToEpsg(params) {
4123
4376
  var _a;
4124
4377
  return __awaiter(this, void 0, void 0, function* () {
4378
+ const { api, rootEntityId: entityId, req: reqParams } = params;
4125
4379
  if (!params.test) {
4126
- yield UnlinkCoords(api, entityId);
4380
+ yield UnlinkCoords({
4381
+ api,
4382
+ rootEntityId: entityId,
4383
+ req: reqParams
4384
+ });
4127
4385
  }
4128
4386
  const epsg = params.epsg;
4129
4387
  const name = (_a = params.name) !== null && _a !== void 0 ? _a : "EPSG: " + epsg;
@@ -4143,14 +4401,21 @@ var EntityCoords;
4143
4401
  if (!params.test) {
4144
4402
  api.Cache.Remove(GetCacheKey(entityId));
4145
4403
  }
4146
- return res;
4404
+ return {
4405
+ coords: res
4406
+ };
4147
4407
  });
4148
4408
  }
4149
4409
  EntityCoords.EntityRelativeToEpsg = EntityRelativeToEpsg;
4150
- function EntityRelativeToUcs(api, entityId, params, reqParams) {
4410
+ function EntityRelativeToUcs(params) {
4151
4411
  return __awaiter(this, void 0, void 0, function* () {
4412
+ const { api, rootEntityId: entityId, req: reqParams } = params;
4152
4413
  if (!params.test) {
4153
- yield UnlinkCoords(api, entityId);
4414
+ yield UnlinkCoords({
4415
+ api,
4416
+ rootEntityId: entityId,
4417
+ req: reqParams
4418
+ });
4154
4419
  }
4155
4420
  const ucsId = params.ucsId;
4156
4421
  const res = yield api.POST(`entity/${entityId}/ucs`, {
@@ -4162,12 +4427,15 @@ var EntityCoords;
4162
4427
  if (!params.test) {
4163
4428
  api.Cache.Remove(GetCacheKey(entityId));
4164
4429
  }
4165
- return res;
4430
+ return {
4431
+ coords: res
4432
+ };
4166
4433
  });
4167
4434
  }
4168
4435
  EntityCoords.EntityRelativeToUcs = EntityRelativeToUcs;
4169
- function UnlinkCoords(api, entityId, reqParams) {
4436
+ function UnlinkCoords(params) {
4170
4437
  return __awaiter(this, void 0, void 0, function* () {
4438
+ const { api, rootEntityId: entityId, req: reqParams } = params;
4171
4439
  return api.DELETE(`entity/${entityId}/ucs`, reqParams);
4172
4440
  });
4173
4441
  }
@@ -4222,16 +4490,19 @@ var ClientFile;
4222
4490
  return `${Api.ECacheKey.ClientFile}${Api.ECacheKey.Id}${fileId}`;
4223
4491
  }
4224
4492
  ClientFile.GetCacheKey = GetCacheKey;
4225
- function GetUrl(api, fileId) {
4493
+ function GetUrl(params) {
4494
+ const { api, fileId } = params;
4226
4495
  return `${api.GetBaseUrl()}file/${fileId}`;
4227
4496
  }
4228
4497
  ClientFile.GetUrl = GetUrl;
4229
- function GetUrlWithExt(api, file) {
4498
+ function GetUrlWithExt(params) {
4499
+ const { api, file } = params;
4230
4500
  return `${api.GetBaseUrl()}file/${file.ID}${file.FileExt ? file.FileExt : ""}`;
4231
4501
  }
4232
4502
  ClientFile.GetUrlWithExt = GetUrlWithExt;
4233
- function Get(api, fileId, reqParams) {
4503
+ function Get(params) {
4234
4504
  return __awaiter(this, void 0, void 0, function* () {
4505
+ const { api, fileId, req: reqParams } = params;
4235
4506
  if (!fileId) {
4236
4507
  throw ("File ID is required.");
4237
4508
  }
@@ -4240,14 +4511,25 @@ var ClientFile;
4240
4511
  if (cacheData) {
4241
4512
  return cacheData;
4242
4513
  }
4243
- const req = api.GET(`file/${fileId}/details`, Api.PrepReqParams(reqParams));
4244
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
4245
- return req;
4514
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4515
+ try {
4516
+ const data = yield api.GET(`file/${fileId}/details`, Api.PrepReqParams(reqParams));
4517
+ res({
4518
+ clientFile: data
4519
+ });
4520
+ }
4521
+ catch (e) {
4522
+ rej(e);
4523
+ }
4524
+ }));
4525
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
4526
+ return prom;
4246
4527
  });
4247
4528
  }
4248
4529
  ClientFile.Get = Get;
4249
- function Delete(api, fileIds, reqParams) {
4530
+ function Delete(params) {
4250
4531
  return __awaiter(this, void 0, void 0, function* () {
4532
+ const { api, fileIds, req: reqParams } = params;
4251
4533
  if (!fileIds.length) {
4252
4534
  throw ("File IDs are required.");
4253
4535
  }
@@ -4262,8 +4544,9 @@ var ClientFile;
4262
4544
  });
4263
4545
  }
4264
4546
  ClientFile.Delete = Delete;
4265
- function Upload(api, file, purpose, reqParams) {
4547
+ function Upload(params) {
4266
4548
  return __awaiter(this, void 0, void 0, function* () {
4549
+ const { api, file, purpose, req } = params;
4267
4550
  if (!file) {
4268
4551
  throw ("File is required.");
4269
4552
  }
@@ -4273,30 +4556,42 @@ var ClientFile;
4273
4556
  "Purpose": purpose
4274
4557
  };
4275
4558
  }
4276
- const params = Api.PrepReqParams(reqParams);
4277
- params.formData = formData;
4278
- return api.UPLOAD("file/uploadNew", file, params);
4559
+ const reqParams = Api.PrepReqParams(req);
4560
+ reqParams.formData = formData;
4561
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4562
+ try {
4563
+ const data = yield api.UPLOAD("file/uploadNew", file, reqParams);
4564
+ res({
4565
+ clientFile: data
4566
+ });
4567
+ }
4568
+ catch (e) {
4569
+ rej(e);
4570
+ }
4571
+ }));
4572
+ return prom;
4279
4573
  });
4280
4574
  }
4281
4575
  ClientFile.Upload = Upload;
4282
4576
  /**
4283
4577
  * Uploads a temp file.
4284
4578
  * This will return a temp file id which can be used in various endpoints.
4285
- * @param api
4286
- * @param file
4287
- * @param reqParams
4579
+ * @param params
4288
4580
  * @returns
4289
4581
  */
4290
- function UploadTemp(api, file, reqParams) {
4582
+ function UploadTemp(params) {
4291
4583
  return __awaiter(this, void 0, void 0, function* () {
4584
+ const { api, file, req } = params;
4292
4585
  if (!file) {
4293
4586
  throw ("File is required.");
4294
4587
  }
4295
4588
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4296
4589
  try {
4297
- const params = Api.PrepReqParams(reqParams);
4298
- const data = yield api.UPLOAD("file/uploadTemp", file, params);
4299
- res(data["TempFile.ID"]);
4590
+ const reqParams = Api.PrepReqParams(req);
4591
+ const data = yield api.UPLOAD("file/uploadTemp", file, reqParams);
4592
+ res({
4593
+ tempFileId: data["TempFile.ID"]
4594
+ });
4300
4595
  }
4301
4596
  catch (e) {
4302
4597
  rej(e);
@@ -4308,38 +4603,37 @@ var ClientFile;
4308
4603
  ClientFile.UploadTemp = UploadTemp;
4309
4604
  let Filter;
4310
4605
  (function (Filter) {
4311
- let V1;
4312
- (function (V1) {
4313
- let EColumn;
4314
- (function (EColumn) {
4315
- EColumn["ID"] = "id";
4316
- EColumn["Name"] = "name";
4317
- EColumn["DateTime"] = "datetime";
4318
- EColumn["MIMEType"] = "mimeType";
4319
- EColumn["Size"] = "size";
4320
- EColumn["User"] = "user";
4321
- EColumn["Extension"] = "extension";
4322
- })(EColumn = V1.EColumn || (V1.EColumn = {}));
4323
- let ESortOrder;
4324
- (function (ESortOrder) {
4325
- ESortOrder["ASC"] = "asc";
4326
- ESortOrder["DEC"] = "desc";
4327
- })(ESortOrder = V1.ESortOrder || (V1.ESortOrder = {}));
4328
- let ERowOperator;
4329
- (function (ERowOperator) {
4330
- ERowOperator["AND"] = "AND";
4331
- ERowOperator["OR"] = "OR";
4332
- })(ERowOperator = V1.ERowOperator || (V1.ERowOperator = {}));
4333
- function GetList(api, filter, reqParams) {
4334
- return __awaiter(this, void 0, void 0, function* () {
4335
- const data = yield api.POST("files/filtered", filter, Api.PrepReqParams(reqParams));
4336
- return data.Items;
4337
- });
4338
- }
4339
- V1.GetList = GetList;
4340
- })(V1 = Filter.V1 || (Filter.V1 = {}));
4341
- // TODO: Helpers for constructing the filter.
4606
+ let EColumn;
4607
+ (function (EColumn) {
4608
+ EColumn["ID"] = "id";
4609
+ EColumn["Name"] = "name";
4610
+ EColumn["DateTime"] = "datetime";
4611
+ EColumn["MIMEType"] = "mimeType";
4612
+ EColumn["Size"] = "size";
4613
+ EColumn["User"] = "user";
4614
+ EColumn["Extension"] = "extension";
4615
+ })(EColumn = Filter.EColumn || (Filter.EColumn = {}));
4616
+ let ESortOrder;
4617
+ (function (ESortOrder) {
4618
+ ESortOrder["ASC"] = "asc";
4619
+ ESortOrder["DEC"] = "desc";
4620
+ })(ESortOrder = Filter.ESortOrder || (Filter.ESortOrder = {}));
4621
+ let ERowOperator;
4622
+ (function (ERowOperator) {
4623
+ ERowOperator["AND"] = "AND";
4624
+ ERowOperator["OR"] = "OR";
4625
+ })(ERowOperator = Filter.ERowOperator || (Filter.ERowOperator = {}));
4342
4626
  })(Filter = ClientFile.Filter || (ClientFile.Filter = {}));
4627
+ function GetList(params) {
4628
+ return __awaiter(this, void 0, void 0, function* () {
4629
+ const { api, filter, req: reqParams } = params;
4630
+ const data = yield api.POST("files/filtered", filter, Api.PrepReqParams(reqParams));
4631
+ return {
4632
+ clientFiles: data.Items
4633
+ };
4634
+ });
4635
+ }
4636
+ ClientFile.GetList = GetList;
4343
4637
  let Processor;
4344
4638
  (function (Processor) {
4345
4639
  let EConvertExt;
@@ -4347,8 +4641,9 @@ var ClientFile;
4347
4641
  EConvertExt["GLB"] = ".glb";
4348
4642
  EConvertExt["SKP"] = ".skp";
4349
4643
  })(EConvertExt = Processor.EConvertExt || (Processor.EConvertExt = {}));
4350
- function ConvertFormat(api, clientFileId, ext, reqParams) {
4644
+ function ConvertFormat(params) {
4351
4645
  return __awaiter(this, void 0, void 0, function* () {
4646
+ const { api, fileId: clientFileId, ext, req: reqParams } = params;
4352
4647
  if (!clientFileId || !ext) {
4353
4648
  throw ("Client File ID and extension are required.");
4354
4649
  }
@@ -4383,8 +4678,9 @@ var ProgramKey;
4383
4678
  EProgramId["BingMaps"] = "BingMaps";
4384
4679
  EProgramId["Mapbox"] = "Mapbox";
4385
4680
  })(EProgramId = ProgramKey.EProgramId || (ProgramKey.EProgramId = {}));
4386
- function Get(api, programId, reqParams) {
4681
+ function Get(params) {
4387
4682
  return __awaiter(this, void 0, void 0, function* () {
4683
+ const { api, programId, req: reqParams } = params;
4388
4684
  if (!programId) {
4389
4685
  throw ("Program ID is required.");
4390
4686
  }
@@ -4393,14 +4689,25 @@ var ProgramKey;
4393
4689
  if (cacheData) {
4394
4690
  return cacheData;
4395
4691
  }
4396
- const req = api.GET(`programkey/${programId}`, Api.PrepReqParams(reqParams));
4397
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
4398
- return req;
4692
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4693
+ try {
4694
+ const data = yield api.GET(`programkey/${programId}`, Api.PrepReqParams(reqParams));
4695
+ res({
4696
+ programKey: data
4697
+ });
4698
+ }
4699
+ catch (e) {
4700
+ rej(e);
4701
+ }
4702
+ }));
4703
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
4704
+ return prom;
4399
4705
  });
4400
4706
  }
4401
4707
  ProgramKey.Get = Get;
4402
- function GetList(api, reqParams) {
4708
+ function GetList(params) {
4403
4709
  return __awaiter(this, void 0, void 0, function* () {
4710
+ const { api, req: reqParams } = params;
4404
4711
  const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
4405
4712
  if (cacheData) {
4406
4713
  return cacheData;
@@ -4408,7 +4715,9 @@ var ProgramKey;
4408
4715
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4409
4716
  try {
4410
4717
  const data = yield api.GET("programkeys", Api.PrepReqParams(reqParams));
4411
- res(data.Items);
4718
+ res({
4719
+ programKeys: data.Items
4720
+ });
4412
4721
  }
4413
4722
  catch (e) {
4414
4723
  rej(e);
@@ -4419,8 +4728,9 @@ var ProgramKey;
4419
4728
  });
4420
4729
  }
4421
4730
  ProgramKey.GetList = GetList;
4422
- function Delete(api, programId, reqParams) {
4731
+ function Delete(params) {
4423
4732
  return __awaiter(this, void 0, void 0, function* () {
4733
+ const { api, programId, req: reqParams } = params;
4424
4734
  if (!programId) {
4425
4735
  throw ("Program ID is required.");
4426
4736
  }
@@ -4430,15 +4740,18 @@ var ProgramKey;
4430
4740
  });
4431
4741
  }
4432
4742
  ProgramKey.Delete = Delete;
4433
- function Update(api, data, reqParams) {
4743
+ function Update(params) {
4434
4744
  return __awaiter(this, void 0, void 0, function* () {
4745
+ const { api, programKey: data, req: reqParams } = params;
4435
4746
  if (!(data === null || data === void 0 ? void 0 : data.ProgramId)) {
4436
4747
  throw ("Program ID is required.");
4437
4748
  }
4438
- data = yield api.POST("programkey", data, Api.PrepReqParams(reqParams));
4749
+ const res = yield api.POST("programkey", data, Api.PrepReqParams(reqParams));
4439
4750
  api.Cache.Remove(GetCacheKey(data.ProgramId));
4440
4751
  api.Cache.Remove(GetListCacheKey());
4441
- return data;
4752
+ return {
4753
+ programKey: res
4754
+ };
4442
4755
  });
4443
4756
  }
4444
4757
  ProgramKey.Update = Update;
@@ -4497,8 +4810,9 @@ var Tileset;
4497
4810
  EPivot["Weight"] = "weight";
4498
4811
  EPivot["UCS"] = "ucs";
4499
4812
  })(EPivot = Tileset.EPivot || (Tileset.EPivot = {}));
4500
- function Get(api, tilesetId, loadFiles = false, reqParams) {
4813
+ function Get(params) {
4501
4814
  return __awaiter(this, void 0, void 0, function* () {
4815
+ const { api, tilesetId, loadFiles, req: reqParams } = params;
4502
4816
  if (!tilesetId) {
4503
4817
  throw ("Tileset ID is required.");
4504
4818
  }
@@ -4506,14 +4820,25 @@ var Tileset;
4506
4820
  if (cacheData) {
4507
4821
  return cacheData;
4508
4822
  }
4509
- const req = api.GET(`tileset/get/${tilesetId}?noFiles=${loadFiles ? 0 : 1}`, reqParams);
4510
- api.Cache.Set(GetCacheKey(tilesetId, loadFiles), req, Api.DEFAULT_CACHE_DURATION);
4511
- return req;
4823
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4824
+ try {
4825
+ const data = yield api.GET(`tileset/get/${tilesetId}?noFiles=${Boolean(loadFiles) ? 0 : 1}`, reqParams);
4826
+ res({
4827
+ tileset: data
4828
+ });
4829
+ }
4830
+ catch (e) {
4831
+ rej(e);
4832
+ }
4833
+ }));
4834
+ api.Cache.Set(GetCacheKey(tilesetId, loadFiles), prom, Api.DEFAULT_CACHE_DURATION);
4835
+ return prom;
4512
4836
  });
4513
4837
  }
4514
4838
  Tileset.Get = Get;
4515
- function GetList(api, reqParams) {
4839
+ function GetList(params) {
4516
4840
  return __awaiter(this, void 0, void 0, function* () {
4841
+ const { api, req: reqParams } = params;
4517
4842
  const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
4518
4843
  if (cacheData) {
4519
4844
  return cacheData;
@@ -4521,7 +4846,9 @@ var Tileset;
4521
4846
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4522
4847
  try {
4523
4848
  const data = yield api.GET("tileset/getList", reqParams);
4524
- res(data);
4849
+ res({
4850
+ tilesets: data
4851
+ });
4525
4852
  }
4526
4853
  catch (e) {
4527
4854
  rej(e);
@@ -4532,8 +4859,9 @@ var Tileset;
4532
4859
  });
4533
4860
  }
4534
4861
  Tileset.GetList = GetList;
4535
- function Delete(api, tilesetId, reqParams) {
4862
+ function Delete(params) {
4536
4863
  return __awaiter(this, void 0, void 0, function* () {
4864
+ const { api, tilesetId, req: reqParams } = params;
4537
4865
  if (!tilesetId) {
4538
4866
  throw ("Tileset ID is required.");
4539
4867
  }
@@ -4543,8 +4871,9 @@ var Tileset;
4543
4871
  });
4544
4872
  }
4545
4873
  Tileset.Delete = Delete;
4546
- function Update(api, data, reqParams) {
4874
+ function Update(params) {
4547
4875
  return __awaiter(this, void 0, void 0, function* () {
4876
+ let { api, tileset: data, req: reqParams } = params;
4548
4877
  if (!(data === null || data === void 0 ? void 0 : data.name) || !(data === null || data === void 0 ? void 0 : data.type)) {
4549
4878
  throw ("Tileset name and type are required.");
4550
4879
  }
@@ -4556,22 +4885,25 @@ var Tileset;
4556
4885
  yield api.POST(`tileset/update/${data.id}`, data, Api.PrepReqParams(reqParams));
4557
4886
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Tileset + Api.ECacheKey.Id + data.id);
4558
4887
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Tileset);
4559
- return data;
4888
+ return {
4889
+ tileset: data
4890
+ };
4560
4891
  });
4561
4892
  }
4562
4893
  Tileset.Update = Update;
4563
- function UploadFile(api, tilesetId, file, reqParams) {
4894
+ function UploadFile(params) {
4564
4895
  return __awaiter(this, void 0, void 0, function* () {
4896
+ const { api, tilesetId, file, req: reqParams } = params;
4565
4897
  if (!tilesetId || !file) {
4566
4898
  throw ("Tileset ID and file are required.");
4567
4899
  }
4568
- const params = Api.PrepReqParams(reqParams);
4569
- return api.UPLOAD(`tileset/uploadFile/${tilesetId}/files`, file, params);
4900
+ return api.UPLOAD(`tileset/uploadFile/${tilesetId}/files`, file, Api.PrepReqParams(reqParams));
4570
4901
  });
4571
4902
  }
4572
4903
  Tileset.UploadFile = UploadFile;
4573
- function DeleteFile(api, tilesetId, file, reqParams) {
4904
+ function DeleteFile(params) {
4574
4905
  return __awaiter(this, void 0, void 0, function* () {
4906
+ const { api, tilesetId, file, req: reqParams } = params;
4575
4907
  if (!tilesetId || !file) {
4576
4908
  throw ("Tileset ID and file are required.");
4577
4909
  }
@@ -4580,19 +4912,20 @@ var Tileset;
4580
4912
  });
4581
4913
  }
4582
4914
  Tileset.DeleteFile = DeleteFile;
4583
- function UploadSrcFile(api, tilesetId, file, reqParams) {
4915
+ function UploadSrcFile(params) {
4584
4916
  return __awaiter(this, void 0, void 0, function* () {
4917
+ const { api, tilesetId, file, req: reqParams } = params;
4585
4918
  if (!tilesetId || !file) {
4586
4919
  throw ("Tileset ID and file are required.");
4587
4920
  }
4588
- const params = Api.PrepReqParams(reqParams);
4589
- yield api.UPLOAD(`tileset/uploadFile/${tilesetId}/src`, file, params);
4921
+ yield api.UPLOAD(`tileset/uploadFile/${tilesetId}/src`, file, Api.PrepReqParams(reqParams));
4590
4922
  api.Cache.Remove(GetCacheKey(tilesetId, true));
4591
4923
  });
4592
4924
  }
4593
4925
  Tileset.UploadSrcFile = UploadSrcFile;
4594
- function DeleteSrcFile(api, tilesetId, file, reqParams) {
4926
+ function DeleteSrcFile(params) {
4595
4927
  return __awaiter(this, void 0, void 0, function* () {
4928
+ const { api, tilesetId, file, req: reqParams } = params;
4596
4929
  if (!tilesetId || !file) {
4597
4930
  throw ("Tileset ID and file are required.");
4598
4931
  }
@@ -4601,7 +4934,8 @@ var Tileset;
4601
4934
  });
4602
4935
  }
4603
4936
  Tileset.DeleteSrcFile = DeleteSrcFile;
4604
- function GetFileUrl(api, tilesetId, file) {
4937
+ function GetFileUrl(params) {
4938
+ let { api, tilesetId, file } = params;
4605
4939
  if (!tilesetId) {
4606
4940
  throw ("Tileset ID is required.");
4607
4941
  }
@@ -4611,7 +4945,8 @@ var Tileset;
4611
4945
  return api.GetBaseUrl() + `tileset/getFile/${tilesetId}/files/${file}`;
4612
4946
  }
4613
4947
  Tileset.GetFileUrl = GetFileUrl;
4614
- function GetSrcFileUrl(api, tilesetId, file) {
4948
+ function GetSrcFileUrl(params) {
4949
+ let { api, tilesetId, file } = params;
4615
4950
  if (!tilesetId) {
4616
4951
  throw ("Tileset ID is required.");
4617
4952
  }
@@ -4621,7 +4956,8 @@ var Tileset;
4621
4956
  return api.GetBaseUrl() + `tileset/getFile/${tilesetId}/src/${file}`;
4622
4957
  }
4623
4958
  Tileset.GetSrcFileUrl = GetSrcFileUrl;
4624
- function GetPublicFileUrl(api, tilesetId, file) {
4959
+ function GetPublicFileUrl(params) {
4960
+ let { api, tilesetId, file } = params;
4625
4961
  if (!tilesetId) {
4626
4962
  throw ("Tileset ID is required.");
4627
4963
  }
@@ -4631,13 +4967,16 @@ var Tileset;
4631
4967
  return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
4632
4968
  }
4633
4969
  Tileset.GetPublicFileUrl = GetPublicFileUrl;
4634
- function Generate(api, tilesetId, reqParams) {
4970
+ function Generate(params) {
4635
4971
  return __awaiter(this, void 0, void 0, function* () {
4972
+ const { api, tilesetId, req: reqParams } = params;
4636
4973
  if (!tilesetId) {
4637
4974
  throw ("Tileset ID is required.");
4638
4975
  }
4639
4976
  const res = yield api.GET(`tileset/generate/${tilesetId}`, Api.PrepReqParams(reqParams));
4640
- return res.ID;
4977
+ return {
4978
+ pendingActionId: res.ID
4979
+ };
4641
4980
  });
4642
4981
  }
4643
4982
  Tileset.Generate = Generate;
@@ -4650,8 +4989,9 @@ var Tileset;
4650
4989
  return Api.ECacheKey.PublishTileset + Api.ECacheKey.Id + accountId + Api.ECacheKey.Id + tilesetId;
4651
4990
  }
4652
4991
  Publish.GetCacheKey = GetCacheKey;
4653
- function Update(api, data, reqParams) {
4992
+ function Update(params) {
4654
4993
  return __awaiter(this, void 0, void 0, function* () {
4994
+ const { api, published: data, req: reqParams } = params;
4655
4995
  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"])) {
4656
4996
  throw ("Tileset ID, client account ID, and user ID are required.");
4657
4997
  }
@@ -4666,12 +5006,15 @@ var Tileset;
4666
5006
  yield api.POST(`tileset/${data.ID}/enableForAccounts`, req, reqParams);
4667
5007
  api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"], data["Tileset.ID"]));
4668
5008
  api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"]));
4669
- return data;
5009
+ return {
5010
+ published: data
5011
+ };
4670
5012
  });
4671
5013
  }
4672
5014
  Publish.Update = Update;
4673
- function Get(api, accountId, tilesetId, reqParams) {
5015
+ function Get(params) {
4674
5016
  return __awaiter(this, void 0, void 0, function* () {
5017
+ const { api, accountId, tilesetId, req: reqParams } = params;
4675
5018
  if (!accountId || !tilesetId) {
4676
5019
  throw ("Client account ID and tileset ID are required.");
4677
5020
  }
@@ -4679,14 +5022,25 @@ var Tileset;
4679
5022
  if (cacheData) {
4680
5023
  return cacheData;
4681
5024
  }
4682
- const req = api.GET(`tilesetByPublisher/${accountId}/${tilesetId}`, reqParams);
4683
- api.Cache.Set(GetCacheKey(accountId, tilesetId), req);
4684
- return req;
5025
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5026
+ try {
5027
+ const data = yield api.GET(`tilesetByPublisher/${accountId}/${tilesetId}`, reqParams);
5028
+ res({
5029
+ published: data
5030
+ });
5031
+ }
5032
+ catch (e) {
5033
+ rej(e);
5034
+ }
5035
+ }));
5036
+ api.Cache.Set(GetCacheKey(accountId, tilesetId), prom);
5037
+ return prom;
4685
5038
  });
4686
5039
  }
4687
5040
  Publish.Get = Get;
4688
- function GetList(api, accountId, reqParams) {
5041
+ function GetList(params) {
4689
5042
  return __awaiter(this, void 0, void 0, function* () {
5043
+ const { api, accountId, req: reqParams } = params;
4690
5044
  if (!accountId) {
4691
5045
  throw ("Client account ID is required.");
4692
5046
  }
@@ -4697,7 +5051,9 @@ var Tileset;
4697
5051
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4698
5052
  try {
4699
5053
  const data = yield api.GET(`tilesets/enabledForAccount/${accountId}`, reqParams);
4700
- res(data.Items);
5054
+ res({
5055
+ published: data.Items
5056
+ });
4701
5057
  }
4702
5058
  catch (e) {
4703
5059
  rej(e);
@@ -4709,6 +5065,23 @@ var Tileset;
4709
5065
  }
4710
5066
  Publish.GetList = GetList;
4711
5067
  })(Publish = Tileset.Publish || (Tileset.Publish = {}));
5068
+ let Settings;
5069
+ (function (Settings) {
5070
+ let EMapTileSize;
5071
+ (function (EMapTileSize) {
5072
+ EMapTileSize[EMapTileSize["IMG_256"] = 256] = "IMG_256";
5073
+ EMapTileSize[EMapTileSize["IMG_512"] = 512] = "IMG_512";
5074
+ EMapTileSize[EMapTileSize["IMG_1024"] = 1024] = "IMG_1024";
5075
+ EMapTileSize[EMapTileSize["IMG_2048"] = 2048] = "IMG_2048";
5076
+ })(EMapTileSize = Settings.EMapTileSize || (Settings.EMapTileSize = {}));
5077
+ let EExternalMapType;
5078
+ (function (EExternalMapType) {
5079
+ EExternalMapType["TileMapImagery"] = "TileMapImagery";
5080
+ EExternalMapType["OpenStreetMapImagery"] = "OpenStreetMapImagery";
5081
+ EExternalMapType["MapBoxImagery"] = "MapBoxImagery";
5082
+ EExternalMapType["CesiumIon"] = "CesiumIon";
5083
+ })(EExternalMapType = Settings.EExternalMapType || (Settings.EExternalMapType = {}));
5084
+ })(Settings = Tileset.Settings || (Tileset.Settings = {}));
4712
5085
  })(Tileset || (Tileset = {}));
4713
5086
 
4714
5087
  /**
@@ -4840,16 +5213,17 @@ var ProjectViewBookmark;
4840
5213
  // This is the expected default version for the DataVersion value.
4841
5214
  // This value should NOT be changed without looking at our API and seeing what the default value is.
4842
5215
  ProjectViewBookmark.DEFAULT_DATA_VERSION = 1;
4843
- let V1;
4844
- (function (V1) {
4845
- V1.DATA_VERSION = 1;
4846
- })(V1 = ProjectViewBookmark.V1 || (ProjectViewBookmark.V1 = {}));
4847
- let V2;
4848
- (function (V2) {
4849
- V2.DATA_VERSION = 2;
4850
- })(V2 = ProjectViewBookmark.V2 || (ProjectViewBookmark.V2 = {}));
4851
- function Get(api, viewId, bookmarkId, reqParams) {
5216
+ let LegacyNavigator;
5217
+ (function (LegacyNavigator) {
5218
+ LegacyNavigator.DATA_VERSION = 1;
5219
+ })(LegacyNavigator = ProjectViewBookmark.LegacyNavigator || (ProjectViewBookmark.LegacyNavigator = {}));
5220
+ let Navigator;
5221
+ (function (Navigator) {
5222
+ Navigator.DATA_VERSION = 2;
5223
+ })(Navigator = ProjectViewBookmark.Navigator || (ProjectViewBookmark.Navigator = {}));
5224
+ function Get(params) {
4852
5225
  return __awaiter(this, void 0, void 0, function* () {
5226
+ const { api, viewId, bookmarkId, req: reqParams } = params;
4853
5227
  if (!viewId || !bookmarkId) {
4854
5228
  throw ("View ID and Bookmark ID are required.");
4855
5229
  }
@@ -4858,14 +5232,25 @@ var ProjectViewBookmark;
4858
5232
  if (cacheData) {
4859
5233
  return cacheData;
4860
5234
  }
4861
- const req = api.GET(`ui.view/${viewId}/slide/${bookmarkId}`, Api.PrepReqParams(reqParams));
4862
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
4863
- return req;
5235
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5236
+ try {
5237
+ const data = yield api.GET(`ui.view/${viewId}/slide/${bookmarkId}`, Api.PrepReqParams(reqParams));
5238
+ res({
5239
+ bookmark: data
5240
+ });
5241
+ }
5242
+ catch (e) {
5243
+ rej(e);
5244
+ }
5245
+ }));
5246
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
5247
+ return prom;
4864
5248
  });
4865
5249
  }
4866
5250
  ProjectViewBookmark.Get = Get;
4867
- function Delete(api, viewId, bookmarkId, reqParams) {
5251
+ function Delete(params) {
4868
5252
  return __awaiter(this, void 0, void 0, function* () {
5253
+ const { api, viewId, bookmarkId, req: reqParams } = params;
4869
5254
  if (!viewId || !bookmarkId) {
4870
5255
  throw ("View ID and Bookmark ID are required.");
4871
5256
  }
@@ -4875,8 +5260,9 @@ var ProjectViewBookmark;
4875
5260
  });
4876
5261
  }
4877
5262
  ProjectViewBookmark.Delete = Delete;
4878
- function GetList(api, viewId, reqParams) {
5263
+ function GetList(params) {
4879
5264
  return __awaiter(this, void 0, void 0, function* () {
5265
+ const { api, viewId, req: reqParams } = params;
4880
5266
  if (!viewId) {
4881
5267
  throw ("View ID is required.");
4882
5268
  }
@@ -4894,11 +5280,15 @@ var ProjectViewBookmark;
4894
5280
  for (let i = 0; i < items.length; i++) {
4895
5281
  const item = items[i];
4896
5282
  const prom = new Promise((res) => {
4897
- res(item);
5283
+ res({
5284
+ bookmark: item
5285
+ });
4898
5286
  });
4899
5287
  api.Cache.Set(GetCacheKey(viewId, item.ID), prom, Api.DEFAULT_CACHE_DURATION);
4900
5288
  }
4901
- res(items);
5289
+ res({
5290
+ bookmarks: items
5291
+ });
4902
5292
  }
4903
5293
  catch (e) {
4904
5294
  rej(e);
@@ -4909,20 +5299,24 @@ var ProjectViewBookmark;
4909
5299
  });
4910
5300
  }
4911
5301
  ProjectViewBookmark.GetList = GetList;
4912
- function Update(api, viewId, data, reqParams) {
5302
+ function Update(params) {
4913
5303
  return __awaiter(this, void 0, void 0, function* () {
5304
+ const { api, viewId, bookmark: data, req: reqParams } = params;
4914
5305
  if (!(data === null || data === void 0 ? void 0 : data.Title)) {
4915
5306
  data.Title = data.ID;
4916
5307
  }
4917
- data = yield api.POST(`ui.view/${viewId}/slide/${data.ID ? data.ID : ""}`, data, Api.PrepReqParams(reqParams));
5308
+ const res = yield api.POST(`ui.view/${viewId}/slide/${data.ID ? data.ID : ""}`, data, Api.PrepReqParams(reqParams));
4918
5309
  api.Cache.Remove(GetCacheKey(viewId, data.ID));
4919
5310
  api.Cache.Remove(GetListCacheKey(viewId));
4920
- return data;
5311
+ return {
5312
+ bookmark: res
5313
+ };
4921
5314
  });
4922
5315
  }
4923
5316
  ProjectViewBookmark.Update = Update;
4924
- function SetOrder(api, viewId, bookmarkIds, reqParams) {
5317
+ function SetOrder(params) {
4925
5318
  return __awaiter(this, void 0, void 0, function* () {
5319
+ const { api, viewId, bookmarkIds, req: reqParams } = params;
4926
5320
  const reqData = {
4927
5321
  "UISlide.ID": bookmarkIds,
4928
5322
  "DisplayOrder.Start": 0
@@ -4952,16 +5346,17 @@ var ProjectView;
4952
5346
  // This is the expected default version for the DataVersion value.
4953
5347
  // This value should NOT be changed without looking at our API and seeing what the default value is.
4954
5348
  ProjectView.DEFAULT_DATA_VERSION = 1;
4955
- let V1;
4956
- (function (V1) {
4957
- V1.DATA_VERSION = 1;
4958
- })(V1 = ProjectView.V1 || (ProjectView.V1 = {}));
4959
- let V2;
4960
- (function (V2) {
4961
- V2.DATA_VERSION = 2;
4962
- })(V2 = ProjectView.V2 || (ProjectView.V2 = {}));
4963
- function Get(api, viewId, reqParams) {
5349
+ let LegacyNavigator;
5350
+ (function (LegacyNavigator) {
5351
+ LegacyNavigator.DATA_VERSION = 1;
5352
+ })(LegacyNavigator = ProjectView.LegacyNavigator || (ProjectView.LegacyNavigator = {}));
5353
+ let Navigator;
5354
+ (function (Navigator) {
5355
+ Navigator.DATA_VERSION = 2;
5356
+ })(Navigator = ProjectView.Navigator || (ProjectView.Navigator = {}));
5357
+ function Get(params) {
4964
5358
  return __awaiter(this, void 0, void 0, function* () {
5359
+ const { api, viewId, req: reqParams } = params;
4965
5360
  if (!viewId) {
4966
5361
  throw ("View ID is required.");
4967
5362
  }
@@ -4970,34 +5365,48 @@ var ProjectView;
4970
5365
  if (cacheData) {
4971
5366
  return cacheData;
4972
5367
  }
4973
- const req = api.GET(`ui.view/${viewId}`, Api.PrepReqParams(reqParams));
4974
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
4975
- return req;
5368
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5369
+ try {
5370
+ const data = yield api.GET(`ui.view/${viewId}`, Api.PrepReqParams(reqParams));
5371
+ res({
5372
+ view: data
5373
+ });
5374
+ }
5375
+ catch (e) {
5376
+ rej(e);
5377
+ }
5378
+ }));
5379
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
5380
+ return prom;
4976
5381
  });
4977
5382
  }
4978
5383
  ProjectView.Get = Get;
4979
- function GetList(api, reqParams) {
5384
+ function GetList(params) {
4980
5385
  return __awaiter(this, void 0, void 0, function* () {
5386
+ const { api, req: reqParams } = params;
4981
5387
  const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
4982
5388
  if (cacheData) {
4983
5389
  return cacheData;
4984
5390
  }
4985
- const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5391
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4986
5392
  try {
4987
5393
  const data = yield api.GET("ui.view/list", Api.PrepReqParams(reqParams));
4988
- res(data.Items);
5394
+ res({
5395
+ views: data.Items
5396
+ });
4989
5397
  }
4990
5398
  catch (e) {
4991
5399
  rej(e);
4992
5400
  }
4993
5401
  }));
4994
- api.Cache.Set(GetListCacheKey(), req, Api.DEFAULT_CACHE_DURATION);
4995
- return req;
5402
+ api.Cache.Set(GetListCacheKey(), prom, Api.DEFAULT_CACHE_DURATION);
5403
+ return prom;
4996
5404
  });
4997
5405
  }
4998
5406
  ProjectView.GetList = GetList;
4999
- function Delete(api, viewId, reqParams) {
5407
+ function Delete(params) {
5000
5408
  return __awaiter(this, void 0, void 0, function* () {
5409
+ const { api, viewId, req: reqParams } = params;
5001
5410
  if (!viewId) {
5002
5411
  throw ("View ID is required.");
5003
5412
  }
@@ -5007,8 +5416,9 @@ var ProjectView;
5007
5416
  });
5008
5417
  }
5009
5418
  ProjectView.Delete = Delete;
5010
- function Update(api, data, reqParams) {
5419
+ function Update(params) {
5011
5420
  return __awaiter(this, void 0, void 0, function* () {
5421
+ let { api, view: data, req: reqParams } = params;
5012
5422
  if (!data) {
5013
5423
  data = {};
5014
5424
  }
@@ -5030,7 +5440,9 @@ var ProjectView;
5030
5440
  }
5031
5441
  api.Cache.Remove(GetCacheKey(data.ID));
5032
5442
  api.Cache.Remove(GetListCacheKey());
5033
- return data;
5443
+ return {
5444
+ view: data
5445
+ };
5034
5446
  });
5035
5447
  }
5036
5448
  ProjectView.Update = Update;
@@ -5039,7 +5451,11 @@ var ProjectView;
5039
5451
  function getTemplateSettings(apiGetter, reqParams) {
5040
5452
  var _a;
5041
5453
  return __awaiter(this, void 0, void 0, function* () {
5042
- const view = yield ProjectView.Get(apiGetter.getApi(Api.TEMPLATE_ACCOUNT_ID), "default", reqParams);
5454
+ const { view } = yield ProjectView.Get({
5455
+ api: apiGetter.getApi(Api.TEMPLATE_ACCOUNT_ID),
5456
+ viewId: "default",
5457
+ req: reqParams
5458
+ });
5043
5459
  return (_a = view.Settings) !== null && _a !== void 0 ? _a : {};
5044
5460
  });
5045
5461
  }
@@ -5062,29 +5478,35 @@ function checkSourceToTemplate(items, templateItem, addIfMissing) {
5062
5478
  */
5063
5479
  var ProjectViewLegacyTile;
5064
5480
  (function (ProjectViewLegacyTile) {
5065
- function MergeMapTemplateData(getter, items, addIfMissing, reqParams) {
5481
+ function MergeMapTemplateData(params) {
5066
5482
  var _a;
5067
5483
  return __awaiter(this, void 0, void 0, function* () {
5484
+ const { getter, sources: items, addIfMissing, req: reqParams } = params;
5068
5485
  const settings = yield getTemplateSettings(getter, reqParams);
5069
5486
  const maps = (_a = settings.CesiumMapSources) !== null && _a !== void 0 ? _a : [];
5070
5487
  for (let i = 0; i < maps.length; i++) {
5071
5488
  const mapSource = maps[i];
5072
5489
  checkSourceToTemplate(items, mapSource, addIfMissing);
5073
5490
  }
5074
- return [];
5491
+ return {
5492
+ sources: items
5493
+ };
5075
5494
  });
5076
5495
  }
5077
5496
  ProjectViewLegacyTile.MergeMapTemplateData = MergeMapTemplateData;
5078
- function MergeTerrainTemplateData(getter, items, addIfMissing, reqParams) {
5497
+ function MergeTerrainTemplateData(params) {
5079
5498
  var _a;
5080
5499
  return __awaiter(this, void 0, void 0, function* () {
5500
+ const { getter, sources: items, addIfMissing, req: reqParams } = params;
5081
5501
  const settings = yield getTemplateSettings(getter, reqParams);
5082
5502
  const terrains = (_a = settings.CesiumTerrainSources) !== null && _a !== void 0 ? _a : [];
5083
5503
  for (let i = 0; i < terrains.length; i++) {
5084
5504
  const terrainSource = terrains[i];
5085
5505
  checkSourceToTemplate(items, terrainSource, addIfMissing);
5086
5506
  }
5087
- return [];
5507
+ return {
5508
+ sources: items
5509
+ };
5088
5510
  });
5089
5511
  }
5090
5512
  ProjectViewLegacyTile.MergeTerrainTemplateData = MergeTerrainTemplateData;
@@ -5221,24 +5643,32 @@ var PendingAction;
5221
5643
  EStatus["Complete"] = "COMPLETE";
5222
5644
  EStatus["Failed"] = "FAILED";
5223
5645
  })(EStatus = PendingAction.EStatus || (PendingAction.EStatus = {}));
5224
- function Get(api, actionId, reqParams) {
5646
+ function Get(params) {
5225
5647
  return __awaiter(this, void 0, void 0, function* () {
5648
+ const { api, actionId, req: reqParams } = params;
5226
5649
  if (!actionId) {
5227
5650
  throw ("Action ID is required.");
5228
5651
  }
5229
- return api.GET(`pendingAction/${actionId}`, Api.PrepReqParams(reqParams));
5652
+ const data = yield api.GET(`pendingAction/${actionId}`, Api.PrepReqParams(reqParams));
5653
+ return {
5654
+ action: data
5655
+ };
5230
5656
  });
5231
5657
  }
5232
5658
  PendingAction.Get = Get;
5233
- function GetRelevantList(api, stricter = false, reqParams) {
5659
+ function GetRelevantList(params) {
5234
5660
  return __awaiter(this, void 0, void 0, function* () {
5235
- const data = yield api.GET(`pendingActions/important?Update=${stricter}`, Api.PrepReqParams(reqParams));
5236
- return data.Items;
5661
+ const { api, stricter, reqParams } = params;
5662
+ const data = yield api.GET(`pendingActions/important?Update=${Boolean(stricter)}`, Api.PrepReqParams(reqParams));
5663
+ return {
5664
+ actions: data.Items
5665
+ };
5237
5666
  });
5238
5667
  }
5239
5668
  PendingAction.GetRelevantList = GetRelevantList;
5240
- function GetMessages(api, actionId, order, startIndex, amount, reqParams) {
5669
+ function GetMessages(params) {
5241
5670
  return __awaiter(this, void 0, void 0, function* () {
5671
+ let { api, actionId, order, startIndex, amount, req: reqParams } = params;
5242
5672
  if (amount == null) {
5243
5673
  amount = 500;
5244
5674
  }
@@ -5250,7 +5680,9 @@ var PendingAction;
5250
5680
  }
5251
5681
  const args = `?SortOrder=${order == Api.ESortOrder.Desc ? "DESC" : "ASC"}&PageSize=${amount}&PageIndex=${startIndex}`;
5252
5682
  const data = yield api.GET(`pendingAction/${actionId}/progressMessages` + args, Api.PrepReqParams(reqParams));
5253
- return data.Items;
5683
+ return {
5684
+ messages: data.Items
5685
+ };
5254
5686
  });
5255
5687
  }
5256
5688
  PendingAction.GetMessages = GetMessages;
@@ -5284,25 +5716,29 @@ var Style;
5284
5716
  EPointType["Icon"] = "ICON";
5285
5717
  EPointType["Cylinder"] = "CYLINDER";
5286
5718
  })(EPointType = Style.EPointType || (Style.EPointType = {}));
5287
- function GetList(api, reqParams) {
5719
+ function GetList(params) {
5720
+ const { api, req: reqParams } = params;
5288
5721
  const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
5289
5722
  if (cacheData) {
5290
5723
  return cacheData;
5291
5724
  }
5292
- const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5725
+ const res = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5293
5726
  try {
5294
5727
  const data = yield api.GET("ui.entityDisplaySettings", Api.PrepReqParams(reqParams));
5295
- res(data.Items);
5728
+ res({
5729
+ styles: data.Items
5730
+ });
5296
5731
  }
5297
5732
  catch (e) {
5298
5733
  rej(e);
5299
5734
  }
5300
5735
  }));
5301
- api.Cache.Set(GetListCacheKey(), req, Api.DEFAULT_CACHE_DURATION);
5302
- return req;
5736
+ api.Cache.Set(GetListCacheKey(), res, Api.DEFAULT_CACHE_DURATION);
5737
+ return res;
5303
5738
  }
5304
5739
  Style.GetList = GetList;
5305
- function Get(api, id, reqParams) {
5740
+ function Get(params) {
5741
+ const { api, styleId: id, req: reqParams } = params;
5306
5742
  if (!id) {
5307
5743
  throw ("Style ID is required.");
5308
5744
  }
@@ -5310,28 +5746,42 @@ var Style;
5310
5746
  if (cacheData) {
5311
5747
  return cacheData;
5312
5748
  }
5313
- const req = api.GET(`ui.entityDisplaySetting/${id}`, Api.PrepReqParams(reqParams));
5314
- api.Cache.Set(GetCacheKey(id), req, Api.DEFAULT_CACHE_DURATION);
5315
- return req;
5749
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5750
+ try {
5751
+ const data = yield api.GET(`ui.entityDisplaySetting/${id}`, Api.PrepReqParams(reqParams));
5752
+ res({
5753
+ style: data
5754
+ });
5755
+ }
5756
+ catch (e) {
5757
+ rej(e);
5758
+ }
5759
+ }));
5760
+ api.Cache.Set(GetCacheKey(id), prom, Api.DEFAULT_CACHE_DURATION);
5761
+ return prom;
5316
5762
  }
5317
5763
  Style.Get = Get;
5318
- function Update(api, data, reqParams) {
5764
+ function Update(params) {
5319
5765
  return __awaiter(this, void 0, void 0, function* () {
5766
+ const { api, style: data, req: reqParams } = params;
5320
5767
  if (!(data === null || data === void 0 ? void 0 : data.Name)) {
5321
5768
  throw ("Style name is required.");
5322
5769
  }
5323
5770
  if (!data.ID) {
5324
5771
  data.ID = 0;
5325
5772
  }
5326
- data = yield api.POST(`ui.entityDisplaySetting/${data.ID}`, data, Api.PrepReqParams(reqParams));
5773
+ const res = yield api.POST(`ui.entityDisplaySetting/${data.ID}`, data, Api.PrepReqParams(reqParams));
5327
5774
  api.Cache.Remove(GetCacheKey(data.ID));
5328
5775
  api.Cache.Remove(GetListCacheKey());
5329
- return data;
5776
+ return {
5777
+ style: res
5778
+ };
5330
5779
  });
5331
5780
  }
5332
5781
  Style.Update = Update;
5333
- function Delete(api, id, reqParams) {
5782
+ function Delete(params) {
5334
5783
  return __awaiter(this, void 0, void 0, function* () {
5784
+ const { api, styleId: id, req: reqParams } = params;
5335
5785
  if (!id) {
5336
5786
  throw ("Style ID is required.");
5337
5787
  }
@@ -5343,37 +5793,6 @@ var Style;
5343
5793
  Style.Delete = Delete;
5344
5794
  })(Style || (Style = {}));
5345
5795
 
5346
- /**
5347
- * Describes expected settings for an entities-map tileset.
5348
- * This is the kind of tileset generated from arbitrary Bruce entities-
5349
- * which produced map tiles of the entity vector geometry.
5350
- */
5351
- var TilesetEntitiesMapTiles;
5352
- (function (TilesetEntitiesMapTiles) {
5353
- let ETileSize;
5354
- (function (ETileSize) {
5355
- ETileSize[ETileSize["IMG_256"] = 256] = "IMG_256";
5356
- ETileSize[ETileSize["IMG_512"] = 512] = "IMG_512";
5357
- ETileSize[ETileSize["IMG_1024"] = 1024] = "IMG_1024";
5358
- ETileSize[ETileSize["IMG_2048"] = 2048] = "IMG_2048";
5359
- })(ETileSize = TilesetEntitiesMapTiles.ETileSize || (TilesetEntitiesMapTiles.ETileSize = {}));
5360
- })(TilesetEntitiesMapTiles || (TilesetEntitiesMapTiles = {}));
5361
-
5362
- /**
5363
- * Describes settings for an external map-tiles tileset.
5364
- * This will serve content from elsewhere with the assumption that the data is valid map tiles.
5365
- */
5366
- var TilesetExtMapTiles;
5367
- (function (TilesetExtMapTiles) {
5368
- let EType;
5369
- (function (EType) {
5370
- EType["TileMapImagery"] = "TileMapImagery";
5371
- EType["OpenStreetMapImagery"] = "OpenStreetMapImagery";
5372
- EType["MapBoxImagery"] = "MapBoxImagery";
5373
- EType["CesiumIon"] = "CesiumIon";
5374
- })(EType = TilesetExtMapTiles.EType || (TilesetExtMapTiles.EType = {}));
5375
- })(TilesetExtMapTiles || (TilesetExtMapTiles = {}));
5376
-
5377
5796
  var Permission;
5378
5797
  (function (Permission) {
5379
5798
  let EPerm;
@@ -5402,8 +5821,9 @@ var Session;
5402
5821
  function GetCacheKey(sessionId) {
5403
5822
  return `${Api.ECacheKey.Session}${Api.ECacheKey.Id}${sessionId}`;
5404
5823
  }
5405
- function Get(api, sessionId, reqParams) {
5824
+ function Get(params) {
5406
5825
  return __awaiter(this, void 0, void 0, function* () {
5826
+ const { api, sessionId, req: reqParams } = params;
5407
5827
  if (!sessionId) {
5408
5828
  throw ("Session ID is required.");
5409
5829
  }
@@ -5412,14 +5832,25 @@ var Session;
5412
5832
  if (cacheData) {
5413
5833
  return cacheData;
5414
5834
  }
5415
- const req = api.GET(`session/${sessionId}`, reqParams);
5416
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
5417
- return req;
5835
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5836
+ try {
5837
+ const data = yield api.GET(`session/${sessionId}`, reqParams);
5838
+ res({
5839
+ session: data
5840
+ });
5841
+ }
5842
+ catch (e) {
5843
+ rej(e);
5844
+ }
5845
+ }));
5846
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
5847
+ return prom;
5418
5848
  });
5419
5849
  }
5420
5850
  Session.Get = Get;
5421
- function Login(api, username, password, accountId, reqParams) {
5851
+ function Login(params) {
5422
5852
  return __awaiter(this, void 0, void 0, function* () {
5853
+ const { api, username, password, accountId, req: reqParams } = params;
5423
5854
  if (!username || !password) {
5424
5855
  throw ("Username and password are required.");
5425
5856
  }
@@ -5432,12 +5863,15 @@ var Session;
5432
5863
  const ssid = session === null || session === void 0 ? void 0 : session.ID;
5433
5864
  api.SetSessionId(ssid);
5434
5865
  api.Cache.Remove(GetCacheKey(ssid));
5435
- return session;
5866
+ return {
5867
+ session: session
5868
+ };
5436
5869
  });
5437
5870
  }
5438
5871
  Session.Login = Login;
5439
- function Logout(api, reqParams) {
5872
+ function Logout(params) {
5440
5873
  return __awaiter(this, void 0, void 0, function* () {
5874
+ const { api, req: reqParams } = params;
5441
5875
  const ssid = api.GetSessionId();
5442
5876
  if (ssid) {
5443
5877
  yield api.POST("logout", null, reqParams);
@@ -5447,8 +5881,9 @@ var Session;
5447
5881
  });
5448
5882
  }
5449
5883
  Session.Logout = Logout;
5450
- function IsPermEnabled(session, accountId, perm) {
5884
+ function IsPermEnabled(params) {
5451
5885
  var _a, _b;
5886
+ let { session, accountId, perm } = params;
5452
5887
  if (!perm) {
5453
5888
  throw ("Perm is required.");
5454
5889
  }
@@ -5472,8 +5907,9 @@ var Session;
5472
5907
  return false;
5473
5908
  }
5474
5909
  Session.IsPermEnabled = IsPermEnabled;
5475
- function IsSuperPermEnabled(session, perm) {
5910
+ function IsSuperPermEnabled(params) {
5476
5911
  var _a, _b;
5912
+ let { session, perm } = params;
5477
5913
  if (!perm) {
5478
5914
  throw ("Perm is required.");
5479
5915
  }
@@ -5482,12 +5918,19 @@ var Session;
5482
5918
  return accessPerms.findIndex(x => x.toLocaleUpperCase() == perm) > -1;
5483
5919
  }
5484
5920
  Session.IsSuperPermEnabled = IsSuperPermEnabled;
5485
- function IsAccountAdmin(session, accountId) {
5486
- return IsPermEnabled(session, accountId, Permission.EPerm.ADMIN);
5921
+ function IsAccountAdmin(params) {
5922
+ return IsPermEnabled({
5923
+ perm: Permission.EPerm.ADMIN,
5924
+ accountId: params.accountId,
5925
+ session: params.session
5926
+ });
5487
5927
  }
5488
5928
  Session.IsAccountAdmin = IsAccountAdmin;
5489
- function IsSuperAdmin(session) {
5490
- return IsSuperPermEnabled(session, Permission.EPerm.ADMIN);
5929
+ function IsSuperAdmin(params) {
5930
+ return IsSuperPermEnabled({
5931
+ session: params.session,
5932
+ perm: Permission.EPerm.ADMIN
5933
+ });
5491
5934
  }
5492
5935
  Session.IsSuperAdmin = IsSuperAdmin;
5493
5936
  })(Session || (Session = {}));
@@ -5498,47 +5941,61 @@ var Session;
5498
5941
  */
5499
5942
  var UserGroup;
5500
5943
  (function (UserGroup) {
5501
- function GetByName(api, accountId, name, reqParams) {
5944
+ function GetByName(params) {
5502
5945
  return __awaiter(this, void 0, void 0, function* () {
5946
+ const { api, accountId, name, req: reqParams } = params;
5503
5947
  if (!name || !accountId) {
5504
5948
  throw ("Name and AccountID are required.");
5505
5949
  }
5506
- return api.GET(`account/${accountId}/userGroupByName/${name}`, reqParams);
5950
+ const data = yield api.GET(`account/${accountId}/userGroupByName/${name}`, reqParams);
5951
+ return {
5952
+ group: data
5953
+ };
5507
5954
  });
5508
5955
  }
5509
5956
  UserGroup.GetByName = GetByName;
5510
- function GetUsers(api, accountId, id, reqParams) {
5957
+ function GetUsers(params) {
5511
5958
  return __awaiter(this, void 0, void 0, function* () {
5959
+ const { api, accountId, groupId: id, req: reqParams } = params;
5512
5960
  if (!accountId || !id) {
5513
5961
  throw ("AccountID and ID are required.");
5514
5962
  }
5515
5963
  const data = yield api.GET(`userGroup/${accountId}/${id}/users`, reqParams);
5516
- return data.Items;
5964
+ return {
5965
+ users: data.Items
5966
+ };
5517
5967
  });
5518
5968
  }
5519
5969
  UserGroup.GetUsers = GetUsers;
5520
- function GetListByPerm(api, accountId, perm, reqParams) {
5970
+ function GetListByPerm(params) {
5521
5971
  return __awaiter(this, void 0, void 0, function* () {
5972
+ const { api, accountId, perm, req: reqParams } = params;
5522
5973
  if (!accountId || !perm) {
5523
5974
  throw ("AccountID and Perm are required.");
5524
5975
  }
5525
5976
  const data = yield api.GET(`userGroupsByFeature/${accountId}/${perm}`, reqParams);
5526
- return data.Items;
5977
+ return {
5978
+ groups: data.Items
5979
+ };
5527
5980
  });
5528
5981
  }
5529
5982
  UserGroup.GetListByPerm = GetListByPerm;
5530
- function GetList(api, accountId, reqParams) {
5983
+ function GetList(params) {
5531
5984
  return __awaiter(this, void 0, void 0, function* () {
5985
+ const { api, accountId, req: reqParams } = params;
5532
5986
  if (!accountId) {
5533
5987
  throw ("AccountID is required.");
5534
5988
  }
5535
5989
  const data = yield api.GET(`userGroups/${accountId}`, reqParams);
5536
- return data.Items;
5990
+ return {
5991
+ groups: data.Items
5992
+ };
5537
5993
  });
5538
5994
  }
5539
5995
  UserGroup.GetList = GetList;
5540
- function Delete(api, accountId, id, reqParams) {
5996
+ function Delete(params) {
5541
5997
  return __awaiter(this, void 0, void 0, function* () {
5998
+ const { api, accountId, groupId: id, req: reqParams } = params;
5542
5999
  if (!accountId || !id) {
5543
6000
  throw ("AccountID and ID are required.");
5544
6001
  }
@@ -5546,13 +6003,16 @@ var UserGroup;
5546
6003
  });
5547
6004
  }
5548
6005
  UserGroup.Delete = Delete;
5549
- function Update(api, data, reqParams) {
6006
+ function Update(params) {
5550
6007
  return __awaiter(this, void 0, void 0, function* () {
6008
+ const { api, group: data, reqParams } = params;
5551
6009
  if (!data.Name || !data["ClientAccount.ID"]) {
5552
6010
  throw ("User group name and client account ID are required.");
5553
6011
  }
5554
- data = yield api.POST(`userGroup${data.ID ? ("/" + data.ID) : ""}`, data, reqParams);
5555
- return data;
6012
+ const res = yield api.POST(`userGroup${data.ID ? ("/" + data.ID) : ""}`, data, reqParams);
6013
+ return {
6014
+ group: res
6015
+ };
5556
6016
  });
5557
6017
  }
5558
6018
  UserGroup.Update = Update;
@@ -5590,8 +6050,9 @@ var User;
5590
6050
  EType["User"] = "LOGIN_USER";
5591
6051
  EType["AccessToken"] = "ACCESS_TOKEN";
5592
6052
  })(EType = User.EType || (User.EType = {}));
5593
- function Get(api, id, accountId, reqParams) {
6053
+ function Get(params) {
5594
6054
  return __awaiter(this, void 0, void 0, function* () {
6055
+ const { api, userId: id, accountId, req: reqParams } = params;
5595
6056
  if (!id) {
5596
6057
  throw ("ID is required.");
5597
6058
  }
@@ -5601,13 +6062,16 @@ var User;
5601
6062
  }
5602
6063
  const req = yield api.GET(`user/${id}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
5603
6064
  api.Cache.Set(GetCacheKey(id, accountId), req, Api.DEFAULT_CACHE_DURATION);
5604
- return req;
6065
+ return {
6066
+ user: req
6067
+ };
5605
6068
  });
5606
6069
  }
5607
6070
  User.Get = Get;
5608
- function Update(api, data, reqParams) {
6071
+ function Update(params) {
5609
6072
  var _a;
5610
6073
  return __awaiter(this, void 0, void 0, function* () {
6074
+ const { api, user: data, req: reqParams } = params;
5611
6075
  if (!(data === null || data === void 0 ? void 0 : data.ID) || !(data === null || data === void 0 ? void 0 : data.Type)) {
5612
6076
  throw ("ID and Type are required.");
5613
6077
  }
@@ -5624,7 +6088,7 @@ var User;
5624
6088
  }
5625
6089
  }
5626
6090
  }
5627
- data = yield api.POST(`user/${data.ID}`, data, reqParams);
6091
+ const res = yield api.POST(`user/${data.ID}`, data, reqParams);
5628
6092
  api.Cache.RemoveByContains(Api.ECacheKey.User + Api.ECacheKey.Id + data.ID);
5629
6093
  if (data.Type == EType.AccessToken) {
5630
6094
  api.Cache.RemoveByStartsWith(Api.ECacheKey.AccessToken + Api.ECacheKey.Account);
@@ -5632,7 +6096,9 @@ var User;
5632
6096
  else if (data.Type == EType.User) {
5633
6097
  api.Cache.RemoveByStartsWith(Api.ECacheKey.User + Api.ECacheKey.Account);
5634
6098
  }
5635
- return data;
6099
+ return {
6100
+ user: res
6101
+ };
5636
6102
  });
5637
6103
  }
5638
6104
  User.Update = Update;
@@ -5655,14 +6121,18 @@ var User;
5655
6121
  try {
5656
6122
  const data = yield api.GET(`user/${userId}/application/${appId}/settings`);
5657
6123
  const settings = (data === null || data === void 0 ? void 0 : data.Settings) ? data.Settings : {};
5658
- res(settings);
6124
+ res({
6125
+ settings: settings
6126
+ });
5659
6127
  }
5660
6128
  catch (e) {
5661
6129
  // It will complain if an app id hasn't been used yet.
5662
6130
  // We need to suppress that error.
5663
6131
  if (e && typeof e == "object") {
5664
6132
  if (e.ERROR && typeof e.ERROR == "object" && e.ERROR.Type == "NotFound") {
5665
- res({});
6133
+ res({
6134
+ settings: {}
6135
+ });
5666
6136
  return;
5667
6137
  }
5668
6138
  }
@@ -5697,8 +6167,9 @@ var User;
5697
6167
  });
5698
6168
  }
5699
6169
  User.UpdateSettings = UpdateSettings;
5700
- function GetUsernameAvailable(api, username, excludeUserId, reqParams) {
6170
+ function GetUsernameAvailable(params) {
5701
6171
  return __awaiter(this, void 0, void 0, function* () {
6172
+ const { api, username, excludeUserId, req: reqParams } = params;
5702
6173
  if (!username) {
5703
6174
  throw ("Username is required.");
5704
6175
  }
@@ -5706,7 +6177,9 @@ var User;
5706
6177
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5707
6178
  try {
5708
6179
  const data = yield req;
5709
- res(data.IsAvailable);
6180
+ res({
6181
+ isAvailable: data.IsAvailable
6182
+ });
5710
6183
  }
5711
6184
  catch (e) {
5712
6185
  rej(e);
@@ -5722,8 +6195,9 @@ var User;
5722
6195
  return Api.ECacheKey.User + Api.ECacheKey.Account + Api.ECacheKey.Id + accountId;
5723
6196
  }
5724
6197
  LoginUser.GetListCacheKey = GetListCacheKey;
5725
- function GetByEmail(api, email, accountId, reqParams) {
6198
+ function GetByEmail(params) {
5726
6199
  return __awaiter(this, void 0, void 0, function* () {
6200
+ const { api, email, accountId, req: reqParams } = params;
5727
6201
  if (!email) {
5728
6202
  throw ("Email is required.");
5729
6203
  }
@@ -5733,12 +6207,15 @@ var User;
5733
6207
  }
5734
6208
  const req = yield api.GET(`userByEmail/${email}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
5735
6209
  api.Cache.Set(GetEmailCacheKey(email, accountId), req, Api.DEFAULT_CACHE_DURATION);
5736
- return req;
6210
+ return {
6211
+ user: req
6212
+ };
5737
6213
  });
5738
6214
  }
5739
6215
  LoginUser.GetByEmail = GetByEmail;
5740
- function GetList(api, accountId, exclusive, reqParams) {
6216
+ function GetList(params) {
5741
6217
  return __awaiter(this, void 0, void 0, function* () {
6218
+ let { api, accountId, exclusive, req: reqParams } = params;
5742
6219
  if (!accountId) {
5743
6220
  throw ("Client account ID is required.");
5744
6221
  }
@@ -5752,13 +6229,16 @@ var User;
5752
6229
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5753
6230
  try {
5754
6231
  const data = yield api.GET(`users?clientAccountID=${accountId}${exclusive ? "&allExcludingClientAccount=true" : ""}`, reqParams);
5755
- res(data.Items);
6232
+ res({
6233
+ users: data.Items
6234
+ });
5756
6235
  }
5757
6236
  catch (e) {
5758
6237
  rej(e);
5759
6238
  }
5760
6239
  }));
5761
- req.then((users) => {
6240
+ req.then((data) => {
6241
+ const users = data.users;
5762
6242
  for (let i = 0; i < users.length; i++) {
5763
6243
  api.Cache.Set(GetCacheKey(users[i].ID, accountId), users[i]);
5764
6244
  }
@@ -5772,12 +6252,12 @@ var User;
5772
6252
  LoginUser.GetList = GetList;
5773
6253
  /**
5774
6254
  * Sends a signup email to the specified email address.
5775
- * @param api
5776
- * @param email
6255
+ * @param params
5777
6256
  * @returns
5778
6257
  */
5779
- function Signup(api, email, reqParams) {
6258
+ function Signup(params) {
5780
6259
  return __awaiter(this, void 0, void 0, function* () {
6260
+ const { api, email, req: reqParams } = params;
5781
6261
  if (!email) {
5782
6262
  throw ("Email is required.");
5783
6263
  }
@@ -5789,12 +6269,12 @@ var User;
5789
6269
  LoginUser.Signup = Signup;
5790
6270
  /**
5791
6271
  * Sends a new signup email using a previous one's expired code.
5792
- * @param api
5793
- * @param expiredCode
6272
+ * @param params
5794
6273
  * @returns
5795
6274
  */
5796
- function SignupResend(api, expiredCode, reqParams) {
6275
+ function SignupResend(params) {
5797
6276
  return __awaiter(this, void 0, void 0, function* () {
6277
+ const { api, expiredCode, req: reqParams } = params;
5798
6278
  if (!expiredCode) {
5799
6279
  throw ("Expired activation code is required.");
5800
6280
  }
@@ -5804,14 +6284,12 @@ var User;
5804
6284
  LoginUser.SignupResend = SignupResend;
5805
6285
  /**
5806
6286
  * Completes signup using user data and a signup code.
5807
- * @param api
5808
- * @param code
5809
- * @param data
5810
- * @param accountId
6287
+ * @param params
5811
6288
  * @returns
5812
6289
  */
5813
- function SignupComplete(api, code, data, accountId, reqParams) {
6290
+ function SignupComplete(params) {
5814
6291
  return __awaiter(this, void 0, void 0, function* () {
6292
+ let { api, code, user: data, accountId, req: reqParams } = params;
5815
6293
  if (!code || !(data === null || data === void 0 ? void 0 : data.Login) || !(data === null || data === void 0 ? void 0 : data.Password)) {
5816
6294
  throw ("Login, password, and activation code are required.");
5817
6295
  }
@@ -5824,19 +6302,20 @@ var User;
5824
6302
  if (data.Email) {
5825
6303
  api.Cache.RemoveByContains(Api.ECacheKey.User + Api.ECacheKey.UserEmail + data.Email);
5826
6304
  }
5827
- return res;
6305
+ return {
6306
+ user: res
6307
+ };
5828
6308
  });
5829
6309
  }
5830
6310
  LoginUser.SignupComplete = SignupComplete;
5831
6311
  /**
5832
6312
  * Sends a password reset email to the specified email address.
5833
- * @param api
5834
- * @param accountId
5835
- * @param email
6313
+ * @param params
5836
6314
  * @returns user id associated with provided email.
5837
6315
  */
5838
- function ForgotPassword(api, accountId, email, reqParams) {
6316
+ function ForgotPassword(params) {
5839
6317
  return __awaiter(this, void 0, void 0, function* () {
6318
+ const { api, accountId, email, req: reqParams } = params;
5840
6319
  if (!accountId || !email) {
5841
6320
  throw ("Account ID and email are required.");
5842
6321
  }
@@ -5846,7 +6325,9 @@ var User;
5846
6325
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5847
6326
  try {
5848
6327
  const data = yield req;
5849
- res(data.ID);
6328
+ res({
6329
+ userId: data.ID
6330
+ });
5850
6331
  }
5851
6332
  catch (e) {
5852
6333
  rej(e);
@@ -5858,22 +6339,28 @@ var User;
5858
6339
  LoginUser.ForgotPassword = ForgotPassword;
5859
6340
  /**
5860
6341
  * Completes password reset using a password reset code and new password.
5861
- * @param api
5862
- * @param code
5863
- * @param userId
5864
- * @param password
6342
+ * @param params
5865
6343
  * @returns
5866
6344
  */
5867
- function ForgotPasswordComplete(api, code, userId, password, reqParams) {
6345
+ function ForgotPasswordComplete(params) {
5868
6346
  return __awaiter(this, void 0, void 0, function* () {
5869
- const user = yield Get(api, userId, "");
5870
- return api.POST("UserSetNameAndPassword", {
6347
+ const { api, code, userId, password, req: reqParams } = params;
6348
+ const { user } = yield Get({
6349
+ api: api,
6350
+ userId: userId,
6351
+ accountId: "",
6352
+ req: reqParams
6353
+ });
6354
+ const res = yield api.POST("UserSetNameAndPassword", {
5871
6355
  ID: userId,
5872
6356
  Email: user.Email,
5873
6357
  ActivationCode: code,
5874
6358
  Password: password,
5875
6359
  FullName: user.FullName
5876
6360
  }, reqParams);
6361
+ return {
6362
+ user: res
6363
+ };
5877
6364
  });
5878
6365
  }
5879
6366
  LoginUser.ForgotPasswordComplete = ForgotPasswordComplete;
@@ -5884,8 +6371,9 @@ var User;
5884
6371
  return Api.ECacheKey.AccessToken + Api.ECacheKey.Account + Api.ECacheKey.Id + accountId;
5885
6372
  }
5886
6373
  AccessToken.GetListCacheKey = GetListCacheKey;
5887
- function GetList(api, accountId, reqParams) {
6374
+ function GetList(params) {
5888
6375
  return __awaiter(this, void 0, void 0, function* () {
6376
+ const { api, accountId, req: reqParams } = params;
5889
6377
  const cacheData = api.GetCacheItem(GetListCacheKey(accountId), reqParams);
5890
6378
  if (cacheData) {
5891
6379
  return cacheData;
@@ -5893,13 +6381,16 @@ var User;
5893
6381
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5894
6382
  try {
5895
6383
  const data = yield api.GET("usersByClientAccount/accessTokens", reqParams);
5896
- res(data.Items);
6384
+ res({
6385
+ tokens: data.Items
6386
+ });
5897
6387
  }
5898
6388
  catch (e) {
5899
6389
  rej(e);
5900
6390
  }
5901
6391
  }));
5902
- req.then((users) => {
6392
+ req.then((data) => {
6393
+ const users = data.tokens;
5903
6394
  for (let i = 0; i < users.length; i++) {
5904
6395
  api.Cache.Set(GetCacheKey(users[i].ID, accountId), users[i]);
5905
6396
  }
@@ -5909,16 +6400,18 @@ var User;
5909
6400
  });
5910
6401
  }
5911
6402
  AccessToken.GetList = GetList;
5912
- function Delete(api, id, reqParams) {
6403
+ function Delete(params) {
5913
6404
  return __awaiter(this, void 0, void 0, function* () {
6405
+ const { api, tokenId: id, req: reqParams } = params;
5914
6406
  yield api.DELETE(`accessToken/${id}`, reqParams);
5915
6407
  api.Cache.RemoveByContains(Api.ECacheKey.User + Api.ECacheKey.Id + id);
5916
6408
  api.Cache.RemoveByStartsWith(Api.ECacheKey.AccessToken + Api.ECacheKey.Account);
5917
6409
  });
5918
6410
  }
5919
6411
  AccessToken.Delete = Delete;
5920
- function Create(api, data, reqParams) {
6412
+ function Create(params) {
5921
6413
  return __awaiter(this, void 0, void 0, function* () {
6414
+ let { api, token: data, req: reqParams } = params;
5922
6415
  if (!data) {
5923
6416
  data = {};
5924
6417
  }
@@ -5930,7 +6423,9 @@ var User;
5930
6423
  }
5931
6424
  data = yield api.POST("accessToken", data, reqParams);
5932
6425
  api.Cache.RemoveByStartsWith(Api.ECacheKey.AccessToken + Api.ECacheKey.Account);
5933
- return data;
6426
+ return {
6427
+ token: data
6428
+ };
5934
6429
  });
5935
6430
  }
5936
6431
  AccessToken.Create = Create;
@@ -6023,13 +6518,13 @@ var UrlUtils;
6023
6518
  Clear() {
6024
6519
  this.refresh({});
6025
6520
  }
6026
- refresh(data) {
6521
+ refresh(urlParams) {
6027
6522
  const params = [];
6028
- const keys = Object.keys(data);
6523
+ const keys = Object.keys(urlParams);
6029
6524
  for (let i = 0; i < keys.length; i++) {
6030
6525
  const key = keys[i];
6031
6526
  if (this._allowedKeys == null || this._allowedKeys.includes(key)) {
6032
- const val = data[key];
6527
+ const val = urlParams[key];
6033
6528
  if (!!val || val == 0) {
6034
6529
  params.push(`${key}=${val}`);
6035
6530
  }
@@ -6053,34 +6548,34 @@ var DataLab;
6053
6548
  EReqKey["Primary"] = "PrimarySelection";
6054
6549
  EReqKey["Secondary"] = "SecondarySelection";
6055
6550
  })(EReqKey = DataLab.EReqKey || (DataLab.EReqKey = {}));
6056
- let Entity;
6057
- (function (Entity) {
6058
- function GetList(api, query, key, skip, load, reqParams) {
6059
- return __awaiter(this, void 0, void 0, function* () {
6060
- if (!key) {
6061
- key = EReqKey.Primary;
6062
- }
6063
- if (!skip) {
6064
- skip = 0;
6551
+ function Run(params) {
6552
+ return __awaiter(this, void 0, void 0, function* () {
6553
+ let { api, query, key, skip, load, req: reqParams } = params;
6554
+ if (!key) {
6555
+ key = EReqKey.Primary;
6556
+ }
6557
+ if (!skip) {
6558
+ skip = 0;
6559
+ }
6560
+ if (!load) {
6561
+ load = 50;
6562
+ }
6563
+ const req = api.POST(`entities/datalab/getMatchingEntities/${key}?skip=${skip}&load=${load}`, query, Api.PrepReqParams(reqParams));
6564
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
6565
+ try {
6566
+ const data = yield req;
6567
+ res({
6568
+ entities: data.Items
6569
+ });
6065
6570
  }
6066
- if (!load) {
6067
- load = 50;
6571
+ catch (e) {
6572
+ rej(e);
6068
6573
  }
6069
- const req = api.POST(`entities/datalab/getMatchingEntities/${key}?skip=${skip}&load=${load}`, query, Api.PrepReqParams(reqParams));
6070
- const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
6071
- try {
6072
- const data = yield req;
6073
- res(data.Items);
6074
- }
6075
- catch (e) {
6076
- rej(e);
6077
- }
6078
- }));
6079
- return prom;
6080
- });
6081
- }
6082
- Entity.GetList = GetList;
6083
- })(Entity = DataLab.Entity || (DataLab.Entity = {}));
6574
+ }));
6575
+ return prom;
6576
+ });
6577
+ }
6578
+ DataLab.Run = Run;
6084
6579
  })(DataLab || (DataLab = {}));
6085
6580
 
6086
6581
  /**
@@ -6089,15 +6584,17 @@ var DataLab;
6089
6584
  */
6090
6585
  var ImportCad;
6091
6586
  (function (ImportCad) {
6092
- function Analyze(api, params, reqParams) {
6587
+ function Analyze(params) {
6093
6588
  return __awaiter(this, void 0, void 0, function* () {
6094
- return api.POST("entities/PrepareIFCForImport", params, Api.PrepReqParams(reqParams));
6589
+ const { api, fileAnalyze, req: reqParams } = params;
6590
+ return api.POST("entities/PrepareIFCForImport", fileAnalyze, Api.PrepReqParams(reqParams));
6095
6591
  });
6096
6592
  }
6097
6593
  ImportCad.Analyze = Analyze;
6098
- function ImportEntities(api, params, reqParams) {
6594
+ function ImportEntities(params) {
6099
6595
  return __awaiter(this, void 0, void 0, function* () {
6100
- return api.POST("entities/importIFCWithProgress", params, Api.PrepReqParams(reqParams));
6596
+ const { api, fileImport, req: reqParams } = params;
6597
+ return api.POST("entities/importIFCWithProgress", fileImport, Api.PrepReqParams(reqParams));
6101
6598
  });
6102
6599
  }
6103
6600
  ImportCad.ImportEntities = ImportEntities;
@@ -6124,9 +6621,10 @@ var ImportCad;
6124
6621
 
6125
6622
  var ImportCsv;
6126
6623
  (function (ImportCsv) {
6127
- function ImportEntities(api, params, reqParams) {
6624
+ function ImportEntities(params) {
6128
6625
  return __awaiter(this, void 0, void 0, function* () {
6129
- return api.POST("entities/importCSVWithProgress2", params, Api.PrepReqParams(reqParams));
6626
+ const { api, fileImport, req: reqParams } = params;
6627
+ return api.POST("entities/importCSVWithProgress2", fileImport, Api.PrepReqParams(reqParams));
6130
6628
  });
6131
6629
  }
6132
6630
  ImportCsv.ImportEntities = ImportEntities;
@@ -6134,9 +6632,10 @@ var ImportCsv;
6134
6632
 
6135
6633
  var ImportJson;
6136
6634
  (function (ImportJson) {
6137
- function ImportEntities(api, params, reqParams) {
6635
+ function ImportEntities(params) {
6138
6636
  return __awaiter(this, void 0, void 0, function* () {
6139
- return api.POST("entities/importJsonWithProgress", params, Api.PrepReqParams(reqParams));
6637
+ const { api, fileImport, req: reqParams } = params;
6638
+ return api.POST("entities/importJsonWithProgress", fileImport, Api.PrepReqParams(reqParams));
6140
6639
  });
6141
6640
  }
6142
6641
  ImportJson.ImportEntities = ImportEntities;
@@ -6144,9 +6643,10 @@ var ImportJson;
6144
6643
 
6145
6644
  var ImportKml;
6146
6645
  (function (ImportKml) {
6147
- function ImportEntities(api, params, reqParams) {
6646
+ function ImportEntities(params) {
6148
6647
  return __awaiter(this, void 0, void 0, function* () {
6149
- return api.POST("entities/importKMLWithProgress2", params, Api.PrepReqParams(reqParams));
6648
+ const { api, fileImport, req: reqParams } = params;
6649
+ return api.POST("entities/importKMLWithProgress2", fileImport, Api.PrepReqParams(reqParams));
6150
6650
  });
6151
6651
  }
6152
6652
  ImportKml.ImportEntities = ImportEntities;
@@ -6167,8 +6667,9 @@ var ImportedFile;
6167
6667
  EFileType["CAD"] = "CAD";
6168
6668
  EFileType["All"] = "All";
6169
6669
  })(EFileType = ImportedFile.EFileType || (ImportedFile.EFileType = {}));
6170
- function GetList(api, type, pageIndex, reqParams) {
6670
+ function GetList(params) {
6171
6671
  return __awaiter(this, void 0, void 0, function* () {
6672
+ let { api, fileType: type, pageIndex, req: reqParams } = params;
6172
6673
  if (!type) {
6173
6674
  type = EFileType.All;
6174
6675
  }
@@ -6192,7 +6693,9 @@ var ImportedFile;
6192
6693
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
6193
6694
  try {
6194
6695
  const data = yield req;
6195
- res(data.Items);
6696
+ res({
6697
+ importedFiles: data.Items
6698
+ });
6196
6699
  }
6197
6700
  catch (e) {
6198
6701
  rej(e);
@@ -6203,15 +6706,26 @@ var ImportedFile;
6203
6706
  });
6204
6707
  }
6205
6708
  ImportedFile.GetList = GetList;
6206
- function Get(api, fileId, reqParams) {
6709
+ function Get(params) {
6207
6710
  return __awaiter(this, void 0, void 0, function* () {
6711
+ const { api, importedFileId: fileId, req: reqParams } = params;
6208
6712
  const cacheData = api.GetCacheItem(GetCacheKey(fileId), reqParams);
6209
6713
  if (cacheData) {
6210
6714
  return cacheData;
6211
6715
  }
6212
- const req = api.GET(`entityImportFile/${fileId}`, Api.PrepReqParams(reqParams));
6213
- api.Cache.Set(GetCacheKey(fileId), req, Api.DEFAULT_CACHE_DURATION);
6214
- return req;
6716
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
6717
+ try {
6718
+ const data = yield api.GET(`entityImportFile/${fileId}`, Api.PrepReqParams(reqParams));
6719
+ res({
6720
+ importedFile: data
6721
+ });
6722
+ }
6723
+ catch (e) {
6724
+ rej(e);
6725
+ }
6726
+ }));
6727
+ api.Cache.Set(GetCacheKey(fileId), prom, Api.DEFAULT_CACHE_DURATION);
6728
+ return prom;
6215
6729
  });
6216
6730
  }
6217
6731
  ImportedFile.Get = Get;
@@ -6295,105 +6809,106 @@ var Markup;
6295
6809
  type: EType.Default
6296
6810
  };
6297
6811
  })(Div = Markup.Div || (Markup.Div = {}));
6298
- let Drawing;
6299
- (function (Drawing) {
6812
+ let Line;
6813
+ (function (Line) {
6300
6814
  // Describes a line end's head.
6301
- let EHeadStyle;
6302
- (function (EHeadStyle) {
6303
- EHeadStyle["None"] = "NONE";
6304
- EHeadStyle["Circle"] = "CIRCLE";
6305
- EHeadStyle["Arrow"] = "ARROW";
6306
- })(EHeadStyle = Drawing.EHeadStyle || (Drawing.EHeadStyle = {}));
6307
- let Line;
6308
- (function (Line) {
6309
- // Dictates where on a DIV an anchor should snap to.
6310
- let EAnchorDivSide;
6311
- (function (EAnchorDivSide) {
6312
- EAnchorDivSide[EAnchorDivSide["TopLeft"] = 0] = "TopLeft";
6313
- EAnchorDivSide[EAnchorDivSide["TopRight"] = 1] = "TopRight";
6314
- EAnchorDivSide[EAnchorDivSide["BottomLeft"] = 2] = "BottomLeft";
6315
- EAnchorDivSide[EAnchorDivSide["BottomRight"] = 3] = "BottomRight";
6316
- EAnchorDivSide[EAnchorDivSide["Center"] = 4] = "Center";
6317
- EAnchorDivSide[EAnchorDivSide["CenterLeft"] = 5] = "CenterLeft";
6318
- EAnchorDivSide[EAnchorDivSide["CenterRight"] = 6] = "CenterRight";
6319
- EAnchorDivSide[EAnchorDivSide["CenterTop"] = 7] = "CenterTop";
6320
- EAnchorDivSide[EAnchorDivSide["CenterBottom"] = 8] = "CenterBottom";
6321
- })(EAnchorDivSide = Line.EAnchorDivSide || (Line.EAnchorDivSide = {}));
6322
- // Dictates what end of the line an anchor should render on.
6323
- let EAnchorLineSide;
6324
- (function (EAnchorLineSide) {
6325
- EAnchorLineSide[EAnchorLineSide["Start"] = 0] = "Start";
6326
- EAnchorLineSide[EAnchorLineSide["End"] = 1] = "End";
6327
- })(EAnchorLineSide = Line.EAnchorLineSide || (Line.EAnchorLineSide = {}));
6328
- Line.DEFAULT = {
6329
- brushColor: "rgba(255, 255, 255, 1)",
6330
- brushSize: 4,
6331
- path: null,
6332
- pathType: "LINE",
6333
- transform: null,
6334
- snaps: null,
6335
- id: null
6336
- };
6337
- })(Line = Drawing.Line || (Drawing.Line = {}));
6338
- let FreePaint;
6339
- (function (FreePaint) {
6340
- FreePaint.DEFAULT = {
6341
- brushColor: "rgba(255, 255, 255, 1)",
6342
- brushSize: 4,
6343
- path: null,
6344
- pathType: "PLAIN",
6345
- transform: null,
6346
- id: null
6347
- };
6348
- })(FreePaint = Drawing.FreePaint || (Drawing.FreePaint = {}));
6349
- })(Drawing = Markup.Drawing || (Markup.Drawing = {}));
6350
- let Entity3d;
6351
- (function (Entity3d) {
6352
- let Polygon;
6353
- (function (Polygon) {
6354
- // Determines if terrain and 3d models should be overlapped or not.
6355
- let EClassificationType;
6356
- (function (EClassificationType) {
6357
- // 3d models and terrain are overlapped.
6358
- EClassificationType["Both"] = "BOTH";
6359
- // Only terrain is overlapped.
6360
- EClassificationType["Terrain"] = "TERRAIN";
6361
- })(EClassificationType = Polygon.EClassificationType || (Polygon.EClassificationType = {}));
6362
- Polygon.DEFAULT = {
6363
- type: "POLYGON",
6364
- id: null,
6365
- positions: null,
6366
- color: "rgba(254, 234, 57, 0.54)",
6367
- outlineColor: "rgba(215, 215, 215, 0)",
6368
- outlineWidth: 2,
6369
- extrudedHeight: 0,
6370
- classificationType: EClassificationType.Both,
6371
- smoothen: 0
6372
- };
6373
- })(Polygon = Entity3d.Polygon || (Entity3d.Polygon = {}));
6374
- let Polyline;
6375
- (function (Polyline) {
6376
- Polyline.DEFAULT = {
6377
- type: "POLYLINE",
6378
- id: null,
6379
- positions: null,
6380
- color: "rgba(254, 234, 57, 0.54)",
6381
- outlineWidth: 4,
6382
- smoothen: 0
6383
- };
6384
- })(Polyline = Entity3d.Polyline || (Entity3d.Polyline = {}));
6385
- let Circle;
6386
- (function (Circle) {
6387
- Circle.DEFAULT = {
6388
- type: "CIRCLE",
6389
- id: null,
6390
- position: null,
6391
- radius: 50,
6392
- color: "rgba(254, 234, 57, 0.54)"
6393
- };
6394
- })(Circle = Entity3d.Circle || (Entity3d.Circle = {}));
6395
- })(Entity3d = Markup.Entity3d || (Markup.Entity3d = {}));
6815
+ let ELineHead;
6816
+ (function (ELineHead) {
6817
+ ELineHead["None"] = "NONE";
6818
+ ELineHead["Circle"] = "CIRCLE";
6819
+ ELineHead["Arrow"] = "ARROW";
6820
+ })(ELineHead = Line.ELineHead || (Line.ELineHead = {}));
6821
+ // Dictates where on a DIV an anchor should snap to.
6822
+ let EAnchorDivSide;
6823
+ (function (EAnchorDivSide) {
6824
+ EAnchorDivSide[EAnchorDivSide["TopLeft"] = 0] = "TopLeft";
6825
+ EAnchorDivSide[EAnchorDivSide["TopRight"] = 1] = "TopRight";
6826
+ EAnchorDivSide[EAnchorDivSide["BottomLeft"] = 2] = "BottomLeft";
6827
+ EAnchorDivSide[EAnchorDivSide["BottomRight"] = 3] = "BottomRight";
6828
+ EAnchorDivSide[EAnchorDivSide["Center"] = 4] = "Center";
6829
+ EAnchorDivSide[EAnchorDivSide["CenterLeft"] = 5] = "CenterLeft";
6830
+ EAnchorDivSide[EAnchorDivSide["CenterRight"] = 6] = "CenterRight";
6831
+ EAnchorDivSide[EAnchorDivSide["CenterTop"] = 7] = "CenterTop";
6832
+ EAnchorDivSide[EAnchorDivSide["CenterBottom"] = 8] = "CenterBottom";
6833
+ })(EAnchorDivSide = Line.EAnchorDivSide || (Line.EAnchorDivSide = {}));
6834
+ // Dictates what end of the line an anchor should render on.
6835
+ let EAnchorLineSide;
6836
+ (function (EAnchorLineSide) {
6837
+ EAnchorLineSide[EAnchorLineSide["Start"] = 0] = "Start";
6838
+ EAnchorLineSide[EAnchorLineSide["End"] = 1] = "End";
6839
+ })(EAnchorLineSide = Line.EAnchorLineSide || (Line.EAnchorLineSide = {}));
6840
+ Line.DEFAULT = {
6841
+ brushColor: "rgba(255, 255, 255, 1)",
6842
+ brushSize: 4,
6843
+ path: null,
6844
+ pathType: "LINE",
6845
+ transform: null,
6846
+ snaps: null,
6847
+ id: null
6848
+ };
6849
+ })(Line = Markup.Line || (Markup.Line = {}));
6850
+ let FreePaint;
6851
+ (function (FreePaint) {
6852
+ // Describes a free-paint end's head.
6853
+ let EPaintHead;
6854
+ (function (EPaintHead) {
6855
+ EPaintHead["None"] = "NONE";
6856
+ EPaintHead["Circle"] = "CIRCLE";
6857
+ EPaintHead["Arrow"] = "ARROW";
6858
+ })(EPaintHead = FreePaint.EPaintHead || (FreePaint.EPaintHead = {}));
6859
+ FreePaint.DEFAULT = {
6860
+ brushColor: "rgba(255, 255, 255, 1)",
6861
+ brushSize: 4,
6862
+ path: null,
6863
+ pathType: "PLAIN",
6864
+ transform: null,
6865
+ id: null
6866
+ };
6867
+ })(FreePaint = Markup.FreePaint || (Markup.FreePaint = {}));
6868
+ let Polygon;
6869
+ (function (Polygon) {
6870
+ // Determines if terrain and 3d models should be overlapped or not.
6871
+ let EClassificationType;
6872
+ (function (EClassificationType) {
6873
+ // 3d models and terrain are overlapped.
6874
+ EClassificationType["Both"] = "BOTH";
6875
+ // Only terrain is overlapped.
6876
+ EClassificationType["Terrain"] = "TERRAIN";
6877
+ })(EClassificationType = Polygon.EClassificationType || (Polygon.EClassificationType = {}));
6878
+ Polygon.DEFAULT = {
6879
+ type: "POLYGON",
6880
+ id: null,
6881
+ positions: null,
6882
+ color: "rgba(254, 234, 57, 0.54)",
6883
+ outlineColor: "rgba(215, 215, 215, 0)",
6884
+ outlineWidth: 2,
6885
+ extrudedHeight: 0,
6886
+ classificationType: EClassificationType.Both,
6887
+ smoothen: 0
6888
+ };
6889
+ })(Polygon = Markup.Polygon || (Markup.Polygon = {}));
6890
+ let Polyline;
6891
+ (function (Polyline) {
6892
+ Polyline.DEFAULT = {
6893
+ type: "POLYLINE",
6894
+ id: null,
6895
+ positions: null,
6896
+ color: "rgba(254, 234, 57, 0.54)",
6897
+ outlineWidth: 4,
6898
+ smoothen: 0
6899
+ };
6900
+ })(Polyline = Markup.Polyline || (Markup.Polyline = {}));
6901
+ let Circle;
6902
+ (function (Circle) {
6903
+ Circle.DEFAULT = {
6904
+ type: "CIRCLE",
6905
+ id: null,
6906
+ position: null,
6907
+ radius: 50,
6908
+ color: "rgba(254, 234, 57, 0.54)"
6909
+ };
6910
+ })(Circle = Markup.Circle || (Markup.Circle = {}));
6396
6911
  })(Markup || (Markup = {}));
6397
6912
 
6398
- export { AnnDocument, CustomForm, CustomFormContent, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, PendingAction, MessageBroker, Style, TilesetEntitiesMapTiles, TilesetExtMapTiles, Tileset, Permission, Session, UserGroup, User, Account, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup };
6913
+ export { AnnDocument, CustomForm, CustomFormContent, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, PendingAction, MessageBroker, Style, Tileset, Permission, Session, UserGroup, User, Account, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup };
6399
6914
  //# sourceMappingURL=bruce-models.es5.js.map