bruce-models 5.4.5 → 5.4.7

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.
@@ -625,9 +625,11 @@
625
625
  }
626
626
  }
627
627
  formatApiUri(uri) {
628
- const wsProtocol = window.document.location.protocol === "https:" ? "wss" : "ws";
629
628
  const currentUrl = new URL(uri);
630
- let full = wsProtocol + "://" + currentUrl.host + currentUrl.pathname + "websocket";
629
+ // Protocol matching the Bruce API one.
630
+ // In almost all cases it will be wss, in a localhost BruceAPI then it might be ws.
631
+ const protocol = currentUrl.protocol === "http:" ? "ws:" : "wss:";
632
+ let full = protocol + "://" + currentUrl.host + currentUrl.pathname + "websocket";
631
633
  // Check if we have a queryParam for accountId.
632
634
  const accountId = currentUrl.searchParams.get("accountId");
633
635
  if (accountId) {
@@ -10820,6 +10822,7 @@
10820
10822
  EAppId["BruceApi"] = "BruceAPI";
10821
10823
  EAppId["Navigator"] = "Navigator";
10822
10824
  EAppId["Operator"] = "BruceClientAdmin";
10825
+ EAppId["UI"] = "UI";
10823
10826
  })(EAppId = Account.EAppId || (Account.EAppId = {}));
10824
10827
  /**
10825
10828
  * Possible starter content options.
@@ -10923,15 +10926,15 @@
10923
10926
  */
10924
10927
  function GetRelatedList(params) {
10925
10928
  return __awaiter(this, void 0, void 0, function* () {
10926
- let { api, req: reqParams } = params;
10929
+ let { api, req: reqParams, owned } = params;
10927
10930
  if (!api) {
10928
10931
  api = exports.ENVIRONMENT.Api().GetGuardianApi();
10929
10932
  }
10930
- const cache = api.GetCacheItem(GetListCacheKey(api.GetSessionId()), reqParams);
10933
+ const cache = api.GetCacheItem(GetListCacheKey(api.GetSessionId(), owned), reqParams);
10931
10934
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
10932
10935
  return cache.data;
10933
10936
  }
10934
- const req = api.GET("user/relatedClientAccounts", reqParams);
10937
+ const req = api.GET(owned ? "user/ownedClientAccounts" : "user/relatedClientAccounts", reqParams);
10935
10938
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
10936
10939
  try {
10937
10940
  const data = yield req;
@@ -10945,7 +10948,7 @@
10945
10948
  }
10946
10949
  }));
10947
10950
  api.SetCacheItem({
10948
- key: GetListCacheKey(api.GetSessionId()),
10951
+ key: GetListCacheKey(api.GetSessionId(), owned),
10949
10952
  value: prom,
10950
10953
  req: reqParams
10951
10954
  });
@@ -11037,7 +11040,7 @@
11037
11040
  const resData = {
11038
11041
  account: res
11039
11042
  };
11040
- api.Cache.Remove(GetListCacheKey(api.GetSessionId()));
11043
+ api.Cache.RemoveByStartsWith(GetListCacheKey(api.GetSessionId()));
11041
11044
  return resData;
11042
11045
  });
11043
11046
  }
@@ -11091,8 +11094,11 @@
11091
11094
  * @param ssid
11092
11095
  * @returns
11093
11096
  */
11094
- function GetListCacheKey(ssid) {
11095
- return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + ssid;
11097
+ function GetListCacheKey(ssid, owned) {
11098
+ if (!owned) {
11099
+ owned = false;
11100
+ }
11101
+ return exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Session + exports.Api.ECacheKey.Id + ssid + exports.Api.ECacheKey.Id + (owned ? "owned" : "related");
11096
11102
  }
11097
11103
  Account.GetListCacheKey = GetListCacheKey;
11098
11104
  /**
@@ -11595,153 +11601,6 @@
11595
11601
  }
11596
11602
  })(exports.Session || (exports.Session = {}));
11597
11603
 
11598
- (function (UserGroup) {
11599
- /**
11600
- * Returns a user group by its name.
11601
- * @param params
11602
- * @returns
11603
- */
11604
- function GetByName(params) {
11605
- return __awaiter(this, void 0, void 0, function* () {
11606
- let { api, accountId, name, req: reqParams } = params;
11607
- if (!name) {
11608
- throw ("Name is required.");
11609
- }
11610
- if (!api) {
11611
- api = exports.ENVIRONMENT.Api().GetGuardianApi();
11612
- }
11613
- // Default groups.
11614
- if (!accountId) {
11615
- accountId = "";
11616
- }
11617
- const data = yield api.GET(`account/${accountId}/userGroupByName/${name}`, reqParams);
11618
- return {
11619
- group: data
11620
- };
11621
- });
11622
- }
11623
- UserGroup.GetByName = GetByName;
11624
- /**
11625
- * Returns all users in a user group.
11626
- * @param params
11627
- * @returns
11628
- */
11629
- function GetUsers(params) {
11630
- return __awaiter(this, void 0, void 0, function* () {
11631
- let { api, accountId, groupId: id, req: reqParams } = params;
11632
- if (!id) {
11633
- throw ("ID is required.");
11634
- }
11635
- if (!api) {
11636
- api = exports.ENVIRONMENT.Api().GetGuardianApi();
11637
- }
11638
- // Default groups.
11639
- if (!accountId) {
11640
- accountId = "";
11641
- }
11642
- const data = yield api.GET(`userGroup/${accountId}/${id}/users`, reqParams);
11643
- return {
11644
- users: data.Items
11645
- };
11646
- });
11647
- }
11648
- UserGroup.GetUsers = GetUsers;
11649
- /**
11650
- * Returns list of user groups that have a specific permission enabled.
11651
- * @param params
11652
- * @returns
11653
- */
11654
- function GetListByPerm(params) {
11655
- return __awaiter(this, void 0, void 0, function* () {
11656
- let { api, accountId, perm, req: reqParams } = params;
11657
- if (!perm) {
11658
- throw ("Perm is required.");
11659
- }
11660
- if (!api) {
11661
- api = exports.ENVIRONMENT.Api().GetGuardianApi();
11662
- }
11663
- // Default groups.
11664
- if (!accountId) {
11665
- accountId = "";
11666
- }
11667
- const data = yield api.GET(`userGroupsByFeature/${accountId}/${perm}`, reqParams);
11668
- return {
11669
- groups: data.Items
11670
- };
11671
- });
11672
- }
11673
- UserGroup.GetListByPerm = GetListByPerm;
11674
- /**
11675
- * Returns all user groups for an account.
11676
- * @param params
11677
- * @returns
11678
- */
11679
- function GetList(params) {
11680
- return __awaiter(this, void 0, void 0, function* () {
11681
- let { api, accountId, req: reqParams } = params;
11682
- if (!api) {
11683
- api = exports.ENVIRONMENT.Api().GetGuardianApi();
11684
- }
11685
- // Default groups.
11686
- if (!accountId) {
11687
- accountId = "";
11688
- }
11689
- const data = yield api.GET(`userGroups/${accountId}`, reqParams);
11690
- return {
11691
- groups: data.Items
11692
- };
11693
- });
11694
- }
11695
- UserGroup.GetList = GetList;
11696
- /**
11697
- * Deletes a user group.
11698
- * @param params
11699
- * @returns
11700
- */
11701
- function Delete(params) {
11702
- return __awaiter(this, void 0, void 0, function* () {
11703
- let { api, accountId, groupId: id, req: reqParams } = params;
11704
- if (!id) {
11705
- throw ("ID is required.");
11706
- }
11707
- if (!api) {
11708
- api = exports.ENVIRONMENT.Api().GetGuardianApi();
11709
- }
11710
- // Default groups.
11711
- if (!accountId) {
11712
- accountId = "";
11713
- }
11714
- return api.DELETE(`account/${accountId}/userGroupID/${id}`, reqParams);
11715
- });
11716
- }
11717
- UserGroup.Delete = Delete;
11718
- /**
11719
- * Creates or updates a user group.
11720
- * @param params
11721
- * @returns
11722
- */
11723
- function Update(params) {
11724
- return __awaiter(this, void 0, void 0, function* () {
11725
- let { api, group: data, reqParams } = params;
11726
- if (!data.Name) {
11727
- throw ("User group name is required.");
11728
- }
11729
- // Default groups.
11730
- if (!data["ClientAccount.ID"]) {
11731
- data["ClientAccount.ID"] = "";
11732
- }
11733
- if (!api) {
11734
- api = exports.ENVIRONMENT.Api().GetGuardianApi();
11735
- }
11736
- const res = yield api.POST(`userGroup${data.ID ? ("/" + data.ID) : ""}`, data, reqParams);
11737
- return {
11738
- group: res
11739
- };
11740
- });
11741
- }
11742
- UserGroup.Update = Update;
11743
- })(exports.UserGroup || (exports.UserGroup = {}));
11744
-
11745
11604
  (function (User) {
11746
11605
  /**
11747
11606
  * Available user types.
@@ -11842,6 +11701,36 @@
11842
11701
  });
11843
11702
  }
11844
11703
  User.Update = Update;
11704
+ /**
11705
+ * Creates a user record.
11706
+ * This is not a user invitation, this creates a new user which you can then manage or invite yourself.
11707
+ * TODO: The user should be tied to the client account's client and not the global list.
11708
+ * @param params
11709
+ */
11710
+ function Create(params) {
11711
+ return __awaiter(this, void 0, void 0, function* () {
11712
+ let { api, user: data, req: reqParams } = params;
11713
+ if (!api) {
11714
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
11715
+ }
11716
+ if (data.Type == EType.AccessToken) {
11717
+ throw ("Access tokens cannot be created this way.");
11718
+ }
11719
+ if (!data.Type) {
11720
+ data.Type = EType.User;
11721
+ }
11722
+ if (!data.ID) {
11723
+ data.ID = exports.ObjectUtils.UId();
11724
+ }
11725
+ const res = yield api.POST("user", data, reqParams);
11726
+ api.Cache.RemoveByContains(exports.Api.ECacheKey.User + exports.Api.ECacheKey.Id + data.ID);
11727
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.User + exports.Api.ECacheKey.Account);
11728
+ return {
11729
+ user: res
11730
+ };
11731
+ });
11732
+ }
11733
+ User.Create = Create;
11845
11734
  /**
11846
11735
  * Loads settings for a given user + app.
11847
11736
  * The session's account id is used to separate settings between accounts.
@@ -11958,10 +11847,18 @@
11958
11847
  * api.Cache.Remove(key);
11959
11848
  * }
11960
11849
  * @param accountId
11850
+ * @param exclusive
11851
+ * @param search
11961
11852
  * @returns
11962
11853
  */
11963
- function GetListCacheKey(accountId) {
11964
- return exports.Api.ECacheKey.User + exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId;
11854
+ function GetListCacheKey(accountId, exclusive, search) {
11855
+ if (!exclusive) {
11856
+ exclusive = false;
11857
+ }
11858
+ if (!search) {
11859
+ search = "";
11860
+ }
11861
+ return exports.Api.ECacheKey.User + exports.Api.ECacheKey.Account + exports.Api.ECacheKey.Id + accountId + exports.Api.ECacheKey.Id + exclusive + exports.Api.ECacheKey.Id + search;
11965
11862
  }
11966
11863
  LoginUser.GetListCacheKey = GetListCacheKey;
11967
11864
  /**
@@ -12009,23 +11906,31 @@
12009
11906
  */
12010
11907
  function GetList(params) {
12011
11908
  return __awaiter(this, void 0, void 0, function* () {
12012
- let { api, accountId, exclusive, req: reqParams } = params;
12013
- if (!accountId) {
12014
- throw ("Client account ID is required.");
12015
- }
11909
+ let { api, accountId, exclusive, req: reqParams, search } = params;
12016
11910
  if (!api) {
12017
11911
  api = exports.ENVIRONMENT.Api().GetGuardianApi();
12018
11912
  }
12019
11913
  if (!exclusive) {
12020
11914
  exclusive = false;
12021
11915
  }
12022
- const cache = exclusive ? null : api.GetCacheItem(GetListCacheKey(accountId), reqParams);
11916
+ const cacheKey = GetListCacheKey(accountId, exclusive, search);
11917
+ const cache = exclusive ? null : api.GetCacheItem(cacheKey, reqParams);
12023
11918
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
12024
11919
  return cache.data;
12025
11920
  }
12026
11921
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
12027
11922
  try {
12028
- const data = yield api.GET(`users?clientAccountID=${accountId}${exclusive ? "&allExcludingClientAccount=true" : ""}`, reqParams);
11923
+ const urlParams = new URLSearchParams();
11924
+ if (accountId) {
11925
+ urlParams.append("clientAccountID", accountId);
11926
+ }
11927
+ if (search) {
11928
+ urlParams.append("search", search);
11929
+ }
11930
+ if (exclusive) {
11931
+ urlParams.append("allExcludingClientAccount", "true");
11932
+ }
11933
+ const data = yield api.GET(`users?${urlParams.toString()}`, reqParams);
12029
11934
  res({
12030
11935
  users: data.Items
12031
11936
  });
@@ -12048,7 +11953,7 @@
12048
11953
  }));
12049
11954
  if (!exclusive) {
12050
11955
  api.SetCacheItem({
12051
- key: GetListCacheKey(accountId),
11956
+ key: cacheKey,
12052
11957
  value: req,
12053
11958
  req: reqParams
12054
11959
  });
@@ -12283,6 +12188,26 @@
12283
12188
  }
12284
12189
  AccessToken.Create = Create;
12285
12190
  })(AccessToken = User.AccessToken || (User.AccessToken = {}));
12191
+ /**
12192
+ * Updates the password for a user by supplying the existing and new password.
12193
+ * @param params
12194
+ */
12195
+ function UpdatePassword(params) {
12196
+ return __awaiter(this, void 0, void 0, function* () {
12197
+ let { userId, passwordCurrent, passwordNew, api, req } = params;
12198
+ if (!userId || !passwordCurrent || !passwordNew) {
12199
+ throw ("UserId, current password, and new password are required.");
12200
+ }
12201
+ if (!api) {
12202
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
12203
+ }
12204
+ return api.POST(`user/${userId}/setPassword`, {
12205
+ CurrentPassword: passwordCurrent,
12206
+ NewPassword: passwordNew
12207
+ }, req);
12208
+ });
12209
+ }
12210
+ User.UpdatePassword = UpdatePassword;
12286
12211
  /**
12287
12212
  * Returns cache identifier for a user.
12288
12213
  * Example: {
@@ -12336,6 +12261,206 @@
12336
12261
  User.GetSettingsCacheKey = GetSettingsCacheKey;
12337
12262
  })(exports.User || (exports.User = {}));
12338
12263
 
12264
+ (function (UserGroup) {
12265
+ /**
12266
+ * Returns a user group by its name.
12267
+ * @param params
12268
+ * @returns
12269
+ */
12270
+ function GetByName(params) {
12271
+ return __awaiter(this, void 0, void 0, function* () {
12272
+ let { api, accountId, name, req: reqParams } = params;
12273
+ if (!name) {
12274
+ throw ("Name is required.");
12275
+ }
12276
+ if (!api) {
12277
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
12278
+ }
12279
+ // Default groups.
12280
+ if (!accountId) {
12281
+ accountId = "";
12282
+ }
12283
+ const data = yield api.GET(`account/${accountId}/userGroupByName/${name}`, reqParams);
12284
+ return {
12285
+ group: data
12286
+ };
12287
+ });
12288
+ }
12289
+ UserGroup.GetByName = GetByName;
12290
+ /**
12291
+ * Returns all users in a user group.
12292
+ * @param params
12293
+ * @returns
12294
+ */
12295
+ function GetUsers(params) {
12296
+ return __awaiter(this, void 0, void 0, function* () {
12297
+ let { api, accountId, groupId: id, req: reqParams } = params;
12298
+ if (!id) {
12299
+ throw ("ID is required.");
12300
+ }
12301
+ if (!api) {
12302
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
12303
+ }
12304
+ // Default groups.
12305
+ if (!accountId) {
12306
+ accountId = "";
12307
+ }
12308
+ const data = yield api.GET(`userGroup/${accountId}/${id}/users`, reqParams);
12309
+ return {
12310
+ users: data.Items
12311
+ };
12312
+ });
12313
+ }
12314
+ UserGroup.GetUsers = GetUsers;
12315
+ /**
12316
+ * Returns list of user groups that have a specific permission enabled.
12317
+ * @param params
12318
+ * @returns
12319
+ */
12320
+ function GetListByPerm(params) {
12321
+ return __awaiter(this, void 0, void 0, function* () {
12322
+ let { api, accountId, perm, req: reqParams } = params;
12323
+ if (!perm) {
12324
+ throw ("Perm is required.");
12325
+ }
12326
+ if (!api) {
12327
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
12328
+ }
12329
+ // Default groups.
12330
+ if (!accountId) {
12331
+ accountId = "";
12332
+ }
12333
+ const data = yield api.GET(`userGroupsByFeature/${accountId}/${perm}`, reqParams);
12334
+ return {
12335
+ groups: data.Items
12336
+ };
12337
+ });
12338
+ }
12339
+ UserGroup.GetListByPerm = GetListByPerm;
12340
+ /**
12341
+ * Returns all user groups for an account.
12342
+ * @param params
12343
+ * @returns
12344
+ */
12345
+ function GetList(params) {
12346
+ return __awaiter(this, void 0, void 0, function* () {
12347
+ let { api, accountId, req: reqParams } = params;
12348
+ if (!api) {
12349
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
12350
+ }
12351
+ // Default groups.
12352
+ if (!accountId) {
12353
+ accountId = "";
12354
+ }
12355
+ const data = yield api.GET(`userGroups/${accountId}`, reqParams);
12356
+ return {
12357
+ groups: data.Items
12358
+ };
12359
+ });
12360
+ }
12361
+ UserGroup.GetList = GetList;
12362
+ /**
12363
+ * Deletes a user group.
12364
+ * @param params
12365
+ * @returns
12366
+ */
12367
+ function Delete(params) {
12368
+ return __awaiter(this, void 0, void 0, function* () {
12369
+ let { api, accountId, groupId: id, req: reqParams } = params;
12370
+ if (!id) {
12371
+ throw ("ID is required.");
12372
+ }
12373
+ if (!api) {
12374
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
12375
+ }
12376
+ // Default groups.
12377
+ if (!accountId) {
12378
+ accountId = "";
12379
+ }
12380
+ return api.DELETE(`account/${accountId}/userGroupID/${id}`, reqParams);
12381
+ });
12382
+ }
12383
+ UserGroup.Delete = Delete;
12384
+ /**
12385
+ * Creates or updates a user group.
12386
+ * @param params
12387
+ * @returns
12388
+ */
12389
+ function Update(params) {
12390
+ return __awaiter(this, void 0, void 0, function* () {
12391
+ let { api, group: data, reqParams } = params;
12392
+ if (!data.Name) {
12393
+ throw ("User group name is required.");
12394
+ }
12395
+ // Default groups.
12396
+ if (!data["ClientAccount.ID"]) {
12397
+ data["ClientAccount.ID"] = "";
12398
+ }
12399
+ if (!api) {
12400
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
12401
+ }
12402
+ const res = yield api.POST(`userGroup${data.ID ? ("/" + data.ID) : ""}`, data, reqParams);
12403
+ return {
12404
+ group: res
12405
+ };
12406
+ });
12407
+ }
12408
+ UserGroup.Update = Update;
12409
+ /**
12410
+ * Adds a user to specified groups.
12411
+ * @param params
12412
+ * @returns
12413
+ */
12414
+ function AddUser(params) {
12415
+ return __awaiter(this, void 0, void 0, function* () {
12416
+ let { api, userId, groupIds, accountId, req: reqParams } = params;
12417
+ if (!userId) {
12418
+ throw ("User ID is required.");
12419
+ }
12420
+ if (!(groupIds === null || groupIds === void 0 ? void 0 : groupIds.length)) {
12421
+ throw ("At least one group ID is required.");
12422
+ }
12423
+ if (!accountId) {
12424
+ accountId = "";
12425
+ }
12426
+ if (!api) {
12427
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
12428
+ }
12429
+ yield api.POST(`user/${userId}/account/${accountId}/addToGroups`, {
12430
+ UserGroups: groupIds
12431
+ }, reqParams);
12432
+ api.Cache.RemoveByContains(exports.User.GetCacheKey(userId, accountId));
12433
+ });
12434
+ }
12435
+ UserGroup.AddUser = AddUser;
12436
+ /**
12437
+ * Removes a user from specified groups.
12438
+ * @param params
12439
+ */
12440
+ function RemoveUser(params) {
12441
+ return __awaiter(this, void 0, void 0, function* () {
12442
+ let { api, userId, groupIds, accountId, req: reqParams } = params;
12443
+ if (!userId) {
12444
+ throw ("User ID is required.");
12445
+ }
12446
+ if (!(groupIds === null || groupIds === void 0 ? void 0 : groupIds.length)) {
12447
+ throw ("At least one group ID is required.");
12448
+ }
12449
+ if (!accountId) {
12450
+ accountId = "";
12451
+ }
12452
+ if (!api) {
12453
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
12454
+ }
12455
+ yield api.POST(`user/${userId}/account/${accountId}/removeFromGroups`, {
12456
+ UserGroups: groupIds
12457
+ }, reqParams);
12458
+ api.Cache.RemoveByContains(exports.User.GetCacheKey(userId, accountId));
12459
+ });
12460
+ }
12461
+ UserGroup.RemoveUser = RemoveUser;
12462
+ })(exports.UserGroup || (exports.UserGroup = {}));
12463
+
12339
12464
  (function (AccountInvite) {
12340
12465
  /**
12341
12466
  * Possible invite statuses.
@@ -13149,6 +13274,104 @@
13149
13274
  AccountLimits.GetLimitsCacheKey = GetLimitsCacheKey;
13150
13275
  })(exports.AccountLimits || (exports.AccountLimits = {}));
13151
13276
 
13277
+ (function (AccountTemplate) {
13278
+ /**
13279
+ * Known keywords that will be substituted in the template.
13280
+ * A keyword must be surrounded by ${blah} in the template.
13281
+ */
13282
+ let EKeyword;
13283
+ (function (EKeyword) {
13284
+ EKeyword["AccountName"] = "ClientAccount.Name";
13285
+ EKeyword["InvitedByUserName"] = "InvitedBy.User.FullName";
13286
+ EKeyword["InvitedUserName"] = "Invited.User.FullName";
13287
+ EKeyword["URL"] = "URL";
13288
+ EKeyword["ActivationCode"] = "ActivationCode";
13289
+ })(EKeyword = AccountTemplate.EKeyword || (AccountTemplate.EKeyword = {}));
13290
+ function GetList(params) {
13291
+ return __awaiter(this, void 0, void 0, function* () {
13292
+ let { accountId, api, req } = params;
13293
+ if (!accountId) {
13294
+ throw new Error("accountId is required");
13295
+ }
13296
+ if (!api) {
13297
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
13298
+ }
13299
+ const data = yield api.GET(`templates/${accountId}`, exports.Api.PrepReqParams(req));
13300
+ return {
13301
+ templates: data.Items
13302
+ };
13303
+ });
13304
+ }
13305
+ AccountTemplate.GetList = GetList;
13306
+ function Get(params) {
13307
+ return __awaiter(this, void 0, void 0, function* () {
13308
+ let { key, accountId, api, req } = params;
13309
+ if (!accountId) {
13310
+ throw new Error("accountId is required");
13311
+ }
13312
+ if (!api) {
13313
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
13314
+ }
13315
+ const data = yield api.GET(`template/${accountId}/${key}`, exports.Api.PrepReqParams(req));
13316
+ return {
13317
+ template: data
13318
+ };
13319
+ });
13320
+ }
13321
+ AccountTemplate.Get = Get;
13322
+ function Update(params) {
13323
+ return __awaiter(this, void 0, void 0, function* () {
13324
+ let { template, api, req } = params;
13325
+ if (!(template === null || template === void 0 ? void 0 : template["ClientAccount.ID"])) {
13326
+ throw new Error("ClientAccount.ID is required");
13327
+ }
13328
+ if (!(template === null || template === void 0 ? void 0 : template.Key)) {
13329
+ throw new Error("Key is required");
13330
+ }
13331
+ if (!api) {
13332
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
13333
+ }
13334
+ const data = yield api.POST(`template/${template["ClientAccount.ID"]}/${template.Key}`, template, exports.Api.PrepReqParams(req));
13335
+ return {
13336
+ template: data
13337
+ };
13338
+ });
13339
+ }
13340
+ AccountTemplate.Update = Update;
13341
+ function Delete(params) {
13342
+ return __awaiter(this, void 0, void 0, function* () {
13343
+ let { key, accountId, api, req } = params;
13344
+ if (!accountId) {
13345
+ throw new Error("accountId is required");
13346
+ }
13347
+ if (!key) {
13348
+ throw new Error("key is required");
13349
+ }
13350
+ if (!api) {
13351
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
13352
+ }
13353
+ yield api.DELETE(`template/${accountId}/${key}`, exports.Api.PrepReqParams(req));
13354
+ });
13355
+ }
13356
+ AccountTemplate.Delete = Delete;
13357
+ })(exports.AccountTemplate || (exports.AccountTemplate = {}));
13358
+
13359
+ (function (AccountType) {
13360
+ function GetList(params) {
13361
+ return __awaiter(this, void 0, void 0, function* () {
13362
+ let { api, req } = params;
13363
+ if (!api) {
13364
+ api = exports.ENVIRONMENT.Api().GetGuardianApi();
13365
+ }
13366
+ const data = yield api.GET("accountTypes", exports.Api.PrepReqParams(req));
13367
+ return {
13368
+ types: data.Items
13369
+ };
13370
+ });
13371
+ }
13372
+ AccountType.GetList = GetList;
13373
+ })(exports.AccountType || (exports.AccountType = {}));
13374
+
13152
13375
  (function (EncryptUtils) {
13153
13376
  // https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
13154
13377
  function Cyrb53Hash(str, seed = 0) {
@@ -14477,7 +14700,7 @@
14477
14700
  })(exports.DataSource || (exports.DataSource = {}));
14478
14701
 
14479
14702
  // This is updated with the package.json version on build.
14480
- const VERSION = "5.4.5";
14703
+ const VERSION = "5.4.7";
14481
14704
 
14482
14705
  exports.VERSION = VERSION;
14483
14706
  exports.AbstractApi = AbstractApi;