triangle-types 1.0.234 → 1.0.236
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/index.d.ts +3 -0
- package/dist/src/index.js +3 -0
- package/dist/src/types/user/TenantProvision.d.ts +5 -10
- package/dist/src/types/user/TenantProvision.js +10 -26
- package/dist/src/types/user/TenantRole.d.ts +8 -0
- package/dist/src/types/user/TenantRole.js +19 -0
- package/dist/src/types/user/TenantRoleProvision.d.ts +11 -0
- package/dist/src/types/user/TenantRoleProvision.js +26 -0
- package/dist/src/types/user/User.d.ts +1 -2
- package/dist/src/types/user/User.js +4 -7
- package/dist/src/types/user/UserTenantRole.d.ts +8 -0
- package/dist/src/types/user/UserTenantRole.js +19 -0
- package/dist/src/types/web/WebArticleFragment.d.ts +1 -1
- package/dist/src/types/web/WebArticleFragment.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -1
- package/src/types/user/TenantProvision.ts +11 -32
- package/src/types/user/TenantRole.ts +25 -0
- package/src/types/user/TenantRoleProvision.ts +33 -0
- package/src/types/user/User.ts +5 -8
- package/src/types/user/UserTenantRole.ts +24 -0
- package/src/types/web/WebArticleFragment.ts +2 -2
package/dist/src/index.d.ts
CHANGED
|
@@ -106,5 +106,8 @@ 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/UserTenantRole.js";
|
package/dist/src/index.js
CHANGED
|
@@ -106,5 +106,8 @@ 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/UserTenantRole.js";
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export type
|
|
3
|
-
export declare function
|
|
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
|
|
2
|
-
export function
|
|
3
|
-
return
|
|
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.
|
|
20
|
-
|
|
21
|
-
typeof tenant_provision.
|
|
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,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
|
|
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
|
-
|
|
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.
|
|
25
|
+
this.tenants = user.tenants;
|
|
29
26
|
}
|
|
30
27
|
static is(user) {
|
|
31
28
|
return (User.is(user) &&
|
|
32
|
-
(user.
|
|
29
|
+
Array.isArray(user.tenants) && user.tenants.every(TenantAux.is));
|
|
33
30
|
}
|
|
34
31
|
}
|
|
@@ -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
|
+
}
|
|
@@ -8,7 +8,7 @@ export declare class WebArticleFragment {
|
|
|
8
8
|
readonly max_index: number;
|
|
9
9
|
readonly title: string;
|
|
10
10
|
readonly text: string;
|
|
11
|
-
readonly vector
|
|
11
|
+
readonly vector?: number[];
|
|
12
12
|
readonly [x: string]: any;
|
|
13
13
|
constructor(web_article_fragment: WebArticleFragment);
|
|
14
14
|
static is(web_article_fragment: any): web_article_fragment is WebArticleFragment;
|
|
@@ -33,6 +33,6 @@ export class WebArticleFragment {
|
|
|
33
33
|
typeof web_article_fragment.max_index === "number" &&
|
|
34
34
|
typeof web_article_fragment.title === "string" &&
|
|
35
35
|
typeof web_article_fragment.text === "string" &&
|
|
36
|
-
Array.isArray(web_article_fragment.vector) && web_article_fragment.vector.every((coordinate) => typeof coordinate === "number"));
|
|
36
|
+
(web_article_fragment.vector === undefined || Array.isArray(web_article_fragment.vector) && web_article_fragment.vector.every((coordinate) => typeof coordinate === "number")));
|
|
37
37
|
}
|
|
38
38
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -130,5 +130,8 @@ 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/UserTenantRole"
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
const
|
|
1
|
+
const resource_type_ids = ["scout", "prism", "tag", "target", "fragment_type", "client_theme"] as const
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type ResourceTypeID = typeof resource_type_ids[number]
|
|
4
4
|
|
|
5
|
-
export function
|
|
6
|
-
return
|
|
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.
|
|
28
|
-
|
|
29
|
-
typeof tenant_provision.
|
|
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
|
+
}
|
package/src/types/user/User.ts
CHANGED
|
@@ -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
|
|
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.
|
|
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.
|
|
39
|
+
Array.isArray(user.tenants) && user.tenants.every(TenantAux.is)
|
|
43
40
|
)
|
|
44
41
|
}
|
|
45
42
|
}
|
|
@@ -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
|
+
}
|
|
@@ -9,7 +9,7 @@ export class WebArticleFragment {
|
|
|
9
9
|
readonly max_index : number
|
|
10
10
|
readonly title : string
|
|
11
11
|
readonly text : string
|
|
12
|
-
readonly vector : number[]
|
|
12
|
+
readonly vector? : number[]
|
|
13
13
|
readonly [x : string] : any
|
|
14
14
|
|
|
15
15
|
constructor(web_article_fragment : WebArticleFragment) {
|
|
@@ -38,7 +38,7 @@ export class WebArticleFragment {
|
|
|
38
38
|
typeof web_article_fragment.max_index === "number" &&
|
|
39
39
|
typeof web_article_fragment.title === "string" &&
|
|
40
40
|
typeof web_article_fragment.text === "string" &&
|
|
41
|
-
Array.isArray(web_article_fragment.vector) && web_article_fragment.vector.every((coordinate : any) => typeof coordinate === "number")
|
|
41
|
+
(web_article_fragment.vector === undefined || Array.isArray(web_article_fragment.vector) && web_article_fragment.vector.every((coordinate : any) => typeof coordinate === "number"))
|
|
42
42
|
)
|
|
43
43
|
}
|
|
44
44
|
}
|