triangle-types 1.0.237 → 1.0.238
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,3 +1,4 @@
|
|
|
1
|
+
import { TenantRoleProvision } from "./TenantRoleProvision.js";
|
|
1
2
|
export declare class TenantRole {
|
|
2
3
|
readonly tenant_id: string;
|
|
3
4
|
readonly role_id: string;
|
|
@@ -6,3 +7,8 @@ export declare class TenantRole {
|
|
|
6
7
|
constructor(tenant_role: TenantRole);
|
|
7
8
|
static is(tenant_role: any): tenant_role is TenantRole;
|
|
8
9
|
}
|
|
10
|
+
export declare class TenantRoleAux extends TenantRole {
|
|
11
|
+
readonly provisions: TenantRoleProvision[];
|
|
12
|
+
constructor(tenant_role: TenantRoleAux);
|
|
13
|
+
static is(tenant_role: any): tenant_role is TenantRoleAux;
|
|
14
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TenantRoleProvision } from "./TenantRoleProvision.js";
|
|
1
2
|
export class TenantRole {
|
|
2
3
|
tenant_id;
|
|
3
4
|
role_id;
|
|
@@ -17,3 +18,17 @@ export class TenantRole {
|
|
|
17
18
|
typeof tenant_role.name === "string");
|
|
18
19
|
}
|
|
19
20
|
}
|
|
21
|
+
export class TenantRoleAux extends TenantRole {
|
|
22
|
+
provisions;
|
|
23
|
+
constructor(tenant_role) {
|
|
24
|
+
if (!TenantRoleAux.is(tenant_role)) {
|
|
25
|
+
throw Error("Invalid Input.");
|
|
26
|
+
}
|
|
27
|
+
super(tenant_role);
|
|
28
|
+
this.provisions = tenant_role.provisions;
|
|
29
|
+
}
|
|
30
|
+
static is(tenant_role) {
|
|
31
|
+
return (TenantRoleAux.is(tenant_role) &&
|
|
32
|
+
Array.isArray(tenant_role.provisions) && tenant_role.provisions.every(TenantRoleProvision.is));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TenantAux } from "./Tenant.js";
|
|
2
|
+
import { TenantRoleAux } from "./TenantRole.js";
|
|
2
3
|
export declare class User {
|
|
3
4
|
readonly user_id: string;
|
|
4
5
|
readonly email: string;
|
|
@@ -7,7 +8,8 @@ export declare class User {
|
|
|
7
8
|
static is(user: any): user is User;
|
|
8
9
|
}
|
|
9
10
|
export declare class UserAux extends User {
|
|
10
|
-
readonly
|
|
11
|
+
readonly tenant?: TenantAux;
|
|
12
|
+
readonly tenant_roles: TenantRoleAux[];
|
|
11
13
|
constructor(user: UserAux);
|
|
12
14
|
static is(user: any): user is UserAux;
|
|
13
15
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TenantAux } from "./Tenant.js";
|
|
2
|
+
import { TenantRoleAux } from "./TenantRole.js";
|
|
2
3
|
export class User {
|
|
3
4
|
user_id;
|
|
4
5
|
email;
|
|
@@ -16,16 +17,19 @@ export class User {
|
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
export class UserAux extends User {
|
|
19
|
-
|
|
20
|
+
tenant;
|
|
21
|
+
tenant_roles;
|
|
20
22
|
constructor(user) {
|
|
21
23
|
if (!UserAux.is(user)) {
|
|
22
24
|
throw Error("Invalid Input.");
|
|
23
25
|
}
|
|
24
26
|
super(user);
|
|
25
|
-
this.
|
|
27
|
+
this.tenant = user.tenant;
|
|
28
|
+
this.tenant_roles = user.tenant_roles;
|
|
26
29
|
}
|
|
27
30
|
static is(user) {
|
|
28
31
|
return (User.is(user) &&
|
|
29
|
-
|
|
32
|
+
(user.tenant === undefined || TenantAux.is(user.tenant)) &&
|
|
33
|
+
Array.isArray(user.tenant_roles) || user.tenant_roles.every(TenantRoleAux.is));
|
|
30
34
|
}
|
|
31
35
|
}
|
package/package.json
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { TenantRoleProvision } from "./TenantRoleProvision"
|
|
2
|
+
|
|
1
3
|
export class TenantRole {
|
|
2
4
|
readonly tenant_id : string
|
|
3
5
|
readonly role_id : string
|
|
@@ -22,4 +24,23 @@ export class TenantRole {
|
|
|
22
24
|
typeof tenant_role.name === "string"
|
|
23
25
|
)
|
|
24
26
|
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class TenantRoleAux extends TenantRole {
|
|
30
|
+
readonly provisions : TenantRoleProvision[]
|
|
31
|
+
|
|
32
|
+
constructor (tenant_role : TenantRoleAux) {
|
|
33
|
+
if (!TenantRoleAux.is(tenant_role)) {
|
|
34
|
+
throw Error("Invalid Input.")
|
|
35
|
+
}
|
|
36
|
+
super(tenant_role)
|
|
37
|
+
this.provisions = tenant_role.provisions
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static is(tenant_role : any) : tenant_role is TenantRoleAux {
|
|
41
|
+
return (
|
|
42
|
+
TenantRoleAux.is(tenant_role) &&
|
|
43
|
+
Array.isArray(tenant_role.provisions) && tenant_role.provisions.every(TenantRoleProvision.is)
|
|
44
|
+
)
|
|
45
|
+
}
|
|
25
46
|
}
|
package/src/types/user/User.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Tenant, TenantAux } from "./Tenant"
|
|
2
|
+
import { TenantRoleAux } from "./TenantRole"
|
|
2
3
|
|
|
3
4
|
export class User {
|
|
4
5
|
readonly user_id : string
|
|
@@ -23,20 +24,23 @@ export class User {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export class UserAux extends User {
|
|
26
|
-
readonly
|
|
27
|
+
readonly tenant? : TenantAux
|
|
28
|
+
readonly tenant_roles : TenantRoleAux[]
|
|
27
29
|
|
|
28
30
|
constructor (user : UserAux) {
|
|
29
31
|
if (!UserAux.is(user)) {
|
|
30
32
|
throw Error("Invalid Input.")
|
|
31
33
|
}
|
|
32
34
|
super(user)
|
|
33
|
-
this.
|
|
35
|
+
this.tenant = user.tenant
|
|
36
|
+
this.tenant_roles = user.tenant_roles
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
static is(user : any) : user is UserAux {
|
|
37
40
|
return (
|
|
38
41
|
User.is(user) &&
|
|
39
|
-
|
|
42
|
+
(user.tenant === undefined || TenantAux.is(user.tenant)) &&
|
|
43
|
+
Array.isArray(user.tenant_roles) || user.tenant_roles.every(TenantRoleAux.is)
|
|
40
44
|
)
|
|
41
45
|
}
|
|
42
46
|
}
|