@sprucelabs/spruce-profile-utils 0.11.9 → 0.11.12
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
|
|
4
|
+
const schema_1 = require("@sprucelabs/schema");
|
|
4
5
|
class RoleSelectCardViewController extends heartwood_view_controllers_1.AbstractViewController {
|
|
5
6
|
constructor(options) {
|
|
6
7
|
super(options);
|
|
@@ -42,6 +43,7 @@ class RoleSelectCardViewController extends heartwood_view_controllers_1.Abstract
|
|
|
42
43
|
}
|
|
43
44
|
async setRoles(roles) {
|
|
44
45
|
this.roles = roles;
|
|
46
|
+
(0, schema_1.assertOptions)({ roles }, ['roles'], `The role select card needs roles passed to it to work!`);
|
|
45
47
|
const records = this.activeRecordCardVc.getRecords();
|
|
46
48
|
for (const profileRole of roles) {
|
|
47
49
|
const match = records.find((r) => r.id === profileRole.roleId);
|
|
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { AbstractViewController, buildActiveRecordCard, } from '@sprucelabs/heartwood-view-controllers';
|
|
11
|
+
import { assertOptions } from '@sprucelabs/schema';
|
|
11
12
|
export default class RoleSelectCardViewController extends AbstractViewController {
|
|
12
13
|
constructor(options) {
|
|
13
14
|
super(options);
|
|
@@ -50,6 +51,7 @@ export default class RoleSelectCardViewController extends AbstractViewController
|
|
|
50
51
|
setRoles(roles) {
|
|
51
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
53
|
this.roles = roles;
|
|
54
|
+
assertOptions({ roles }, ['roles'], `The role select card needs roles passed to it to work!`);
|
|
53
55
|
const records = this.activeRecordCardVc.getRecords();
|
|
54
56
|
for (const profileRole of roles) {
|
|
55
57
|
const match = records.find((r) => r.id === profileRole.roleId);
|