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.
- package/dist/bruce-models.es5.js +135 -7
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +133 -6
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +2 -1
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/user/session.js +12 -5
- package/dist/lib/user/session.js.map +1 -1
- package/dist/lib/user/user-group.js +2 -0
- package/dist/lib/user/user-group.js.map +1 -1
- package/dist/lib/user/user-mfa-method.js +133 -0
- package/dist/lib/user/user-mfa-method.js.map +1 -0
- package/dist/lib/user/user.js.map +1 -1
- package/dist/types/bruce-models.d.ts +2 -1
- package/dist/types/user/session.d.ts +5 -1
- package/dist/types/user/user-mfa-method.d.ts +74 -0
- package/dist/types/user/user.d.ts +2 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -12313,21 +12313,28 @@
|
|
|
12313
12313
|
*/
|
|
12314
12314
|
function Login(params) {
|
|
12315
12315
|
return __awaiter(this, void 0, void 0, function* () {
|
|
12316
|
-
let { api, username, password, accountId, req: reqParams } = params;
|
|
12316
|
+
let { api, username, password, accountId, req: reqParams, code } = params;
|
|
12317
12317
|
if (!api) {
|
|
12318
12318
|
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
12319
12319
|
}
|
|
12320
12320
|
const data = yield api.POST("login", {
|
|
12321
12321
|
account: accountId ? accountId : "",
|
|
12322
12322
|
login: username,
|
|
12323
|
-
password: password
|
|
12323
|
+
password: password,
|
|
12324
|
+
code: code
|
|
12324
12325
|
}, reqParams);
|
|
12325
|
-
const session = data
|
|
12326
|
-
|
|
12326
|
+
const session = data.Session;
|
|
12327
|
+
let ssid = session === null || session === void 0 ? void 0 : session.ID;
|
|
12328
|
+
if (!ssid) {
|
|
12329
|
+
ssid = "anonymous";
|
|
12330
|
+
}
|
|
12327
12331
|
api.SetSessionId(ssid);
|
|
12328
12332
|
api.Cache.Remove(GetCacheKey(ssid));
|
|
12329
12333
|
return {
|
|
12330
|
-
|
|
12334
|
+
loggedIn: ssid && ssid != "anonymous",
|
|
12335
|
+
session: session,
|
|
12336
|
+
mfaMessage: data.Message,
|
|
12337
|
+
mfaContact: (data.Email ? data.Email : data.Contact)
|
|
12331
12338
|
};
|
|
12332
12339
|
});
|
|
12333
12340
|
}
|
|
@@ -13480,11 +13487,131 @@
|
|
|
13480
13487
|
UserGroups: groupIds
|
|
13481
13488
|
}, reqParams);
|
|
13482
13489
|
api.Cache.RemoveByContains(exports.User.GetCacheKey(userId, accountId));
|
|
13490
|
+
api.Cache.RemoveByContains(exports.Api.ECacheKey.User);
|
|
13483
13491
|
});
|
|
13484
13492
|
}
|
|
13485
13493
|
UserGroup.RemoveUser = RemoveUser;
|
|
13486
13494
|
})(exports.UserGroup || (exports.UserGroup = {}));
|
|
13487
13495
|
|
|
13496
|
+
(function (UserMfaMethod) {
|
|
13497
|
+
/**
|
|
13498
|
+
* Returns an MFA Method record by its ID.
|
|
13499
|
+
* The api's session must be related to the record.
|
|
13500
|
+
* @param params
|
|
13501
|
+
* @returns
|
|
13502
|
+
*/
|
|
13503
|
+
function Get(params) {
|
|
13504
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13505
|
+
let { methodId, api } = params;
|
|
13506
|
+
if (!methodId) {
|
|
13507
|
+
throw new Error("methodId is required");
|
|
13508
|
+
}
|
|
13509
|
+
if (!api) {
|
|
13510
|
+
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
13511
|
+
}
|
|
13512
|
+
const method = yield api.GET("v3/mfaMethod/" + methodId);
|
|
13513
|
+
return {
|
|
13514
|
+
method: method
|
|
13515
|
+
};
|
|
13516
|
+
});
|
|
13517
|
+
}
|
|
13518
|
+
UserMfaMethod.Get = Get;
|
|
13519
|
+
/**
|
|
13520
|
+
* Returns a list of MFA Methods for the current session.
|
|
13521
|
+
* @param params
|
|
13522
|
+
* @returns
|
|
13523
|
+
*/
|
|
13524
|
+
function GetList(params) {
|
|
13525
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13526
|
+
if (!params) {
|
|
13527
|
+
params = {};
|
|
13528
|
+
}
|
|
13529
|
+
let { api } = params;
|
|
13530
|
+
if (!api) {
|
|
13531
|
+
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
13532
|
+
}
|
|
13533
|
+
const { Items } = yield api.GET("v3/mfaMethods");
|
|
13534
|
+
return {
|
|
13535
|
+
methods: Items
|
|
13536
|
+
};
|
|
13537
|
+
});
|
|
13538
|
+
}
|
|
13539
|
+
UserMfaMethod.GetList = GetList;
|
|
13540
|
+
/**
|
|
13541
|
+
* Deletes an MFA Method record by its ID.
|
|
13542
|
+
* The api's session must be related to the record.
|
|
13543
|
+
* @param params
|
|
13544
|
+
*/
|
|
13545
|
+
function Delete(params) {
|
|
13546
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13547
|
+
let { methodId, api } = params;
|
|
13548
|
+
if (!methodId) {
|
|
13549
|
+
throw new Error("methodId is required");
|
|
13550
|
+
}
|
|
13551
|
+
if (!api) {
|
|
13552
|
+
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
13553
|
+
}
|
|
13554
|
+
yield api.DELETE("v3/mfaMethod/" + methodId);
|
|
13555
|
+
});
|
|
13556
|
+
}
|
|
13557
|
+
UserMfaMethod.Delete = Delete;
|
|
13558
|
+
/**
|
|
13559
|
+
* Creates or updates an MFA Method record.
|
|
13560
|
+
* If the method has an ID, it will be updated, otherwise a new record will be created.
|
|
13561
|
+
* The api's session must be related to the record if updating.
|
|
13562
|
+
* @param params
|
|
13563
|
+
* @returns
|
|
13564
|
+
*/
|
|
13565
|
+
function Update(params) {
|
|
13566
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13567
|
+
let { method, api } = params;
|
|
13568
|
+
if (!method) {
|
|
13569
|
+
throw new Error("method is required");
|
|
13570
|
+
}
|
|
13571
|
+
if (!api) {
|
|
13572
|
+
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
13573
|
+
}
|
|
13574
|
+
let url = "v3/mfaMethod/";
|
|
13575
|
+
if (method.ID) {
|
|
13576
|
+
url += method.ID;
|
|
13577
|
+
}
|
|
13578
|
+
const updated = yield api.POST(url, method);
|
|
13579
|
+
return {
|
|
13580
|
+
method: updated
|
|
13581
|
+
};
|
|
13582
|
+
});
|
|
13583
|
+
}
|
|
13584
|
+
UserMfaMethod.Update = Update;
|
|
13585
|
+
/**
|
|
13586
|
+
* Verifies an MFA Method record by its ID.
|
|
13587
|
+
* The api's session must be related to the record.
|
|
13588
|
+
* @param params
|
|
13589
|
+
* @returns
|
|
13590
|
+
*/
|
|
13591
|
+
function Verify(params) {
|
|
13592
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13593
|
+
let { methodId, code, api } = params;
|
|
13594
|
+
if (!methodId) {
|
|
13595
|
+
throw new Error("methodId is required");
|
|
13596
|
+
}
|
|
13597
|
+
else if (!code) {
|
|
13598
|
+
throw new Error("code is required");
|
|
13599
|
+
}
|
|
13600
|
+
if (!api) {
|
|
13601
|
+
api = exports.ENVIRONMENT.Api().GetGuardianApi();
|
|
13602
|
+
}
|
|
13603
|
+
const body = {
|
|
13604
|
+
Code: code
|
|
13605
|
+
};
|
|
13606
|
+
const updated = yield api.POST("v3/mfaMethod/" + methodId + "/verify", body);
|
|
13607
|
+
return {
|
|
13608
|
+
method: updated
|
|
13609
|
+
};
|
|
13610
|
+
});
|
|
13611
|
+
}
|
|
13612
|
+
UserMfaMethod.Verify = Verify;
|
|
13613
|
+
})(exports.UserMfaMethod || (exports.UserMfaMethod = {}));
|
|
13614
|
+
|
|
13488
13615
|
(function (AccountInvite) {
|
|
13489
13616
|
/**
|
|
13490
13617
|
* Possible invite statuses.
|
|
@@ -15922,7 +16049,7 @@
|
|
|
15922
16049
|
})(exports.Tracking || (exports.Tracking = {}));
|
|
15923
16050
|
|
|
15924
16051
|
// This is updated with the package.json version on build.
|
|
15925
|
-
const VERSION = "6.5.
|
|
16052
|
+
const VERSION = "6.5.8";
|
|
15926
16053
|
|
|
15927
16054
|
exports.VERSION = VERSION;
|
|
15928
16055
|
exports.AbstractApi = AbstractApi;
|