triangle-types 1.0.236 → 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.
@@ -110,4 +110,5 @@ export * from "./types/user/TenantRole.js";
110
110
  export * from "./types/user/TenantRoleProvision.js";
111
111
  export * from "./types/user/User.js";
112
112
  export * from "./types/user/UserComment.js";
113
+ export * from "./types/user/UserTenant.js";
113
114
  export * from "./types/user/UserTenantRole.js";
package/dist/src/index.js CHANGED
@@ -110,4 +110,5 @@ export * from "./types/user/TenantRole.js";
110
110
  export * from "./types/user/TenantRoleProvision.js";
111
111
  export * from "./types/user/User.js";
112
112
  export * from "./types/user/UserComment.js";
113
+ export * from "./types/user/UserTenant.js";
113
114
  export * from "./types/user/UserTenantRole.js";
@@ -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 tenants: TenantAux[];
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
- tenants;
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.tenants = user.tenants;
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
- Array.isArray(user.tenants) && user.tenants.every(TenantAux.is));
32
+ (user.tenant === undefined || TenantAux.is(user.tenant)) &&
33
+ Array.isArray(user.tenant_roles) || user.tenant_roles.every(TenantRoleAux.is));
30
34
  }
31
35
  }
@@ -0,0 +1,7 @@
1
+ export declare class UserTenant {
2
+ readonly user_id: string;
3
+ readonly tenant_id: string;
4
+ readonly [x: string]: any;
5
+ constructor(user_tenant: UserTenant);
6
+ static is(user_tenant: any): user_tenant is UserTenant;
7
+ }
@@ -0,0 +1,16 @@
1
+ export class UserTenant {
2
+ user_id;
3
+ tenant_id;
4
+ constructor(user_tenant) {
5
+ if (!UserTenant.is(user_tenant)) {
6
+ throw Error("Invalid input.");
7
+ }
8
+ this.user_id = user_tenant.user_id;
9
+ this.tenant_id = user_tenant.tenant_id;
10
+ }
11
+ static is(user_tenant) {
12
+ return (user_tenant !== undefined &&
13
+ typeof user_tenant.user_id === "string" &&
14
+ typeof user_tenant.tenant_id === "string");
15
+ }
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.236",
3
+ "version": "1.0.238",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -134,4 +134,5 @@ export * from "./types/user/TenantRole"
134
134
  export * from "./types/user/TenantRoleProvision"
135
135
  export * from "./types/user/User"
136
136
  export * from "./types/user/UserComment"
137
+ export * from "./types/user/UserTenant"
137
138
  export * from "./types/user/UserTenantRole"
@@ -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
  }
@@ -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 tenants : TenantAux[]
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.tenants = user.tenants
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
- Array.isArray(user.tenants) && user.tenants.every(TenantAux.is)
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
  }
@@ -0,0 +1,21 @@
1
+ export class UserTenant {
2
+ readonly user_id : string
3
+ readonly tenant_id : string
4
+ readonly [x : string] : any
5
+
6
+ constructor(user_tenant : UserTenant) {
7
+ if (!UserTenant.is(user_tenant)) {
8
+ throw Error("Invalid input.")
9
+ }
10
+ this.user_id = user_tenant.user_id
11
+ this.tenant_id = user_tenant.tenant_id
12
+ }
13
+
14
+ static is(user_tenant : any) : user_tenant is UserTenant {
15
+ return (
16
+ user_tenant !== undefined &&
17
+ typeof user_tenant.user_id === "string" &&
18
+ typeof user_tenant.tenant_id === "string"
19
+ )
20
+ }
21
+ }