bruce-models 1.3.7 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/bruce-models.es5.js +1195 -676
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +1194 -673
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/account/account.js +35 -26
  6. package/dist/lib/account/account.js.map +1 -1
  7. package/dist/lib/ann-document/ann-document.js +20 -6
  8. package/dist/lib/ann-document/ann-document.js.map +1 -1
  9. package/dist/lib/api/abstract-api.js +20 -13
  10. package/dist/lib/api/abstract-api.js.map +1 -1
  11. package/dist/lib/api/api.js +0 -4
  12. package/dist/lib/api/api.js.map +1 -1
  13. package/dist/lib/api/bruce-api.js +5 -1
  14. package/dist/lib/api/bruce-api.js.map +1 -1
  15. package/dist/lib/bruce-models.js +0 -8
  16. package/dist/lib/bruce-models.js.map +1 -1
  17. package/dist/lib/calculator/calculator.js +12 -3
  18. package/dist/lib/calculator/calculator.js.map +1 -1
  19. package/dist/lib/client-file/client-file.js +77 -50
  20. package/dist/lib/client-file/client-file.js.map +1 -1
  21. package/dist/lib/common/bruce-variable.js +6 -2
  22. package/dist/lib/common/bruce-variable.js.map +1 -1
  23. package/dist/lib/common/geometry.js +5 -5
  24. package/dist/lib/common/geometry.js.map +1 -1
  25. package/dist/lib/custom-form/custom-form.js +28 -10
  26. package/dist/lib/custom-form/custom-form.js.map +1 -1
  27. package/dist/lib/data-lab/data-lab.js +26 -26
  28. package/dist/lib/data-lab/data-lab.js.map +1 -1
  29. package/dist/lib/entity/entity-attachment-type.js +13 -6
  30. package/dist/lib/entity/entity-attachment-type.js.map +1 -1
  31. package/dist/lib/entity/entity-attachment.js +23 -11
  32. package/dist/lib/entity/entity-attachment.js.map +1 -1
  33. package/dist/lib/entity/entity-comment.js +13 -6
  34. package/dist/lib/entity/entity-comment.js.map +1 -1
  35. package/dist/lib/entity/entity-coords.js +47 -14
  36. package/dist/lib/entity/entity-coords.js.map +1 -1
  37. package/dist/lib/entity/entity-link.js +13 -6
  38. package/dist/lib/entity/entity-link.js.map +1 -1
  39. package/dist/lib/entity/entity-lod-category.js +18 -8
  40. package/dist/lib/entity/entity-lod-category.js.map +1 -1
  41. package/dist/lib/entity/entity-lod.js +32 -18
  42. package/dist/lib/entity/entity-lod.js.map +1 -1
  43. package/dist/lib/entity/entity-relation-type.js +28 -10
  44. package/dist/lib/entity/entity-relation-type.js.map +1 -1
  45. package/dist/lib/entity/entity-relation.js +35 -17
  46. package/dist/lib/entity/entity-relation.js.map +1 -1
  47. package/dist/lib/entity/entity-source.js +31 -9
  48. package/dist/lib/entity/entity-source.js.map +1 -1
  49. package/dist/lib/entity/entity-tag.js +28 -11
  50. package/dist/lib/entity/entity-tag.js.map +1 -1
  51. package/dist/lib/entity/entity-type.js +28 -10
  52. package/dist/lib/entity/entity-type.js.map +1 -1
  53. package/dist/lib/entity/entity.js +93 -68
  54. package/dist/lib/entity/entity.js.map +1 -1
  55. package/dist/lib/entity/getters/entity-filter-getter.js +17 -14
  56. package/dist/lib/entity/getters/entity-filter-getter.js.map +1 -1
  57. package/dist/lib/import/import-cad.js +6 -4
  58. package/dist/lib/import/import-cad.js.map +1 -1
  59. package/dist/lib/import/import-csv.js +3 -2
  60. package/dist/lib/import/import-csv.js.map +1 -1
  61. package/dist/lib/import/import-json.js +3 -2
  62. package/dist/lib/import/import-json.js.map +1 -1
  63. package/dist/lib/import/import-kml.js +3 -2
  64. package/dist/lib/import/import-kml.js.map +1 -1
  65. package/dist/lib/import/imported-file.js +20 -6
  66. package/dist/lib/import/imported-file.js.map +1 -1
  67. package/dist/lib/markup/markup.js +98 -97
  68. package/dist/lib/markup/markup.js.map +1 -1
  69. package/dist/lib/program-key/program-key.js +28 -10
  70. package/dist/lib/program-key/program-key.js.map +1 -1
  71. package/dist/lib/project/menu-item.js.map +1 -1
  72. package/dist/lib/project/project-view-bookmark.js +41 -20
  73. package/dist/lib/project/project-view-bookmark.js.map +1 -1
  74. package/dist/lib/project/project-view-legacy-tile.js +15 -5
  75. package/dist/lib/project/project-view-legacy-tile.js.map +1 -1
  76. package/dist/lib/project/project-view.js +38 -20
  77. package/dist/lib/project/project-view.js.map +1 -1
  78. package/dist/lib/server/pending-action.js +17 -7
  79. package/dist/lib/server/pending-action.js.map +1 -1
  80. package/dist/lib/server/task.js +11 -6
  81. package/dist/lib/server/task.js.map +1 -1
  82. package/dist/lib/style/style.js +31 -13
  83. package/dist/lib/style/style.js.map +1 -1
  84. package/dist/lib/tileset/tileset.js +90 -30
  85. package/dist/lib/tileset/tileset.js.map +1 -1
  86. package/dist/lib/user/session.js +37 -13
  87. package/dist/lib/user/session.js.map +1 -1
  88. package/dist/lib/user/user-group.js +29 -12
  89. package/dist/lib/user/user-group.js.map +1 -1
  90. package/dist/lib/user/user.js +79 -44
  91. package/dist/lib/user/user.js.map +1 -1
  92. package/dist/lib/util/url-utils.js +3 -3
  93. package/dist/lib/util/url-utils.js.map +1 -1
  94. package/dist/types/account/account.d.ts +49 -17
  95. package/dist/types/ann-document/ann-document.d.ts +14 -2
  96. package/dist/types/api/api.d.ts +2 -3
  97. package/dist/types/bruce-models.d.ts +0 -8
  98. package/dist/types/client-file/client-file.d.ts +81 -45
  99. package/dist/types/common/bruce-variable.d.ts +5 -1
  100. package/dist/types/common/geometry.d.ts +1 -1
  101. package/dist/types/custom-form/custom-form.d.ts +26 -4
  102. package/dist/types/data-lab/data-lab.d.ts +10 -3
  103. package/dist/types/entity/entity-attachment-type.d.ts +18 -3
  104. package/dist/types/entity/entity-attachment.d.ts +42 -6
  105. package/dist/types/entity/entity-comment.d.ts +20 -3
  106. package/dist/types/entity/entity-coords.d.ts +33 -5
  107. package/dist/types/entity/entity-link.d.ts +20 -3
  108. package/dist/types/entity/entity-lod-category.d.ts +25 -4
  109. package/dist/types/entity/entity-lod.d.ts +51 -11
  110. package/dist/types/entity/entity-relation-type.d.ts +25 -4
  111. package/dist/types/entity/entity-relation.d.ts +28 -5
  112. package/dist/types/entity/entity-source.d.ts +24 -3
  113. package/dist/types/entity/entity-tag.d.ts +33 -5
  114. package/dist/types/entity/entity-type.d.ts +25 -4
  115. package/dist/types/entity/entity.d.ts +72 -29
  116. package/dist/types/import/import-cad.d.ts +10 -2
  117. package/dist/types/import/import-csv.d.ts +5 -1
  118. package/dist/types/import/import-json.d.ts +5 -1
  119. package/dist/types/import/import-kml.d.ts +5 -1
  120. package/dist/types/import/imported-file.d.ts +15 -2
  121. package/dist/types/markup/markup.d.ts +105 -106
  122. package/dist/types/program-key/program-key.d.ts +25 -4
  123. package/dist/types/project/menu-item.d.ts +2 -1
  124. package/dist/types/project/project-view-bookmark.d.ts +52 -16
  125. package/dist/types/project/project-view-legacy-tile.d.ts +16 -2
  126. package/dist/types/project/project-view.d.ts +46 -18
  127. package/dist/types/server/pending-action.d.ts +24 -3
  128. package/dist/types/server/task.d.ts +15 -2
  129. package/dist/types/style/style.d.ts +25 -4
  130. package/dist/types/tileset/tileset.d.ts +183 -24
  131. package/dist/types/user/session.d.ts +36 -7
  132. package/dist/types/user/user-group.d.ts +44 -6
  133. package/dist/types/user/user.d.ts +102 -29
  134. package/package.json +1 -1
  135. package/dist/lib/tileset/tileset-cad.js +0 -3
  136. package/dist/lib/tileset/tileset-cad.js.map +0 -1
  137. package/dist/lib/tileset/tileset-entities-map-tiles.js +0 -19
  138. package/dist/lib/tileset/tileset-entities-map-tiles.js.map +0 -1
  139. package/dist/lib/tileset/tileset-entities.js +0 -3
  140. package/dist/lib/tileset/tileset-entities.js.map +0 -1
  141. package/dist/lib/tileset/tileset-ext-map-tiles.js +0 -18
  142. package/dist/lib/tileset/tileset-ext-map-tiles.js.map +0 -1
  143. package/dist/lib/tileset/tileset-ext-terrain-tiles.js +0 -3
  144. package/dist/lib/tileset/tileset-ext-terrain-tiles.js.map +0 -1
  145. package/dist/lib/tileset/tileset-map-tiles.js +0 -3
  146. package/dist/lib/tileset/tileset-map-tiles.js.map +0 -1
  147. package/dist/lib/tileset/tileset-pointcloud.js +0 -3
  148. package/dist/lib/tileset/tileset-pointcloud.js.map +0 -1
  149. package/dist/lib/tileset/tileset-terrain-tiles.js +0 -3
  150. package/dist/lib/tileset/tileset-terrain-tiles.js.map +0 -1
  151. package/dist/types/tileset/tileset-cad.d.ts +0 -25
  152. package/dist/types/tileset/tileset-entities-map-tiles.d.ts +0 -23
  153. package/dist/types/tileset/tileset-entities.d.ts +0 -18
  154. package/dist/types/tileset/tileset-ext-map-tiles.d.ts +0 -21
  155. package/dist/types/tileset/tileset-ext-terrain-tiles.d.ts +0 -10
  156. package/dist/types/tileset/tileset-map-tiles.d.ts +0 -14
  157. package/dist/types/tileset/tileset-pointcloud.d.ts +0 -20
  158. package/dist/types/tileset/tileset-terrain-tiles.d.ts +0 -10
@@ -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
  }
@@ -1504,7 +1564,9 @@ var Entity;
1504
1564
  try {
1505
1565
  const data = yield req;
1506
1566
  const item = data.Items.find(x => x.Bruce.ID == entityId);
1507
- res(item);
1567
+ res({
1568
+ entity: item
1569
+ });
1508
1570
  }
1509
1571
  catch (e) {
1510
1572
  // No showing error as we don't want to see it 2000 times.
@@ -1515,12 +1577,15 @@ var Entity;
1515
1577
  reqs.push(prom);
1516
1578
  }
1517
1579
  }
1518
- return (yield Promise.all(reqs)).filter(x => !!x);
1580
+ return {
1581
+ entities: (yield Promise.all(reqs)).map(x => x === null || x === void 0 ? void 0 : x.entity).filter(x => !!x)
1582
+ };
1519
1583
  });
1520
1584
  }
1521
1585
  Entity.GetListByIds = GetListByIds;
1522
- function Delete(api, entityId, reqParams) {
1586
+ function Delete(params) {
1523
1587
  return __awaiter(this, void 0, void 0, function* () {
1588
+ const { api, entityId, req: reqParams } = params;
1524
1589
  if (!entityId) {
1525
1590
  throw ("Entity ID is required.");
1526
1591
  }
@@ -1529,8 +1594,9 @@ var Entity;
1529
1594
  });
1530
1595
  }
1531
1596
  Entity.Delete = Delete;
1532
- function DeleteList(api, entityIds, reqParams) {
1597
+ function DeleteList(params) {
1533
1598
  return __awaiter(this, void 0, void 0, function* () {
1599
+ const { api, entityIds, req: reqParams } = params;
1534
1600
  if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
1535
1601
  throw ("Entity IDs are required.");
1536
1602
  }
@@ -1544,9 +1610,10 @@ var Entity;
1544
1610
  });
1545
1611
  }
1546
1612
  Entity.DeleteList = DeleteList;
1547
- function Update(api, data, override, reqParams) {
1613
+ function Update(params) {
1548
1614
  var _a, _b;
1549
1615
  return __awaiter(this, void 0, void 0, function* () {
1616
+ const { api, entity: data, override, req: reqParams } = params;
1550
1617
  if (!((_a = data === null || data === void 0 ? void 0 : data.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"])) {
1551
1618
  throw ("Entity Type ID is required.");
1552
1619
  }
@@ -1554,14 +1621,17 @@ var Entity;
1554
1621
  data.Bruce = Object.assign(Object.assign({}, data.Bruce), { ID: ObjectUtils.UId() });
1555
1622
  }
1556
1623
  const reqUrl = `entity/${data.Bruce.ID}/?dataoverride=${override}&BruceEntityType=${data.Bruce["EntityType.ID"]}`;
1557
- data = yield api.POST(reqUrl, data, Api.PrepReqParams(reqParams));
1624
+ const res = yield api.POST(reqUrl, data, Api.PrepReqParams(reqParams));
1558
1625
  api.Cache.Remove(GetCacheKey(data.Bruce.ID));
1559
- return data;
1626
+ return {
1627
+ entity: res
1628
+ };
1560
1629
  });
1561
1630
  }
1562
1631
  Entity.Update = Update;
1563
- function RemoveTag(data, tagId) {
1632
+ function RemoveTag(params) {
1564
1633
  var _a;
1634
+ const { entity: data, tagId } = params;
1565
1635
  const tags = (_a = data.Bruce["Layer.ID"]) !== null && _a !== void 0 ? _a : [];
1566
1636
  const index = tags.indexOf(tagId);
1567
1637
  if (index >= 0) {
@@ -1570,8 +1640,9 @@ var Entity;
1570
1640
  }
1571
1641
  }
1572
1642
  Entity.RemoveTag = RemoveTag;
1573
- function AddTag(data, tagId) {
1643
+ function AddTag(params) {
1574
1644
  var _a;
1645
+ const { entity: data, tagId } = params;
1575
1646
  const tags = (_a = data.Bruce["Layer.ID"]) !== null && _a !== void 0 ? _a : [];
1576
1647
  if (!tags.includes(tagId)) {
1577
1648
  tags.push(tagId);
@@ -1579,7 +1650,8 @@ var Entity;
1579
1650
  }
1580
1651
  }
1581
1652
  Entity.AddTag = AddTag;
1582
- function SetValue(data, path, value) {
1653
+ function SetValue(params) {
1654
+ const { entity: data, path, value } = params;
1583
1655
  let curData = data;
1584
1656
  for (let i = 0; i < path.length; i++) {
1585
1657
  const step = path[i];
@@ -1594,8 +1666,9 @@ var Entity;
1594
1666
  }
1595
1667
  }
1596
1668
  Entity.SetValue = SetValue;
1597
- function GetValue(data, path) {
1669
+ function GetValue(params) {
1598
1670
  var _a;
1671
+ const { entity: data, path } = params;
1599
1672
  // Backwards compatibility.
1600
1673
  if (path.length == 1 && path[0] == "ID") {
1601
1674
  return (_a = data.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
@@ -1616,21 +1689,23 @@ var Entity;
1616
1689
  Entity.GetValue = GetValue;
1617
1690
  /**
1618
1691
  * Calculates an entity's name based on attribute priority set in the type.
1619
- * @param entity
1620
- * @param type
1621
- * @param defaultToId
1692
+ * @param params
1622
1693
  * If true, will return the entity ID if no name can be calculated.
1623
1694
  * Otherwise it returns null.
1624
1695
  * @returns
1625
1696
  */
1626
- function CalculateName(entity, type, defaultToId) {
1697
+ function CalculateName(params) {
1698
+ const { entity, type, defaultToId = true } = params;
1627
1699
  const attrStr = type.DisplayNameAttributePath;
1628
1700
  if (attrStr) {
1629
1701
  const attrPaths = attrStr.split(",");
1630
1702
  for (let i = 0; i < attrPaths.length; i++) {
1631
1703
  const pathStr = attrPaths[i];
1632
1704
  const path = PathUtils.Parse(pathStr);
1633
- const name = Entity.GetValue(entity, path);
1705
+ const name = Entity.GetValue({
1706
+ entity: entity,
1707
+ path
1708
+ });
1634
1709
  if (name && typeof name != "object") {
1635
1710
  return name;
1636
1711
  }
@@ -1639,54 +1714,52 @@ var Entity;
1639
1714
  return defaultToId ? entity.Bruce.ID : null;
1640
1715
  }
1641
1716
  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
- });
1717
+ function GetList(params) {
1718
+ return __awaiter(this, void 0, void 0, function* () {
1719
+ const { api, filter, req: reqParams } = params;
1720
+ let requestFilter = {};
1721
+ if (filter.entityTypeConditions) {
1722
+ requestFilter = Object.assign({}, filter.entityTypeConditions);
1723
+ }
1724
+ if (filter.layerIds != null && filter.layerIds.length > 0) {
1725
+ requestFilter["Bruce.Layer.ID"] = {
1726
+ equals: filter.layerIds
1727
+ };
1685
1728
  }
1686
- V1.GetList = GetList;
1687
- })(V1 = Filter.V1 || (Filter.V1 = {}));
1688
- // TODO: Helpers for constructing the filter.
1689
- })(Filter = Entity.Filter || (Entity.Filter = {}));
1729
+ if (filter.bounds) {
1730
+ requestFilter["geometry"] = {
1731
+ "intersects": [
1732
+ filter.bounds.south,
1733
+ filter.bounds.north,
1734
+ filter.bounds.west,
1735
+ filter.bounds.east
1736
+ ]
1737
+ };
1738
+ }
1739
+ const body = {
1740
+ SortOrder: filter.sortOrder == Api.ESortOrder.Asc ? "ASC" : "DESC",
1741
+ OrderBy: filter.orderBy,
1742
+ Filter: requestFilter,
1743
+ LODType: filter.lodCategoryId,
1744
+ BruceEntityType: filter.entityTypeId,
1745
+ PageIndex: filter.pageIndex,
1746
+ PageSize: filter.pageSize
1747
+ };
1748
+ const data = yield api.POST("entities", body, Api.PrepReqParams(reqParams));
1749
+ const entities = data.Items;
1750
+ for (let i = 0; i < entities.length; i++) {
1751
+ const entity = entities[i];
1752
+ const id = entity.Bruce.ID;
1753
+ api.Cache.Set(GetCacheKey(id), {
1754
+ entity: entity
1755
+ }, Api.DEFAULT_CACHE_DURATION);
1756
+ }
1757
+ return {
1758
+ entities: entities
1759
+ };
1760
+ });
1761
+ }
1762
+ Entity.GetList = GetList;
1690
1763
  })(Entity || (Entity = {}));
1691
1764
 
1692
1765
  function getVariable(str) {
@@ -1716,7 +1789,8 @@ var BruceVariable;
1716
1789
  * @param legacyParse
1717
1790
  * @returns
1718
1791
  */
1719
- function SwapValues(str, data, legacyParse) {
1792
+ function SwapValues(params) {
1793
+ let { str, entity: data, legacyParse } = params;
1720
1794
  if (!legacyParse) {
1721
1795
  legacyParse = false;
1722
1796
  }
@@ -1726,7 +1800,10 @@ var BruceVariable;
1726
1800
  const path = legacyParse ? PathUtils.ParseLegacy(variable.path) : PathUtils.Parse(variable.path);
1727
1801
  let value = "";
1728
1802
  if (path.length > 0) {
1729
- value = Entity.GetValue(data, path);
1803
+ value = Entity.GetValue({
1804
+ entity: data,
1805
+ path: path
1806
+ });
1730
1807
  }
1731
1808
  str = str.replace(variable.text, value);
1732
1809
  }
@@ -1881,7 +1958,10 @@ var Calculator;
1881
1958
  Calculator.GetColor = GetColor;
1882
1959
  function GetMappingValue(value, entity) {
1883
1960
  const attrPath = parseLegacyPath(value.field);
1884
- const eValue = Entity.GetValue(entity, attrPath);
1961
+ let eValue = Entity.GetValue({
1962
+ entity: entity,
1963
+ path: attrPath
1964
+ });
1885
1965
  const isValueNum = !isNaN(+eValue);
1886
1966
  for (let i = 0; i < value.values.length; i++) {
1887
1967
  const option = value.values[i];
@@ -1922,7 +2002,10 @@ var Calculator;
1922
2002
  Calculator.GetMappingValue = GetMappingValue;
1923
2003
  function GetGradientValue(value, entity) {
1924
2004
  const attrPath = parseLegacyPath(value.field);
1925
- let eValue = Entity.GetValue(entity, attrPath);
2005
+ let eValue = Entity.GetValue({
2006
+ entity: entity,
2007
+ path: attrPath
2008
+ });
1926
2009
  eValue = Math.min(Math.max(eValue, value.min), value.max);
1927
2010
  if (eValue < value.points[0].position) {
1928
2011
  return Color.ColorFromStr(value.points[0].color);
@@ -1951,7 +2034,10 @@ var Calculator;
1951
2034
  function GetInputValue(value, entity) {
1952
2035
  if (typeof value == "string") {
1953
2036
  try {
1954
- value = BruceVariable.SwapValues(value, entity);
2037
+ value = BruceVariable.SwapValues({
2038
+ str: value,
2039
+ entity: entity
2040
+ });
1955
2041
  const eval2 = eval; // https://rollupjs.org/guide/en/#avoiding-eval
1956
2042
  return eval2(value);
1957
2043
  }
@@ -2019,17 +2105,17 @@ var Geometry;
2019
2105
  return filteredList;
2020
2106
  }
2021
2107
  Geometry.RemoveRepeatPoints = RemoveRepeatPoints;
2022
- function ParsePoints(data) {
2023
- data = data.replace(/[^\d.,-\s]/g, "");
2108
+ function ParsePoints(pointsStr) {
2109
+ pointsStr = pointsStr.replace(/[^\d.,-\s]/g, "");
2024
2110
  let splitterCoordinates = " ";
2025
2111
  let splitterAxis = ",";
2026
- const commaIndex = data.indexOf(",");
2027
- const spaceIndex = data.indexOf(" ");
2112
+ const commaIndex = pointsStr.indexOf(",");
2113
+ const spaceIndex = pointsStr.indexOf(" ");
2028
2114
  if ((spaceIndex > -1 && commaIndex > spaceIndex) || commaIndex <= -1) {
2029
2115
  splitterCoordinates = ",";
2030
2116
  splitterAxis = " ";
2031
2117
  }
2032
- let points = data.trim().split(splitterCoordinates);
2118
+ let points = pointsStr.trim().split(splitterCoordinates);
2033
2119
  points = points.filter(a => a != "");
2034
2120
  const result = [];
2035
2121
  for (let i = 0; i < points.length; i++) {
@@ -2488,8 +2574,9 @@ var EntityAttachmentType;
2488
2574
  EType["Photo"] = "photo";
2489
2575
  EType["Document"] = "document";
2490
2576
  })(EType = EntityAttachmentType.EType || (EntityAttachmentType.EType = {}));
2491
- function Delete(api, id, reqParams) {
2577
+ function Delete(params) {
2492
2578
  return __awaiter(this, void 0, void 0, function* () {
2579
+ const { api, attachmentTypeId: id, req: reqParams } = params;
2493
2580
  if (!id) {
2494
2581
  throw ("Type ID is required.");
2495
2582
  }
@@ -2499,20 +2586,24 @@ var EntityAttachmentType;
2499
2586
  });
2500
2587
  }
2501
2588
  EntityAttachmentType.Delete = Delete;
2502
- function Update(api, data, reqParams) {
2589
+ function Update(params) {
2503
2590
  return __awaiter(this, void 0, void 0, function* () {
2591
+ const { api, attachmentType: data, req: reqParams } = params;
2504
2592
  if (!(data === null || data === void 0 ? void 0 : data.ID)) {
2505
2593
  throw ("Type ID is required.");
2506
2594
  }
2507
- data = yield api.POST(`entityAttachmentType/${data.ID}`, data, Api.PrepReqParams(reqParams));
2595
+ const res = yield api.POST(`entityAttachmentType/${data.ID}`, data, Api.PrepReqParams(reqParams));
2508
2596
  api.Cache.Remove(GetCacheKey(data.ID));
2509
2597
  api.Cache.Remove(GetListCacheKey());
2510
- return data;
2598
+ return {
2599
+ attachmentType: res
2600
+ };
2511
2601
  });
2512
2602
  }
2513
2603
  EntityAttachmentType.Update = Update;
2514
- function GetList(api, reqParams) {
2604
+ function GetList(params) {
2515
2605
  return __awaiter(this, void 0, void 0, function* () {
2606
+ const { api, reqParams } = params;
2516
2607
  const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
2517
2608
  if (cacheData) {
2518
2609
  return cacheData;
@@ -2520,7 +2611,9 @@ var EntityAttachmentType;
2520
2611
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2521
2612
  try {
2522
2613
  const data = yield api.GET(`entityAttachmentTypes`, Api.PrepReqParams(reqParams));
2523
- res(data.Items);
2614
+ res({
2615
+ attachmentTypes: data.Items
2616
+ });
2524
2617
  }
2525
2618
  catch (e) {
2526
2619
  rej(e);
@@ -2548,21 +2641,25 @@ var EntityAttachment;
2548
2641
  return Api.ECacheKey.Attachment + Api.ECacheKey.Entity + Api.ECacheKey.Id + entityId;
2549
2642
  }
2550
2643
  EntityAttachment.GetListCacheKey = GetListCacheKey;
2551
- function Update(api, data, reqParams) {
2644
+ function Update(params) {
2552
2645
  return __awaiter(this, void 0, void 0, function* () {
2646
+ const { api, attachment: data, req: reqParams } = params;
2553
2647
  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
2648
  throw ("Entity ID, Type ID, and File ID are required.");
2555
2649
  }
2556
2650
  const url = `entity/${data["Entity.ID"]}/attachment/${data.oldAttachmentTypeId}/${data["ClientFile.ID"]}`;
2557
- data = yield api.PUT(url, data, Api.PrepReqParams(reqParams));
2651
+ const res = yield api.PUT(url, data, Api.PrepReqParams(reqParams));
2558
2652
  api.Cache.Remove(GetCacheKey(data["Entity.ID"], data["EntityAttachmentType.ID"], data["ClientFile.ID"]));
2559
2653
  api.Cache.RemoveByStartsWith(GetListCacheKey(data["Entity.ID"]));
2560
- return data;
2654
+ return {
2655
+ attachment: res
2656
+ };
2561
2657
  });
2562
2658
  }
2563
2659
  EntityAttachment.Update = Update;
2564
- function UpdateOrder(api, entityId, typeId, fileIds, reqParams) {
2660
+ function UpdateOrder(params) {
2565
2661
  return __awaiter(this, void 0, void 0, function* () {
2662
+ const { api, entityId, attachmentTypeId: typeId, fileIds, req: reqParams } = params;
2566
2663
  if (!entityId || !typeId || !(fileIds === null || fileIds === void 0 ? void 0 : fileIds.length)) {
2567
2664
  throw ("Entity ID, Type ID, and File IDs are required.");
2568
2665
  }
@@ -2578,8 +2675,9 @@ var EntityAttachment;
2578
2675
  });
2579
2676
  }
2580
2677
  EntityAttachment.UpdateOrder = UpdateOrder;
2581
- function Delete(api, data, reqParams) {
2678
+ function Delete(params) {
2582
2679
  return __awaiter(this, void 0, void 0, function* () {
2680
+ const { api, attachment: data, req: reqParams } = params;
2583
2681
  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
2682
  throw ("Entity ID, Type ID, and File ID are required.");
2585
2683
  }
@@ -2592,8 +2690,9 @@ var EntityAttachment;
2592
2690
  });
2593
2691
  }
2594
2692
  EntityAttachment.Delete = Delete;
2595
- function DeleteByFileIds(api, entityId, typeId, fileIds, reqParams) {
2693
+ function DeleteByFileIds(params) {
2596
2694
  return __awaiter(this, void 0, void 0, function* () {
2695
+ const { api, entityId, attachmentTypeId: typeId, fileIds, req: reqParams } = params;
2597
2696
  if (!entityId || !typeId || !(fileIds === null || fileIds === void 0 ? void 0 : fileIds.length)) {
2598
2697
  throw ("Entity ID, Type ID, and File IDs are required.");
2599
2698
  }
@@ -2608,8 +2707,9 @@ var EntityAttachment;
2608
2707
  });
2609
2708
  }
2610
2709
  EntityAttachment.DeleteByFileIds = DeleteByFileIds;
2611
- function GetListByEntityId(api, entityId, reqParams) {
2710
+ function GetListByEntityId(params) {
2612
2711
  return __awaiter(this, void 0, void 0, function* () {
2712
+ const { api, entityId, req: reqParams } = params;
2613
2713
  if (!entityId) {
2614
2714
  throw ("Entity ID is required.");
2615
2715
  }
@@ -2620,7 +2720,9 @@ var EntityAttachment;
2620
2720
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2621
2721
  try {
2622
2722
  const data = yield api.GET(`entity/${entityId}/attachments`, Api.PrepReqParams(reqParams));
2623
- res(data.Items);
2723
+ res({
2724
+ attachments: data.Items
2725
+ });
2624
2726
  }
2625
2727
  catch (e) {
2626
2728
  rej(e);
@@ -2631,15 +2733,18 @@ var EntityAttachment;
2631
2733
  });
2632
2734
  }
2633
2735
  EntityAttachment.GetListByEntityId = GetListByEntityId;
2634
- function Upload(api, file, entityId, typeId, reqParams) {
2736
+ function Upload(params) {
2635
2737
  return __awaiter(this, void 0, void 0, function* () {
2738
+ const { api, file, entityId, attachmentTypeId: typeId, req: reqParams } = params;
2636
2739
  if (!entityId || !typeId || !file) {
2637
2740
  throw ("Entity ID, Type ID, and File are required.");
2638
2741
  }
2639
2742
  const url = `entity/${entityId}/attachment/${typeId}`;
2640
- const req = yield api.UPLOAD(url, file, reqParams);
2743
+ const res = yield api.UPLOAD(url, file, reqParams);
2641
2744
  api.Cache.RemoveByStartsWith(GetListCacheKey(entityId));
2642
- return req;
2745
+ return {
2746
+ attachment: res
2747
+ };
2643
2748
  });
2644
2749
  }
2645
2750
  EntityAttachment.Upload = Upload;
@@ -2659,21 +2764,25 @@ var EntityComment;
2659
2764
  return Api.ECacheKey.Comment + Api.ECacheKey.Entity + Api.ECacheKey.Id + entityId;
2660
2765
  }
2661
2766
  EntityComment.GetListCacheKey = GetListCacheKey;
2662
- function Update(api, data, reqParams) {
2767
+ function Update(params) {
2663
2768
  return __awaiter(this, void 0, void 0, function* () {
2769
+ const { api, comment: data, req: reqParams } = params;
2664
2770
  if (!(data === null || data === void 0 ? void 0 : data["TargetObject.ID"])) {
2665
2771
  throw ("TargetObject.ID (entity id) is required.");
2666
2772
  }
2667
2773
  const url = `entity/${data["TargetObject.ID"]}/comment` + (data.ID == null ? "" : "/" + data.ID);
2668
- data = yield api.POST(url, data, Api.PrepReqParams(reqParams));
2774
+ const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
2669
2775
  api.Cache.Remove(GetCacheKey(data.ID));
2670
2776
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Comment + Api.ECacheKey.Entity);
2671
- return data;
2777
+ return {
2778
+ comment: res
2779
+ };
2672
2780
  });
2673
2781
  }
2674
2782
  EntityComment.Update = Update;
2675
- function Delete(api, entityId, commentId, reqParams) {
2783
+ function Delete(params) {
2676
2784
  return __awaiter(this, void 0, void 0, function* () {
2785
+ const { api, entityId, commentId, req: reqParams } = params;
2677
2786
  if (!commentId) {
2678
2787
  throw ("Comment ID is required.");
2679
2788
  }
@@ -2683,8 +2792,9 @@ var EntityComment;
2683
2792
  });
2684
2793
  }
2685
2794
  EntityComment.Delete = Delete;
2686
- function GetListByEntityId(api, entityId, reqParams) {
2795
+ function GetListByEntityId(params) {
2687
2796
  return __awaiter(this, void 0, void 0, function* () {
2797
+ const { api, entityId, req: reqParams } = params;
2688
2798
  if (!entityId) {
2689
2799
  throw ("Entity ID is required.");
2690
2800
  }
@@ -2695,7 +2805,9 @@ var EntityComment;
2695
2805
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2696
2806
  try {
2697
2807
  const data = yield api.GET(`entity/${entityId}/comments`, Api.PrepReqParams(reqParams));
2698
- res(data.Items);
2808
+ res({
2809
+ comments: data.Items
2810
+ });
2699
2811
  }
2700
2812
  catch (e) {
2701
2813
  rej(e);
@@ -2722,21 +2834,25 @@ var EntityLink;
2722
2834
  return Api.ECacheKey.Link + Api.ECacheKey.Entity + Api.ECacheKey.Id + entityId;
2723
2835
  }
2724
2836
  EntityLink.GetListCacheKey = GetListCacheKey;
2725
- function Update(api, data, reqParams) {
2837
+ function Update(params) {
2726
2838
  return __awaiter(this, void 0, void 0, function* () {
2839
+ const { api, link: data, req: reqParams } = params;
2727
2840
  if (!(data === null || data === void 0 ? void 0 : data["Entity.ID"])) {
2728
2841
  throw ("Entity ID is required.");
2729
2842
  }
2730
2843
  const url = `entity/${data["Entity.ID"]}/link` + (data.ID == null ? "" : "/" + data.ID);
2731
- data = yield api.POST(url, data, Api.PrepReqParams(reqParams));
2844
+ const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
2732
2845
  api.Cache.Remove(GetCacheKey(data.ID));
2733
2846
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Link + Api.ECacheKey.Entity);
2734
- return data;
2847
+ return {
2848
+ link: res
2849
+ };
2735
2850
  });
2736
2851
  }
2737
2852
  EntityLink.Update = Update;
2738
- function Delete(api, entityId, linkId, reqParams) {
2853
+ function Delete(params) {
2739
2854
  return __awaiter(this, void 0, void 0, function* () {
2855
+ const { api, entityId, linkId, req: reqParams } = params;
2740
2856
  if (!linkId) {
2741
2857
  throw ("Link ID is required.");
2742
2858
  }
@@ -2746,8 +2862,9 @@ var EntityLink;
2746
2862
  });
2747
2863
  }
2748
2864
  EntityLink.Delete = Delete;
2749
- function GetListByEntityId(api, entityId, reqParams) {
2865
+ function GetListByEntityId(params) {
2750
2866
  return __awaiter(this, void 0, void 0, function* () {
2867
+ const { api, entityId, req: reqParams } = params;
2751
2868
  if (!entityId) {
2752
2869
  throw ("Entity ID is required.");
2753
2870
  }
@@ -2758,7 +2875,9 @@ var EntityLink;
2758
2875
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2759
2876
  try {
2760
2877
  const data = yield api.GET(`entity/${entityId}/links`, Api.PrepReqParams(reqParams));
2761
- res(data.Items);
2878
+ res({
2879
+ links: data.Items
2880
+ });
2762
2881
  }
2763
2882
  catch (e) {
2764
2883
  rej(e);
@@ -2791,7 +2910,8 @@ var EntityLod;
2791
2910
  return Api.ECacheKey.Lod + Api.ECacheKey.Entity + entityId;
2792
2911
  }
2793
2912
  EntityLod.GetEntityListKey = GetEntityListKey;
2794
- function GetUrl(api, entityId, categoryId, level, strict) {
2913
+ function GetUrl(params) {
2914
+ let { api, entityId, categoryId, level, strict } = params;
2795
2915
  if (!entityId) {
2796
2916
  throw ("Entity ID is required.");
2797
2917
  }
@@ -2805,11 +2925,14 @@ var EntityLod;
2805
2925
  if (strict) {
2806
2926
  url = url + "?strict=true";
2807
2927
  }
2808
- return url;
2928
+ return {
2929
+ url: url
2930
+ };
2809
2931
  }
2810
2932
  EntityLod.GetUrl = GetUrl;
2811
- function GetUrlFileId(api, url, reqParams) {
2933
+ function GetUrlFileId(params) {
2812
2934
  return __awaiter(this, void 0, void 0, function* () {
2935
+ const { api, url, req: reqParams } = params;
2813
2936
  if (!url) {
2814
2937
  throw ("Url is required.");
2815
2938
  }
@@ -2820,7 +2943,9 @@ var EntityLod;
2820
2943
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2821
2944
  try {
2822
2945
  const record = yield api.get(url, Api.PrepReqParams(reqParams));
2823
- res(record["ClientFile.ID"]);
2946
+ res({
2947
+ clientFileId: record["ClientFile.ID"]
2948
+ });
2824
2949
  }
2825
2950
  catch (e) {
2826
2951
  rej(e);
@@ -2831,19 +2956,23 @@ var EntityLod;
2831
2956
  });
2832
2957
  }
2833
2958
  EntityLod.GetUrlFileId = GetUrlFileId;
2834
- function GetLods(api, params, reqParams) {
2959
+ function GetLods(params) {
2835
2960
  var _a;
2836
2961
  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)) {
2962
+ const { api, filter, req: reqParams } = params;
2963
+ if (!((_a = filter === null || filter === void 0 ? void 0 : filter.Items) === null || _a === void 0 ? void 0 : _a.length)) {
2838
2964
  throw ("Items are required.");
2839
2965
  }
2840
- const data = yield api.POST("entity/getlods", params, reqParams);
2841
- return data.Items;
2966
+ const data = yield api.POST("entity/getlods", filter, reqParams);
2967
+ return {
2968
+ lods: data.Items
2969
+ };
2842
2970
  });
2843
2971
  }
2844
2972
  EntityLod.GetLods = GetLods;
2845
- function GetEntityLods(api, entityId, reqParams) {
2973
+ function GetEntityLods(params) {
2846
2974
  return __awaiter(this, void 0, void 0, function* () {
2975
+ const { api, entityId, req: reqParams } = params;
2847
2976
  if (!entityId) {
2848
2977
  throw ("Entity id is required.");
2849
2978
  }
@@ -2855,7 +2984,9 @@ var EntityLod;
2855
2984
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2856
2985
  try {
2857
2986
  const data = yield req;
2858
- res(data.Items);
2987
+ res({
2988
+ lods: data.Items
2989
+ });
2859
2990
  }
2860
2991
  catch (e) {
2861
2992
  rej(e);
@@ -2868,13 +2999,11 @@ var EntityLod;
2868
2999
  EntityLod.GetEntityLods = GetEntityLods;
2869
3000
  /**
2870
3001
  * Returns lods for a specified entity type.
2871
- * @param api
2872
- * @param typeId
2873
- * @param group default is "DEFAULT".
2874
- * @param reqParams
3002
+ * @param params
2875
3003
  */
2876
- function GetTypeLods(api, typeId, group, reqParams) {
3004
+ function GetTypeLods(params) {
2877
3005
  return __awaiter(this, void 0, void 0, function* () {
3006
+ let { api, entityTypeId: typeId, group, req: reqParams } = params;
2878
3007
  if (!group) {
2879
3008
  group = "DEFAULT";
2880
3009
  }
@@ -2887,7 +3016,9 @@ var EntityLod;
2887
3016
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2888
3017
  try {
2889
3018
  const data = yield req;
2890
- res(data.Items);
3019
+ res({
3020
+ lods: data.Items
3021
+ });
2891
3022
  }
2892
3023
  catch (e) {
2893
3024
  rej(e);
@@ -2898,8 +3029,9 @@ var EntityLod;
2898
3029
  });
2899
3030
  }
2900
3031
  EntityLod.GetTypeLods = GetTypeLods;
2901
- function Update(api, entityId, params, reqParams) {
3032
+ function Update(params) {
2902
3033
  return __awaiter(this, void 0, void 0, function* () {
3034
+ const { api, entityId, req: reqParams } = params;
2903
3035
  if (!params["ClientFile.ID"] || !params["LODCategory.Key"] || (!params.Level && params.Level !== 0)) {
2904
3036
  throw ("ClientFile.ID, LODCategory.Key and Level are required.");
2905
3037
  }
@@ -2912,8 +3044,9 @@ var EntityLod;
2912
3044
  });
2913
3045
  }
2914
3046
  EntityLod.Update = Update;
2915
- function Delete(api, entityId, lodCategoryId, level, reqParams) {
3047
+ function Delete(params) {
2916
3048
  return __awaiter(this, void 0, void 0, function* () {
3049
+ let { api, entityId, lodCategoryId, level, req: reqParams } = params;
2917
3050
  if (!entityId || !lodCategoryId) {
2918
3051
  throw ("Entity ID and LOD Category ID are required.");
2919
3052
  }
@@ -2940,8 +3073,9 @@ var EntityLodCategory;
2940
3073
  return Api.ECacheKey.LodCategory;
2941
3074
  }
2942
3075
  EntityLodCategory.GetListCacheKey = GetListCacheKey;
2943
- function GetList(api, reqParams) {
3076
+ function GetList(params) {
2944
3077
  return __awaiter(this, void 0, void 0, function* () {
3078
+ const { api, req: reqParams } = params;
2945
3079
  const cacheKey = api.GetCacheItem(GetListCacheKey(), reqParams);
2946
3080
  if (cacheKey) {
2947
3081
  return cacheKey;
@@ -2949,7 +3083,9 @@ var EntityLodCategory;
2949
3083
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2950
3084
  try {
2951
3085
  const data = yield api.GET("lodCategories", Api.PrepReqParams(reqParams));
2952
- res(data.Items);
3086
+ res({
3087
+ categories: data.Items
3088
+ });
2953
3089
  }
2954
3090
  catch (e) {
2955
3091
  rej(e);
@@ -2960,8 +3096,9 @@ var EntityLodCategory;
2960
3096
  });
2961
3097
  }
2962
3098
  EntityLodCategory.GetList = GetList;
2963
- function Get(api, id, reqParams) {
3099
+ function Get(params) {
2964
3100
  return __awaiter(this, void 0, void 0, function* () {
3101
+ const { api, categoryId: id, req: reqParams } = params;
2965
3102
  if (!id) {
2966
3103
  throw ("Lod category id is required.");
2967
3104
  }
@@ -2972,7 +3109,9 @@ var EntityLodCategory;
2972
3109
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2973
3110
  try {
2974
3111
  const data = yield api.GET(`lodCategory/${id}`, Api.PrepReqParams(reqParams));
2975
- res(data);
3112
+ res({
3113
+ category: data
3114
+ });
2976
3115
  }
2977
3116
  catch (e) {
2978
3117
  rej(e);
@@ -2983,8 +3122,9 @@ var EntityLodCategory;
2983
3122
  });
2984
3123
  }
2985
3124
  EntityLodCategory.Get = Get;
2986
- function Delete(api, id, reqParams) {
3125
+ function Delete(params) {
2987
3126
  return __awaiter(this, void 0, void 0, function* () {
3127
+ const { api, categoryId: id, req: reqParams } = params;
2988
3128
  if (!id) {
2989
3129
  throw ("Lod category id is required.");
2990
3130
  }
@@ -2994,15 +3134,18 @@ var EntityLodCategory;
2994
3134
  });
2995
3135
  }
2996
3136
  EntityLodCategory.Delete = Delete;
2997
- function Update(api, data, reqParams) {
3137
+ function Update(params) {
2998
3138
  return __awaiter(this, void 0, void 0, function* () {
3139
+ const { api, category: data, req: reqParams } = params;
2999
3140
  if (!data.Key || !data.Name) {
3000
3141
  throw ("Lod category key and name are required.");
3001
3142
  }
3002
- data = yield api.POST(`lodCategory/${data.Key}`, data, Api.PrepReqParams(reqParams));
3143
+ const res = yield api.POST(`lodCategory/${data.Key}`, data, Api.PrepReqParams(reqParams));
3003
3144
  api.Cache.Remove(GetCacheKey(data.Key));
3004
3145
  api.Cache.Remove(GetListCacheKey());
3005
- return data;
3146
+ return {
3147
+ category: res
3148
+ };
3006
3149
  });
3007
3150
  }
3008
3151
  EntityLodCategory.Update = Update;
@@ -3022,8 +3165,9 @@ var EntityRelationType;
3022
3165
  return Api.ECacheKey.RelationType;
3023
3166
  }
3024
3167
  EntityRelationType.GetListCacheKey = GetListCacheKey;
3025
- function Get(api, typeId, reqParams) {
3168
+ function Get(params) {
3026
3169
  return __awaiter(this, void 0, void 0, function* () {
3170
+ const { api, relationTypeId: typeId, req: reqParams } = params;
3027
3171
  if (!typeId) {
3028
3172
  throw ("Type ID is required.");
3029
3173
  }
@@ -3032,14 +3176,25 @@ var EntityRelationType;
3032
3176
  if (cacheData) {
3033
3177
  return cacheData;
3034
3178
  }
3035
- const req = api.GET(`entityRelationType/${typeId}`, Api.PrepReqParams(reqParams));
3036
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
3037
- return req;
3179
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3180
+ try {
3181
+ const data = yield api.GET(`entityRelationType/${typeId}`, Api.PrepReqParams(reqParams));
3182
+ res({
3183
+ relationType: data
3184
+ });
3185
+ }
3186
+ catch (e) {
3187
+ rej(e);
3188
+ }
3189
+ }));
3190
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
3191
+ return prom;
3038
3192
  });
3039
3193
  }
3040
3194
  EntityRelationType.Get = Get;
3041
- function Delete(api, typeId, reqParams) {
3195
+ function Delete(params) {
3042
3196
  return __awaiter(this, void 0, void 0, function* () {
3197
+ const { api, relationTypeId: typeId, req: reqParams } = params;
3043
3198
  if (!typeId) {
3044
3199
  throw ("Type ID is required.");
3045
3200
  }
@@ -3049,8 +3204,9 @@ var EntityRelationType;
3049
3204
  });
3050
3205
  }
3051
3206
  EntityRelationType.Delete = Delete;
3052
- function GetList(api, reqParams) {
3207
+ function GetList(params) {
3053
3208
  return __awaiter(this, void 0, void 0, function* () {
3209
+ const { api, req: reqParams } = params;
3054
3210
  const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
3055
3211
  if (cacheData) {
3056
3212
  return cacheData;
@@ -3058,7 +3214,9 @@ var EntityRelationType;
3058
3214
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3059
3215
  try {
3060
3216
  const data = yield api.GET("entityRelationTypes", Api.PrepReqParams(reqParams));
3061
- res(data.Items);
3217
+ res({
3218
+ relationTypes: data.Items
3219
+ });
3062
3220
  }
3063
3221
  catch (e) {
3064
3222
  rej(e);
@@ -3069,18 +3227,21 @@ var EntityRelationType;
3069
3227
  });
3070
3228
  }
3071
3229
  EntityRelationType.GetList = GetList;
3072
- function Update(api, data, reqParams) {
3230
+ function Update(params) {
3073
3231
  return __awaiter(this, void 0, void 0, function* () {
3232
+ const { api, relationType: data, req: reqParams } = params;
3074
3233
  if (!(data === null || data === void 0 ? void 0 : data.ForwardName) || !(data === null || data === void 0 ? void 0 : data.ReverseName)) {
3075
3234
  throw ("Forward and reverse names are required.");
3076
3235
  }
3077
3236
  if (!data.ID) {
3078
3237
  data.ID = ObjectUtils.UId();
3079
3238
  }
3080
- data = yield api.POST(`entityRelationType/${data.ID}`, data, Api.PrepReqParams(reqParams));
3239
+ const res = yield api.POST(`entityRelationType/${data.ID}`, data, Api.PrepReqParams(reqParams));
3081
3240
  api.Cache.Remove(GetCacheKey(data.ID));
3082
3241
  api.Cache.Remove(GetListCacheKey());
3083
- return data;
3242
+ return {
3243
+ relationType: res
3244
+ };
3084
3245
  });
3085
3246
  }
3086
3247
  EntityRelationType.Update = Update;
@@ -3103,14 +3264,15 @@ var EntityRelation;
3103
3264
  EntityRelation.GetEntityCacheKey = GetEntityCacheKey;
3104
3265
  function GetListCacheKey(entityId, params) {
3105
3266
  return Api.ECacheKey.Relation + Api.ECacheKey.RelationType +
3106
- Api.ECacheKey.Id + params.typeId +
3267
+ Api.ECacheKey.Id + params.relationTypeId +
3107
3268
  Api.ECacheKey.Id + params.oneWayOnly +
3108
3269
  Api.ECacheKey.Id + params.loadEntityData +
3109
3270
  Api.ECacheKey.Entity + Api.ECacheKey.Id + entityId;
3110
3271
  }
3111
3272
  EntityRelation.GetListCacheKey = GetListCacheKey;
3112
- function Create(api, data, reqParams) {
3273
+ function Create(params) {
3113
3274
  return __awaiter(this, void 0, void 0, function* () {
3275
+ const { api, relation: data, req: reqParams } = params;
3114
3276
  if (!data["Principal.Entity.ID"] || !data["Related.Entity.ID"] || !data["Relation.Type.ID"]) {
3115
3277
  throw ("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
3116
3278
  }
@@ -3128,54 +3290,61 @@ var EntityRelation;
3128
3290
  });
3129
3291
  }
3130
3292
  EntityRelation.Create = Create;
3131
- function Update(api, data, reqParams) {
3293
+ function Update(params) {
3132
3294
  return __awaiter(this, void 0, void 0, function* () {
3295
+ const { api, relation: data, req: reqParams } = params;
3133
3296
  if (!data["Principal.Entity.ID"] || !data["Related.Entity.ID"] || !data["Relation.Type.ID"]) {
3134
3297
  throw ("Principal Entity ID, Related Entity ID, and Relation Type ID are required.");
3135
3298
  }
3136
3299
  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));
3300
+ const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
3138
3301
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + data["Principal.Entity.ID"]);
3139
3302
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Id + data["Related.Entity.ID"]);
3140
3303
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.RelationType + Api.ECacheKey.Id + data["Relation.Type.ID"]);
3141
3304
  if (data["Data.Entity.ID"]) {
3142
3305
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Relation + Api.ECacheKey.Entity + Api.ECacheKey.Id + data["Data.Entity.ID"]);
3143
3306
  }
3144
- return data;
3307
+ return {
3308
+ relation: res
3309
+ };
3145
3310
  });
3146
3311
  }
3147
3312
  EntityRelation.Update = Update;
3148
- function GetList(api, entityId, params, reqParams) {
3313
+ function GetList(params) {
3149
3314
  return __awaiter(this, void 0, void 0, function* () {
3315
+ let { api, entityId, filter, req: reqParams } = params;
3150
3316
  if (!entityId) {
3151
3317
  throw ("Entity ID is required.");
3152
3318
  }
3153
- params = Object.assign({ typeId: "", oneWayOnly: false, loadEntityData: false }, params);
3154
- const cacheData = api.GetCacheItem(GetListCacheKey(entityId, params), reqParams);
3319
+ filter = Object.assign({ relationTypeId: "", oneWayOnly: false, loadEntityData: false }, filter);
3320
+ const cacheData = api.GetCacheItem(GetListCacheKey(entityId, filter), reqParams);
3155
3321
  if (cacheData) {
3156
3322
  return cacheData;
3157
3323
  }
3158
3324
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3159
3325
  try {
3160
3326
  let url = `entity/${entityId}/relations`;
3161
- if (params.typeId) {
3162
- url += "/" + params.typeId;
3327
+ if (filter.relationTypeId) {
3328
+ url += "/" + filter.relationTypeId;
3163
3329
  }
3164
- url += `?Oneway=${params.oneWayOnly}&LoadInfo=${params.loadEntityData}`;
3330
+ url += `?Oneway=${filter.oneWayOnly}&LoadInfo=${filter.loadEntityData}`;
3165
3331
  const data = yield api.GET(url, Api.PrepReqParams(reqParams));
3166
- res(data.Items);
3332
+ res({
3333
+ relations: data.Items
3334
+ });
3167
3335
  }
3168
3336
  catch (e) {
3169
3337
  rej(e);
3170
3338
  }
3171
3339
  }));
3172
- api.Cache.Set(GetListCacheKey(entityId, params), req);
3340
+ api.Cache.Set(GetListCacheKey(entityId, filter), req);
3173
3341
  return req;
3174
3342
  });
3175
3343
  }
3176
3344
  EntityRelation.GetList = GetList;
3177
- function GetByDataEntityId(api, entityId, reqParams) {
3345
+ function GetByDataEntityId(params) {
3178
3346
  return __awaiter(this, void 0, void 0, function* () {
3347
+ const { api, entityId, req: reqParams } = params;
3179
3348
  if (!entityId) {
3180
3349
  throw ("Entity ID is required.");
3181
3350
  }
@@ -3183,9 +3352,19 @@ var EntityRelation;
3183
3352
  if (cacheData) {
3184
3353
  return cacheData;
3185
3354
  }
3186
- const req = api.GET(`entity/relation/${entityId}/dataentity`, Api.PrepReqParams(reqParams));
3187
- api.Cache.Set(GetEntityCacheKey(entityId), req);
3188
- return req;
3355
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3356
+ try {
3357
+ const data = yield api.GET(`entity/relation/${entityId}/dataentity`, Api.PrepReqParams(reqParams));
3358
+ res({
3359
+ relation: data
3360
+ });
3361
+ }
3362
+ catch (e) {
3363
+ rej(e);
3364
+ }
3365
+ }));
3366
+ api.Cache.Set(GetEntityCacheKey(entityId), prom);
3367
+ return prom;
3189
3368
  });
3190
3369
  }
3191
3370
  EntityRelation.GetByDataEntityId = GetByDataEntityId;
@@ -3202,8 +3381,9 @@ var EntitySource;
3202
3381
  return `${Api.ECacheKey.EntitySource}${Api.ECacheKey.Id}${sourceId}${Api.ECacheKey.Id}${sourceKey}`;
3203
3382
  }
3204
3383
  EntitySource.GetCacheKey = GetCacheKey;
3205
- function Get(api, sourceId, sourceKey, reqParams) {
3384
+ function Get(params) {
3206
3385
  return __awaiter(this, void 0, void 0, function* () {
3386
+ const { api, sourceId, sourceKey, req: reqParams } = params;
3207
3387
  if (!sourceId || !sourceKey) {
3208
3388
  throw ("Source ID and Source Key are required.");
3209
3389
  }
@@ -3212,14 +3392,25 @@ var EntitySource;
3212
3392
  if (cacheData) {
3213
3393
  return cacheData;
3214
3394
  }
3215
- const req = api.GET(`entitysource/${sourceId}/${sourceKey}`, Api.PrepReqParams(reqParams));
3216
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
3217
- return req;
3395
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3396
+ try {
3397
+ const data = yield api.GET(`entitysource/${sourceId}/${sourceKey}`, Api.PrepReqParams(reqParams));
3398
+ res({
3399
+ source: data
3400
+ });
3401
+ }
3402
+ catch (e) {
3403
+ rej(e);
3404
+ }
3405
+ }));
3406
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
3407
+ return prom;
3218
3408
  });
3219
3409
  }
3220
3410
  EntitySource.Get = Get;
3221
- function GetListByKeys(api, sourceId, sourceKeys, reqParams) {
3411
+ function GetListByKeys(params) {
3222
3412
  return __awaiter(this, void 0, void 0, function* () {
3413
+ const { api, sourceId, sourceKeys, req: reqParams } = params;
3223
3414
  if (!sourceId || !sourceKeys.length) {
3224
3415
  throw ("Source ID and Source Keys are required.");
3225
3416
  }
@@ -3258,18 +3449,26 @@ var EntitySource;
3258
3449
  reqs.push(req);
3259
3450
  }
3260
3451
  }
3261
- return (yield Promise.all(reqs)).filter(x => !!x);
3452
+ return {
3453
+ sources: (yield Promise.all(reqs)).filter(x => !!x)
3454
+ };
3262
3455
  });
3263
3456
  }
3264
3457
  EntitySource.GetListByKeys = GetListByKeys;
3265
- function GetEntityIdsBySourceKeys(api, sourceId, sourceKeys, reqParams) {
3458
+ function GetEntityIdsBySourceKeys(params) {
3266
3459
  return __awaiter(this, void 0, void 0, function* () {
3460
+ const { api, sourceId, sourceKeys, req: reqParams } = params;
3267
3461
  if (!sourceId || !sourceKeys.length) {
3268
3462
  throw ("Source ID and Source Keys are required.");
3269
3463
  }
3270
3464
  const result = {};
3271
3465
  if (sourceKeys.length > 0) {
3272
- const sources = yield GetListByKeys(api, sourceId, sourceKeys, reqParams);
3466
+ const { sources } = yield GetListByKeys({
3467
+ api,
3468
+ sourceId,
3469
+ sourceKeys,
3470
+ req: reqParams
3471
+ });
3273
3472
  for (let i = 0; i < sources.length; i++) {
3274
3473
  const source = sources[i];
3275
3474
  for (let i = 0; i < sourceKeys.length; i++) {
@@ -3280,7 +3479,9 @@ var EntitySource;
3280
3479
  }
3281
3480
  }
3282
3481
  }
3283
- return result;
3482
+ return {
3483
+ idMapping: result
3484
+ };
3284
3485
  });
3285
3486
  }
3286
3487
  EntitySource.GetEntityIdsBySourceKeys = GetEntityIdsBySourceKeys;
@@ -3304,18 +3505,26 @@ var EntityTag;
3304
3505
  return Api.ECacheKey.Tag;
3305
3506
  }
3306
3507
  EntityTag.GetListCacheKey = GetListCacheKey;
3307
- function Get(api, tagId, reqParams) {
3508
+ function Get(params) {
3308
3509
  return __awaiter(this, void 0, void 0, function* () {
3510
+ const { api, tagId, req: reqParams } = params;
3309
3511
  if (!tagId) {
3310
3512
  throw ("Tag ID is required.");
3311
3513
  }
3312
- const data = yield GetListByIds(api, [tagId], reqParams);
3313
- return data.length ? data[0] : null;
3514
+ const { tags } = yield GetListByIds({
3515
+ api,
3516
+ tagIds: [tagId],
3517
+ req: reqParams
3518
+ });
3519
+ return {
3520
+ tag: tags.length ? tags[0] : null
3521
+ };
3314
3522
  });
3315
3523
  }
3316
3524
  EntityTag.Get = Get;
3317
- function GetListByIds(api, tagIds, reqParams) {
3525
+ function GetListByIds(params) {
3318
3526
  return __awaiter(this, void 0, void 0, function* () {
3527
+ const { api, tagIds, req: reqParams } = params;
3319
3528
  if (!tagIds.length) {
3320
3529
  throw ("Tag Ids are empty.");
3321
3530
  }
@@ -3357,12 +3566,15 @@ var EntityTag;
3357
3566
  reqs.push(req);
3358
3567
  }
3359
3568
  }
3360
- return (yield Promise.all(reqs)).filter(x => !!x);
3569
+ return {
3570
+ tags: (yield Promise.all(reqs)).filter(x => !!x)
3571
+ };
3361
3572
  });
3362
3573
  }
3363
3574
  EntityTag.GetListByIds = GetListByIds;
3364
- function GetList(api, entityTypeId, reqParams) {
3575
+ function GetList(params) {
3365
3576
  return __awaiter(this, void 0, void 0, function* () {
3577
+ const { api, entityTypeId, req: reqParams } = params;
3366
3578
  const cacheData = api.GetCacheItem(GetListCacheKey(entityTypeId), reqParams);
3367
3579
  if (cacheData) {
3368
3580
  return cacheData;
@@ -3370,7 +3582,9 @@ var EntityTag;
3370
3582
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3371
3583
  try {
3372
3584
  const data = yield api.GET(entityTypeId ? `entityType/${entityTypeId}/layers` : "layers", Api.PrepReqParams(reqParams));
3373
- res(data.Items);
3585
+ res({
3586
+ tags: data.Items
3587
+ });
3374
3588
  }
3375
3589
  catch (e) {
3376
3590
  rej(e);
@@ -3381,8 +3595,9 @@ var EntityTag;
3381
3595
  });
3382
3596
  }
3383
3597
  EntityTag.GetList = GetList;
3384
- function Delete(api, tagId, reqParams) {
3598
+ function Delete(params) {
3385
3599
  return __awaiter(this, void 0, void 0, function* () {
3600
+ const { api, tagId, req: reqParams } = params;
3386
3601
  if (!tagId) {
3387
3602
  throw ("Tag ID is required.");
3388
3603
  }
@@ -3392,16 +3607,19 @@ var EntityTag;
3392
3607
  });
3393
3608
  }
3394
3609
  EntityTag.Delete = Delete;
3395
- function Update(api, data, reqParams) {
3610
+ function Update(params) {
3396
3611
  return __awaiter(this, void 0, void 0, function* () {
3612
+ const { api, tag: data, req: reqParams } = params;
3397
3613
  if (!(data === null || data === void 0 ? void 0 : data.ID)) {
3398
3614
  throw ("Tag ID is required.");
3399
3615
  }
3400
3616
  const url = data.ID ? `layer/${data.ID}` : "layer";
3401
- data = yield api.POST(url, data, Api.PrepReqParams(reqParams));
3617
+ const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
3402
3618
  api.Cache.Remove(GetCacheKey(data.ID));
3403
3619
  api.Cache.RemoveByStartsWith(GetListCacheKey());
3404
- return data;
3620
+ return {
3621
+ tag: res
3622
+ };
3405
3623
  });
3406
3624
  }
3407
3625
  EntityTag.Update = Update;
@@ -3422,8 +3640,9 @@ var EntityType;
3422
3640
  return Api.ECacheKey.EntityType;
3423
3641
  }
3424
3642
  EntityType.GetListCacheKey = GetListCacheKey;
3425
- function Get(api, typeId, reqParams) {
3643
+ function Get(params) {
3426
3644
  return __awaiter(this, void 0, void 0, function* () {
3645
+ const { api, entityTypeId: typeId, req: reqParams } = params;
3427
3646
  if (!typeId) {
3428
3647
  throw ("Type ID is required.");
3429
3648
  }
@@ -3432,14 +3651,25 @@ var EntityType;
3432
3651
  if (cacheData) {
3433
3652
  return cacheData;
3434
3653
  }
3435
- const req = api.GET(`entitytype/${typeId}`, Api.PrepReqParams(reqParams));
3436
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
3437
- return req;
3654
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3655
+ try {
3656
+ const data = yield api.GET(`entitytype/${typeId}`, Api.PrepReqParams(reqParams));
3657
+ res({
3658
+ entityType: data
3659
+ });
3660
+ }
3661
+ catch (e) {
3662
+ rej(e);
3663
+ }
3664
+ }));
3665
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
3666
+ return prom;
3438
3667
  });
3439
3668
  }
3440
3669
  EntityType.Get = Get;
3441
- function Delete(api, typeId, reqParams) {
3670
+ function Delete(params) {
3442
3671
  return __awaiter(this, void 0, void 0, function* () {
3672
+ const { api, entityTypeId: typeId, req: reqParams } = params;
3443
3673
  if (!typeId) {
3444
3674
  throw ("Type ID is required.");
3445
3675
  }
@@ -3449,8 +3679,9 @@ var EntityType;
3449
3679
  });
3450
3680
  }
3451
3681
  EntityType.Delete = Delete;
3452
- function GetList(api, reqParams) {
3682
+ function GetList(params) {
3453
3683
  return __awaiter(this, void 0, void 0, function* () {
3684
+ const { api, req: reqParams } = params;
3454
3685
  const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
3455
3686
  if (cacheData) {
3456
3687
  return cacheData;
@@ -3458,7 +3689,9 @@ var EntityType;
3458
3689
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3459
3690
  try {
3460
3691
  const data = yield api.GET("entitytypes", Api.PrepReqParams(reqParams));
3461
- res(data.Items);
3692
+ res({
3693
+ entityTypes: data.Items
3694
+ });
3462
3695
  }
3463
3696
  catch (e) {
3464
3697
  rej(e);
@@ -3469,8 +3702,9 @@ var EntityType;
3469
3702
  });
3470
3703
  }
3471
3704
  EntityType.GetList = GetList;
3472
- function Update(api, data, reqParams) {
3705
+ function Update(params) {
3473
3706
  return __awaiter(this, void 0, void 0, function* () {
3707
+ let { api, entityType: data, req: reqParams } = params;
3474
3708
  if (!data) {
3475
3709
  data = {};
3476
3710
  }
@@ -3480,10 +3714,12 @@ var EntityType;
3480
3714
  if (!data.Name) {
3481
3715
  data.Name = data.ID;
3482
3716
  }
3483
- data = yield api.POST(`entitytype/${data.ID}`, data, Api.PrepReqParams(reqParams));
3717
+ const res = yield api.POST(`entitytype/${data.ID}`, data, Api.PrepReqParams(reqParams));
3484
3718
  api.Cache.Remove(GetCacheKey(data.ID));
3485
3719
  api.Cache.Remove(GetListCacheKey());
3486
- return data;
3720
+ return {
3721
+ entityType: res
3722
+ };
3487
3723
  });
3488
3724
  }
3489
3725
  EntityType.Update = Update;
@@ -3889,18 +4125,21 @@ var EntityFilterGetter;
3889
4125
  continue;
3890
4126
  }
3891
4127
  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
4128
+ const { entities } = yield Entity.GetList({
4129
+ api: this.api,
4130
+ filter: {
4131
+ pageSize: PAGE_SIZE,
4132
+ pageIndex: curCell.FetchPageIndex,
4133
+ entityTypeId: this.typeId,
4134
+ layerIds: this.tagIds,
4135
+ bounds: curCell.GetBounds(),
4136
+ sortOrder: Api.ESortOrder.Asc,
4137
+ entityTypeConditions: this.attrFilter
4138
+ }
3900
4139
  });
3901
4140
  const integrity = this.getIntegrityId();
3902
- if (loopIntegrity == integrity && page) {
3903
- (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger(page);
4141
+ if (loopIntegrity == integrity && entities) {
4142
+ (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger(entities);
3904
4143
  }
3905
4144
  if (this.getterLoopId != loopId) {
3906
4145
  break;
@@ -3910,15 +4149,15 @@ var EntityFilterGetter;
3910
4149
  postedLoading = true;
3911
4150
  }
3912
4151
  // Only mark as fetched when ALL pages are done.
3913
- if (page.length <= 0) {
4152
+ if (entities.length <= 0) {
3914
4153
  curCell.Fetched = true;
3915
4154
  (_d = this.onScanUpdate) === null || _d === void 0 ? void 0 : _d.Trigger(cells);
3916
4155
  continue;
3917
4156
  }
3918
4157
  // 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;
4158
+ if (entities.length > 0) {
4159
+ const first = (_f = (_e = entities[0]) === null || _e === void 0 ? void 0 : _e.Bruce) === null || _f === void 0 ? void 0 : _f.ID;
4160
+ 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
4161
  if (prevFirstId == first && prevLastId == last) {
3923
4162
  break;
3924
4163
  }
@@ -4078,22 +4317,38 @@ var EntityCoords;
4078
4317
  return Api.ECacheKey.EntityCoords + Api.ECacheKey.Entity + Api.ECacheKey.Id + entityId;
4079
4318
  }
4080
4319
  EntityCoords.GetCacheKey = GetCacheKey;
4081
- function GetEntityCoords(api, entityId, reqParams) {
4320
+ function GetEntityCoords(params) {
4082
4321
  return __awaiter(this, void 0, void 0, function* () {
4322
+ const { api, rootEntityId: entityId, req: reqParams } = params;
4083
4323
  const cacheData = api.GetCacheItem(GetCacheKey(entityId), reqParams);
4084
4324
  if (cacheData) {
4085
4325
  return cacheData;
4086
4326
  }
4087
- const req = api.GET(`entity/${entityId}/ucs`, reqParams);
4088
- api.Cache.Set(GetCacheKey(entityId), req, Api.DEFAULT_CACHE_DURATION);
4089
- return req;
4327
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4328
+ try {
4329
+ const data = yield api.GET(`entity/${entityId}/ucs`, reqParams);
4330
+ res({
4331
+ coords: data
4332
+ });
4333
+ }
4334
+ catch (e) {
4335
+ rej(e);
4336
+ }
4337
+ }));
4338
+ api.Cache.Set(GetCacheKey(entityId), prom, Api.DEFAULT_CACHE_DURATION);
4339
+ return prom;
4090
4340
  });
4091
4341
  }
4092
4342
  EntityCoords.GetEntityCoords = GetEntityCoords;
4093
- function EntityRelativeToPoint(api, entityId, params, reqParams) {
4343
+ function EntityRelativeToPoint(params) {
4094
4344
  return __awaiter(this, void 0, void 0, function* () {
4345
+ const { api, rootEntityId: entityId, req: reqParams } = params;
4095
4346
  if (!params.test) {
4096
- yield UnlinkCoords(api, entityId);
4347
+ yield UnlinkCoords({
4348
+ api,
4349
+ rootEntityId: entityId,
4350
+ req: reqParams
4351
+ });
4097
4352
  }
4098
4353
  const point = params.point;
4099
4354
  const name = params.name || `${MathUtils.Round(point.latitude, 4)}, ${MathUtils.Round(point.longitude, 4)}`;
@@ -4115,15 +4370,22 @@ var EntityCoords;
4115
4370
  if (!params.test) {
4116
4371
  api.Cache.Remove(GetCacheKey(entityId));
4117
4372
  }
4118
- return res;
4373
+ return {
4374
+ coords: res
4375
+ };
4119
4376
  });
4120
4377
  }
4121
4378
  EntityCoords.EntityRelativeToPoint = EntityRelativeToPoint;
4122
- function EntityRelativeToEpsg(api, entityId, params, reqParams) {
4379
+ function EntityRelativeToEpsg(params) {
4123
4380
  var _a;
4124
4381
  return __awaiter(this, void 0, void 0, function* () {
4382
+ const { api, rootEntityId: entityId, req: reqParams } = params;
4125
4383
  if (!params.test) {
4126
- yield UnlinkCoords(api, entityId);
4384
+ yield UnlinkCoords({
4385
+ api,
4386
+ rootEntityId: entityId,
4387
+ req: reqParams
4388
+ });
4127
4389
  }
4128
4390
  const epsg = params.epsg;
4129
4391
  const name = (_a = params.name) !== null && _a !== void 0 ? _a : "EPSG: " + epsg;
@@ -4143,14 +4405,21 @@ var EntityCoords;
4143
4405
  if (!params.test) {
4144
4406
  api.Cache.Remove(GetCacheKey(entityId));
4145
4407
  }
4146
- return res;
4408
+ return {
4409
+ coords: res
4410
+ };
4147
4411
  });
4148
4412
  }
4149
4413
  EntityCoords.EntityRelativeToEpsg = EntityRelativeToEpsg;
4150
- function EntityRelativeToUcs(api, entityId, params, reqParams) {
4414
+ function EntityRelativeToUcs(params) {
4151
4415
  return __awaiter(this, void 0, void 0, function* () {
4416
+ const { api, rootEntityId: entityId, req: reqParams } = params;
4152
4417
  if (!params.test) {
4153
- yield UnlinkCoords(api, entityId);
4418
+ yield UnlinkCoords({
4419
+ api,
4420
+ rootEntityId: entityId,
4421
+ req: reqParams
4422
+ });
4154
4423
  }
4155
4424
  const ucsId = params.ucsId;
4156
4425
  const res = yield api.POST(`entity/${entityId}/ucs`, {
@@ -4162,12 +4431,15 @@ var EntityCoords;
4162
4431
  if (!params.test) {
4163
4432
  api.Cache.Remove(GetCacheKey(entityId));
4164
4433
  }
4165
- return res;
4434
+ return {
4435
+ coords: res
4436
+ };
4166
4437
  });
4167
4438
  }
4168
4439
  EntityCoords.EntityRelativeToUcs = EntityRelativeToUcs;
4169
- function UnlinkCoords(api, entityId, reqParams) {
4440
+ function UnlinkCoords(params) {
4170
4441
  return __awaiter(this, void 0, void 0, function* () {
4442
+ const { api, rootEntityId: entityId, req: reqParams } = params;
4171
4443
  return api.DELETE(`entity/${entityId}/ucs`, reqParams);
4172
4444
  });
4173
4445
  }
@@ -4222,16 +4494,19 @@ var ClientFile;
4222
4494
  return `${Api.ECacheKey.ClientFile}${Api.ECacheKey.Id}${fileId}`;
4223
4495
  }
4224
4496
  ClientFile.GetCacheKey = GetCacheKey;
4225
- function GetUrl(api, fileId) {
4497
+ function GetUrl(params) {
4498
+ const { api, fileId } = params;
4226
4499
  return `${api.GetBaseUrl()}file/${fileId}`;
4227
4500
  }
4228
4501
  ClientFile.GetUrl = GetUrl;
4229
- function GetUrlWithExt(api, file) {
4502
+ function GetUrlWithExt(params) {
4503
+ const { api, file } = params;
4230
4504
  return `${api.GetBaseUrl()}file/${file.ID}${file.FileExt ? file.FileExt : ""}`;
4231
4505
  }
4232
4506
  ClientFile.GetUrlWithExt = GetUrlWithExt;
4233
- function Get(api, fileId, reqParams) {
4507
+ function Get(params) {
4234
4508
  return __awaiter(this, void 0, void 0, function* () {
4509
+ const { api, fileId, req: reqParams } = params;
4235
4510
  if (!fileId) {
4236
4511
  throw ("File ID is required.");
4237
4512
  }
@@ -4240,14 +4515,25 @@ var ClientFile;
4240
4515
  if (cacheData) {
4241
4516
  return cacheData;
4242
4517
  }
4243
- const req = api.GET(`file/${fileId}/details`, Api.PrepReqParams(reqParams));
4244
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
4245
- return req;
4518
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4519
+ try {
4520
+ const data = yield api.GET(`file/${fileId}/details`, Api.PrepReqParams(reqParams));
4521
+ res({
4522
+ clientFile: data
4523
+ });
4524
+ }
4525
+ catch (e) {
4526
+ rej(e);
4527
+ }
4528
+ }));
4529
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
4530
+ return prom;
4246
4531
  });
4247
4532
  }
4248
4533
  ClientFile.Get = Get;
4249
- function Delete(api, fileIds, reqParams) {
4534
+ function Delete(params) {
4250
4535
  return __awaiter(this, void 0, void 0, function* () {
4536
+ const { api, fileIds, req: reqParams } = params;
4251
4537
  if (!fileIds.length) {
4252
4538
  throw ("File IDs are required.");
4253
4539
  }
@@ -4262,8 +4548,9 @@ var ClientFile;
4262
4548
  });
4263
4549
  }
4264
4550
  ClientFile.Delete = Delete;
4265
- function Upload(api, file, purpose, reqParams) {
4551
+ function Upload(params) {
4266
4552
  return __awaiter(this, void 0, void 0, function* () {
4553
+ const { api, file, purpose, req } = params;
4267
4554
  if (!file) {
4268
4555
  throw ("File is required.");
4269
4556
  }
@@ -4273,30 +4560,42 @@ var ClientFile;
4273
4560
  "Purpose": purpose
4274
4561
  };
4275
4562
  }
4276
- const params = Api.PrepReqParams(reqParams);
4277
- params.formData = formData;
4278
- return api.UPLOAD("file/uploadNew", file, params);
4563
+ const reqParams = Api.PrepReqParams(req);
4564
+ reqParams.formData = formData;
4565
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4566
+ try {
4567
+ const data = yield api.UPLOAD("file/uploadNew", file, reqParams);
4568
+ res({
4569
+ clientFile: data
4570
+ });
4571
+ }
4572
+ catch (e) {
4573
+ rej(e);
4574
+ }
4575
+ }));
4576
+ return prom;
4279
4577
  });
4280
4578
  }
4281
4579
  ClientFile.Upload = Upload;
4282
4580
  /**
4283
4581
  * Uploads a temp file.
4284
4582
  * This will return a temp file id which can be used in various endpoints.
4285
- * @param api
4286
- * @param file
4287
- * @param reqParams
4583
+ * @param params
4288
4584
  * @returns
4289
4585
  */
4290
- function UploadTemp(api, file, reqParams) {
4586
+ function UploadTemp(params) {
4291
4587
  return __awaiter(this, void 0, void 0, function* () {
4588
+ const { api, file, req } = params;
4292
4589
  if (!file) {
4293
4590
  throw ("File is required.");
4294
4591
  }
4295
4592
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4296
4593
  try {
4297
- const params = Api.PrepReqParams(reqParams);
4298
- const data = yield api.UPLOAD("file/uploadTemp", file, params);
4299
- res(data["TempFile.ID"]);
4594
+ const reqParams = Api.PrepReqParams(req);
4595
+ const data = yield api.UPLOAD("file/uploadTemp", file, reqParams);
4596
+ res({
4597
+ tempFileId: data["TempFile.ID"]
4598
+ });
4300
4599
  }
4301
4600
  catch (e) {
4302
4601
  rej(e);
@@ -4308,38 +4607,37 @@ var ClientFile;
4308
4607
  ClientFile.UploadTemp = UploadTemp;
4309
4608
  let Filter;
4310
4609
  (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.
4610
+ let EColumn;
4611
+ (function (EColumn) {
4612
+ EColumn["ID"] = "id";
4613
+ EColumn["Name"] = "name";
4614
+ EColumn["DateTime"] = "datetime";
4615
+ EColumn["MIMEType"] = "mimeType";
4616
+ EColumn["Size"] = "size";
4617
+ EColumn["User"] = "user";
4618
+ EColumn["Extension"] = "extension";
4619
+ })(EColumn = Filter.EColumn || (Filter.EColumn = {}));
4620
+ let ESortOrder;
4621
+ (function (ESortOrder) {
4622
+ ESortOrder["ASC"] = "asc";
4623
+ ESortOrder["DEC"] = "desc";
4624
+ })(ESortOrder = Filter.ESortOrder || (Filter.ESortOrder = {}));
4625
+ let ERowOperator;
4626
+ (function (ERowOperator) {
4627
+ ERowOperator["AND"] = "AND";
4628
+ ERowOperator["OR"] = "OR";
4629
+ })(ERowOperator = Filter.ERowOperator || (Filter.ERowOperator = {}));
4342
4630
  })(Filter = ClientFile.Filter || (ClientFile.Filter = {}));
4631
+ function GetList(params) {
4632
+ return __awaiter(this, void 0, void 0, function* () {
4633
+ const { api, filter, req: reqParams } = params;
4634
+ const data = yield api.POST("files/filtered", filter, Api.PrepReqParams(reqParams));
4635
+ return {
4636
+ clientFiles: data.Items
4637
+ };
4638
+ });
4639
+ }
4640
+ ClientFile.GetList = GetList;
4343
4641
  let Processor;
4344
4642
  (function (Processor) {
4345
4643
  let EConvertExt;
@@ -4347,8 +4645,9 @@ var ClientFile;
4347
4645
  EConvertExt["GLB"] = ".glb";
4348
4646
  EConvertExt["SKP"] = ".skp";
4349
4647
  })(EConvertExt = Processor.EConvertExt || (Processor.EConvertExt = {}));
4350
- function ConvertFormat(api, clientFileId, ext, reqParams) {
4648
+ function ConvertFormat(params) {
4351
4649
  return __awaiter(this, void 0, void 0, function* () {
4650
+ const { api, fileId: clientFileId, ext, req: reqParams } = params;
4352
4651
  if (!clientFileId || !ext) {
4353
4652
  throw ("Client File ID and extension are required.");
4354
4653
  }
@@ -4383,8 +4682,9 @@ var ProgramKey;
4383
4682
  EProgramId["BingMaps"] = "BingMaps";
4384
4683
  EProgramId["Mapbox"] = "Mapbox";
4385
4684
  })(EProgramId = ProgramKey.EProgramId || (ProgramKey.EProgramId = {}));
4386
- function Get(api, programId, reqParams) {
4685
+ function Get(params) {
4387
4686
  return __awaiter(this, void 0, void 0, function* () {
4687
+ const { api, programId, req: reqParams } = params;
4388
4688
  if (!programId) {
4389
4689
  throw ("Program ID is required.");
4390
4690
  }
@@ -4393,14 +4693,25 @@ var ProgramKey;
4393
4693
  if (cacheData) {
4394
4694
  return cacheData;
4395
4695
  }
4396
- const req = api.GET(`programkey/${programId}`, Api.PrepReqParams(reqParams));
4397
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
4398
- return req;
4696
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4697
+ try {
4698
+ const data = yield api.GET(`programkey/${programId}`, Api.PrepReqParams(reqParams));
4699
+ res({
4700
+ programKey: data
4701
+ });
4702
+ }
4703
+ catch (e) {
4704
+ rej(e);
4705
+ }
4706
+ }));
4707
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
4708
+ return prom;
4399
4709
  });
4400
4710
  }
4401
4711
  ProgramKey.Get = Get;
4402
- function GetList(api, reqParams) {
4712
+ function GetList(params) {
4403
4713
  return __awaiter(this, void 0, void 0, function* () {
4714
+ const { api, req: reqParams } = params;
4404
4715
  const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
4405
4716
  if (cacheData) {
4406
4717
  return cacheData;
@@ -4408,7 +4719,9 @@ var ProgramKey;
4408
4719
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4409
4720
  try {
4410
4721
  const data = yield api.GET("programkeys", Api.PrepReqParams(reqParams));
4411
- res(data.Items);
4722
+ res({
4723
+ programKeys: data.Items
4724
+ });
4412
4725
  }
4413
4726
  catch (e) {
4414
4727
  rej(e);
@@ -4419,8 +4732,9 @@ var ProgramKey;
4419
4732
  });
4420
4733
  }
4421
4734
  ProgramKey.GetList = GetList;
4422
- function Delete(api, programId, reqParams) {
4735
+ function Delete(params) {
4423
4736
  return __awaiter(this, void 0, void 0, function* () {
4737
+ const { api, programId, req: reqParams } = params;
4424
4738
  if (!programId) {
4425
4739
  throw ("Program ID is required.");
4426
4740
  }
@@ -4430,15 +4744,18 @@ var ProgramKey;
4430
4744
  });
4431
4745
  }
4432
4746
  ProgramKey.Delete = Delete;
4433
- function Update(api, data, reqParams) {
4747
+ function Update(params) {
4434
4748
  return __awaiter(this, void 0, void 0, function* () {
4749
+ const { api, programKey: data, req: reqParams } = params;
4435
4750
  if (!(data === null || data === void 0 ? void 0 : data.ProgramId)) {
4436
4751
  throw ("Program ID is required.");
4437
4752
  }
4438
- data = yield api.POST("programkey", data, Api.PrepReqParams(reqParams));
4753
+ const res = yield api.POST("programkey", data, Api.PrepReqParams(reqParams));
4439
4754
  api.Cache.Remove(GetCacheKey(data.ProgramId));
4440
4755
  api.Cache.Remove(GetListCacheKey());
4441
- return data;
4756
+ return {
4757
+ programKey: res
4758
+ };
4442
4759
  });
4443
4760
  }
4444
4761
  ProgramKey.Update = Update;
@@ -4497,8 +4814,9 @@ var Tileset;
4497
4814
  EPivot["Weight"] = "weight";
4498
4815
  EPivot["UCS"] = "ucs";
4499
4816
  })(EPivot = Tileset.EPivot || (Tileset.EPivot = {}));
4500
- function Get(api, tilesetId, loadFiles = false, reqParams) {
4817
+ function Get(params) {
4501
4818
  return __awaiter(this, void 0, void 0, function* () {
4819
+ const { api, tilesetId, loadFiles, req: reqParams } = params;
4502
4820
  if (!tilesetId) {
4503
4821
  throw ("Tileset ID is required.");
4504
4822
  }
@@ -4506,14 +4824,25 @@ var Tileset;
4506
4824
  if (cacheData) {
4507
4825
  return cacheData;
4508
4826
  }
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;
4827
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4828
+ try {
4829
+ const data = yield api.GET(`tileset/get/${tilesetId}?noFiles=${Boolean(loadFiles) ? 0 : 1}`, reqParams);
4830
+ res({
4831
+ tileset: data
4832
+ });
4833
+ }
4834
+ catch (e) {
4835
+ rej(e);
4836
+ }
4837
+ }));
4838
+ api.Cache.Set(GetCacheKey(tilesetId, loadFiles), prom, Api.DEFAULT_CACHE_DURATION);
4839
+ return prom;
4512
4840
  });
4513
4841
  }
4514
4842
  Tileset.Get = Get;
4515
- function GetList(api, reqParams) {
4843
+ function GetList(params) {
4516
4844
  return __awaiter(this, void 0, void 0, function* () {
4845
+ const { api, req: reqParams } = params;
4517
4846
  const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
4518
4847
  if (cacheData) {
4519
4848
  return cacheData;
@@ -4521,7 +4850,9 @@ var Tileset;
4521
4850
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4522
4851
  try {
4523
4852
  const data = yield api.GET("tileset/getList", reqParams);
4524
- res(data);
4853
+ res({
4854
+ tilesets: data
4855
+ });
4525
4856
  }
4526
4857
  catch (e) {
4527
4858
  rej(e);
@@ -4532,8 +4863,9 @@ var Tileset;
4532
4863
  });
4533
4864
  }
4534
4865
  Tileset.GetList = GetList;
4535
- function Delete(api, tilesetId, reqParams) {
4866
+ function Delete(params) {
4536
4867
  return __awaiter(this, void 0, void 0, function* () {
4868
+ const { api, tilesetId, req: reqParams } = params;
4537
4869
  if (!tilesetId) {
4538
4870
  throw ("Tileset ID is required.");
4539
4871
  }
@@ -4543,8 +4875,9 @@ var Tileset;
4543
4875
  });
4544
4876
  }
4545
4877
  Tileset.Delete = Delete;
4546
- function Update(api, data, reqParams) {
4878
+ function Update(params) {
4547
4879
  return __awaiter(this, void 0, void 0, function* () {
4880
+ let { api, tileset: data, req: reqParams } = params;
4548
4881
  if (!(data === null || data === void 0 ? void 0 : data.name) || !(data === null || data === void 0 ? void 0 : data.type)) {
4549
4882
  throw ("Tileset name and type are required.");
4550
4883
  }
@@ -4556,22 +4889,25 @@ var Tileset;
4556
4889
  yield api.POST(`tileset/update/${data.id}`, data, Api.PrepReqParams(reqParams));
4557
4890
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Tileset + Api.ECacheKey.Id + data.id);
4558
4891
  api.Cache.RemoveByStartsWith(Api.ECacheKey.Tileset);
4559
- return data;
4892
+ return {
4893
+ tileset: data
4894
+ };
4560
4895
  });
4561
4896
  }
4562
4897
  Tileset.Update = Update;
4563
- function UploadFile(api, tilesetId, file, reqParams) {
4898
+ function UploadFile(params) {
4564
4899
  return __awaiter(this, void 0, void 0, function* () {
4900
+ const { api, tilesetId, file, req: reqParams } = params;
4565
4901
  if (!tilesetId || !file) {
4566
4902
  throw ("Tileset ID and file are required.");
4567
4903
  }
4568
- const params = Api.PrepReqParams(reqParams);
4569
- return api.UPLOAD(`tileset/uploadFile/${tilesetId}/files`, file, params);
4904
+ return api.UPLOAD(`tileset/uploadFile/${tilesetId}/files`, file, Api.PrepReqParams(reqParams));
4570
4905
  });
4571
4906
  }
4572
4907
  Tileset.UploadFile = UploadFile;
4573
- function DeleteFile(api, tilesetId, file, reqParams) {
4908
+ function DeleteFile(params) {
4574
4909
  return __awaiter(this, void 0, void 0, function* () {
4910
+ const { api, tilesetId, file, req: reqParams } = params;
4575
4911
  if (!tilesetId || !file) {
4576
4912
  throw ("Tileset ID and file are required.");
4577
4913
  }
@@ -4580,19 +4916,20 @@ var Tileset;
4580
4916
  });
4581
4917
  }
4582
4918
  Tileset.DeleteFile = DeleteFile;
4583
- function UploadSrcFile(api, tilesetId, file, reqParams) {
4919
+ function UploadSrcFile(params) {
4584
4920
  return __awaiter(this, void 0, void 0, function* () {
4921
+ const { api, tilesetId, file, req: reqParams } = params;
4585
4922
  if (!tilesetId || !file) {
4586
4923
  throw ("Tileset ID and file are required.");
4587
4924
  }
4588
- const params = Api.PrepReqParams(reqParams);
4589
- yield api.UPLOAD(`tileset/uploadFile/${tilesetId}/src`, file, params);
4925
+ yield api.UPLOAD(`tileset/uploadFile/${tilesetId}/src`, file, Api.PrepReqParams(reqParams));
4590
4926
  api.Cache.Remove(GetCacheKey(tilesetId, true));
4591
4927
  });
4592
4928
  }
4593
4929
  Tileset.UploadSrcFile = UploadSrcFile;
4594
- function DeleteSrcFile(api, tilesetId, file, reqParams) {
4930
+ function DeleteSrcFile(params) {
4595
4931
  return __awaiter(this, void 0, void 0, function* () {
4932
+ const { api, tilesetId, file, req: reqParams } = params;
4596
4933
  if (!tilesetId || !file) {
4597
4934
  throw ("Tileset ID and file are required.");
4598
4935
  }
@@ -4601,7 +4938,8 @@ var Tileset;
4601
4938
  });
4602
4939
  }
4603
4940
  Tileset.DeleteSrcFile = DeleteSrcFile;
4604
- function GetFileUrl(api, tilesetId, file) {
4941
+ function GetFileUrl(params) {
4942
+ let { api, tilesetId, file } = params;
4605
4943
  if (!tilesetId) {
4606
4944
  throw ("Tileset ID is required.");
4607
4945
  }
@@ -4611,7 +4949,8 @@ var Tileset;
4611
4949
  return api.GetBaseUrl() + `tileset/getFile/${tilesetId}/files/${file}`;
4612
4950
  }
4613
4951
  Tileset.GetFileUrl = GetFileUrl;
4614
- function GetSrcFileUrl(api, tilesetId, file) {
4952
+ function GetSrcFileUrl(params) {
4953
+ let { api, tilesetId, file } = params;
4615
4954
  if (!tilesetId) {
4616
4955
  throw ("Tileset ID is required.");
4617
4956
  }
@@ -4621,7 +4960,8 @@ var Tileset;
4621
4960
  return api.GetBaseUrl() + `tileset/getFile/${tilesetId}/src/${file}`;
4622
4961
  }
4623
4962
  Tileset.GetSrcFileUrl = GetSrcFileUrl;
4624
- function GetPublicFileUrl(api, tilesetId, file) {
4963
+ function GetPublicFileUrl(params) {
4964
+ let { api, tilesetId, file } = params;
4625
4965
  if (!tilesetId) {
4626
4966
  throw ("Tileset ID is required.");
4627
4967
  }
@@ -4631,13 +4971,16 @@ var Tileset;
4631
4971
  return api.GetBaseUrl() + `tileset/file/${tilesetId}/${file}`;
4632
4972
  }
4633
4973
  Tileset.GetPublicFileUrl = GetPublicFileUrl;
4634
- function Generate(api, tilesetId, reqParams) {
4974
+ function Generate(params) {
4635
4975
  return __awaiter(this, void 0, void 0, function* () {
4976
+ const { api, tilesetId, req: reqParams } = params;
4636
4977
  if (!tilesetId) {
4637
4978
  throw ("Tileset ID is required.");
4638
4979
  }
4639
4980
  const res = yield api.GET(`tileset/generate/${tilesetId}`, Api.PrepReqParams(reqParams));
4640
- return res.ID;
4981
+ return {
4982
+ pendingActionId: res.ID
4983
+ };
4641
4984
  });
4642
4985
  }
4643
4986
  Tileset.Generate = Generate;
@@ -4650,8 +4993,9 @@ var Tileset;
4650
4993
  return Api.ECacheKey.PublishTileset + Api.ECacheKey.Id + accountId + Api.ECacheKey.Id + tilesetId;
4651
4994
  }
4652
4995
  Publish.GetCacheKey = GetCacheKey;
4653
- function Update(api, data, reqParams) {
4996
+ function Update(params) {
4654
4997
  return __awaiter(this, void 0, void 0, function* () {
4998
+ const { api, published: data, req: reqParams } = params;
4655
4999
  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
5000
  throw ("Tileset ID, client account ID, and user ID are required.");
4657
5001
  }
@@ -4666,12 +5010,15 @@ var Tileset;
4666
5010
  yield api.POST(`tileset/${data.ID}/enableForAccounts`, req, reqParams);
4667
5011
  api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"], data["Tileset.ID"]));
4668
5012
  api.Cache.Remove(GetCacheKey(data["PublishedBy.ClientAccount.ID"]));
4669
- return data;
5013
+ return {
5014
+ published: data
5015
+ };
4670
5016
  });
4671
5017
  }
4672
5018
  Publish.Update = Update;
4673
- function Get(api, accountId, tilesetId, reqParams) {
5019
+ function Get(params) {
4674
5020
  return __awaiter(this, void 0, void 0, function* () {
5021
+ const { api, accountId, tilesetId, req: reqParams } = params;
4675
5022
  if (!accountId || !tilesetId) {
4676
5023
  throw ("Client account ID and tileset ID are required.");
4677
5024
  }
@@ -4679,14 +5026,25 @@ var Tileset;
4679
5026
  if (cacheData) {
4680
5027
  return cacheData;
4681
5028
  }
4682
- const req = api.GET(`tilesetByPublisher/${accountId}/${tilesetId}`, reqParams);
4683
- api.Cache.Set(GetCacheKey(accountId, tilesetId), req);
4684
- return req;
5029
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5030
+ try {
5031
+ const data = yield api.GET(`tilesetByPublisher/${accountId}/${tilesetId}`, reqParams);
5032
+ res({
5033
+ published: data
5034
+ });
5035
+ }
5036
+ catch (e) {
5037
+ rej(e);
5038
+ }
5039
+ }));
5040
+ api.Cache.Set(GetCacheKey(accountId, tilesetId), prom);
5041
+ return prom;
4685
5042
  });
4686
5043
  }
4687
5044
  Publish.Get = Get;
4688
- function GetList(api, accountId, reqParams) {
5045
+ function GetList(params) {
4689
5046
  return __awaiter(this, void 0, void 0, function* () {
5047
+ const { api, accountId, req: reqParams } = params;
4690
5048
  if (!accountId) {
4691
5049
  throw ("Client account ID is required.");
4692
5050
  }
@@ -4697,7 +5055,9 @@ var Tileset;
4697
5055
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4698
5056
  try {
4699
5057
  const data = yield api.GET(`tilesets/enabledForAccount/${accountId}`, reqParams);
4700
- res(data.Items);
5058
+ res({
5059
+ published: data.Items
5060
+ });
4701
5061
  }
4702
5062
  catch (e) {
4703
5063
  rej(e);
@@ -4709,6 +5069,23 @@ var Tileset;
4709
5069
  }
4710
5070
  Publish.GetList = GetList;
4711
5071
  })(Publish = Tileset.Publish || (Tileset.Publish = {}));
5072
+ let Settings;
5073
+ (function (Settings) {
5074
+ let EMapTileSize;
5075
+ (function (EMapTileSize) {
5076
+ EMapTileSize[EMapTileSize["IMG_256"] = 256] = "IMG_256";
5077
+ EMapTileSize[EMapTileSize["IMG_512"] = 512] = "IMG_512";
5078
+ EMapTileSize[EMapTileSize["IMG_1024"] = 1024] = "IMG_1024";
5079
+ EMapTileSize[EMapTileSize["IMG_2048"] = 2048] = "IMG_2048";
5080
+ })(EMapTileSize = Settings.EMapTileSize || (Settings.EMapTileSize = {}));
5081
+ let EExternalMapType;
5082
+ (function (EExternalMapType) {
5083
+ EExternalMapType["TileMapImagery"] = "TileMapImagery";
5084
+ EExternalMapType["OpenStreetMapImagery"] = "OpenStreetMapImagery";
5085
+ EExternalMapType["MapBoxImagery"] = "MapBoxImagery";
5086
+ EExternalMapType["CesiumIon"] = "CesiumIon";
5087
+ })(EExternalMapType = Settings.EExternalMapType || (Settings.EExternalMapType = {}));
5088
+ })(Settings = Tileset.Settings || (Tileset.Settings = {}));
4712
5089
  })(Tileset || (Tileset = {}));
4713
5090
 
4714
5091
  /**
@@ -4840,16 +5217,17 @@ var ProjectViewBookmark;
4840
5217
  // This is the expected default version for the DataVersion value.
4841
5218
  // This value should NOT be changed without looking at our API and seeing what the default value is.
4842
5219
  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) {
5220
+ let LegacyNavigator;
5221
+ (function (LegacyNavigator) {
5222
+ LegacyNavigator.DATA_VERSION = 1;
5223
+ })(LegacyNavigator = ProjectViewBookmark.LegacyNavigator || (ProjectViewBookmark.LegacyNavigator = {}));
5224
+ let Navigator;
5225
+ (function (Navigator) {
5226
+ Navigator.DATA_VERSION = 2;
5227
+ })(Navigator = ProjectViewBookmark.Navigator || (ProjectViewBookmark.Navigator = {}));
5228
+ function Get(params) {
4852
5229
  return __awaiter(this, void 0, void 0, function* () {
5230
+ const { api, viewId, bookmarkId, req: reqParams } = params;
4853
5231
  if (!viewId || !bookmarkId) {
4854
5232
  throw ("View ID and Bookmark ID are required.");
4855
5233
  }
@@ -4858,14 +5236,25 @@ var ProjectViewBookmark;
4858
5236
  if (cacheData) {
4859
5237
  return cacheData;
4860
5238
  }
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;
5239
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5240
+ try {
5241
+ const data = yield api.GET(`ui.view/${viewId}/slide/${bookmarkId}`, Api.PrepReqParams(reqParams));
5242
+ res({
5243
+ bookmark: data
5244
+ });
5245
+ }
5246
+ catch (e) {
5247
+ rej(e);
5248
+ }
5249
+ }));
5250
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
5251
+ return prom;
4864
5252
  });
4865
5253
  }
4866
5254
  ProjectViewBookmark.Get = Get;
4867
- function Delete(api, viewId, bookmarkId, reqParams) {
5255
+ function Delete(params) {
4868
5256
  return __awaiter(this, void 0, void 0, function* () {
5257
+ const { api, viewId, bookmarkId, req: reqParams } = params;
4869
5258
  if (!viewId || !bookmarkId) {
4870
5259
  throw ("View ID and Bookmark ID are required.");
4871
5260
  }
@@ -4875,8 +5264,9 @@ var ProjectViewBookmark;
4875
5264
  });
4876
5265
  }
4877
5266
  ProjectViewBookmark.Delete = Delete;
4878
- function GetList(api, viewId, reqParams) {
5267
+ function GetList(params) {
4879
5268
  return __awaiter(this, void 0, void 0, function* () {
5269
+ const { api, viewId, req: reqParams } = params;
4880
5270
  if (!viewId) {
4881
5271
  throw ("View ID is required.");
4882
5272
  }
@@ -4894,11 +5284,15 @@ var ProjectViewBookmark;
4894
5284
  for (let i = 0; i < items.length; i++) {
4895
5285
  const item = items[i];
4896
5286
  const prom = new Promise((res) => {
4897
- res(item);
5287
+ res({
5288
+ bookmark: item
5289
+ });
4898
5290
  });
4899
5291
  api.Cache.Set(GetCacheKey(viewId, item.ID), prom, Api.DEFAULT_CACHE_DURATION);
4900
5292
  }
4901
- res(items);
5293
+ res({
5294
+ bookmarks: items
5295
+ });
4902
5296
  }
4903
5297
  catch (e) {
4904
5298
  rej(e);
@@ -4909,20 +5303,24 @@ var ProjectViewBookmark;
4909
5303
  });
4910
5304
  }
4911
5305
  ProjectViewBookmark.GetList = GetList;
4912
- function Update(api, viewId, data, reqParams) {
5306
+ function Update(params) {
4913
5307
  return __awaiter(this, void 0, void 0, function* () {
5308
+ const { api, viewId, bookmark: data, req: reqParams } = params;
4914
5309
  if (!(data === null || data === void 0 ? void 0 : data.Title)) {
4915
5310
  data.Title = data.ID;
4916
5311
  }
4917
- data = yield api.POST(`ui.view/${viewId}/slide/${data.ID ? data.ID : ""}`, data, Api.PrepReqParams(reqParams));
5312
+ const res = yield api.POST(`ui.view/${viewId}/slide/${data.ID ? data.ID : ""}`, data, Api.PrepReqParams(reqParams));
4918
5313
  api.Cache.Remove(GetCacheKey(viewId, data.ID));
4919
5314
  api.Cache.Remove(GetListCacheKey(viewId));
4920
- return data;
5315
+ return {
5316
+ bookmark: res
5317
+ };
4921
5318
  });
4922
5319
  }
4923
5320
  ProjectViewBookmark.Update = Update;
4924
- function SetOrder(api, viewId, bookmarkIds, reqParams) {
5321
+ function SetOrder(params) {
4925
5322
  return __awaiter(this, void 0, void 0, function* () {
5323
+ const { api, viewId, bookmarkIds, req: reqParams } = params;
4926
5324
  const reqData = {
4927
5325
  "UISlide.ID": bookmarkIds,
4928
5326
  "DisplayOrder.Start": 0
@@ -4952,16 +5350,17 @@ var ProjectView;
4952
5350
  // This is the expected default version for the DataVersion value.
4953
5351
  // This value should NOT be changed without looking at our API and seeing what the default value is.
4954
5352
  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) {
5353
+ let LegacyNavigator;
5354
+ (function (LegacyNavigator) {
5355
+ LegacyNavigator.DATA_VERSION = 1;
5356
+ })(LegacyNavigator = ProjectView.LegacyNavigator || (ProjectView.LegacyNavigator = {}));
5357
+ let Navigator;
5358
+ (function (Navigator) {
5359
+ Navigator.DATA_VERSION = 2;
5360
+ })(Navigator = ProjectView.Navigator || (ProjectView.Navigator = {}));
5361
+ function Get(params) {
4964
5362
  return __awaiter(this, void 0, void 0, function* () {
5363
+ const { api, viewId, req: reqParams } = params;
4965
5364
  if (!viewId) {
4966
5365
  throw ("View ID is required.");
4967
5366
  }
@@ -4970,34 +5369,48 @@ var ProjectView;
4970
5369
  if (cacheData) {
4971
5370
  return cacheData;
4972
5371
  }
4973
- const req = api.GET(`ui.view/${viewId}`, Api.PrepReqParams(reqParams));
4974
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
4975
- return req;
5372
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5373
+ try {
5374
+ const data = yield api.GET(`ui.view/${viewId}`, Api.PrepReqParams(reqParams));
5375
+ res({
5376
+ view: data
5377
+ });
5378
+ }
5379
+ catch (e) {
5380
+ rej(e);
5381
+ }
5382
+ }));
5383
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
5384
+ return prom;
4976
5385
  });
4977
5386
  }
4978
5387
  ProjectView.Get = Get;
4979
- function GetList(api, reqParams) {
5388
+ function GetList(params) {
4980
5389
  return __awaiter(this, void 0, void 0, function* () {
5390
+ const { api, req: reqParams } = params;
4981
5391
  const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
4982
5392
  if (cacheData) {
4983
5393
  return cacheData;
4984
5394
  }
4985
- const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5395
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
4986
5396
  try {
4987
5397
  const data = yield api.GET("ui.view/list", Api.PrepReqParams(reqParams));
4988
- res(data.Items);
5398
+ res({
5399
+ views: data.Items
5400
+ });
4989
5401
  }
4990
5402
  catch (e) {
4991
5403
  rej(e);
4992
5404
  }
4993
5405
  }));
4994
- api.Cache.Set(GetListCacheKey(), req, Api.DEFAULT_CACHE_DURATION);
4995
- return req;
5406
+ api.Cache.Set(GetListCacheKey(), prom, Api.DEFAULT_CACHE_DURATION);
5407
+ return prom;
4996
5408
  });
4997
5409
  }
4998
5410
  ProjectView.GetList = GetList;
4999
- function Delete(api, viewId, reqParams) {
5411
+ function Delete(params) {
5000
5412
  return __awaiter(this, void 0, void 0, function* () {
5413
+ const { api, viewId, req: reqParams } = params;
5001
5414
  if (!viewId) {
5002
5415
  throw ("View ID is required.");
5003
5416
  }
@@ -5007,8 +5420,9 @@ var ProjectView;
5007
5420
  });
5008
5421
  }
5009
5422
  ProjectView.Delete = Delete;
5010
- function Update(api, data, reqParams) {
5423
+ function Update(params) {
5011
5424
  return __awaiter(this, void 0, void 0, function* () {
5425
+ let { api, view: data, req: reqParams } = params;
5012
5426
  if (!data) {
5013
5427
  data = {};
5014
5428
  }
@@ -5030,7 +5444,9 @@ var ProjectView;
5030
5444
  }
5031
5445
  api.Cache.Remove(GetCacheKey(data.ID));
5032
5446
  api.Cache.Remove(GetListCacheKey());
5033
- return data;
5447
+ return {
5448
+ view: data
5449
+ };
5034
5450
  });
5035
5451
  }
5036
5452
  ProjectView.Update = Update;
@@ -5039,7 +5455,11 @@ var ProjectView;
5039
5455
  function getTemplateSettings(apiGetter, reqParams) {
5040
5456
  var _a;
5041
5457
  return __awaiter(this, void 0, void 0, function* () {
5042
- const view = yield ProjectView.Get(apiGetter.getApi(Api.TEMPLATE_ACCOUNT_ID), "default", reqParams);
5458
+ const { view } = yield ProjectView.Get({
5459
+ api: apiGetter.getApi(Api.TEMPLATE_ACCOUNT_ID),
5460
+ viewId: "default",
5461
+ req: reqParams
5462
+ });
5043
5463
  return (_a = view.Settings) !== null && _a !== void 0 ? _a : {};
5044
5464
  });
5045
5465
  }
@@ -5062,29 +5482,35 @@ function checkSourceToTemplate(items, templateItem, addIfMissing) {
5062
5482
  */
5063
5483
  var ProjectViewLegacyTile;
5064
5484
  (function (ProjectViewLegacyTile) {
5065
- function MergeMapTemplateData(getter, items, addIfMissing, reqParams) {
5485
+ function MergeMapTemplateData(params) {
5066
5486
  var _a;
5067
5487
  return __awaiter(this, void 0, void 0, function* () {
5488
+ const { getter, sources: items, addIfMissing, req: reqParams } = params;
5068
5489
  const settings = yield getTemplateSettings(getter, reqParams);
5069
5490
  const maps = (_a = settings.CesiumMapSources) !== null && _a !== void 0 ? _a : [];
5070
5491
  for (let i = 0; i < maps.length; i++) {
5071
5492
  const mapSource = maps[i];
5072
5493
  checkSourceToTemplate(items, mapSource, addIfMissing);
5073
5494
  }
5074
- return [];
5495
+ return {
5496
+ sources: items
5497
+ };
5075
5498
  });
5076
5499
  }
5077
5500
  ProjectViewLegacyTile.MergeMapTemplateData = MergeMapTemplateData;
5078
- function MergeTerrainTemplateData(getter, items, addIfMissing, reqParams) {
5501
+ function MergeTerrainTemplateData(params) {
5079
5502
  var _a;
5080
5503
  return __awaiter(this, void 0, void 0, function* () {
5504
+ const { getter, sources: items, addIfMissing, req: reqParams } = params;
5081
5505
  const settings = yield getTemplateSettings(getter, reqParams);
5082
5506
  const terrains = (_a = settings.CesiumTerrainSources) !== null && _a !== void 0 ? _a : [];
5083
5507
  for (let i = 0; i < terrains.length; i++) {
5084
5508
  const terrainSource = terrains[i];
5085
5509
  checkSourceToTemplate(items, terrainSource, addIfMissing);
5086
5510
  }
5087
- return [];
5511
+ return {
5512
+ sources: items
5513
+ };
5088
5514
  });
5089
5515
  }
5090
5516
  ProjectViewLegacyTile.MergeTerrainTemplateData = MergeTerrainTemplateData;
@@ -5221,24 +5647,32 @@ var PendingAction;
5221
5647
  EStatus["Complete"] = "COMPLETE";
5222
5648
  EStatus["Failed"] = "FAILED";
5223
5649
  })(EStatus = PendingAction.EStatus || (PendingAction.EStatus = {}));
5224
- function Get(api, actionId, reqParams) {
5650
+ function Get(params) {
5225
5651
  return __awaiter(this, void 0, void 0, function* () {
5652
+ const { api, actionId, req: reqParams } = params;
5226
5653
  if (!actionId) {
5227
5654
  throw ("Action ID is required.");
5228
5655
  }
5229
- return api.GET(`pendingAction/${actionId}`, Api.PrepReqParams(reqParams));
5656
+ const data = yield api.GET(`pendingAction/${actionId}`, Api.PrepReqParams(reqParams));
5657
+ return {
5658
+ action: data
5659
+ };
5230
5660
  });
5231
5661
  }
5232
5662
  PendingAction.Get = Get;
5233
- function GetRelevantList(api, stricter = false, reqParams) {
5663
+ function GetRelevantList(params) {
5234
5664
  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;
5665
+ const { api, stricter, reqParams } = params;
5666
+ const data = yield api.GET(`pendingActions/important?Update=${Boolean(stricter)}`, Api.PrepReqParams(reqParams));
5667
+ return {
5668
+ actions: data.Items
5669
+ };
5237
5670
  });
5238
5671
  }
5239
5672
  PendingAction.GetRelevantList = GetRelevantList;
5240
- function GetMessages(api, actionId, order, startIndex, amount, reqParams) {
5673
+ function GetMessages(params) {
5241
5674
  return __awaiter(this, void 0, void 0, function* () {
5675
+ let { api, actionId, order, startIndex, amount, req: reqParams } = params;
5242
5676
  if (amount == null) {
5243
5677
  amount = 500;
5244
5678
  }
@@ -5250,7 +5684,9 @@ var PendingAction;
5250
5684
  }
5251
5685
  const args = `?SortOrder=${order == Api.ESortOrder.Desc ? "DESC" : "ASC"}&PageSize=${amount}&PageIndex=${startIndex}`;
5252
5686
  const data = yield api.GET(`pendingAction/${actionId}/progressMessages` + args, Api.PrepReqParams(reqParams));
5253
- return data.Items;
5687
+ return {
5688
+ messages: data.Items
5689
+ };
5254
5690
  });
5255
5691
  }
5256
5692
  PendingAction.GetMessages = GetMessages;
@@ -5284,25 +5720,29 @@ var Style;
5284
5720
  EPointType["Icon"] = "ICON";
5285
5721
  EPointType["Cylinder"] = "CYLINDER";
5286
5722
  })(EPointType = Style.EPointType || (Style.EPointType = {}));
5287
- function GetList(api, reqParams) {
5723
+ function GetList(params) {
5724
+ const { api, req: reqParams } = params;
5288
5725
  const cacheData = api.GetCacheItem(GetListCacheKey(), reqParams);
5289
5726
  if (cacheData) {
5290
5727
  return cacheData;
5291
5728
  }
5292
- const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5729
+ const res = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5293
5730
  try {
5294
5731
  const data = yield api.GET("ui.entityDisplaySettings", Api.PrepReqParams(reqParams));
5295
- res(data.Items);
5732
+ res({
5733
+ styles: data.Items
5734
+ });
5296
5735
  }
5297
5736
  catch (e) {
5298
5737
  rej(e);
5299
5738
  }
5300
5739
  }));
5301
- api.Cache.Set(GetListCacheKey(), req, Api.DEFAULT_CACHE_DURATION);
5302
- return req;
5740
+ api.Cache.Set(GetListCacheKey(), res, Api.DEFAULT_CACHE_DURATION);
5741
+ return res;
5303
5742
  }
5304
5743
  Style.GetList = GetList;
5305
- function Get(api, id, reqParams) {
5744
+ function Get(params) {
5745
+ const { api, styleId: id, req: reqParams } = params;
5306
5746
  if (!id) {
5307
5747
  throw ("Style ID is required.");
5308
5748
  }
@@ -5310,28 +5750,42 @@ var Style;
5310
5750
  if (cacheData) {
5311
5751
  return cacheData;
5312
5752
  }
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;
5753
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5754
+ try {
5755
+ const data = yield api.GET(`ui.entityDisplaySetting/${id}`, Api.PrepReqParams(reqParams));
5756
+ res({
5757
+ style: data
5758
+ });
5759
+ }
5760
+ catch (e) {
5761
+ rej(e);
5762
+ }
5763
+ }));
5764
+ api.Cache.Set(GetCacheKey(id), prom, Api.DEFAULT_CACHE_DURATION);
5765
+ return prom;
5316
5766
  }
5317
5767
  Style.Get = Get;
5318
- function Update(api, data, reqParams) {
5768
+ function Update(params) {
5319
5769
  return __awaiter(this, void 0, void 0, function* () {
5770
+ const { api, style: data, req: reqParams } = params;
5320
5771
  if (!(data === null || data === void 0 ? void 0 : data.Name)) {
5321
5772
  throw ("Style name is required.");
5322
5773
  }
5323
5774
  if (!data.ID) {
5324
5775
  data.ID = 0;
5325
5776
  }
5326
- data = yield api.POST(`ui.entityDisplaySetting/${data.ID}`, data, Api.PrepReqParams(reqParams));
5777
+ const res = yield api.POST(`ui.entityDisplaySetting/${data.ID}`, data, Api.PrepReqParams(reqParams));
5327
5778
  api.Cache.Remove(GetCacheKey(data.ID));
5328
5779
  api.Cache.Remove(GetListCacheKey());
5329
- return data;
5780
+ return {
5781
+ style: res
5782
+ };
5330
5783
  });
5331
5784
  }
5332
5785
  Style.Update = Update;
5333
- function Delete(api, id, reqParams) {
5786
+ function Delete(params) {
5334
5787
  return __awaiter(this, void 0, void 0, function* () {
5788
+ const { api, styleId: id, req: reqParams } = params;
5335
5789
  if (!id) {
5336
5790
  throw ("Style ID is required.");
5337
5791
  }
@@ -5343,37 +5797,6 @@ var Style;
5343
5797
  Style.Delete = Delete;
5344
5798
  })(Style || (Style = {}));
5345
5799
 
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
5800
  var Permission;
5378
5801
  (function (Permission) {
5379
5802
  let EPerm;
@@ -5402,8 +5825,9 @@ var Session;
5402
5825
  function GetCacheKey(sessionId) {
5403
5826
  return `${Api.ECacheKey.Session}${Api.ECacheKey.Id}${sessionId}`;
5404
5827
  }
5405
- function Get(api, sessionId, reqParams) {
5828
+ function Get(params) {
5406
5829
  return __awaiter(this, void 0, void 0, function* () {
5830
+ const { api, sessionId, req: reqParams } = params;
5407
5831
  if (!sessionId) {
5408
5832
  throw ("Session ID is required.");
5409
5833
  }
@@ -5412,14 +5836,25 @@ var Session;
5412
5836
  if (cacheData) {
5413
5837
  return cacheData;
5414
5838
  }
5415
- const req = api.GET(`session/${sessionId}`, reqParams);
5416
- api.Cache.Set(key, req, Api.DEFAULT_CACHE_DURATION);
5417
- return req;
5839
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5840
+ try {
5841
+ const data = yield api.GET(`session/${sessionId}`, reqParams);
5842
+ res({
5843
+ session: data
5844
+ });
5845
+ }
5846
+ catch (e) {
5847
+ rej(e);
5848
+ }
5849
+ }));
5850
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
5851
+ return prom;
5418
5852
  });
5419
5853
  }
5420
5854
  Session.Get = Get;
5421
- function Login(api, username, password, accountId, reqParams) {
5855
+ function Login(params) {
5422
5856
  return __awaiter(this, void 0, void 0, function* () {
5857
+ const { api, username, password, accountId, req: reqParams } = params;
5423
5858
  if (!username || !password) {
5424
5859
  throw ("Username and password are required.");
5425
5860
  }
@@ -5432,12 +5867,15 @@ var Session;
5432
5867
  const ssid = session === null || session === void 0 ? void 0 : session.ID;
5433
5868
  api.SetSessionId(ssid);
5434
5869
  api.Cache.Remove(GetCacheKey(ssid));
5435
- return session;
5870
+ return {
5871
+ session: session
5872
+ };
5436
5873
  });
5437
5874
  }
5438
5875
  Session.Login = Login;
5439
- function Logout(api, reqParams) {
5876
+ function Logout(params) {
5440
5877
  return __awaiter(this, void 0, void 0, function* () {
5878
+ const { api, req: reqParams } = params;
5441
5879
  const ssid = api.GetSessionId();
5442
5880
  if (ssid) {
5443
5881
  yield api.POST("logout", null, reqParams);
@@ -5447,8 +5885,9 @@ var Session;
5447
5885
  });
5448
5886
  }
5449
5887
  Session.Logout = Logout;
5450
- function IsPermEnabled(session, accountId, perm) {
5888
+ function IsPermEnabled(params) {
5451
5889
  var _a, _b;
5890
+ let { session, accountId, perm } = params;
5452
5891
  if (!perm) {
5453
5892
  throw ("Perm is required.");
5454
5893
  }
@@ -5472,8 +5911,9 @@ var Session;
5472
5911
  return false;
5473
5912
  }
5474
5913
  Session.IsPermEnabled = IsPermEnabled;
5475
- function IsSuperPermEnabled(session, perm) {
5914
+ function IsSuperPermEnabled(params) {
5476
5915
  var _a, _b;
5916
+ let { session, perm } = params;
5477
5917
  if (!perm) {
5478
5918
  throw ("Perm is required.");
5479
5919
  }
@@ -5482,12 +5922,19 @@ var Session;
5482
5922
  return accessPerms.findIndex(x => x.toLocaleUpperCase() == perm) > -1;
5483
5923
  }
5484
5924
  Session.IsSuperPermEnabled = IsSuperPermEnabled;
5485
- function IsAccountAdmin(session, accountId) {
5486
- return IsPermEnabled(session, accountId, Permission.EPerm.ADMIN);
5925
+ function IsAccountAdmin(params) {
5926
+ return IsPermEnabled({
5927
+ perm: Permission.EPerm.ADMIN,
5928
+ accountId: params.accountId,
5929
+ session: params.session
5930
+ });
5487
5931
  }
5488
5932
  Session.IsAccountAdmin = IsAccountAdmin;
5489
- function IsSuperAdmin(session) {
5490
- return IsSuperPermEnabled(session, Permission.EPerm.ADMIN);
5933
+ function IsSuperAdmin(params) {
5934
+ return IsSuperPermEnabled({
5935
+ session: params.session,
5936
+ perm: Permission.EPerm.ADMIN
5937
+ });
5491
5938
  }
5492
5939
  Session.IsSuperAdmin = IsSuperAdmin;
5493
5940
  })(Session || (Session = {}));
@@ -5498,47 +5945,61 @@ var Session;
5498
5945
  */
5499
5946
  var UserGroup;
5500
5947
  (function (UserGroup) {
5501
- function GetByName(api, accountId, name, reqParams) {
5948
+ function GetByName(params) {
5502
5949
  return __awaiter(this, void 0, void 0, function* () {
5950
+ const { api, accountId, name, req: reqParams } = params;
5503
5951
  if (!name || !accountId) {
5504
5952
  throw ("Name and AccountID are required.");
5505
5953
  }
5506
- return api.GET(`account/${accountId}/userGroupByName/${name}`, reqParams);
5954
+ const data = yield api.GET(`account/${accountId}/userGroupByName/${name}`, reqParams);
5955
+ return {
5956
+ group: data
5957
+ };
5507
5958
  });
5508
5959
  }
5509
5960
  UserGroup.GetByName = GetByName;
5510
- function GetUsers(api, accountId, id, reqParams) {
5961
+ function GetUsers(params) {
5511
5962
  return __awaiter(this, void 0, void 0, function* () {
5963
+ const { api, accountId, groupId: id, req: reqParams } = params;
5512
5964
  if (!accountId || !id) {
5513
5965
  throw ("AccountID and ID are required.");
5514
5966
  }
5515
5967
  const data = yield api.GET(`userGroup/${accountId}/${id}/users`, reqParams);
5516
- return data.Items;
5968
+ return {
5969
+ users: data.Items
5970
+ };
5517
5971
  });
5518
5972
  }
5519
5973
  UserGroup.GetUsers = GetUsers;
5520
- function GetListByPerm(api, accountId, perm, reqParams) {
5974
+ function GetListByPerm(params) {
5521
5975
  return __awaiter(this, void 0, void 0, function* () {
5976
+ const { api, accountId, perm, req: reqParams } = params;
5522
5977
  if (!accountId || !perm) {
5523
5978
  throw ("AccountID and Perm are required.");
5524
5979
  }
5525
5980
  const data = yield api.GET(`userGroupsByFeature/${accountId}/${perm}`, reqParams);
5526
- return data.Items;
5981
+ return {
5982
+ groups: data.Items
5983
+ };
5527
5984
  });
5528
5985
  }
5529
5986
  UserGroup.GetListByPerm = GetListByPerm;
5530
- function GetList(api, accountId, reqParams) {
5987
+ function GetList(params) {
5531
5988
  return __awaiter(this, void 0, void 0, function* () {
5989
+ const { api, accountId, req: reqParams } = params;
5532
5990
  if (!accountId) {
5533
5991
  throw ("AccountID is required.");
5534
5992
  }
5535
5993
  const data = yield api.GET(`userGroups/${accountId}`, reqParams);
5536
- return data.Items;
5994
+ return {
5995
+ groups: data.Items
5996
+ };
5537
5997
  });
5538
5998
  }
5539
5999
  UserGroup.GetList = GetList;
5540
- function Delete(api, accountId, id, reqParams) {
6000
+ function Delete(params) {
5541
6001
  return __awaiter(this, void 0, void 0, function* () {
6002
+ const { api, accountId, groupId: id, req: reqParams } = params;
5542
6003
  if (!accountId || !id) {
5543
6004
  throw ("AccountID and ID are required.");
5544
6005
  }
@@ -5546,13 +6007,16 @@ var UserGroup;
5546
6007
  });
5547
6008
  }
5548
6009
  UserGroup.Delete = Delete;
5549
- function Update(api, data, reqParams) {
6010
+ function Update(params) {
5550
6011
  return __awaiter(this, void 0, void 0, function* () {
6012
+ const { api, group: data, reqParams } = params;
5551
6013
  if (!data.Name || !data["ClientAccount.ID"]) {
5552
6014
  throw ("User group name and client account ID are required.");
5553
6015
  }
5554
- data = yield api.POST(`userGroup${data.ID ? ("/" + data.ID) : ""}`, data, reqParams);
5555
- return data;
6016
+ const res = yield api.POST(`userGroup${data.ID ? ("/" + data.ID) : ""}`, data, reqParams);
6017
+ return {
6018
+ group: res
6019
+ };
5556
6020
  });
5557
6021
  }
5558
6022
  UserGroup.Update = Update;
@@ -5590,8 +6054,9 @@ var User;
5590
6054
  EType["User"] = "LOGIN_USER";
5591
6055
  EType["AccessToken"] = "ACCESS_TOKEN";
5592
6056
  })(EType = User.EType || (User.EType = {}));
5593
- function Get(api, id, accountId, reqParams) {
6057
+ function Get(params) {
5594
6058
  return __awaiter(this, void 0, void 0, function* () {
6059
+ const { api, userId: id, accountId, req: reqParams } = params;
5595
6060
  if (!id) {
5596
6061
  throw ("ID is required.");
5597
6062
  }
@@ -5601,13 +6066,16 @@ var User;
5601
6066
  }
5602
6067
  const req = yield api.GET(`user/${id}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
5603
6068
  api.Cache.Set(GetCacheKey(id, accountId), req, Api.DEFAULT_CACHE_DURATION);
5604
- return req;
6069
+ return {
6070
+ user: req
6071
+ };
5605
6072
  });
5606
6073
  }
5607
6074
  User.Get = Get;
5608
- function Update(api, data, reqParams) {
6075
+ function Update(params) {
5609
6076
  var _a;
5610
6077
  return __awaiter(this, void 0, void 0, function* () {
6078
+ const { api, user: data, req: reqParams } = params;
5611
6079
  if (!(data === null || data === void 0 ? void 0 : data.ID) || !(data === null || data === void 0 ? void 0 : data.Type)) {
5612
6080
  throw ("ID and Type are required.");
5613
6081
  }
@@ -5624,7 +6092,7 @@ var User;
5624
6092
  }
5625
6093
  }
5626
6094
  }
5627
- data = yield api.POST(`user/${data.ID}`, data, reqParams);
6095
+ const res = yield api.POST(`user/${data.ID}`, data, reqParams);
5628
6096
  api.Cache.RemoveByContains(Api.ECacheKey.User + Api.ECacheKey.Id + data.ID);
5629
6097
  if (data.Type == EType.AccessToken) {
5630
6098
  api.Cache.RemoveByStartsWith(Api.ECacheKey.AccessToken + Api.ECacheKey.Account);
@@ -5632,7 +6100,9 @@ var User;
5632
6100
  else if (data.Type == EType.User) {
5633
6101
  api.Cache.RemoveByStartsWith(Api.ECacheKey.User + Api.ECacheKey.Account);
5634
6102
  }
5635
- return data;
6103
+ return {
6104
+ user: res
6105
+ };
5636
6106
  });
5637
6107
  }
5638
6108
  User.Update = Update;
@@ -5655,14 +6125,18 @@ var User;
5655
6125
  try {
5656
6126
  const data = yield api.GET(`user/${userId}/application/${appId}/settings`);
5657
6127
  const settings = (data === null || data === void 0 ? void 0 : data.Settings) ? data.Settings : {};
5658
- res(settings);
6128
+ res({
6129
+ settings: settings
6130
+ });
5659
6131
  }
5660
6132
  catch (e) {
5661
6133
  // It will complain if an app id hasn't been used yet.
5662
6134
  // We need to suppress that error.
5663
6135
  if (e && typeof e == "object") {
5664
6136
  if (e.ERROR && typeof e.ERROR == "object" && e.ERROR.Type == "NotFound") {
5665
- res({});
6137
+ res({
6138
+ settings: {}
6139
+ });
5666
6140
  return;
5667
6141
  }
5668
6142
  }
@@ -5697,8 +6171,9 @@ var User;
5697
6171
  });
5698
6172
  }
5699
6173
  User.UpdateSettings = UpdateSettings;
5700
- function GetUsernameAvailable(api, username, excludeUserId, reqParams) {
6174
+ function GetUsernameAvailable(params) {
5701
6175
  return __awaiter(this, void 0, void 0, function* () {
6176
+ const { api, username, excludeUserId, req: reqParams } = params;
5702
6177
  if (!username) {
5703
6178
  throw ("Username is required.");
5704
6179
  }
@@ -5706,7 +6181,9 @@ var User;
5706
6181
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5707
6182
  try {
5708
6183
  const data = yield req;
5709
- res(data.IsAvailable);
6184
+ res({
6185
+ isAvailable: data.IsAvailable
6186
+ });
5710
6187
  }
5711
6188
  catch (e) {
5712
6189
  rej(e);
@@ -5722,8 +6199,9 @@ var User;
5722
6199
  return Api.ECacheKey.User + Api.ECacheKey.Account + Api.ECacheKey.Id + accountId;
5723
6200
  }
5724
6201
  LoginUser.GetListCacheKey = GetListCacheKey;
5725
- function GetByEmail(api, email, accountId, reqParams) {
6202
+ function GetByEmail(params) {
5726
6203
  return __awaiter(this, void 0, void 0, function* () {
6204
+ const { api, email, accountId, req: reqParams } = params;
5727
6205
  if (!email) {
5728
6206
  throw ("Email is required.");
5729
6207
  }
@@ -5733,12 +6211,15 @@ var User;
5733
6211
  }
5734
6212
  const req = yield api.GET(`userByEmail/${email}${accountId ? `?clientAccountID=${accountId}` : ""}`, reqParams);
5735
6213
  api.Cache.Set(GetEmailCacheKey(email, accountId), req, Api.DEFAULT_CACHE_DURATION);
5736
- return req;
6214
+ return {
6215
+ user: req
6216
+ };
5737
6217
  });
5738
6218
  }
5739
6219
  LoginUser.GetByEmail = GetByEmail;
5740
- function GetList(api, accountId, exclusive, reqParams) {
6220
+ function GetList(params) {
5741
6221
  return __awaiter(this, void 0, void 0, function* () {
6222
+ let { api, accountId, exclusive, req: reqParams } = params;
5742
6223
  if (!accountId) {
5743
6224
  throw ("Client account ID is required.");
5744
6225
  }
@@ -5752,13 +6233,16 @@ var User;
5752
6233
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5753
6234
  try {
5754
6235
  const data = yield api.GET(`users?clientAccountID=${accountId}${exclusive ? "&allExcludingClientAccount=true" : ""}`, reqParams);
5755
- res(data.Items);
6236
+ res({
6237
+ users: data.Items
6238
+ });
5756
6239
  }
5757
6240
  catch (e) {
5758
6241
  rej(e);
5759
6242
  }
5760
6243
  }));
5761
- req.then((users) => {
6244
+ req.then((data) => {
6245
+ const users = data.users;
5762
6246
  for (let i = 0; i < users.length; i++) {
5763
6247
  api.Cache.Set(GetCacheKey(users[i].ID, accountId), users[i]);
5764
6248
  }
@@ -5772,12 +6256,12 @@ var User;
5772
6256
  LoginUser.GetList = GetList;
5773
6257
  /**
5774
6258
  * Sends a signup email to the specified email address.
5775
- * @param api
5776
- * @param email
6259
+ * @param params
5777
6260
  * @returns
5778
6261
  */
5779
- function Signup(api, email, reqParams) {
6262
+ function Signup(params) {
5780
6263
  return __awaiter(this, void 0, void 0, function* () {
6264
+ const { api, email, req: reqParams } = params;
5781
6265
  if (!email) {
5782
6266
  throw ("Email is required.");
5783
6267
  }
@@ -5789,12 +6273,12 @@ var User;
5789
6273
  LoginUser.Signup = Signup;
5790
6274
  /**
5791
6275
  * Sends a new signup email using a previous one's expired code.
5792
- * @param api
5793
- * @param expiredCode
6276
+ * @param params
5794
6277
  * @returns
5795
6278
  */
5796
- function SignupResend(api, expiredCode, reqParams) {
6279
+ function SignupResend(params) {
5797
6280
  return __awaiter(this, void 0, void 0, function* () {
6281
+ const { api, expiredCode, req: reqParams } = params;
5798
6282
  if (!expiredCode) {
5799
6283
  throw ("Expired activation code is required.");
5800
6284
  }
@@ -5804,14 +6288,12 @@ var User;
5804
6288
  LoginUser.SignupResend = SignupResend;
5805
6289
  /**
5806
6290
  * Completes signup using user data and a signup code.
5807
- * @param api
5808
- * @param code
5809
- * @param data
5810
- * @param accountId
6291
+ * @param params
5811
6292
  * @returns
5812
6293
  */
5813
- function SignupComplete(api, code, data, accountId, reqParams) {
6294
+ function SignupComplete(params) {
5814
6295
  return __awaiter(this, void 0, void 0, function* () {
6296
+ let { api, code, user: data, accountId, req: reqParams } = params;
5815
6297
  if (!code || !(data === null || data === void 0 ? void 0 : data.Login) || !(data === null || data === void 0 ? void 0 : data.Password)) {
5816
6298
  throw ("Login, password, and activation code are required.");
5817
6299
  }
@@ -5824,19 +6306,20 @@ var User;
5824
6306
  if (data.Email) {
5825
6307
  api.Cache.RemoveByContains(Api.ECacheKey.User + Api.ECacheKey.UserEmail + data.Email);
5826
6308
  }
5827
- return res;
6309
+ return {
6310
+ user: res
6311
+ };
5828
6312
  });
5829
6313
  }
5830
6314
  LoginUser.SignupComplete = SignupComplete;
5831
6315
  /**
5832
6316
  * Sends a password reset email to the specified email address.
5833
- * @param api
5834
- * @param accountId
5835
- * @param email
6317
+ * @param params
5836
6318
  * @returns user id associated with provided email.
5837
6319
  */
5838
- function ForgotPassword(api, accountId, email, reqParams) {
6320
+ function ForgotPassword(params) {
5839
6321
  return __awaiter(this, void 0, void 0, function* () {
6322
+ const { api, accountId, email, req: reqParams } = params;
5840
6323
  if (!accountId || !email) {
5841
6324
  throw ("Account ID and email are required.");
5842
6325
  }
@@ -5846,7 +6329,9 @@ var User;
5846
6329
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5847
6330
  try {
5848
6331
  const data = yield req;
5849
- res(data.ID);
6332
+ res({
6333
+ userId: data.ID
6334
+ });
5850
6335
  }
5851
6336
  catch (e) {
5852
6337
  rej(e);
@@ -5858,22 +6343,28 @@ var User;
5858
6343
  LoginUser.ForgotPassword = ForgotPassword;
5859
6344
  /**
5860
6345
  * Completes password reset using a password reset code and new password.
5861
- * @param api
5862
- * @param code
5863
- * @param userId
5864
- * @param password
6346
+ * @param params
5865
6347
  * @returns
5866
6348
  */
5867
- function ForgotPasswordComplete(api, code, userId, password, reqParams) {
6349
+ function ForgotPasswordComplete(params) {
5868
6350
  return __awaiter(this, void 0, void 0, function* () {
5869
- const user = yield Get(api, userId, "");
5870
- return api.POST("UserSetNameAndPassword", {
6351
+ const { api, code, userId, password, req: reqParams } = params;
6352
+ const { user } = yield Get({
6353
+ api: api,
6354
+ userId: userId,
6355
+ accountId: "",
6356
+ req: reqParams
6357
+ });
6358
+ const res = yield api.POST("UserSetNameAndPassword", {
5871
6359
  ID: userId,
5872
6360
  Email: user.Email,
5873
6361
  ActivationCode: code,
5874
6362
  Password: password,
5875
6363
  FullName: user.FullName
5876
6364
  }, reqParams);
6365
+ return {
6366
+ user: res
6367
+ };
5877
6368
  });
5878
6369
  }
5879
6370
  LoginUser.ForgotPasswordComplete = ForgotPasswordComplete;
@@ -5884,8 +6375,9 @@ var User;
5884
6375
  return Api.ECacheKey.AccessToken + Api.ECacheKey.Account + Api.ECacheKey.Id + accountId;
5885
6376
  }
5886
6377
  AccessToken.GetListCacheKey = GetListCacheKey;
5887
- function GetList(api, accountId, reqParams) {
6378
+ function GetList(params) {
5888
6379
  return __awaiter(this, void 0, void 0, function* () {
6380
+ const { api, accountId, req: reqParams } = params;
5889
6381
  const cacheData = api.GetCacheItem(GetListCacheKey(accountId), reqParams);
5890
6382
  if (cacheData) {
5891
6383
  return cacheData;
@@ -5893,13 +6385,16 @@ var User;
5893
6385
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
5894
6386
  try {
5895
6387
  const data = yield api.GET("usersByClientAccount/accessTokens", reqParams);
5896
- res(data.Items);
6388
+ res({
6389
+ tokens: data.Items
6390
+ });
5897
6391
  }
5898
6392
  catch (e) {
5899
6393
  rej(e);
5900
6394
  }
5901
6395
  }));
5902
- req.then((users) => {
6396
+ req.then((data) => {
6397
+ const users = data.tokens;
5903
6398
  for (let i = 0; i < users.length; i++) {
5904
6399
  api.Cache.Set(GetCacheKey(users[i].ID, accountId), users[i]);
5905
6400
  }
@@ -5909,16 +6404,18 @@ var User;
5909
6404
  });
5910
6405
  }
5911
6406
  AccessToken.GetList = GetList;
5912
- function Delete(api, id, reqParams) {
6407
+ function Delete(params) {
5913
6408
  return __awaiter(this, void 0, void 0, function* () {
6409
+ const { api, tokenId: id, req: reqParams } = params;
5914
6410
  yield api.DELETE(`accessToken/${id}`, reqParams);
5915
6411
  api.Cache.RemoveByContains(Api.ECacheKey.User + Api.ECacheKey.Id + id);
5916
6412
  api.Cache.RemoveByStartsWith(Api.ECacheKey.AccessToken + Api.ECacheKey.Account);
5917
6413
  });
5918
6414
  }
5919
6415
  AccessToken.Delete = Delete;
5920
- function Create(api, data, reqParams) {
6416
+ function Create(params) {
5921
6417
  return __awaiter(this, void 0, void 0, function* () {
6418
+ let { api, token: data, req: reqParams } = params;
5922
6419
  if (!data) {
5923
6420
  data = {};
5924
6421
  }
@@ -5930,7 +6427,9 @@ var User;
5930
6427
  }
5931
6428
  data = yield api.POST("accessToken", data, reqParams);
5932
6429
  api.Cache.RemoveByStartsWith(Api.ECacheKey.AccessToken + Api.ECacheKey.Account);
5933
- return data;
6430
+ return {
6431
+ token: data
6432
+ };
5934
6433
  });
5935
6434
  }
5936
6435
  AccessToken.Create = Create;
@@ -6023,13 +6522,13 @@ var UrlUtils;
6023
6522
  Clear() {
6024
6523
  this.refresh({});
6025
6524
  }
6026
- refresh(data) {
6525
+ refresh(urlParams) {
6027
6526
  const params = [];
6028
- const keys = Object.keys(data);
6527
+ const keys = Object.keys(urlParams);
6029
6528
  for (let i = 0; i < keys.length; i++) {
6030
6529
  const key = keys[i];
6031
6530
  if (this._allowedKeys == null || this._allowedKeys.includes(key)) {
6032
- const val = data[key];
6531
+ const val = urlParams[key];
6033
6532
  if (!!val || val == 0) {
6034
6533
  params.push(`${key}=${val}`);
6035
6534
  }
@@ -6053,34 +6552,34 @@ var DataLab;
6053
6552
  EReqKey["Primary"] = "PrimarySelection";
6054
6553
  EReqKey["Secondary"] = "SecondarySelection";
6055
6554
  })(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;
6555
+ function Run(params) {
6556
+ return __awaiter(this, void 0, void 0, function* () {
6557
+ let { api, query, key, skip, load, req: reqParams } = params;
6558
+ if (!key) {
6559
+ key = EReqKey.Primary;
6560
+ }
6561
+ if (!skip) {
6562
+ skip = 0;
6563
+ }
6564
+ if (!load) {
6565
+ load = 50;
6566
+ }
6567
+ const req = api.POST(`entities/datalab/getMatchingEntities/${key}?skip=${skip}&load=${load}`, query, Api.PrepReqParams(reqParams));
6568
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
6569
+ try {
6570
+ const data = yield req;
6571
+ res({
6572
+ entities: data.Items
6573
+ });
6065
6574
  }
6066
- if (!load) {
6067
- load = 50;
6575
+ catch (e) {
6576
+ rej(e);
6068
6577
  }
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 = {}));
6578
+ }));
6579
+ return prom;
6580
+ });
6581
+ }
6582
+ DataLab.Run = Run;
6084
6583
  })(DataLab || (DataLab = {}));
6085
6584
 
6086
6585
  /**
@@ -6089,15 +6588,17 @@ var DataLab;
6089
6588
  */
6090
6589
  var ImportCad;
6091
6590
  (function (ImportCad) {
6092
- function Analyze(api, params, reqParams) {
6591
+ function Analyze(params) {
6093
6592
  return __awaiter(this, void 0, void 0, function* () {
6094
- return api.POST("entities/PrepareIFCForImport", params, Api.PrepReqParams(reqParams));
6593
+ const { api, fileAnalyze, req: reqParams } = params;
6594
+ return api.POST("entities/PrepareIFCForImport", fileAnalyze, Api.PrepReqParams(reqParams));
6095
6595
  });
6096
6596
  }
6097
6597
  ImportCad.Analyze = Analyze;
6098
- function ImportEntities(api, params, reqParams) {
6598
+ function ImportEntities(params) {
6099
6599
  return __awaiter(this, void 0, void 0, function* () {
6100
- return api.POST("entities/importIFCWithProgress", params, Api.PrepReqParams(reqParams));
6600
+ const { api, fileImport, req: reqParams } = params;
6601
+ return api.POST("entities/importIFCWithProgress", fileImport, Api.PrepReqParams(reqParams));
6101
6602
  });
6102
6603
  }
6103
6604
  ImportCad.ImportEntities = ImportEntities;
@@ -6124,9 +6625,10 @@ var ImportCad;
6124
6625
 
6125
6626
  var ImportCsv;
6126
6627
  (function (ImportCsv) {
6127
- function ImportEntities(api, params, reqParams) {
6628
+ function ImportEntities(params) {
6128
6629
  return __awaiter(this, void 0, void 0, function* () {
6129
- return api.POST("entities/importCSVWithProgress2", params, Api.PrepReqParams(reqParams));
6630
+ const { api, fileImport, req: reqParams } = params;
6631
+ return api.POST("entities/importCSVWithProgress2", fileImport, Api.PrepReqParams(reqParams));
6130
6632
  });
6131
6633
  }
6132
6634
  ImportCsv.ImportEntities = ImportEntities;
@@ -6134,9 +6636,10 @@ var ImportCsv;
6134
6636
 
6135
6637
  var ImportJson;
6136
6638
  (function (ImportJson) {
6137
- function ImportEntities(api, params, reqParams) {
6639
+ function ImportEntities(params) {
6138
6640
  return __awaiter(this, void 0, void 0, function* () {
6139
- return api.POST("entities/importJsonWithProgress", params, Api.PrepReqParams(reqParams));
6641
+ const { api, fileImport, req: reqParams } = params;
6642
+ return api.POST("entities/importJsonWithProgress", fileImport, Api.PrepReqParams(reqParams));
6140
6643
  });
6141
6644
  }
6142
6645
  ImportJson.ImportEntities = ImportEntities;
@@ -6144,9 +6647,10 @@ var ImportJson;
6144
6647
 
6145
6648
  var ImportKml;
6146
6649
  (function (ImportKml) {
6147
- function ImportEntities(api, params, reqParams) {
6650
+ function ImportEntities(params) {
6148
6651
  return __awaiter(this, void 0, void 0, function* () {
6149
- return api.POST("entities/importKMLWithProgress2", params, Api.PrepReqParams(reqParams));
6652
+ const { api, fileImport, req: reqParams } = params;
6653
+ return api.POST("entities/importKMLWithProgress2", fileImport, Api.PrepReqParams(reqParams));
6150
6654
  });
6151
6655
  }
6152
6656
  ImportKml.ImportEntities = ImportEntities;
@@ -6167,8 +6671,9 @@ var ImportedFile;
6167
6671
  EFileType["CAD"] = "CAD";
6168
6672
  EFileType["All"] = "All";
6169
6673
  })(EFileType = ImportedFile.EFileType || (ImportedFile.EFileType = {}));
6170
- function GetList(api, type, pageIndex, reqParams) {
6674
+ function GetList(params) {
6171
6675
  return __awaiter(this, void 0, void 0, function* () {
6676
+ let { api, fileType: type, pageIndex, req: reqParams } = params;
6172
6677
  if (!type) {
6173
6678
  type = EFileType.All;
6174
6679
  }
@@ -6192,7 +6697,9 @@ var ImportedFile;
6192
6697
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
6193
6698
  try {
6194
6699
  const data = yield req;
6195
- res(data.Items);
6700
+ res({
6701
+ importedFiles: data.Items
6702
+ });
6196
6703
  }
6197
6704
  catch (e) {
6198
6705
  rej(e);
@@ -6203,15 +6710,26 @@ var ImportedFile;
6203
6710
  });
6204
6711
  }
6205
6712
  ImportedFile.GetList = GetList;
6206
- function Get(api, fileId, reqParams) {
6713
+ function Get(params) {
6207
6714
  return __awaiter(this, void 0, void 0, function* () {
6715
+ const { api, importedFileId: fileId, req: reqParams } = params;
6208
6716
  const cacheData = api.GetCacheItem(GetCacheKey(fileId), reqParams);
6209
6717
  if (cacheData) {
6210
6718
  return cacheData;
6211
6719
  }
6212
- const req = api.GET(`entityImportFile/${fileId}`, Api.PrepReqParams(reqParams));
6213
- api.Cache.Set(GetCacheKey(fileId), req, Api.DEFAULT_CACHE_DURATION);
6214
- return req;
6720
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
6721
+ try {
6722
+ const data = yield api.GET(`entityImportFile/${fileId}`, Api.PrepReqParams(reqParams));
6723
+ res({
6724
+ importedFile: data
6725
+ });
6726
+ }
6727
+ catch (e) {
6728
+ rej(e);
6729
+ }
6730
+ }));
6731
+ api.Cache.Set(GetCacheKey(fileId), prom, Api.DEFAULT_CACHE_DURATION);
6732
+ return prom;
6215
6733
  });
6216
6734
  }
6217
6735
  ImportedFile.Get = Get;
@@ -6295,105 +6813,106 @@ var Markup;
6295
6813
  type: EType.Default
6296
6814
  };
6297
6815
  })(Div = Markup.Div || (Markup.Div = {}));
6298
- let Drawing;
6299
- (function (Drawing) {
6816
+ let Line;
6817
+ (function (Line) {
6300
6818
  // 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 = {}));
6819
+ let ELineHead;
6820
+ (function (ELineHead) {
6821
+ ELineHead["None"] = "NONE";
6822
+ ELineHead["Circle"] = "CIRCLE";
6823
+ ELineHead["Arrow"] = "ARROW";
6824
+ })(ELineHead = Line.ELineHead || (Line.ELineHead = {}));
6825
+ // Dictates where on a DIV an anchor should snap to.
6826
+ let EAnchorDivSide;
6827
+ (function (EAnchorDivSide) {
6828
+ EAnchorDivSide[EAnchorDivSide["TopLeft"] = 0] = "TopLeft";
6829
+ EAnchorDivSide[EAnchorDivSide["TopRight"] = 1] = "TopRight";
6830
+ EAnchorDivSide[EAnchorDivSide["BottomLeft"] = 2] = "BottomLeft";
6831
+ EAnchorDivSide[EAnchorDivSide["BottomRight"] = 3] = "BottomRight";
6832
+ EAnchorDivSide[EAnchorDivSide["Center"] = 4] = "Center";
6833
+ EAnchorDivSide[EAnchorDivSide["CenterLeft"] = 5] = "CenterLeft";
6834
+ EAnchorDivSide[EAnchorDivSide["CenterRight"] = 6] = "CenterRight";
6835
+ EAnchorDivSide[EAnchorDivSide["CenterTop"] = 7] = "CenterTop";
6836
+ EAnchorDivSide[EAnchorDivSide["CenterBottom"] = 8] = "CenterBottom";
6837
+ })(EAnchorDivSide = Line.EAnchorDivSide || (Line.EAnchorDivSide = {}));
6838
+ // Dictates what end of the line an anchor should render on.
6839
+ let EAnchorLineSide;
6840
+ (function (EAnchorLineSide) {
6841
+ EAnchorLineSide[EAnchorLineSide["Start"] = 0] = "Start";
6842
+ EAnchorLineSide[EAnchorLineSide["End"] = 1] = "End";
6843
+ })(EAnchorLineSide = Line.EAnchorLineSide || (Line.EAnchorLineSide = {}));
6844
+ Line.DEFAULT = {
6845
+ brushColor: "rgba(255, 255, 255, 1)",
6846
+ brushSize: 4,
6847
+ path: null,
6848
+ pathType: "LINE",
6849
+ transform: null,
6850
+ snaps: null,
6851
+ id: null
6852
+ };
6853
+ })(Line = Markup.Line || (Markup.Line = {}));
6854
+ let FreePaint;
6855
+ (function (FreePaint) {
6856
+ // Describes a free-paint end's head.
6857
+ let EPaintHead;
6858
+ (function (EPaintHead) {
6859
+ EPaintHead["None"] = "NONE";
6860
+ EPaintHead["Circle"] = "CIRCLE";
6861
+ EPaintHead["Arrow"] = "ARROW";
6862
+ })(EPaintHead = FreePaint.EPaintHead || (FreePaint.EPaintHead = {}));
6863
+ FreePaint.DEFAULT = {
6864
+ brushColor: "rgba(255, 255, 255, 1)",
6865
+ brushSize: 4,
6866
+ path: null,
6867
+ pathType: "PLAIN",
6868
+ transform: null,
6869
+ id: null
6870
+ };
6871
+ })(FreePaint = Markup.FreePaint || (Markup.FreePaint = {}));
6872
+ let Polygon;
6873
+ (function (Polygon) {
6874
+ // Determines if terrain and 3d models should be overlapped or not.
6875
+ let EClassificationType;
6876
+ (function (EClassificationType) {
6877
+ // 3d models and terrain are overlapped.
6878
+ EClassificationType["Both"] = "BOTH";
6879
+ // Only terrain is overlapped.
6880
+ EClassificationType["Terrain"] = "TERRAIN";
6881
+ })(EClassificationType = Polygon.EClassificationType || (Polygon.EClassificationType = {}));
6882
+ Polygon.DEFAULT = {
6883
+ type: "POLYGON",
6884
+ id: null,
6885
+ positions: null,
6886
+ color: "rgba(254, 234, 57, 0.54)",
6887
+ outlineColor: "rgba(215, 215, 215, 0)",
6888
+ outlineWidth: 2,
6889
+ extrudedHeight: 0,
6890
+ classificationType: EClassificationType.Both,
6891
+ smoothen: 0
6892
+ };
6893
+ })(Polygon = Markup.Polygon || (Markup.Polygon = {}));
6894
+ let Polyline;
6895
+ (function (Polyline) {
6896
+ Polyline.DEFAULT = {
6897
+ type: "POLYLINE",
6898
+ id: null,
6899
+ positions: null,
6900
+ color: "rgba(254, 234, 57, 0.54)",
6901
+ outlineWidth: 4,
6902
+ smoothen: 0
6903
+ };
6904
+ })(Polyline = Markup.Polyline || (Markup.Polyline = {}));
6905
+ let Circle;
6906
+ (function (Circle) {
6907
+ Circle.DEFAULT = {
6908
+ type: "CIRCLE",
6909
+ id: null,
6910
+ position: null,
6911
+ radius: 50,
6912
+ color: "rgba(254, 234, 57, 0.54)"
6913
+ };
6914
+ })(Circle = Markup.Circle || (Markup.Circle = {}));
6396
6915
  })(Markup || (Markup = {}));
6397
6916
 
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 };
6917
+ 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
6918
  //# sourceMappingURL=bruce-models.es5.js.map