bruce-models 6.5.6 → 6.5.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.
@@ -12551,21 +12551,28 @@ var Session;
12551
12551
  */
12552
12552
  function Login(params) {
12553
12553
  return __awaiter(this, void 0, void 0, function* () {
12554
- let { api, username, password, accountId, req: reqParams } = params;
12554
+ let { api, username, password, accountId, req: reqParams, code } = params;
12555
12555
  if (!api) {
12556
12556
  api = ENVIRONMENT.Api().GetGuardianApi();
12557
12557
  }
12558
12558
  const data = yield api.POST("login", {
12559
12559
  account: accountId ? accountId : "",
12560
12560
  login: username,
12561
- password: password
12561
+ password: password,
12562
+ code: code
12562
12563
  }, reqParams);
12563
- const session = data === null || data === void 0 ? void 0 : data.Session;
12564
- const ssid = session === null || session === void 0 ? void 0 : session.ID;
12564
+ const session = data.Session;
12565
+ let ssid = session === null || session === void 0 ? void 0 : session.ID;
12566
+ if (!ssid) {
12567
+ ssid = "anonymous";
12568
+ }
12565
12569
  api.SetSessionId(ssid);
12566
12570
  api.Cache.Remove(GetCacheKey(ssid));
12567
12571
  return {
12568
- session: session
12572
+ loggedIn: ssid && ssid != "anonymous",
12573
+ session: session,
12574
+ mfaMessage: data.Message,
12575
+ mfaContact: (data.Email ? data.Email : data.Contact)
12569
12576
  };
12570
12577
  });
12571
12578
  }
@@ -13731,11 +13738,132 @@ var UserGroup;
13731
13738
  UserGroups: groupIds
13732
13739
  }, reqParams);
13733
13740
  api.Cache.RemoveByContains(User.GetCacheKey(userId, accountId));
13741
+ api.Cache.RemoveByContains(Api.ECacheKey.User);
13734
13742
  });
13735
13743
  }
13736
13744
  UserGroup.RemoveUser = RemoveUser;
13737
13745
  })(UserGroup || (UserGroup = {}));
13738
13746
 
13747
+ var UserMfaMethod;
13748
+ (function (UserMfaMethod) {
13749
+ /**
13750
+ * Returns an MFA Method record by its ID.
13751
+ * The api's session must be related to the record.
13752
+ * @param params
13753
+ * @returns
13754
+ */
13755
+ function Get(params) {
13756
+ return __awaiter(this, void 0, void 0, function* () {
13757
+ let { methodId, api } = params;
13758
+ if (!methodId) {
13759
+ throw new Error("methodId is required");
13760
+ }
13761
+ if (!api) {
13762
+ api = ENVIRONMENT.Api().GetGuardianApi();
13763
+ }
13764
+ const method = yield api.GET("v3/mfaMethod/" + methodId);
13765
+ return {
13766
+ method: method
13767
+ };
13768
+ });
13769
+ }
13770
+ UserMfaMethod.Get = Get;
13771
+ /**
13772
+ * Returns a list of MFA Methods for the current session.
13773
+ * @param params
13774
+ * @returns
13775
+ */
13776
+ function GetList(params) {
13777
+ return __awaiter(this, void 0, void 0, function* () {
13778
+ if (!params) {
13779
+ params = {};
13780
+ }
13781
+ let { api } = params;
13782
+ if (!api) {
13783
+ api = ENVIRONMENT.Api().GetGuardianApi();
13784
+ }
13785
+ const { Items } = yield api.GET("v3/mfaMethods");
13786
+ return {
13787
+ methods: Items
13788
+ };
13789
+ });
13790
+ }
13791
+ UserMfaMethod.GetList = GetList;
13792
+ /**
13793
+ * Deletes an MFA Method record by its ID.
13794
+ * The api's session must be related to the record.
13795
+ * @param params
13796
+ */
13797
+ function Delete(params) {
13798
+ return __awaiter(this, void 0, void 0, function* () {
13799
+ let { methodId, api } = params;
13800
+ if (!methodId) {
13801
+ throw new Error("methodId is required");
13802
+ }
13803
+ if (!api) {
13804
+ api = ENVIRONMENT.Api().GetGuardianApi();
13805
+ }
13806
+ yield api.DELETE("v3/mfaMethod/" + methodId);
13807
+ });
13808
+ }
13809
+ UserMfaMethod.Delete = Delete;
13810
+ /**
13811
+ * Creates or updates an MFA Method record.
13812
+ * If the method has an ID, it will be updated, otherwise a new record will be created.
13813
+ * The api's session must be related to the record if updating.
13814
+ * @param params
13815
+ * @returns
13816
+ */
13817
+ function Update(params) {
13818
+ return __awaiter(this, void 0, void 0, function* () {
13819
+ let { method, api } = params;
13820
+ if (!method) {
13821
+ throw new Error("method is required");
13822
+ }
13823
+ if (!api) {
13824
+ api = ENVIRONMENT.Api().GetGuardianApi();
13825
+ }
13826
+ let url = "v3/mfaMethod/";
13827
+ if (method.ID) {
13828
+ url += method.ID;
13829
+ }
13830
+ const updated = yield api.POST(url, method);
13831
+ return {
13832
+ method: updated
13833
+ };
13834
+ });
13835
+ }
13836
+ UserMfaMethod.Update = Update;
13837
+ /**
13838
+ * Verifies an MFA Method record by its ID.
13839
+ * The api's session must be related to the record.
13840
+ * @param params
13841
+ * @returns
13842
+ */
13843
+ function Verify(params) {
13844
+ return __awaiter(this, void 0, void 0, function* () {
13845
+ let { methodId, code, api } = params;
13846
+ if (!methodId) {
13847
+ throw new Error("methodId is required");
13848
+ }
13849
+ else if (!code) {
13850
+ throw new Error("code is required");
13851
+ }
13852
+ if (!api) {
13853
+ api = ENVIRONMENT.Api().GetGuardianApi();
13854
+ }
13855
+ const body = {
13856
+ Code: code
13857
+ };
13858
+ const updated = yield api.POST("v3/mfaMethod/" + methodId + "/verify", body);
13859
+ return {
13860
+ method: updated
13861
+ };
13862
+ });
13863
+ }
13864
+ UserMfaMethod.Verify = Verify;
13865
+ })(UserMfaMethod || (UserMfaMethod = {}));
13866
+
13739
13867
  /**
13740
13868
  * An account-invite is an invitation to a user to join a client account.
13741
13869
  * New users to Nextspace will setup their user account within the invitation process.
@@ -16236,7 +16364,7 @@ var Tracking;
16236
16364
  })(Tracking || (Tracking = {}));
16237
16365
 
16238
16366
  // This is updated with the package.json version on build.
16239
- const VERSION = "6.5.6";
16367
+ const VERSION = "6.5.8";
16240
16368
 
16241
- export { VERSION, Assembly, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario, Tracking };
16369
+ export { VERSION, Assembly, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, UserMfaMethod, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario, Tracking };
16242
16370
  //# sourceMappingURL=bruce-models.es5.js.map