triangle-types 1.0.235 → 1.0.237

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.
@@ -106,5 +106,9 @@ export * from "./types/user/TenantDocument.js";
106
106
  export * from "./types/user/TenantDocumentFragment.js";
107
107
  export * from "./types/user/TenantDocumentTag.js";
108
108
  export * from "./types/user/TenantProvision.js";
109
+ export * from "./types/user/TenantRole.js";
110
+ export * from "./types/user/TenantRoleProvision.js";
109
111
  export * from "./types/user/User.js";
110
112
  export * from "./types/user/UserComment.js";
113
+ export * from "./types/user/UserTenant.js";
114
+ export * from "./types/user/UserTenantRole.js";
package/dist/src/index.js CHANGED
@@ -106,5 +106,9 @@ export * from "./types/user/TenantDocument.js";
106
106
  export * from "./types/user/TenantDocumentFragment.js";
107
107
  export * from "./types/user/TenantDocumentTag.js";
108
108
  export * from "./types/user/TenantProvision.js";
109
+ export * from "./types/user/TenantRole.js";
110
+ export * from "./types/user/TenantRoleProvision.js";
109
111
  export * from "./types/user/User.js";
110
112
  export * from "./types/user/UserComment.js";
113
+ export * from "./types/user/UserTenant.js";
114
+ export * from "./types/user/UserTenantRole.js";
@@ -1,18 +1,13 @@
1
- declare const tenant_provision_type_ids: readonly ["role", "scout", "prism", "tag", "target", "fragment_type", "client_theme"];
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
+ declare const resource_type_ids: readonly ["scout", "prism", "tag", "target", "fragment_type", "client_theme"];
2
+ export type ResourceTypeID = typeof resource_type_ids[number];
3
+ export declare function is_resource_type_id(resource_type_id: any): resource_type_id is ResourceTypeID;
4
4
  export declare class TenantProvision {
5
5
  readonly tenant_id: string;
6
- readonly provision_type_id: TenantProvisionTypeID;
7
6
  readonly provision_id: string;
7
+ readonly resource_type_id: ResourceTypeID;
8
+ readonly resource_id: string;
8
9
  readonly [x: string]: any;
9
10
  constructor(tenant_provision: TenantProvision);
10
11
  static is(tenant_provision: any): tenant_provision is TenantProvision;
11
12
  }
12
- export declare class TenantTagProvisionAux extends TenantProvision {
13
- readonly provision_type_id: "tag";
14
- readonly num_voters: number;
15
- constructor(tenant_provision: TenantTagProvisionAux);
16
- static is(tenant_provision: any): tenant_provision is TenantTagProvisionAux;
17
- }
18
13
  export {};
@@ -1,41 +1,25 @@
1
- const tenant_provision_type_ids = ["role", "scout", "prism", "tag", "target", "fragment_type", "client_theme"];
2
- export function is_tenant_provision_type_id(tenant_provision_type_id) {
3
- return tenant_provision_type_ids.includes(tenant_provision_type_id);
1
+ const resource_type_ids = ["scout", "prism", "tag", "target", "fragment_type", "client_theme"];
2
+ export function is_resource_type_id(resource_type_id) {
3
+ return resource_type_ids.includes(resource_type_id);
4
4
  }
5
5
  export class TenantProvision {
6
6
  tenant_id;
7
- provision_type_id;
8
7
  provision_id;
8
+ resource_type_id;
9
+ resource_id;
9
10
  constructor(tenant_provision) {
10
11
  if (!TenantProvision.is(tenant_provision)) {
11
12
  throw Error("Invalid Input.");
12
13
  }
13
14
  this.tenant_id = tenant_provision.tenant_id;
14
- this.provision_type_id = tenant_provision.provision_type_id;
15
15
  this.provision_id = tenant_provision.provision_id;
16
+ this.resource_type_id = tenant_provision.resource_type_id;
17
+ this.resource_id = tenant_provision.resource_id;
16
18
  }
17
19
  static is(tenant_provision) {
18
20
  return (tenant_provision !== undefined &&
19
- typeof tenant_provision.tenant_id === "string" &&
20
- is_tenant_provision_type_id(tenant_provision.provision_type_id) &&
21
- typeof tenant_provision.provision_id === "string");
22
- }
23
- }
24
- export class TenantTagProvisionAux extends TenantProvision {
25
- provision_type_id;
26
- num_voters;
27
- // readonly [x : string] : any
28
- constructor(tenant_provision) {
29
- if (!TenantTagProvisionAux.is(tenant_provision)) {
30
- throw Error("Invalid Input.");
31
- }
32
- super(tenant_provision);
33
- this.provision_type_id = "tag";
34
- this.num_voters = tenant_provision.num_voters;
35
- }
36
- static is(tenant_provision) {
37
- return (TenantProvision.is(tenant_provision) &&
38
- tenant_provision.provision_type_id === "tag" &&
39
- typeof tenant_provision.num_voters === "number");
21
+ typeof tenant_provision.provision_id === "string" &&
22
+ is_resource_type_id(tenant_provision.resource_type_id) &&
23
+ typeof tenant_provision.resource_id === "string");
40
24
  }
41
25
  }
@@ -0,0 +1,8 @@
1
+ export declare class TenantRole {
2
+ readonly tenant_id: string;
3
+ readonly role_id: string;
4
+ readonly name: string;
5
+ readonly [x: string]: any;
6
+ constructor(tenant_role: TenantRole);
7
+ static is(tenant_role: any): tenant_role is TenantRole;
8
+ }
@@ -0,0 +1,19 @@
1
+ export class TenantRole {
2
+ tenant_id;
3
+ role_id;
4
+ name;
5
+ constructor(tenant_role) {
6
+ if (!TenantRole.is(tenant_role)) {
7
+ throw Error("Invalid input.");
8
+ }
9
+ this.tenant_id = tenant_role.tenant_id;
10
+ this.role_id = tenant_role.role_id;
11
+ this.name = tenant_role.name;
12
+ }
13
+ static is(tenant_role) {
14
+ return (tenant_role !== undefined &&
15
+ typeof tenant_role.tenant_id === "string" &&
16
+ typeof tenant_role.role_id === "string" &&
17
+ typeof tenant_role.name === "string");
18
+ }
19
+ }
@@ -0,0 +1,11 @@
1
+ import { ResourceTypeID } from "./TenantProvision.js";
2
+ export declare class TenantRoleProvision {
3
+ readonly tenant_id: string;
4
+ readonly role_id: string;
5
+ readonly provision_id: string;
6
+ readonly resource_type_id: ResourceTypeID;
7
+ readonly resource_id: string;
8
+ readonly [x: string]: any;
9
+ constructor(tenant_role_provision: TenantRoleProvision);
10
+ static is(tenant_role_provision: any): tenant_role_provision is TenantRoleProvision;
11
+ }
@@ -0,0 +1,26 @@
1
+ import { is_resource_type_id } from "./TenantProvision.js";
2
+ export class TenantRoleProvision {
3
+ tenant_id;
4
+ role_id;
5
+ provision_id;
6
+ resource_type_id;
7
+ resource_id;
8
+ constructor(tenant_role_provision) {
9
+ if (!TenantRoleProvision.is(tenant_role_provision)) {
10
+ throw Error("Invalid input.");
11
+ }
12
+ this.tenant_id = tenant_role_provision.tenant_id;
13
+ this.role_id = tenant_role_provision.role_id;
14
+ this.provision_id = tenant_role_provision.provision_id;
15
+ this.resource_type_id = tenant_role_provision.resource_type_id;
16
+ this.resource_id = tenant_role_provision.resource_id;
17
+ }
18
+ static is(tenant_role_provision) {
19
+ return (tenant_role_provision !== undefined &&
20
+ typeof tenant_role_provision.tenant_id === "string" &&
21
+ typeof tenant_role_provision.role_id === "string" &&
22
+ typeof tenant_role_provision.provision_id === "string" &&
23
+ is_resource_type_id(tenant_role_provision.resource_type_id) &&
24
+ typeof tenant_role_provision.resource_id === "string");
25
+ }
26
+ }
@@ -2,13 +2,12 @@ import { TenantAux } from "./Tenant.js";
2
2
  export declare class User {
3
3
  readonly user_id: string;
4
4
  readonly email: string;
5
- readonly tenant_id?: string;
6
5
  readonly [x: string]: any;
7
6
  constructor(user: User);
8
7
  static is(user: any): user is User;
9
8
  }
10
9
  export declare class UserAux extends User {
11
- readonly tenant?: TenantAux;
10
+ readonly tenants: TenantAux[];
12
11
  constructor(user: UserAux);
13
12
  static is(user: any): user is UserAux;
14
13
  }
@@ -2,33 +2,30 @@ import { TenantAux } from "./Tenant.js";
2
2
  export class User {
3
3
  user_id;
4
4
  email;
5
- tenant_id;
6
5
  constructor(user) {
7
6
  if (!User.is(user)) {
8
7
  throw Error("Invalid Input.");
9
8
  }
10
9
  this.user_id = user.user_id;
11
10
  this.email = user.email;
12
- this.tenant_id = user.tenant_id;
13
11
  }
14
12
  static is(user) {
15
13
  return (user !== undefined &&
16
14
  typeof user.user_id === "string" &&
17
- typeof user.email === "string" &&
18
- (user.tenant_id === undefined || typeof user.tenant_id === "string"));
15
+ typeof user.email === "string");
19
16
  }
20
17
  }
21
18
  export class UserAux extends User {
22
- tenant;
19
+ tenants;
23
20
  constructor(user) {
24
21
  if (!UserAux.is(user)) {
25
22
  throw Error("Invalid Input.");
26
23
  }
27
24
  super(user);
28
- this.tenant = user.tenant;
25
+ this.tenants = user.tenants;
29
26
  }
30
27
  static is(user) {
31
28
  return (User.is(user) &&
32
- (user.tenant === undefined || TenantAux.is(user.tenant)));
29
+ Array.isArray(user.tenants) && user.tenants.every(TenantAux.is));
33
30
  }
34
31
  }
@@ -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
+ }
@@ -0,0 +1,8 @@
1
+ export declare class UserTenantRole {
2
+ readonly user_id: string;
3
+ readonly tenant_id: string;
4
+ readonly role_id: string;
5
+ readonly [x: string]: any;
6
+ constructor(user_tenant_role: UserTenantRole);
7
+ static is(user_tenant_role: any): user_tenant_role is UserTenantRole;
8
+ }
@@ -0,0 +1,19 @@
1
+ export class UserTenantRole {
2
+ user_id;
3
+ tenant_id;
4
+ role_id;
5
+ constructor(user_tenant_role) {
6
+ if (!UserTenantRole.is(user_tenant_role)) {
7
+ throw Error("Invalid input.");
8
+ }
9
+ this.user_id = user_tenant_role.user_id;
10
+ this.tenant_id = user_tenant_role.tenant_id;
11
+ this.role_id = user_tenant_role.role_id;
12
+ }
13
+ static is(user_tenant_role) {
14
+ return (user_tenant_role !== undefined &&
15
+ typeof user_tenant_role.user_id === "string" &&
16
+ typeof user_tenant_role.tenant_id === "string" &&
17
+ typeof user_tenant_role.role_id === "string");
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.235",
3
+ "version": "1.0.237",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -130,5 +130,9 @@ export * from "./types/user/TenantDocument"
130
130
  export * from "./types/user/TenantDocumentFragment"
131
131
  export * from "./types/user/TenantDocumentTag"
132
132
  export * from "./types/user/TenantProvision"
133
+ export * from "./types/user/TenantRole"
134
+ export * from "./types/user/TenantRoleProvision"
133
135
  export * from "./types/user/User"
134
- export * from "./types/user/UserComment"
136
+ export * from "./types/user/UserComment"
137
+ export * from "./types/user/UserTenant"
138
+ export * from "./types/user/UserTenantRole"
@@ -1,15 +1,16 @@
1
- const tenant_provision_type_ids = ["role", "scout", "prism", "tag", "target", "fragment_type", "client_theme"] as const
1
+ const resource_type_ids = ["scout", "prism", "tag", "target", "fragment_type", "client_theme"] as const
2
2
 
3
- export type TenantProvisionTypeID = typeof tenant_provision_type_ids[number]
3
+ export type ResourceTypeID = typeof resource_type_ids[number]
4
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)
5
+ export function is_resource_type_id(resource_type_id : any) : resource_type_id is ResourceTypeID {
6
+ return resource_type_ids.includes(resource_type_id)
7
7
  }
8
8
 
9
9
  export class TenantProvision {
10
10
  readonly tenant_id : string
11
- readonly provision_type_id : TenantProvisionTypeID
12
11
  readonly provision_id : string
12
+ readonly resource_type_id : ResourceTypeID
13
+ readonly resource_id : string
13
14
  readonly [x : string] : any
14
15
 
15
16
  constructor(tenant_provision : TenantProvision) {
@@ -17,39 +18,17 @@ export class TenantProvision {
17
18
  throw Error("Invalid Input.")
18
19
  }
19
20
  this.tenant_id = tenant_provision.tenant_id
20
- this.provision_type_id = tenant_provision.provision_type_id
21
21
  this.provision_id = tenant_provision.provision_id
22
+ this.resource_type_id = tenant_provision.resource_type_id
23
+ this.resource_id = tenant_provision.resource_id
22
24
  }
23
25
 
24
26
  static is(tenant_provision : any) : tenant_provision is TenantProvision {
25
27
  return (
26
28
  tenant_provision !== undefined &&
27
- typeof tenant_provision.tenant_id === "string" &&
28
- is_tenant_provision_type_id(tenant_provision.provision_type_id) &&
29
- typeof tenant_provision.provision_id === "string"
30
- )
31
- }
32
- }
33
-
34
- export class TenantTagProvisionAux extends TenantProvision {
35
- readonly provision_type_id : "tag"
36
- readonly num_voters : number
37
- // readonly [x : string] : any
38
-
39
- constructor(tenant_provision : TenantTagProvisionAux) {
40
- if (!TenantTagProvisionAux.is(tenant_provision)) {
41
- throw Error("Invalid Input.")
42
- }
43
- super(tenant_provision)
44
- this.provision_type_id = "tag"
45
- this.num_voters = tenant_provision.num_voters
46
- }
47
-
48
- static is(tenant_provision : any) : tenant_provision is TenantTagProvisionAux {
49
- return (
50
- TenantProvision.is(tenant_provision) &&
51
- tenant_provision.provision_type_id === "tag" &&
52
- typeof tenant_provision.num_voters === "number"
29
+ typeof tenant_provision.provision_id === "string" &&
30
+ is_resource_type_id(tenant_provision.resource_type_id) &&
31
+ typeof tenant_provision.resource_id === "string"
53
32
  )
54
33
  }
55
34
  }
@@ -0,0 +1,25 @@
1
+ export class TenantRole {
2
+ readonly tenant_id : string
3
+ readonly role_id : string
4
+ readonly name : string
5
+
6
+ readonly [x : string] : any
7
+
8
+ constructor(tenant_role : TenantRole) {
9
+ if (!TenantRole.is(tenant_role)) {
10
+ throw Error("Invalid input.")
11
+ }
12
+ this.tenant_id = tenant_role.tenant_id
13
+ this.role_id = tenant_role.role_id
14
+ this.name = tenant_role.name
15
+ }
16
+
17
+ static is(tenant_role : any) : tenant_role is TenantRole {
18
+ return (
19
+ tenant_role !== undefined &&
20
+ typeof tenant_role.tenant_id === "string" &&
21
+ typeof tenant_role.role_id === "string" &&
22
+ typeof tenant_role.name === "string"
23
+ )
24
+ }
25
+ }
@@ -0,0 +1,33 @@
1
+ import { is_resource_type_id, ResourceTypeID } from "./TenantProvision"
2
+
3
+ export class TenantRoleProvision {
4
+ readonly tenant_id : string
5
+ readonly role_id : string
6
+ readonly provision_id : string
7
+ readonly resource_type_id : ResourceTypeID
8
+ readonly resource_id : string
9
+
10
+ readonly [x : string] : any
11
+
12
+ constructor(tenant_role_provision : TenantRoleProvision) {
13
+ if (!TenantRoleProvision.is(tenant_role_provision)) {
14
+ throw Error("Invalid input.")
15
+ }
16
+ this.tenant_id = tenant_role_provision.tenant_id
17
+ this.role_id = tenant_role_provision.role_id
18
+ this.provision_id = tenant_role_provision.provision_id
19
+ this.resource_type_id = tenant_role_provision.resource_type_id
20
+ this.resource_id = tenant_role_provision.resource_id
21
+ }
22
+
23
+ static is(tenant_role_provision : any) : tenant_role_provision is TenantRoleProvision {
24
+ return (
25
+ tenant_role_provision !== undefined &&
26
+ typeof tenant_role_provision.tenant_id === "string" &&
27
+ typeof tenant_role_provision.role_id === "string" &&
28
+ typeof tenant_role_provision.provision_id === "string" &&
29
+ is_resource_type_id(tenant_role_provision.resource_type_id) &&
30
+ typeof tenant_role_provision.resource_id === "string"
31
+ )
32
+ }
33
+ }
@@ -1,9 +1,8 @@
1
- import { TenantAux } from "./Tenant"
1
+ import { Tenant, TenantAux } from "./Tenant"
2
2
 
3
3
  export class User {
4
4
  readonly user_id : string
5
5
  readonly email : string
6
- readonly tenant_id? : string
7
6
  readonly [x : string] : any
8
7
 
9
8
  constructor(user : User) {
@@ -12,34 +11,32 @@ export class User {
12
11
  }
13
12
  this.user_id = user.user_id
14
13
  this.email = user.email
15
- this.tenant_id = user.tenant_id
16
14
  }
17
15
 
18
16
  static is(user : any) : user is User {
19
17
  return (
20
18
  user !== undefined &&
21
19
  typeof user.user_id === "string" &&
22
- typeof user.email === "string" &&
23
- (user.tenant_id === undefined || typeof user.tenant_id === "string")
20
+ typeof user.email === "string"
24
21
  )
25
22
  }
26
23
  }
27
24
 
28
25
  export class UserAux extends User {
29
- readonly tenant? : TenantAux
26
+ readonly tenants : TenantAux[]
30
27
 
31
28
  constructor (user : UserAux) {
32
29
  if (!UserAux.is(user)) {
33
30
  throw Error("Invalid Input.")
34
31
  }
35
32
  super(user)
36
- this.tenant = user.tenant
33
+ this.tenants = user.tenants
37
34
  }
38
35
 
39
36
  static is(user : any) : user is UserAux {
40
37
  return (
41
38
  User.is(user) &&
42
- (user.tenant === undefined || TenantAux.is(user.tenant))
39
+ Array.isArray(user.tenants) && user.tenants.every(TenantAux.is)
43
40
  )
44
41
  }
45
42
  }
@@ -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
+ }
@@ -0,0 +1,24 @@
1
+ export class UserTenantRole {
2
+ readonly user_id : string
3
+ readonly tenant_id : string
4
+ readonly role_id : string
5
+ readonly [x : string] : any
6
+
7
+ constructor(user_tenant_role : UserTenantRole) {
8
+ if (!UserTenantRole.is(user_tenant_role)) {
9
+ throw Error("Invalid input.")
10
+ }
11
+ this.user_id = user_tenant_role.user_id
12
+ this.tenant_id = user_tenant_role.tenant_id
13
+ this.role_id = user_tenant_role.role_id
14
+ }
15
+
16
+ static is(user_tenant_role : any) : user_tenant_role is UserTenantRole {
17
+ return (
18
+ user_tenant_role !== undefined &&
19
+ typeof user_tenant_role.user_id === "string" &&
20
+ typeof user_tenant_role.tenant_id === "string" &&
21
+ typeof user_tenant_role.role_id === "string"
22
+ )
23
+ }
24
+ }