triangle-types 1.0.10 → 1.0.12
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/federal_congress/FederalCongressBill.d.ts +2 -2
- package/dist/src/types/federal_congress/FederalCongressBill.js +2 -2
- package/dist/src/types/federal_congress/FederalCongressMember.d.ts +1 -0
- package/dist/src/types/federal_congress/FederalCongressMember.js +5 -2
- package/dist/src/types/scout/Scout.d.ts +5 -0
- package/dist/src/types/scout/Scout.js +8 -1
- package/dist/src/types/voters/Voter.d.ts +1 -0
- package/dist/src/types/voters/Voter.js +3 -0
- package/package.json +1 -1
- package/src/types/federal_congress/FederalCongressBill.ts +3 -3
- package/src/types/federal_congress/FederalCongressMember.ts +5 -2
- package/src/types/scout/Scout.ts +12 -1
- package/src/types/voters/Voter.ts +3 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export type FederalCongressBillTypeID = typeof
|
|
1
|
+
declare const federal_congress_bill_type_ids: readonly ["HR", "S", "HJRES", "SJRES", "HCONRES", "SCONRES", "HRES", "SRES"];
|
|
2
|
+
export type FederalCongressBillTypeID = typeof federal_congress_bill_type_ids[number];
|
|
3
3
|
export declare function is_federal_congress_bill_type_id(federal_congress_bill_type_id: any): federal_congress_bill_type_id is FederalCongressBillTypeID;
|
|
4
4
|
export declare class FederalCongressBill {
|
|
5
5
|
readonly federal_congress_bill_id: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const federal_congress_bill_type_ids = ["HR", "S", "HJRES", "SJRES", "HCONRES", "SCONRES", "HRES", "SRES"];
|
|
2
2
|
export function is_federal_congress_bill_type_id(federal_congress_bill_type_id) {
|
|
3
|
-
return
|
|
3
|
+
return federal_congress_bill_type_ids.includes(federal_congress_bill_type_id);
|
|
4
4
|
}
|
|
5
5
|
export class FederalCongressBill {
|
|
6
6
|
federal_congress_bill_id;
|
|
@@ -11,6 +11,7 @@ export declare class FederalCongressMember {
|
|
|
11
11
|
readonly district?: number;
|
|
12
12
|
readonly is_incumbent: boolean;
|
|
13
13
|
readonly url?: string;
|
|
14
|
+
readonly url_image?: string;
|
|
14
15
|
constructor(federal_congress_member: any);
|
|
15
16
|
static is(federal_congress_member: any): federal_congress_member is FederalCongressMember;
|
|
16
17
|
}
|
|
@@ -11,6 +11,7 @@ export class FederalCongressMember {
|
|
|
11
11
|
district;
|
|
12
12
|
is_incumbent;
|
|
13
13
|
url;
|
|
14
|
+
url_image;
|
|
14
15
|
constructor(federal_congress_member) {
|
|
15
16
|
if (!FederalCongressMember.is(federal_congress_member)) {
|
|
16
17
|
throw Error("Invalid input.");
|
|
@@ -23,9 +24,10 @@ export class FederalCongressMember {
|
|
|
23
24
|
this.name_last = federal_congress_member.name_last;
|
|
24
25
|
this.birth_year = federal_congress_member.birth_year;
|
|
25
26
|
this.state_id = federal_congress_member.state_id;
|
|
27
|
+
this.is_incumbent = federal_congress_member.is_incumbent;
|
|
26
28
|
this.district = federal_congress_member.district;
|
|
27
29
|
this.url = federal_congress_member.url;
|
|
28
|
-
this.
|
|
30
|
+
this.url_image = federal_congress_member.url_image;
|
|
29
31
|
}
|
|
30
32
|
static is(federal_congress_member) {
|
|
31
33
|
return (federal_congress_member !== undefined &&
|
|
@@ -38,7 +40,8 @@ export class FederalCongressMember {
|
|
|
38
40
|
typeof federal_congress_member.birth_year === "number" && !isNaN(federal_congress_member.birth_year) &&
|
|
39
41
|
is_state_id(federal_congress_member.state_id) &&
|
|
40
42
|
(federal_congress_member.district === undefined || typeof federal_congress_member.district === "number") &&
|
|
43
|
+
typeof federal_congress_member.is_incumbent === "boolean" &&
|
|
41
44
|
(federal_congress_member.url === undefined || typeof federal_congress_member.url === "string") &&
|
|
42
|
-
typeof federal_congress_member.
|
|
45
|
+
(federal_congress_member.url_image === undefined || typeof federal_congress_member.url_image === "string"));
|
|
43
46
|
}
|
|
44
47
|
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
declare const scout_type_ids: readonly ["C", "O"];
|
|
2
|
+
export type ScoutTypeID = typeof scout_type_ids[number];
|
|
3
|
+
export declare function is_scout_type_id(scout_type_id: any): scout_type_id is ScoutTypeID;
|
|
1
4
|
export declare class Scout {
|
|
2
5
|
readonly scout_id: string;
|
|
3
6
|
readonly office_id: string;
|
|
4
7
|
readonly number: string;
|
|
5
8
|
readonly name: string;
|
|
9
|
+
readonly scout_type_id: ScoutTypeID;
|
|
6
10
|
readonly [x: string]: any;
|
|
7
11
|
constructor(scout: any);
|
|
8
12
|
static is(scout: any): scout is Scout;
|
|
9
13
|
}
|
|
14
|
+
export {};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
const scout_type_ids = ["C", "O"];
|
|
2
|
+
export function is_scout_type_id(scout_type_id) {
|
|
3
|
+
return scout_type_ids.includes(scout_type_id);
|
|
4
|
+
}
|
|
1
5
|
export class Scout {
|
|
2
6
|
scout_id;
|
|
3
7
|
office_id;
|
|
4
8
|
number;
|
|
5
9
|
name;
|
|
10
|
+
scout_type_id;
|
|
6
11
|
constructor(scout) {
|
|
7
12
|
if (!Scout.is(scout)) {
|
|
8
13
|
throw Error("Invalid input.");
|
|
@@ -11,12 +16,14 @@ export class Scout {
|
|
|
11
16
|
this.number = scout.number;
|
|
12
17
|
this.scout_id = scout.scout_id;
|
|
13
18
|
this.name = scout.name;
|
|
19
|
+
this.scout_type_id = scout.scout_type_id;
|
|
14
20
|
}
|
|
15
21
|
static is(scout) {
|
|
16
22
|
return (scout !== undefined &&
|
|
17
23
|
typeof scout.office_id === "string" &&
|
|
18
24
|
typeof scout.number === "string" &&
|
|
19
25
|
typeof scout.scout_id === "string" &&
|
|
20
|
-
typeof scout.name === "string"
|
|
26
|
+
typeof scout.name === "string" &&
|
|
27
|
+
is_scout_type_id(scout.scout_type_id));
|
|
21
28
|
}
|
|
22
29
|
}
|
|
@@ -27,6 +27,7 @@ export declare class Voter {
|
|
|
27
27
|
readonly occupation_description?: string;
|
|
28
28
|
readonly phone_home?: string;
|
|
29
29
|
readonly phone_mobile?: string;
|
|
30
|
+
readonly email?: string;
|
|
30
31
|
readonly ethnic_group?: string;
|
|
31
32
|
readonly ethnic_description?: string;
|
|
32
33
|
readonly religion_description?: string;
|
|
@@ -27,6 +27,7 @@ export class Voter {
|
|
|
27
27
|
occupation_description;
|
|
28
28
|
phone_home;
|
|
29
29
|
phone_mobile;
|
|
30
|
+
email;
|
|
30
31
|
ethnic_group;
|
|
31
32
|
ethnic_description;
|
|
32
33
|
religion_description;
|
|
@@ -64,6 +65,7 @@ export class Voter {
|
|
|
64
65
|
this.occupation_description = voter.occupation_description;
|
|
65
66
|
this.phone_home = voter.phone_home;
|
|
66
67
|
this.phone_mobile = voter.phone_mobile;
|
|
68
|
+
this.email = voter.email;
|
|
67
69
|
this.ethnic_group = voter.ethnic_group;
|
|
68
70
|
this.ethnic_description = voter.ethnic_description;
|
|
69
71
|
this.religion_description = voter.religion_description;
|
|
@@ -100,6 +102,7 @@ export class Voter {
|
|
|
100
102
|
(voter.occupation_description === undefined || typeof voter.occupation_description === "string") &&
|
|
101
103
|
(voter.phone_home === undefined || typeof voter.phone_home === "string") &&
|
|
102
104
|
(voter.phone_mobile === undefined || typeof voter.phone_mobile === "string") &&
|
|
105
|
+
(voter.email === undefined || typeof voter.email === "string") &&
|
|
103
106
|
(voter.ethnic_group === undefined || typeof voter.ethnic_group === "string") &&
|
|
104
107
|
(voter.ethnic_description === undefined || typeof voter.ethnic_description === "string") &&
|
|
105
108
|
(voter.religion_description === undefined || typeof voter.religion_description === "string") &&
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const
|
|
1
|
+
const federal_congress_bill_type_ids = ["HR", "S", "HJRES", "SJRES", "HCONRES", "SCONRES", "HRES", "SRES"] as const
|
|
2
2
|
|
|
3
|
-
export type FederalCongressBillTypeID = typeof
|
|
3
|
+
export type FederalCongressBillTypeID = typeof federal_congress_bill_type_ids[number]
|
|
4
4
|
|
|
5
5
|
export function is_federal_congress_bill_type_id(federal_congress_bill_type_id : any) : federal_congress_bill_type_id is FederalCongressBillTypeID {
|
|
6
|
-
return
|
|
6
|
+
return federal_congress_bill_type_ids.includes(federal_congress_bill_type_id)
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export class FederalCongressBill {
|
|
@@ -12,6 +12,7 @@ export class FederalCongressMember {
|
|
|
12
12
|
readonly district? : number
|
|
13
13
|
readonly is_incumbent : boolean
|
|
14
14
|
readonly url? : string
|
|
15
|
+
readonly url_image? : string
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
constructor(federal_congress_member : any) {
|
|
@@ -26,9 +27,10 @@ export class FederalCongressMember {
|
|
|
26
27
|
this.name_last = federal_congress_member.name_last
|
|
27
28
|
this.birth_year = federal_congress_member.birth_year
|
|
28
29
|
this.state_id = federal_congress_member.state_id
|
|
30
|
+
this.is_incumbent = federal_congress_member.is_incumbent
|
|
29
31
|
this.district = federal_congress_member.district
|
|
30
32
|
this.url = federal_congress_member.url
|
|
31
|
-
this.
|
|
33
|
+
this.url_image = federal_congress_member.url_image
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
static is(federal_congress_member : any) : federal_congress_member is FederalCongressMember {
|
|
@@ -43,8 +45,9 @@ export class FederalCongressMember {
|
|
|
43
45
|
typeof federal_congress_member.birth_year === "number" && !isNaN(federal_congress_member.birth_year) &&
|
|
44
46
|
is_state_id(federal_congress_member.state_id) &&
|
|
45
47
|
(federal_congress_member.district === undefined || typeof federal_congress_member.district === "number") &&
|
|
48
|
+
typeof federal_congress_member.is_incumbent === "boolean" &&
|
|
46
49
|
(federal_congress_member.url === undefined || typeof federal_congress_member.url === "string") &&
|
|
47
|
-
typeof federal_congress_member.
|
|
50
|
+
(federal_congress_member.url_image === undefined || typeof federal_congress_member.url_image === "string")
|
|
48
51
|
)
|
|
49
52
|
}
|
|
50
53
|
|
package/src/types/scout/Scout.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
const scout_type_ids = ["C", "O"] as const
|
|
2
|
+
|
|
3
|
+
export type ScoutTypeID = typeof scout_type_ids[number]
|
|
4
|
+
|
|
5
|
+
export function is_scout_type_id(scout_type_id : any) : scout_type_id is ScoutTypeID {
|
|
6
|
+
return scout_type_ids.includes(scout_type_id)
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
export class Scout {
|
|
2
10
|
readonly scout_id : string
|
|
3
11
|
readonly office_id : string
|
|
4
12
|
readonly number : string
|
|
5
13
|
readonly name : string
|
|
14
|
+
readonly scout_type_id : ScoutTypeID
|
|
6
15
|
readonly [x : string] : any
|
|
7
16
|
|
|
8
17
|
constructor(scout : any) {
|
|
@@ -13,6 +22,7 @@ export class Scout {
|
|
|
13
22
|
this.number = scout.number
|
|
14
23
|
this.scout_id = scout.scout_id
|
|
15
24
|
this.name = scout.name
|
|
25
|
+
this.scout_type_id = scout.scout_type_id
|
|
16
26
|
}
|
|
17
27
|
|
|
18
28
|
static is(scout : any) : scout is Scout {
|
|
@@ -21,7 +31,8 @@ export class Scout {
|
|
|
21
31
|
typeof scout.office_id === "string" &&
|
|
22
32
|
typeof scout.number === "string" &&
|
|
23
33
|
typeof scout.scout_id === "string" &&
|
|
24
|
-
typeof scout.name === "string"
|
|
34
|
+
typeof scout.name === "string" &&
|
|
35
|
+
is_scout_type_id(scout.scout_type_id)
|
|
25
36
|
)
|
|
26
37
|
}
|
|
27
38
|
}
|
|
@@ -28,6 +28,7 @@ export class Voter {
|
|
|
28
28
|
readonly occupation_description? : string
|
|
29
29
|
readonly phone_home? : string
|
|
30
30
|
readonly phone_mobile? : string
|
|
31
|
+
readonly email? : string
|
|
31
32
|
readonly ethnic_group? : string
|
|
32
33
|
readonly ethnic_description? : string
|
|
33
34
|
readonly religion_description? : string
|
|
@@ -67,6 +68,7 @@ export class Voter {
|
|
|
67
68
|
this.occupation_description = voter.occupation_description
|
|
68
69
|
this.phone_home = voter.phone_home
|
|
69
70
|
this.phone_mobile = voter.phone_mobile
|
|
71
|
+
this.email = voter.email
|
|
70
72
|
this.ethnic_group = voter.ethnic_group
|
|
71
73
|
this.ethnic_description = voter.ethnic_description
|
|
72
74
|
this.religion_description = voter.religion_description
|
|
@@ -105,6 +107,7 @@ export class Voter {
|
|
|
105
107
|
(voter.occupation_description === undefined || typeof voter.occupation_description === "string") &&
|
|
106
108
|
(voter.phone_home === undefined || typeof voter.phone_home === "string") &&
|
|
107
109
|
(voter.phone_mobile === undefined || typeof voter.phone_mobile === "string") &&
|
|
110
|
+
(voter.email === undefined || typeof voter.email === "string") &&
|
|
108
111
|
(voter.ethnic_group === undefined || typeof voter.ethnic_group === "string") &&
|
|
109
112
|
(voter.ethnic_description === undefined || typeof voter.ethnic_description === "string") &&
|
|
110
113
|
(voter.religion_description === undefined || typeof voter.religion_description === "string") &&
|