triangle-types 1.0.118 → 1.0.120
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/src/types/user/TenantProvision.d.ts +6 -0
- package/dist/src/types/user/TenantProvision.js +9 -0
- package/dist/src/types/user/User.d.ts +2 -2
- package/dist/src/types/user/User.js +2 -2
- package/package.json +1 -1
- package/src/types/user/TenantProvision.ts +14 -0
- package/src/types/user/User.ts +3 -3
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
declare const tenant_provision_type_ids: readonly ["supreme_admin", "scout", "prism"];
|
|
2
|
+
export type TenantProvisionTypeID = typeof tenant_provision_type_ids[number];
|
|
3
|
+
export declare function is_tenant_provision_type_id(tenant_provision_type_id: any): tenant_provision_type_id is TenantProvisionTypeID;
|
|
1
4
|
export declare class TenantProvision {
|
|
2
5
|
readonly tenant_id: string;
|
|
3
6
|
readonly provision_id: string;
|
|
7
|
+
readonly provision_type_id: TenantProvisionTypeID;
|
|
8
|
+
readonly value?: any;
|
|
4
9
|
constructor(tenant_provision: TenantProvision);
|
|
5
10
|
static is(tenant_provision: any): tenant_provision is TenantProvision;
|
|
6
11
|
}
|
|
12
|
+
export {};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
const tenant_provision_type_ids = ["supreme_admin", "scout", "prism"];
|
|
2
|
+
export function is_tenant_provision_type_id(tenant_provision_type_id) {
|
|
3
|
+
return tenant_provision_type_ids.includes(tenant_provision_type_id);
|
|
4
|
+
}
|
|
1
5
|
export class TenantProvision {
|
|
2
6
|
tenant_id;
|
|
3
7
|
provision_id;
|
|
8
|
+
provision_type_id;
|
|
9
|
+
value;
|
|
4
10
|
// readonly [x : string] : any
|
|
5
11
|
constructor(tenant_provision) {
|
|
6
12
|
if (!TenantProvision.is(tenant_provision)) {
|
|
@@ -8,10 +14,13 @@ export class TenantProvision {
|
|
|
8
14
|
}
|
|
9
15
|
this.tenant_id = tenant_provision.tenant_id;
|
|
10
16
|
this.provision_id = tenant_provision.provision_id;
|
|
17
|
+
this.provision_type_id = tenant_provision.provision_type_id;
|
|
18
|
+
this.value = tenant_provision.value;
|
|
11
19
|
}
|
|
12
20
|
static is(tenant_provision) {
|
|
13
21
|
return (tenant_provision !== undefined &&
|
|
14
22
|
typeof tenant_provision.tenant_id === "string" &&
|
|
23
|
+
is_tenant_provision_type_id(tenant_provision.provision_type_id) &&
|
|
15
24
|
typeof tenant_provision.provision_id === "string");
|
|
16
25
|
}
|
|
17
26
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TenantAux } from "./Tenant.js";
|
|
2
2
|
export declare class User {
|
|
3
3
|
readonly user_id: string;
|
|
4
4
|
readonly email: string;
|
|
@@ -8,7 +8,7 @@ export declare class User {
|
|
|
8
8
|
static is(user: any): user is User;
|
|
9
9
|
}
|
|
10
10
|
export declare class UserAux extends User {
|
|
11
|
-
readonly tenant?:
|
|
11
|
+
readonly tenant?: TenantAux;
|
|
12
12
|
constructor(user: UserAux);
|
|
13
13
|
static is(user: any): user is UserAux;
|
|
14
14
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TenantAux } from "./Tenant.js";
|
|
2
2
|
export class User {
|
|
3
3
|
user_id;
|
|
4
4
|
email;
|
|
@@ -41,6 +41,6 @@ export class UserAux extends User {
|
|
|
41
41
|
}
|
|
42
42
|
static is(user) {
|
|
43
43
|
return (User.is(user) &&
|
|
44
|
-
(user.tenant === undefined ||
|
|
44
|
+
(user.tenant === undefined || TenantAux.is(user.tenant)));
|
|
45
45
|
}
|
|
46
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
const tenant_provision_type_ids = ["supreme_admin", "scout", "prism"] as const
|
|
2
|
+
|
|
3
|
+
export type TenantProvisionTypeID = typeof tenant_provision_type_ids[number]
|
|
4
|
+
|
|
5
|
+
export function is_tenant_provision_type_id(tenant_provision_type_id : any) : tenant_provision_type_id is TenantProvisionTypeID {
|
|
6
|
+
return tenant_provision_type_ids.includes(tenant_provision_type_id)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
export class TenantProvision {
|
|
2
11
|
readonly tenant_id : string
|
|
3
12
|
readonly provision_id : string
|
|
13
|
+
readonly provision_type_id : TenantProvisionTypeID
|
|
14
|
+
readonly value? : any
|
|
4
15
|
// readonly [x : string] : any
|
|
5
16
|
|
|
6
17
|
constructor(tenant_provision : TenantProvision) {
|
|
@@ -9,12 +20,15 @@ export class TenantProvision {
|
|
|
9
20
|
}
|
|
10
21
|
this.tenant_id = tenant_provision.tenant_id
|
|
11
22
|
this.provision_id = tenant_provision.provision_id
|
|
23
|
+
this.provision_type_id = tenant_provision.provision_type_id
|
|
24
|
+
this.value = tenant_provision.value
|
|
12
25
|
}
|
|
13
26
|
|
|
14
27
|
static is(tenant_provision : any) : tenant_provision is TenantProvision {
|
|
15
28
|
return (
|
|
16
29
|
tenant_provision !== undefined &&
|
|
17
30
|
typeof tenant_provision.tenant_id === "string" &&
|
|
31
|
+
is_tenant_provision_type_id(tenant_provision.provision_type_id) &&
|
|
18
32
|
typeof tenant_provision.provision_id === "string"
|
|
19
33
|
)
|
|
20
34
|
}
|
package/src/types/user/User.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tenant } from "./Tenant"
|
|
1
|
+
import { Tenant, TenantAux } from "./Tenant"
|
|
2
2
|
import { TenantProvision } from "./TenantProvision"
|
|
3
3
|
|
|
4
4
|
export class User {
|
|
@@ -39,7 +39,7 @@ export class User {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export class UserAux extends User {
|
|
42
|
-
readonly tenant? :
|
|
42
|
+
readonly tenant? : TenantAux
|
|
43
43
|
|
|
44
44
|
constructor (user : UserAux) {
|
|
45
45
|
if (!UserAux.is(user)) {
|
|
@@ -52,7 +52,7 @@ export class UserAux extends User {
|
|
|
52
52
|
static is(user : any) : user is UserAux {
|
|
53
53
|
return (
|
|
54
54
|
User.is(user) &&
|
|
55
|
-
(user.tenant === undefined ||
|
|
55
|
+
(user.tenant === undefined || TenantAux.is(user.tenant))
|
|
56
56
|
)
|
|
57
57
|
}
|
|
58
58
|
}
|