bruce-models 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/dist/bruce-models.es5.js +759 -17
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +607 -16
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/account/account.js +213 -0
  6. package/dist/lib/account/account.js.map +1 -0
  7. package/dist/lib/ann-document/ann-document.js +4 -0
  8. package/dist/lib/ann-document/ann-document.js.map +1 -1
  9. package/dist/lib/api/abstract-api.js +3 -0
  10. package/dist/lib/api/abstract-api.js.map +1 -1
  11. package/dist/lib/api/api.js +25 -7
  12. package/dist/lib/api/api.js.map +1 -1
  13. package/dist/lib/api/bruce-api.js +10 -0
  14. package/dist/lib/api/bruce-api.js.map +1 -1
  15. package/dist/lib/api/cam-api.js +10 -0
  16. package/dist/lib/api/cam-api.js.map +1 -1
  17. package/dist/lib/api/global-api.js +10 -0
  18. package/dist/lib/api/global-api.js.map +1 -1
  19. package/dist/lib/api/idm-api.js +10 -0
  20. package/dist/lib/api/idm-api.js.map +1 -1
  21. package/dist/lib/bruce-models.js +2 -0
  22. package/dist/lib/bruce-models.js.map +1 -1
  23. package/dist/lib/calculator/calculator.js +12 -0
  24. package/dist/lib/calculator/calculator.js.map +1 -1
  25. package/dist/lib/common/bruce-event.js +4 -0
  26. package/dist/lib/common/bruce-event.js.map +1 -1
  27. package/dist/lib/common/bruce-variable.js +13 -0
  28. package/dist/lib/common/bruce-variable.js.map +1 -1
  29. package/dist/lib/common/cache.js +3 -0
  30. package/dist/lib/common/cache.js.map +1 -1
  31. package/dist/lib/common/cartes.js +6 -0
  32. package/dist/lib/common/cartes.js.map +1 -1
  33. package/dist/lib/common/carto.js +5 -0
  34. package/dist/lib/common/carto.js.map +1 -1
  35. package/dist/lib/common/color.js +5 -0
  36. package/dist/lib/common/color.js.map +1 -1
  37. package/dist/lib/common/delay-queue.js +4 -0
  38. package/dist/lib/common/delay-queue.js.map +1 -1
  39. package/dist/lib/common/geometry.js +21 -0
  40. package/dist/lib/common/geometry.js.map +1 -1
  41. package/dist/lib/common/utc.js +3 -0
  42. package/dist/lib/common/utc.js.map +1 -1
  43. package/dist/lib/custom-form/custom-form.js +137 -0
  44. package/dist/lib/custom-form/custom-form.js.map +1 -0
  45. package/dist/lib/entity/entity-attachment-type.js +4 -3
  46. package/dist/lib/entity/entity-attachment-type.js.map +1 -1
  47. package/dist/lib/entity/entity-attachment.js +5 -0
  48. package/dist/lib/entity/entity-attachment.js.map +1 -1
  49. package/dist/lib/entity/entity-comment.js +4 -0
  50. package/dist/lib/entity/entity-comment.js.map +1 -1
  51. package/dist/lib/entity/entity-link.js +4 -0
  52. package/dist/lib/entity/entity-link.js.map +1 -1
  53. package/dist/lib/entity/entity-lod.js +6 -0
  54. package/dist/lib/entity/entity-lod.js.map +1 -1
  55. package/dist/lib/entity/entity-relation-type.js +4 -0
  56. package/dist/lib/entity/entity-relation-type.js.map +1 -1
  57. package/dist/lib/entity/entity-relation.js +5 -0
  58. package/dist/lib/entity/entity-relation.js.map +1 -1
  59. package/dist/lib/entity/entity-source.js +5 -0
  60. package/dist/lib/entity/entity-source.js.map +1 -1
  61. package/dist/lib/entity/entity-tag.js +5 -0
  62. package/dist/lib/entity/entity-tag.js.map +1 -1
  63. package/dist/lib/entity/entity-type.js +5 -0
  64. package/dist/lib/entity/entity-type.js.map +1 -1
  65. package/dist/lib/entity/entity.js +5 -0
  66. package/dist/lib/entity/entity.js.map +1 -1
  67. package/dist/lib/entity/getters/batched-data-getter.js +4 -0
  68. package/dist/lib/entity/getters/batched-data-getter.js.map +1 -1
  69. package/dist/lib/entity/getters/entity-filter-getter.js +5 -0
  70. package/dist/lib/entity/getters/entity-filter-getter.js.map +1 -1
  71. package/dist/lib/entity/getters/entity-globe.js +5 -0
  72. package/dist/lib/entity/getters/entity-globe.js.map +1 -1
  73. package/dist/lib/file/client-file.js +4 -0
  74. package/dist/lib/file/client-file.js.map +1 -1
  75. package/dist/lib/markup/markup.js +3 -0
  76. package/dist/lib/markup/markup.js.map +1 -1
  77. package/dist/lib/program-key/program-key.js +4 -0
  78. package/dist/lib/program-key/program-key.js.map +1 -1
  79. package/dist/lib/project/menu-item.js +5 -0
  80. package/dist/lib/project/menu-item.js.map +1 -1
  81. package/dist/lib/project/project-view-bookmark.js +6 -0
  82. package/dist/lib/project/project-view-bookmark.js.map +1 -1
  83. package/dist/lib/project/project-view-tile-source.js +5 -0
  84. package/dist/lib/project/project-view-tile-source.js.map +1 -1
  85. package/dist/lib/project/project-view.js +5 -0
  86. package/dist/lib/project/project-view.js.map +1 -1
  87. package/dist/lib/project/zoom-control.js +4 -0
  88. package/dist/lib/project/zoom-control.js.map +1 -1
  89. package/dist/lib/server/pending-action.js +5 -0
  90. package/dist/lib/server/pending-action.js.map +1 -1
  91. package/dist/lib/style/style.js +7 -0
  92. package/dist/lib/style/style.js.map +1 -1
  93. package/dist/lib/tileset/tileset-entities-map-tiles.js +5 -0
  94. package/dist/lib/tileset/tileset-entities-map-tiles.js.map +1 -1
  95. package/dist/lib/tileset/tileset-ext-map-tiles.js +4 -0
  96. package/dist/lib/tileset/tileset-ext-map-tiles.js.map +1 -1
  97. package/dist/lib/tileset/tileset.js +10 -0
  98. package/dist/lib/tileset/tileset.js.map +1 -1
  99. package/dist/lib/ucs/ucs.js +5 -0
  100. package/dist/lib/ucs/ucs.js.map +1 -1
  101. package/dist/lib/user/session.js +5 -0
  102. package/dist/lib/user/session.js.map +1 -1
  103. package/dist/lib/user/user-group.js +4 -0
  104. package/dist/lib/user/user-group.js.map +1 -1
  105. package/dist/lib/user/user.js +186 -6
  106. package/dist/lib/user/user.js.map +1 -1
  107. package/dist/lib/util/math-utils.js +12 -0
  108. package/dist/lib/util/math-utils.js.map +1 -1
  109. package/dist/lib/util/object-utils.js +4 -0
  110. package/dist/lib/util/object-utils.js.map +1 -1
  111. package/dist/lib/util/path-utils.js +3 -0
  112. package/dist/lib/util/path-utils.js.map +1 -1
  113. package/dist/lib/util/url-utils.js +6 -0
  114. package/dist/lib/util/url-utils.js.map +1 -1
  115. package/dist/types/account/account.d.ts +46 -0
  116. package/dist/types/ann-document/ann-document.d.ts +4 -0
  117. package/dist/types/api/abstract-api.d.ts +3 -0
  118. package/dist/types/api/api.d.ts +26 -8
  119. package/dist/types/api/bruce-api.d.ts +5 -0
  120. package/dist/types/api/cam-api.d.ts +5 -0
  121. package/dist/types/api/global-api.d.ts +5 -0
  122. package/dist/types/api/idm-api.d.ts +5 -0
  123. package/dist/types/bruce-models.d.ts +2 -0
  124. package/dist/types/calculator/calculator.d.ts +12 -0
  125. package/dist/types/common/bounds.d.ts +6 -0
  126. package/dist/types/common/bruce-event.d.ts +4 -0
  127. package/dist/types/common/bruce-variable.d.ts +13 -0
  128. package/dist/types/common/cache.d.ts +3 -0
  129. package/dist/types/common/cartes.d.ts +6 -0
  130. package/dist/types/common/carto.d.ts +5 -0
  131. package/dist/types/common/color.d.ts +5 -0
  132. package/dist/types/common/delay-queue.d.ts +4 -0
  133. package/dist/types/common/geometry.d.ts +21 -0
  134. package/dist/types/common/transform.d.ts +4 -0
  135. package/dist/types/common/utc.d.ts +3 -0
  136. package/dist/types/custom-form/custom-form.d.ts +25 -0
  137. package/dist/types/entity/entity-attachment-type.d.ts +5 -4
  138. package/dist/types/entity/entity-attachment.d.ts +5 -0
  139. package/dist/types/entity/entity-comment.d.ts +4 -0
  140. package/dist/types/entity/entity-link.d.ts +4 -0
  141. package/dist/types/entity/entity-lod.d.ts +6 -0
  142. package/dist/types/entity/entity-relation-type.d.ts +4 -0
  143. package/dist/types/entity/entity-relation.d.ts +5 -0
  144. package/dist/types/entity/entity-source.d.ts +5 -0
  145. package/dist/types/entity/entity-tag.d.ts +5 -0
  146. package/dist/types/entity/entity-type.d.ts +5 -0
  147. package/dist/types/entity/entity.d.ts +5 -0
  148. package/dist/types/entity/getters/batched-data-getter.d.ts +4 -0
  149. package/dist/types/entity/getters/entity-filter-getter.d.ts +5 -0
  150. package/dist/types/entity/getters/entity-globe.d.ts +5 -0
  151. package/dist/types/file/client-file.d.ts +4 -0
  152. package/dist/types/markup/markup.d.ts +3 -0
  153. package/dist/types/program-key/program-key.d.ts +4 -0
  154. package/dist/types/project/menu-item.d.ts +5 -0
  155. package/dist/types/project/project-view-bookmark.d.ts +6 -0
  156. package/dist/types/project/project-view-tile-source.d.ts +5 -0
  157. package/dist/types/project/project-view.d.ts +5 -0
  158. package/dist/types/project/zoom-control.d.ts +4 -0
  159. package/dist/types/server/pending-action.d.ts +5 -0
  160. package/dist/types/style/style.d.ts +7 -0
  161. package/dist/types/tileset/tileset-cad.d.ts +4 -0
  162. package/dist/types/tileset/tileset-entities-map-tiles.d.ts +5 -0
  163. package/dist/types/tileset/tileset-entities.d.ts +4 -0
  164. package/dist/types/tileset/tileset-ext-map-tiles.d.ts +4 -0
  165. package/dist/types/tileset/tileset-ext-terrain-tiles.d.ts +4 -0
  166. package/dist/types/tileset/tileset-map-tiles.d.ts +4 -0
  167. package/dist/types/tileset/tileset-pointcloud.d.ts +4 -0
  168. package/dist/types/tileset/tileset-terrain-tiles.d.ts +4 -0
  169. package/dist/types/tileset/tileset.d.ts +10 -0
  170. package/dist/types/ucs/ucs.d.ts +5 -0
  171. package/dist/types/user/session.d.ts +5 -0
  172. package/dist/types/user/user-group.d.ts +4 -0
  173. package/dist/types/user/user.d.ts +48 -0
  174. package/dist/types/util/math-utils.d.ts +12 -0
  175. package/dist/types/util/object-utils.d.ts +4 -0
  176. package/dist/types/util/path-utils.d.ts +3 -0
  177. package/dist/types/util/url-utils.d.ts +6 -0
  178. package/package.json +1 -1
@@ -81,6 +81,9 @@
81
81
  }
82
82
  }
83
83
 
84
+ /**
85
+ * Contains generic descriptions used for Bruce requests.
86
+ */
84
87
  (function (Api) {
85
88
  var ECacheKey;
86
89
  (function (ECacheKey) {
@@ -111,10 +114,27 @@
111
114
  ECacheKey["AccessToken"] = "accesstoken";
112
115
  ECacheKey["UserGroup"] = "usergroup";
113
116
  ECacheKey["Account"] = "account";
117
+ ECacheKey["CustomForm"] = "customform";
114
118
  })(ECacheKey = Api.ECacheKey || (Api.ECacheKey = {}));
115
119
  Api.DEFAULT_CACHE_DURATION = 60 * 5; // 5 minutes.
116
120
  Api.TEMPLATE_ACCOUNT_ID = "template";
117
121
  Api.ACCESS_TOKEN_HEADER = "X-Access-Token";
122
+ /**
123
+ * Possible environments we host Bruce apps on.
124
+ * When these are matched, they should be case-insensitive.
125
+ */
126
+ var EEnv;
127
+ (function (EEnv) {
128
+ EEnv["DEV"] = "DEV";
129
+ EEnv["STG"] = "STG";
130
+ EEnv["UAT"] = "UAT";
131
+ EEnv["PROD"] = "PROD";
132
+ })(EEnv = Api.EEnv || (Api.EEnv = {}));
133
+ /**
134
+ * Prepares a string to be included in a url.
135
+ * @param str
136
+ * @returns
137
+ */
118
138
  function Encode(str) {
119
139
  return encodeURIComponent(str.replace(/\+/g, "%2B").replace(/\./g, "%2E"));
120
140
  }
@@ -130,13 +150,11 @@
130
150
  EEncoding["UTF8"] = "UTF-8";
131
151
  EEncoding["UTF16"] = "UTF-16BE";
132
152
  })(EEncoding = Api.EEncoding || (Api.EEncoding = {}));
133
- var EEnv;
134
- (function (EEnv) {
135
- EEnv["DEV"] = "DEV";
136
- EEnv["STG"] = "STG";
137
- EEnv["UAT"] = "UAT";
138
- EEnv["PROD"] = "PROD";
139
- })(EEnv = Api.EEnv || (Api.EEnv = {}));
153
+ /**
154
+ * Prepares default settings for a request to Bruce Api.
155
+ * Our requests WRONGLY have utf-16 for 95% of them. Please be wary of that.
156
+ * @returns
157
+ */
140
158
  function PrepReqParams() {
141
159
  return { response: { encoding: Api.EEncoding.UTF16 } };
142
160
  }
@@ -215,6 +233,98 @@
215
233
  AnnDocument.GetList = GetList;
216
234
  })(exports.AnnDocument || (exports.AnnDocument = {}));
217
235
 
236
+ (function (CustomForm) {
237
+ function GetCacheKey(id) {
238
+ return exports.Api.ECacheKey.CustomForm + exports.Api.ECacheKey.Id + id;
239
+ }
240
+ CustomForm.GetCacheKey = GetCacheKey;
241
+ function GetListCacheKey(typeId) {
242
+ if (typeId) {
243
+ return exports.Api.ECacheKey.CustomForm + exports.Api.ECacheKey.EntityType + exports.Api.ECacheKey.Id + typeId;
244
+ }
245
+ return exports.Api.ECacheKey.CustomForm;
246
+ }
247
+ CustomForm.GetListCacheKey = GetListCacheKey;
248
+ var EType;
249
+ (function (EType) {
250
+ EType["Form"] = "GENERIC";
251
+ EType["Markup"] = "MARKUP";
252
+ })(EType = CustomForm.EType || (CustomForm.EType = {}));
253
+ function Get(api, id) {
254
+ return __awaiter(this, void 0, void 0, function () {
255
+ var cacheData, req;
256
+ return __generator(this, function (_a) {
257
+ if (!id) {
258
+ throw ("Id is required.");
259
+ }
260
+ cacheData = api.Cache.Get(GetCacheKey(id));
261
+ if (cacheData) {
262
+ return [2 /*return*/, cacheData];
263
+ }
264
+ req = api.GET("customForm/" + id, exports.Api.PrepReqParams());
265
+ api.Cache.Set(GetCacheKey(id), req, exports.Api.DEFAULT_CACHE_DURATION);
266
+ return [2 /*return*/, req];
267
+ });
268
+ });
269
+ }
270
+ CustomForm.Get = Get;
271
+ function Delete(api, id) {
272
+ return __awaiter(this, void 0, void 0, function () {
273
+ return __generator(this, function (_a) {
274
+ switch (_a.label) {
275
+ case 0:
276
+ if (!id) {
277
+ throw ("Id is required.");
278
+ }
279
+ return [4 /*yield*/, api.DELETE("customForm/" + id, exports.Api.PrepReqParams())];
280
+ case 1:
281
+ _a.sent();
282
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.CustomForm);
283
+ return [2 /*return*/];
284
+ }
285
+ });
286
+ });
287
+ }
288
+ CustomForm.Delete = Delete;
289
+ function GetList(api, typeId) {
290
+ return __awaiter(this, void 0, void 0, function () {
291
+ var url, cacheData, req, prom;
292
+ return __generator(this, function (_a) {
293
+ url = typeId ? "entityType/" + typeId + "/customForms" : "customForms";
294
+ cacheData = api.Cache.Get(GetListCacheKey(typeId));
295
+ if (cacheData) {
296
+ return [2 /*return*/, cacheData];
297
+ }
298
+ req = api.GET(url, exports.Api.PrepReqParams());
299
+ prom = req.then(function (data) {
300
+ return data.Items;
301
+ });
302
+ api.Cache.Set(GetListCacheKey(typeId), prom, exports.Api.DEFAULT_CACHE_DURATION);
303
+ return [2 /*return*/, prom];
304
+ });
305
+ });
306
+ }
307
+ CustomForm.GetList = GetList;
308
+ function Update(api, data) {
309
+ return __awaiter(this, void 0, void 0, function () {
310
+ return __generator(this, function (_a) {
311
+ switch (_a.label) {
312
+ case 0:
313
+ if (!data.ID) {
314
+ data.ID = 0;
315
+ }
316
+ return [4 /*yield*/, api.POST("customForm/" + data.ID, data, exports.Api.PrepReqParams())];
317
+ case 1:
318
+ data = _a.sent();
319
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.CustomForm);
320
+ return [2 /*return*/, data];
321
+ }
322
+ });
323
+ });
324
+ }
325
+ CustomForm.Update = Update;
326
+ })(exports.CustomForm || (exports.CustomForm = {}));
327
+
218
328
  var CacheItem = /** @class */ (function () {
219
329
  function CacheItem(id, data, duration) {
220
330
  this.Id = id;
@@ -230,6 +340,9 @@
230
340
  };
231
341
  return CacheItem;
232
342
  }());
343
+ /**
344
+ * Simple local cache controller.
345
+ */
233
346
  var CacheControl = /** @class */ (function () {
234
347
  function CacheControl() {
235
348
  this.data = {};
@@ -318,6 +431,9 @@
318
431
  });
319
432
  });
320
433
  }
434
+ /**
435
+ * This is a base class for communication with an arbitrary Bruce Api.
436
+ */
321
437
  var AbstractApi = /** @class */ (function () {
322
438
  function AbstractApi(ssidHeader) {
323
439
  this.ssid = "";
@@ -472,6 +588,10 @@
472
588
  return AbstractApi;
473
589
  }());
474
590
 
591
+ /**
592
+ * This is the request handler for Bruce Api,
593
+ * it should be passed to any method that wants to communicate with this particular api.
594
+ */
475
595
  var BruceApi = /** @class */ (function (_super) {
476
596
  __extends(BruceApi, _super);
477
597
  function BruceApi(accountId, env) {
@@ -507,6 +627,12 @@
507
627
  BruceApi.prototype.GetBaseUrl = function () {
508
628
  return this.baseUrl;
509
629
  };
630
+ BruceApi.prototype.SetBaseUrl = function (url) {
631
+ this.baseUrl = url;
632
+ if (!this.baseUrl.endsWith("/")) {
633
+ this.baseUrl += "/";
634
+ }
635
+ };
510
636
  BruceApi.prototype.GET = function (url, params) {
511
637
  return __awaiter(this, void 0, void 0, function () {
512
638
  return __generator(this, function (_a) {
@@ -538,6 +664,10 @@
538
664
  return BruceApi;
539
665
  }(AbstractApi));
540
666
 
667
+ /**
668
+ * This is the request handler for Cam Api,
669
+ * it should be passed to any method that wants to communicate with this particular api.
670
+ */
541
671
  var CamApi = /** @class */ (function (_super) {
542
672
  __extends(CamApi, _super);
543
673
  function CamApi(env) {
@@ -572,6 +702,12 @@
572
702
  CamApi.prototype.GetBaseUrl = function () {
573
703
  return this.baseUrl;
574
704
  };
705
+ CamApi.prototype.SetBaseUrl = function (url) {
706
+ this.baseUrl = url;
707
+ if (!this.baseUrl.endsWith("/")) {
708
+ this.baseUrl += "/";
709
+ }
710
+ };
575
711
  CamApi.prototype.GET = function (url, params) {
576
712
  return __awaiter(this, void 0, void 0, function () {
577
713
  return __generator(this, function (_a) {
@@ -603,6 +739,10 @@
603
739
  return CamApi;
604
740
  }(AbstractApi));
605
741
 
742
+ /**
743
+ * This is the request handler for Idm Api,
744
+ * it should be passed to any method that wants to communicate with this particular api.
745
+ */
606
746
  var IdmApi = /** @class */ (function (_super) {
607
747
  __extends(IdmApi, _super);
608
748
  function IdmApi(env) {
@@ -637,6 +777,12 @@
637
777
  IdmApi.prototype.GetBaseUrl = function () {
638
778
  return this.baseUrl;
639
779
  };
780
+ IdmApi.prototype.SetBaseUrl = function (url) {
781
+ this.baseUrl = url;
782
+ if (!this.baseUrl.endsWith("/")) {
783
+ this.baseUrl += "/";
784
+ }
785
+ };
640
786
  IdmApi.prototype.GET = function (url, params) {
641
787
  return __awaiter(this, void 0, void 0, function () {
642
788
  return __generator(this, function (_a) {
@@ -687,6 +833,11 @@
687
833
  return ColorFromStr(str);
688
834
  }
689
835
  Color.RandomColor = RandomColor;
836
+ /**
837
+ * Attempts to parse a given color string into a model.
838
+ * @param str
839
+ * @returns
840
+ */
690
841
  function ColorFromStr(str) {
691
842
  var r, g, b, a;
692
843
  var rgba = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([^\)]+)\s*)?\)$/.exec(str);
@@ -747,6 +898,10 @@
747
898
  })(exports.Color || (exports.Color = {}));
748
899
 
749
900
  (function (ObjectUtils) {
901
+ /**
902
+ * Generates a Bruce compatible UID.
903
+ * @returns
904
+ */
750
905
  function UId() {
751
906
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
752
907
  var r = Math.random() * 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8);
@@ -756,6 +911,9 @@
756
911
  ObjectUtils.UId = UId;
757
912
  })(exports.ObjectUtils || (exports.ObjectUtils = {}));
758
913
 
914
+ /**
915
+ * Utility to help with parsing and wrapping Bruce paths.
916
+ */
759
917
  (function (PathUtils) {
760
918
  function Parse(str) {
761
919
  if (!str) {
@@ -1090,8 +1248,21 @@
1090
1248
  }
1091
1249
  return null;
1092
1250
  }
1251
+ /**
1252
+ * Utilities for parsing "Bruce variables", typically within strings.
1253
+ *
1254
+ * A Bruce variable is a string that starts with "${" and ends with "}".
1255
+ * Within those brackets is a path to an attribute in an entity.
1256
+ */
1093
1257
  var BruceVariable;
1094
1258
  (function (BruceVariable) {
1259
+ /**
1260
+ * Replaces all Bruce variables in a string with the value of the attribute.
1261
+ * @param str
1262
+ * @param data
1263
+ * @param legacyParse
1264
+ * @returns
1265
+ */
1095
1266
  function SwapValues(str, data, legacyParse) {
1096
1267
  if (!legacyParse) {
1097
1268
  legacyParse = false;
@@ -1125,6 +1296,14 @@
1125
1296
  EValueType[EValueType["TagColor"] = 4] = "TagColor";
1126
1297
  EValueType[EValueType["RandomColor"] = 5] = "RandomColor";
1127
1298
  })(EValueType = Calculator.EValueType || (Calculator.EValueType = {}));
1299
+ /**
1300
+ * Calculates the value of arbitrary field options.
1301
+ * The context calling this should validate results and parse stuff if needed.
1302
+ * @param fields
1303
+ * @param entity
1304
+ * @param tags
1305
+ * @returns
1306
+ */
1128
1307
  function GetValue(fields, entity, tags) {
1129
1308
  if (!tags) {
1130
1309
  tags = [];
@@ -1246,6 +1425,10 @@
1246
1425
  Calculator.GetInputValue = GetInputValue;
1247
1426
  })(exports.Calculator || (exports.Calculator = {}));
1248
1427
 
1428
+ /**
1429
+ * Simple event utility.
1430
+ * Instantiate the model, then subscribe and trigger events.
1431
+ */
1249
1432
  var BruceEvent = /** @class */ (function () {
1250
1433
  function BruceEvent() {
1251
1434
  // Counter to help differentiate subscriptions.
@@ -1295,6 +1478,12 @@
1295
1478
  })(EFrustum = Camera.EFrustum || (Camera.EFrustum = {}));
1296
1479
  })(exports.Camera || (exports.Camera = {}));
1297
1480
 
1481
+ /**
1482
+ * Describes 2d and 3d coordinates.
1483
+ *
1484
+ * In 2d the x/y typically refers to a window left/top offset.
1485
+ * In 3d the x/y/z, the units are in meters.
1486
+ */
1298
1487
  (function (Cartes) {
1299
1488
  function ValidateCartes2(cartes) {
1300
1489
  if (!cartes) {
@@ -1341,6 +1530,11 @@
1341
1530
  Cartes.IsEqualCartes3 = IsEqualCartes3;
1342
1531
  })(exports.Cartes || (exports.Cartes = {}));
1343
1532
 
1533
+ /**
1534
+ * Describes a geographic point.
1535
+ * The units of the stored data should be in Degrees.
1536
+ * Utilities may use this in Radians for temporary calculations.
1537
+ */
1344
1538
  (function (Carto) {
1345
1539
  function ValidateCarto(carto) {
1346
1540
  if (!carto) {
@@ -1393,6 +1587,10 @@
1393
1587
  Carto.GetCenter = GetCenter;
1394
1588
  })(exports.Carto || (exports.Carto = {}));
1395
1589
 
1590
+ /**
1591
+ * Controls the flow of method calls.
1592
+ * If you have a method that may be called often, but you don't want it to run often, use this.
1593
+ */
1396
1594
  var DelayQueue = /** @class */ (function () {
1397
1595
  function DelayQueue(callback, delay) {
1398
1596
  if (delay === void 0) { delay = 200; }
@@ -1446,12 +1644,21 @@
1446
1644
  return DelayQueue;
1447
1645
  }());
1448
1646
 
1647
+ /**
1648
+ * Describes vector geometry that Bruce uses.
1649
+ */
1449
1650
  (function (Geometry) {
1450
1651
  var EPolygonRingType;
1451
1652
  (function (EPolygonRingType) {
1452
1653
  EPolygonRingType["Boundaries"] = "out";
1453
1654
  EPolygonRingType["Hole"] = "in";
1454
1655
  })(EPolygonRingType = Geometry.EPolygonRingType || (Geometry.EPolygonRingType = {}));
1656
+ /**
1657
+ * Turns an array of points into string vector geometry that Bruce can use.
1658
+ * This is used for saving polyline and polygon data.
1659
+ * @param points
1660
+ * @returns
1661
+ */
1455
1662
  function LineStrFromPoints(points) {
1456
1663
  if (!points.length) {
1457
1664
  throw ("points is empty.");
@@ -1465,6 +1672,12 @@
1465
1672
  return lineString;
1466
1673
  }
1467
1674
  Geometry.LineStrFromPoints = LineStrFromPoints;
1675
+ /**
1676
+ * Removes same points that occur in a row.
1677
+ * This will not modify the original array.
1678
+ * @param positions
1679
+ * @returns
1680
+ */
1468
1681
  function RemoveRepeatPoints(positions) {
1469
1682
  var filteredList = [];
1470
1683
  for (var i = 0; i < positions.length; i++) {
@@ -1512,6 +1725,12 @@
1512
1725
  return result;
1513
1726
  }
1514
1727
  Geometry.ParsePoints = ParsePoints;
1728
+ /**
1729
+ * Parses both string and object Bruce geometry.
1730
+ * String geometry is legacy Bruce data.
1731
+ * @param geometry
1732
+ * @returns
1733
+ */
1515
1734
  function ParseGeometry(geometry) {
1516
1735
  if (typeof geometry == "string") {
1517
1736
  var positions = [];
@@ -1542,6 +1761,9 @@
1542
1761
  Geometry.ParseGeometry = ParseGeometry;
1543
1762
  })(exports.Geometry || (exports.Geometry = {}));
1544
1763
 
1764
+ /**
1765
+ * Describes a Bruce stored date.
1766
+ */
1545
1767
  (function (UTC) {
1546
1768
  var EMonth;
1547
1769
  (function (EMonth) {
@@ -1588,9 +1810,6 @@
1588
1810
  (function (EType) {
1589
1811
  EType["Photo"] = "photo";
1590
1812
  EType["Document"] = "document";
1591
- EType["Video"] = "video";
1592
- EType["Drawing"] = "drawing";
1593
- EType["Model"] = "model";
1594
1813
  })(EType = EntityAttachmentType.EType || (EntityAttachmentType.EType = {}));
1595
1814
  function Delete(api, id) {
1596
1815
  return __awaiter(this, void 0, void 0, function () {
@@ -3436,6 +3655,10 @@
3436
3655
  ProgramKey.Update = Update;
3437
3656
  })(exports.ProgramKey || (exports.ProgramKey = {}));
3438
3657
 
3658
+ /**
3659
+ * Describes an expectation on what should be rendered for a menu item-
3660
+ * between a min-max distance of an entity to the camera.
3661
+ */
3439
3662
  (function (ZoomControl) {
3440
3663
  var EDisplayType;
3441
3664
  (function (EDisplayType) {
@@ -4265,6 +4488,11 @@
4265
4488
  Style.Delete = Delete;
4266
4489
  })(exports.Style || (exports.Style = {}));
4267
4490
 
4491
+ /**
4492
+ * Describes expected settings for an entities-map tileset.
4493
+ * This is the kind of tileset generated from arbitrary Bruce entities-
4494
+ * which produced map tiles of the entity vector geometry.
4495
+ */
4268
4496
  (function (TilesetEntitiesMapTiles) {
4269
4497
  var ETileSize;
4270
4498
  (function (ETileSize) {
@@ -4275,6 +4503,10 @@
4275
4503
  })(ETileSize = TilesetEntitiesMapTiles.ETileSize || (TilesetEntitiesMapTiles.ETileSize = {}));
4276
4504
  })(exports.TilesetEntitiesMapTiles || (exports.TilesetEntitiesMapTiles = {}));
4277
4505
 
4506
+ /**
4507
+ * Describes settings for an external map-tiles tileset.
4508
+ * This will serve content from elsewhere with the assumption that the data is valid map tiles.
4509
+ */
4278
4510
  (function (TilesetExtMapTiles) {
4279
4511
  var EType;
4280
4512
  (function (EType) {
@@ -4643,6 +4875,39 @@
4643
4875
  });
4644
4876
  }
4645
4877
  User.Update = Update;
4878
+ function GetUsernameAvailable(api, username) {
4879
+ return __awaiter(this, void 0, void 0, function () {
4880
+ var req, prom;
4881
+ var _this = this;
4882
+ return __generator(this, function (_a) {
4883
+ if (!username) {
4884
+ throw ("Username is required.");
4885
+ }
4886
+ req = api.GET("user/loginavailable/" + username);
4887
+ prom = new Promise(function (rej, res) { return __awaiter(_this, void 0, void 0, function () {
4888
+ var data, e_1;
4889
+ return __generator(this, function (_a) {
4890
+ switch (_a.label) {
4891
+ case 0:
4892
+ _a.trys.push([0, 2, , 3]);
4893
+ return [4 /*yield*/, req];
4894
+ case 1:
4895
+ data = _a.sent();
4896
+ res(data.IsAvailable);
4897
+ return [3 /*break*/, 3];
4898
+ case 2:
4899
+ e_1 = _a.sent();
4900
+ rej(e_1);
4901
+ return [3 /*break*/, 3];
4902
+ case 3: return [2 /*return*/];
4903
+ }
4904
+ });
4905
+ }); });
4906
+ return [2 /*return*/, prom];
4907
+ });
4908
+ });
4909
+ }
4910
+ User.GetUsernameAvailable = GetUsernameAvailable;
4646
4911
  var LoginUser;
4647
4912
  (function (LoginUser) {
4648
4913
  function GetListCacheKey(accountId) {
@@ -4665,7 +4930,7 @@
4665
4930
  return [2 /*return*/, cacheData];
4666
4931
  }
4667
4932
  req = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
4668
- var data, e_1;
4933
+ var data, e_2;
4669
4934
  return __generator(this, function (_a) {
4670
4935
  switch (_a.label) {
4671
4936
  case 0:
@@ -4676,8 +4941,8 @@
4676
4941
  res(data.Items);
4677
4942
  return [3 /*break*/, 3];
4678
4943
  case 2:
4679
- e_1 = _a.sent();
4680
- rej(e_1);
4944
+ e_2 = _a.sent();
4945
+ rej(e_2);
4681
4946
  return [3 /*break*/, 3];
4682
4947
  case 3: return [2 /*return*/];
4683
4948
  }
@@ -4696,6 +4961,146 @@
4696
4961
  });
4697
4962
  }
4698
4963
  LoginUser.GetList = GetList;
4964
+ /**
4965
+ * Sends a signup email to the specified email address.
4966
+ * @param api
4967
+ * @param email
4968
+ * @returns
4969
+ */
4970
+ function Signup(api, email) {
4971
+ return __awaiter(this, void 0, void 0, function () {
4972
+ return __generator(this, function (_a) {
4973
+ if (!email) {
4974
+ throw ("Email is required.");
4975
+ }
4976
+ return [2 /*return*/, api.POST("clientaccount/signup", {
4977
+ Email: email
4978
+ })];
4979
+ });
4980
+ });
4981
+ }
4982
+ LoginUser.Signup = Signup;
4983
+ /**
4984
+ * Sends a new signup email using a previous one's expired code.
4985
+ * @param api
4986
+ * @param expiredCode
4987
+ * @returns
4988
+ */
4989
+ function SignupResend(api, expiredCode) {
4990
+ return __awaiter(this, void 0, void 0, function () {
4991
+ return __generator(this, function (_a) {
4992
+ if (!expiredCode) {
4993
+ throw ("Expired activation code is required.");
4994
+ }
4995
+ return [2 /*return*/, api.POST("clientaccount/signup/resend?activationKey=" + exports.Api.Encode(expiredCode), null)];
4996
+ });
4997
+ });
4998
+ }
4999
+ LoginUser.SignupResend = SignupResend;
5000
+ /**
5001
+ * Completes signup using user data and a signup code.
5002
+ * @param api
5003
+ * @param accountId
5004
+ * @param code
5005
+ * @param data
5006
+ * @returns
5007
+ */
5008
+ function SignupComplete(api, accountId, code, data) {
5009
+ return __awaiter(this, void 0, void 0, function () {
5010
+ var res;
5011
+ return __generator(this, function (_a) {
5012
+ switch (_a.label) {
5013
+ case 0:
5014
+ if (!code || !accountId) {
5015
+ throw ("Activation code and account ID are required.");
5016
+ }
5017
+ if (!(data === null || data === void 0 ? void 0 : data.Login) || !(data === null || data === void 0 ? void 0 : data.Password)) {
5018
+ throw ("Login and password are required.");
5019
+ }
5020
+ data = JSON.parse(JSON.stringify(data));
5021
+ data.IsActivated = true;
5022
+ data.IsDisabled = false;
5023
+ data.key = code;
5024
+ return [4 /*yield*/, api.POST("UserActivate/" + accountId, data)];
5025
+ case 1:
5026
+ res = _a.sent();
5027
+ api.Cache.RemoveByContains(exports.Api.ECacheKey.User + exports.Api.ECacheKey.Id + res.ID);
5028
+ return [2 /*return*/, res];
5029
+ }
5030
+ });
5031
+ });
5032
+ }
5033
+ LoginUser.SignupComplete = SignupComplete;
5034
+ /**
5035
+ * Sends a password reset email to the specified email address.
5036
+ * @param api
5037
+ * @param accountId
5038
+ * @param email
5039
+ * @returns user id associated with provided email.
5040
+ */
5041
+ function ForgotPassword(api, accountId, email) {
5042
+ return __awaiter(this, void 0, void 0, function () {
5043
+ var req, prom;
5044
+ var _this = this;
5045
+ return __generator(this, function (_a) {
5046
+ if (!accountId || !email) {
5047
+ throw ("Account ID and email are required.");
5048
+ }
5049
+ req = api.POST("UserForgotPassword/" + accountId, {
5050
+ Email: email
5051
+ });
5052
+ prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
5053
+ var data, e_3;
5054
+ return __generator(this, function (_a) {
5055
+ switch (_a.label) {
5056
+ case 0:
5057
+ _a.trys.push([0, 2, , 3]);
5058
+ return [4 /*yield*/, req];
5059
+ case 1:
5060
+ data = _a.sent();
5061
+ res(data.ID);
5062
+ return [3 /*break*/, 3];
5063
+ case 2:
5064
+ e_3 = _a.sent();
5065
+ rej(e_3);
5066
+ return [3 /*break*/, 3];
5067
+ case 3: return [2 /*return*/];
5068
+ }
5069
+ });
5070
+ }); });
5071
+ return [2 /*return*/, prom];
5072
+ });
5073
+ });
5074
+ }
5075
+ LoginUser.ForgotPassword = ForgotPassword;
5076
+ /**
5077
+ * Completes password reset using a password reset code and new password.
5078
+ * @param api
5079
+ * @param code
5080
+ * @param userId
5081
+ * @param password
5082
+ * @returns
5083
+ */
5084
+ function ForgotPasswordComplete(api, code, userId, password) {
5085
+ return __awaiter(this, void 0, void 0, function () {
5086
+ var user;
5087
+ return __generator(this, function (_a) {
5088
+ switch (_a.label) {
5089
+ case 0: return [4 /*yield*/, Get(api, userId, "")];
5090
+ case 1:
5091
+ user = _a.sent();
5092
+ return [2 /*return*/, api.POST("UserSetNameAndPassword", {
5093
+ ID: userId,
5094
+ Email: user.Email,
5095
+ ActivationCode: code,
5096
+ Password: password,
5097
+ FullName: user.FullName
5098
+ })];
5099
+ }
5100
+ });
5101
+ });
5102
+ }
5103
+ LoginUser.ForgotPasswordComplete = ForgotPasswordComplete;
4699
5104
  })(LoginUser = User.LoginUser || (User.LoginUser = {}));
4700
5105
  var AccessToken;
4701
5106
  (function (AccessToken) {
@@ -4713,7 +5118,7 @@
4713
5118
  return [2 /*return*/, cacheData];
4714
5119
  }
4715
5120
  req = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
4716
- var data, e_2;
5121
+ var data, e_4;
4717
5122
  return __generator(this, function (_a) {
4718
5123
  switch (_a.label) {
4719
5124
  case 0:
@@ -4724,8 +5129,8 @@
4724
5129
  res(data.Items);
4725
5130
  return [3 /*break*/, 3];
4726
5131
  case 2:
4727
- e_2 = _a.sent();
4728
- rej(e_2);
5132
+ e_4 = _a.sent();
5133
+ rej(e_4);
4729
5134
  return [3 /*break*/, 3];
4730
5135
  case 3: return [2 /*return*/];
4731
5136
  }
@@ -4802,6 +5207,12 @@
4802
5207
  })(exports.EncryptUtils || (exports.EncryptUtils = {}));
4803
5208
 
4804
5209
  (function (MathUtils) {
5210
+ /**
5211
+ * Rounds a number to a given number of decimal places.
5212
+ * @param num
5213
+ * @param decimals
5214
+ * @returns
5215
+ */
4805
5216
  function Round(num, decimals) {
4806
5217
  if (decimals === void 0) { decimals = 0; }
4807
5218
  if (decimals <= 0) {
@@ -4815,6 +5226,12 @@
4815
5226
  return Math.round((num + Number.EPSILON) * d) / d;
4816
5227
  }
4817
5228
  MathUtils.Round = Round;
5229
+ /**
5230
+ * Returns a random integer between min (inclusive) and max (inclusive).
5231
+ * @param min
5232
+ * @param max
5233
+ * @returns
5234
+ */
4818
5235
  function RandInt(min, max) {
4819
5236
  if (min == max) {
4820
5237
  return min;
@@ -4827,6 +5244,9 @@
4827
5244
  MathUtils.RandInt = RandInt;
4828
5245
  })(exports.MathUtils || (exports.MathUtils = {}));
4829
5246
 
5247
+ /**
5248
+ * Utility to help with url manipulation.
5249
+ */
4830
5250
  (function (UrlUtils) {
4831
5251
  function GetQueryString(doc) {
4832
5252
  var qs = {};
@@ -4844,6 +5264,9 @@
4844
5264
  return qs;
4845
5265
  }
4846
5266
  UrlUtils.GetQueryString = GetQueryString;
5267
+ /**
5268
+ * Helper to get and set url params for a given window.
5269
+ */
4847
5270
  var Handler = /** @class */ (function () {
4848
5271
  function Handler(window, allowedKeys) {
4849
5272
  this._allowedKeys = null;
@@ -4925,6 +5348,174 @@
4925
5348
  UrlUtils.Handler = Handler;
4926
5349
  })(exports.UrlUtils || (exports.UrlUtils = {}));
4927
5350
 
5351
+ var ACCOUNT_EXCLUSIONS = ["hyperportal", "hypeportal", "bviewer"];
5352
+ (function (Account) {
5353
+ function GetCacheKey(accountId, appSettingsId) {
5354
+ if (appSettingsId) {
5355
+ return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey + appSettingsId;
5356
+ }
5357
+ return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId;
5358
+ }
5359
+ Account.GetCacheKey = GetCacheKey;
5360
+ function GetListCacheKey(ssid) {
5361
+ return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + ssid;
5362
+ }
5363
+ Account.GetListCacheKey = GetListCacheKey;
5364
+ var EDbRegion;
5365
+ (function (EDbRegion) {
5366
+ EDbRegion["USA"] = "US";
5367
+ EDbRegion["Paris"] = "EU";
5368
+ EDbRegion["Singapore"] = "SE";
5369
+ EDbRegion["Australia"] = "AU";
5370
+ })(EDbRegion || (EDbRegion = {}));
5371
+ function Get(api, id) {
5372
+ return __awaiter(this, void 0, void 0, function () {
5373
+ var cacheData, req;
5374
+ return __generator(this, function (_a) {
5375
+ switch (_a.label) {
5376
+ case 0:
5377
+ cacheData = api.Cache.Get(GetCacheKey(id));
5378
+ if (cacheData) {
5379
+ return [2 /*return*/, cacheData];
5380
+ }
5381
+ return [4 /*yield*/, api.GET("account/" + id)];
5382
+ case 1:
5383
+ req = _a.sent();
5384
+ api.Cache.Set(GetCacheKey(id), req, exports.Api.DEFAULT_CACHE_DURATION);
5385
+ return [2 /*return*/, req];
5386
+ }
5387
+ });
5388
+ });
5389
+ }
5390
+ Account.Get = Get;
5391
+ function GetRelatedList(api) {
5392
+ return __awaiter(this, void 0, void 0, function () {
5393
+ var cacheData, req, prom;
5394
+ var _this = this;
5395
+ return __generator(this, function (_a) {
5396
+ cacheData = api.Cache.Get(GetListCacheKey(api.GetSessionId()));
5397
+ if (cacheData) {
5398
+ return [2 /*return*/, cacheData];
5399
+ }
5400
+ req = api.GET("user/relatedClientAccounts");
5401
+ prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
5402
+ var data, items, e_1;
5403
+ return __generator(this, function (_a) {
5404
+ switch (_a.label) {
5405
+ case 0:
5406
+ _a.trys.push([0, 2, , 3]);
5407
+ return [4 /*yield*/, req];
5408
+ case 1:
5409
+ data = _a.sent();
5410
+ items = data.Items.filter(function (x) { return !ACCOUNT_EXCLUSIONS.includes(x.ID); });
5411
+ res(items);
5412
+ return [3 /*break*/, 3];
5413
+ case 2:
5414
+ e_1 = _a.sent();
5415
+ rej(e_1);
5416
+ return [3 /*break*/, 3];
5417
+ case 3: return [2 /*return*/];
5418
+ }
5419
+ });
5420
+ }); });
5421
+ api.Cache.Set(GetListCacheKey(api.GetSessionId()), prom, exports.Api.DEFAULT_CACHE_DURATION);
5422
+ return [2 /*return*/, prom];
5423
+ });
5424
+ });
5425
+ }
5426
+ Account.GetRelatedList = GetRelatedList;
5427
+ function GetAppSettings(api, id, appId) {
5428
+ return __awaiter(this, void 0, void 0, function () {
5429
+ var cacheData, req, prom;
5430
+ var _this = this;
5431
+ return __generator(this, function (_a) {
5432
+ switch (_a.label) {
5433
+ case 0:
5434
+ cacheData = api.Cache.Get(GetCacheKey(id, appId));
5435
+ if (cacheData) {
5436
+ return [2 /*return*/, cacheData];
5437
+ }
5438
+ return [4 /*yield*/, api.GET("account/" + id + "?ApplicationID=" + appId)];
5439
+ case 1:
5440
+ req = _a.sent();
5441
+ prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
5442
+ var data, settings, e_2;
5443
+ var _a;
5444
+ return __generator(this, function (_b) {
5445
+ switch (_b.label) {
5446
+ case 0:
5447
+ _b.trys.push([0, 2, , 3]);
5448
+ return [4 /*yield*/, req];
5449
+ case 1:
5450
+ data = _b.sent();
5451
+ settings = (_a = data === null || data === void 0 ? void 0 : data["Application.Settings"]) !== null && _a !== void 0 ? _a : {};
5452
+ res(settings);
5453
+ return [3 /*break*/, 3];
5454
+ case 2:
5455
+ e_2 = _b.sent();
5456
+ rej(e_2);
5457
+ return [3 /*break*/, 3];
5458
+ case 3: return [2 /*return*/];
5459
+ }
5460
+ });
5461
+ }); });
5462
+ api.Cache.Set(GetCacheKey(id, appId), prom, exports.Api.DEFAULT_CACHE_DURATION);
5463
+ return [2 /*return*/, prom];
5464
+ }
5465
+ });
5466
+ });
5467
+ }
5468
+ Account.GetAppSettings = GetAppSettings;
5469
+ /**
5470
+ * WARNING: Do not update API settings without knowing what you're doing.
5471
+ * @param api
5472
+ * @param id
5473
+ * @param appId
5474
+ * @param data
5475
+ * @returns
5476
+ */
5477
+ function UpdateAppSettings(api, id, appId, data) {
5478
+ return __awaiter(this, void 0, void 0, function () {
5479
+ return __generator(this, function (_a) {
5480
+ switch (_a.label) {
5481
+ case 0: return [4 /*yield*/, api.POST("account/" + id + "/applicationSettings/" + appId, data)];
5482
+ case 1:
5483
+ data = _a.sent();
5484
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + id);
5485
+ return [2 /*return*/, data];
5486
+ }
5487
+ });
5488
+ });
5489
+ }
5490
+ Account.UpdateAppSettings = UpdateAppSettings;
5491
+ /**
5492
+ * Creates a new Bruce account using given details.
5493
+ * @param api
5494
+ * @param id
5495
+ * @param name
5496
+ * @param region
5497
+ * @returns
5498
+ */
5499
+ function Create(api, id, name, region) {
5500
+ return __awaiter(this, void 0, void 0, function () {
5501
+ var reqData, res;
5502
+ return __generator(this, function (_a) {
5503
+ if (!id || !name || !region) {
5504
+ throw new Error("Id, Name and Region are required.");
5505
+ }
5506
+ reqData = {
5507
+ "Name": name,
5508
+ "DBLocation": region
5509
+ };
5510
+ res = api.POST("clientAccount/" + id, reqData);
5511
+ api.Cache.Remove(GetListCacheKey(api.GetSessionId()));
5512
+ return [2 /*return*/, res];
5513
+ });
5514
+ });
5515
+ }
5516
+ Account.Create = Create;
5517
+ })(exports.Account || (exports.Account = {}));
5518
+
4928
5519
  exports.AbstractApi = AbstractApi;
4929
5520
  exports.BruceApi = BruceApi;
4930
5521
  exports.CamApi = CamApi;