triangle-types 1.0.227 → 1.0.229
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/scout/Scout.d.ts +4 -2
- package/dist/src/types/scout/Scout.js +8 -6
- package/dist/src/types/user/Tenant.d.ts +6 -0
- package/dist/src/types/user/Tenant.js +15 -0
- package/dist/src/types/user/User.d.ts +6 -0
- package/dist/src/types/user/User.js +15 -16
- package/package.json +1 -1
- package/src/types/scout/Scout.ts +8 -6
- package/src/types/user/Tenant.ts +21 -0
- package/src/types/user/User.ts +18 -16
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { FederalCongressMember } from "../federal_congress/FederalCongressMember.js";
|
|
2
|
+
import { FederalElectionCandidate } from "../federal_elections/FederalElectionCandidate.js";
|
|
1
3
|
export declare class Scout {
|
|
2
4
|
readonly scout_id: string;
|
|
3
5
|
readonly name?: string;
|
|
@@ -9,8 +11,8 @@ export declare class Scout {
|
|
|
9
11
|
static is(scout: any): scout is Scout;
|
|
10
12
|
}
|
|
11
13
|
export declare class ScoutAux extends Scout {
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
14
|
+
readonly federal_election_candidates: FederalElectionCandidate[];
|
|
15
|
+
readonly federal_congress_member?: FederalCongressMember;
|
|
14
16
|
constructor(scout: any);
|
|
15
17
|
static is(scout: any): scout is ScoutAux;
|
|
16
18
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { FederalCongressMember } from "../federal_congress/FederalCongressMember.js";
|
|
2
|
+
import { FederalElectionCandidate } from "../federal_elections/FederalElectionCandidate.js";
|
|
1
3
|
// const scout_type_ids = ["I", "O"] as const
|
|
2
4
|
// export type ScoutTypeID = typeof scout_type_ids[number]
|
|
3
5
|
// export function is_scout_type_id(scout_type_id : any) : scout_type_id is ScoutTypeID {
|
|
@@ -32,20 +34,20 @@ export class Scout {
|
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
export class ScoutAux extends Scout {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
federal_election_candidates;
|
|
38
|
+
federal_congress_member;
|
|
37
39
|
constructor(scout) {
|
|
38
40
|
if (!ScoutAux.is(scout)) {
|
|
39
41
|
throw Error("Invalid input.");
|
|
40
42
|
}
|
|
41
43
|
super(scout);
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
44
|
+
this.federal_election_candidates = scout.federal_election_candidates;
|
|
45
|
+
this.federal_congress_member = scout.federal_congress_member;
|
|
44
46
|
}
|
|
45
47
|
static is(scout) {
|
|
46
48
|
return (Scout.is(scout) &&
|
|
47
|
-
Array.isArray(scout.
|
|
48
|
-
(scout.
|
|
49
|
+
Array.isArray(scout.federal_election_candidates) && scout.federal_election_candidates.every(FederalElectionCandidate.is) &&
|
|
50
|
+
(scout.federal_congress_member === undefined || FederalCongressMember.is(scout.federal_congress_member)));
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
// const scout_office_ids = ["USP", "USH", "USS", "STG", "STH", "STS"] as const
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TenantProvision } from "./TenantProvision.js";
|
|
1
2
|
export declare class Tenant {
|
|
2
3
|
readonly tenant_id: string;
|
|
3
4
|
readonly name: string;
|
|
@@ -5,3 +6,8 @@ export declare class Tenant {
|
|
|
5
6
|
constructor(tenant: Tenant);
|
|
6
7
|
static is(tenant: any): tenant is Tenant;
|
|
7
8
|
}
|
|
9
|
+
export declare class TenantAux extends Tenant {
|
|
10
|
+
readonly provisions: TenantProvision[];
|
|
11
|
+
constructor(tenant: TenantAux);
|
|
12
|
+
static is(tenant: any): tenant is TenantAux;
|
|
13
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TenantProvision } from "./TenantProvision.js";
|
|
1
2
|
export class Tenant {
|
|
2
3
|
tenant_id;
|
|
3
4
|
name;
|
|
@@ -14,3 +15,17 @@ export class Tenant {
|
|
|
14
15
|
typeof tenant.name === "string");
|
|
15
16
|
}
|
|
16
17
|
}
|
|
18
|
+
export class TenantAux extends Tenant {
|
|
19
|
+
provisions;
|
|
20
|
+
constructor(tenant) {
|
|
21
|
+
if (!TenantAux.is(tenant)) {
|
|
22
|
+
throw Error("Invalid Input.");
|
|
23
|
+
}
|
|
24
|
+
super(tenant);
|
|
25
|
+
this.provisions = tenant.provisions;
|
|
26
|
+
}
|
|
27
|
+
static is(tenant) {
|
|
28
|
+
return (Tenant.is(tenant) &&
|
|
29
|
+
Array.isArray(tenant.provisions) && tenant.provisions.every(TenantProvision.is));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TenantAux } from "./Tenant.js";
|
|
1
2
|
export declare class User {
|
|
2
3
|
readonly user_id: string;
|
|
3
4
|
readonly email: string;
|
|
@@ -6,3 +7,8 @@ export declare class User {
|
|
|
6
7
|
constructor(user: User);
|
|
7
8
|
static is(user: any): user is User;
|
|
8
9
|
}
|
|
10
|
+
export declare class UserAux extends User {
|
|
11
|
+
readonly tenant?: TenantAux;
|
|
12
|
+
constructor(user: UserAux);
|
|
13
|
+
static is(user: any): user is UserAux;
|
|
14
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TenantAux } from "./Tenant.js";
|
|
1
2
|
export class User {
|
|
2
3
|
user_id;
|
|
3
4
|
email;
|
|
@@ -17,19 +18,17 @@ export class User {
|
|
|
17
18
|
(user.tenant_id === undefined || typeof user.tenant_id === "string"));
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// }
|
|
35
|
-
// }
|
|
21
|
+
export class UserAux extends User {
|
|
22
|
+
tenant;
|
|
23
|
+
constructor(user) {
|
|
24
|
+
if (!UserAux.is(user)) {
|
|
25
|
+
throw Error("Invalid Input.");
|
|
26
|
+
}
|
|
27
|
+
super(user);
|
|
28
|
+
this.tenant = user.tenant;
|
|
29
|
+
}
|
|
30
|
+
static is(user) {
|
|
31
|
+
return (User.is(user) &&
|
|
32
|
+
(user.tenant === undefined || TenantAux.is(user.tenant)));
|
|
33
|
+
}
|
|
34
|
+
}
|
package/package.json
CHANGED
package/src/types/scout/Scout.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { FederalCongressMember } from "../federal_congress/FederalCongressMember"
|
|
2
|
+
import { FederalElectionCandidate } from "../federal_elections/FederalElectionCandidate"
|
|
1
3
|
import { DocumentTypeID, is_document_type_id } from "../fragments/Fragment"
|
|
2
4
|
import { StateID } from "../regions/State"
|
|
3
5
|
|
|
@@ -44,23 +46,23 @@ export class Scout {
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
export class ScoutAux extends Scout {
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
49
|
+
readonly federal_election_candidates : FederalElectionCandidate[]
|
|
50
|
+
readonly federal_congress_member? : FederalCongressMember
|
|
49
51
|
|
|
50
52
|
constructor(scout : any) {
|
|
51
53
|
if (!ScoutAux.is(scout)) {
|
|
52
54
|
throw Error("Invalid input.")
|
|
53
55
|
}
|
|
54
56
|
super(scout)
|
|
55
|
-
this.
|
|
56
|
-
this.
|
|
57
|
+
this.federal_election_candidates = scout.federal_election_candidates
|
|
58
|
+
this.federal_congress_member = scout.federal_congress_member
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
static is(scout : any) : scout is ScoutAux {
|
|
60
62
|
return (
|
|
61
63
|
Scout.is(scout) &&
|
|
62
|
-
Array.isArray(scout.
|
|
63
|
-
(scout.
|
|
64
|
+
Array.isArray(scout.federal_election_candidates) && scout.federal_election_candidates.every(FederalElectionCandidate.is) &&
|
|
65
|
+
(scout.federal_congress_member === undefined || FederalCongressMember.is(scout.federal_congress_member))
|
|
64
66
|
)
|
|
65
67
|
}
|
|
66
68
|
}
|
package/src/types/user/Tenant.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { TenantProvision } from "./TenantProvision"
|
|
2
|
+
|
|
1
3
|
export class Tenant {
|
|
2
4
|
readonly tenant_id : string
|
|
3
5
|
readonly name : string
|
|
@@ -18,4 +20,23 @@ export class Tenant {
|
|
|
18
20
|
typeof tenant.name === "string"
|
|
19
21
|
)
|
|
20
22
|
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class TenantAux extends Tenant {
|
|
26
|
+
readonly provisions : TenantProvision[]
|
|
27
|
+
|
|
28
|
+
constructor (tenant : TenantAux) {
|
|
29
|
+
if (!TenantAux.is(tenant)) {
|
|
30
|
+
throw Error("Invalid Input.")
|
|
31
|
+
}
|
|
32
|
+
super(tenant)
|
|
33
|
+
this.provisions = tenant.provisions
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static is(tenant : any) : tenant is TenantAux {
|
|
37
|
+
return (
|
|
38
|
+
Tenant.is(tenant) &&
|
|
39
|
+
Array.isArray(tenant.provisions) && tenant.provisions.every(TenantProvision.is)
|
|
40
|
+
)
|
|
41
|
+
}
|
|
21
42
|
}
|
package/src/types/user/User.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { TenantAux } from "./Tenant"
|
|
2
|
+
|
|
1
3
|
export class User {
|
|
2
4
|
readonly user_id : string
|
|
3
5
|
readonly email : string
|
|
@@ -23,21 +25,21 @@ export class User {
|
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
export class UserAux extends User {
|
|
29
|
+
readonly tenant? : TenantAux
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
constructor (user : UserAux) {
|
|
32
|
+
if (!UserAux.is(user)) {
|
|
33
|
+
throw Error("Invalid Input.")
|
|
34
|
+
}
|
|
35
|
+
super(user)
|
|
36
|
+
this.tenant = user.tenant
|
|
37
|
+
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
static is(user : any) : user is UserAux {
|
|
40
|
+
return (
|
|
41
|
+
User.is(user) &&
|
|
42
|
+
(user.tenant === undefined || TenantAux.is(user.tenant))
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
}
|