triangle-types 1.0.53 → 1.0.55
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 +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/types/prism/Prism.d.ts +3 -3
- package/dist/src/types/prism/Prism.js +9 -9
- package/dist/src/types/prism/Voter.d.ts +5 -4
- package/dist/src/types/prism/Voter.js +11 -10
- package/dist/src/types/prism/VoterTarget.d.ts +6 -1
- package/dist/src/types/prism/VoterTarget.js +17 -4
- package/dist/src/types/prism/VoterTurnout.d.ts +5 -1
- package/dist/src/types/prism/VoterTurnout.js +15 -4
- package/package.json +1 -1
- package/src/index.ts +3 -0
- package/src/types/prism/Prism.ts +9 -9
- package/src/types/prism/Voter.ts +12 -11
- package/src/types/prism/VoterTarget.ts +18 -4
- package/src/types/prism/VoterTurnout.ts +17 -5
package/dist/src/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export * from "./types/federal_lobby/FederalLobbyDocument.js";
|
|
|
29
29
|
export * from "./types/federal_lobby/FederalLobbyDocumentInterest.js";
|
|
30
30
|
export * from "./types/federal_congress/FederalCongressBill.js";
|
|
31
31
|
export * from "./types/federal_congress/FederalCongressBillDocument.js";
|
|
32
|
+
export * from "./types/federal_congress/FederalCongressDistrict.js";
|
|
32
33
|
export * from "./types/federal_congress/FederalCongressMember.js";
|
|
33
34
|
export * from "./types/federal_register/FederalRegisterAgency.js";
|
|
34
35
|
export * from "./types/federal_register/FederalRegisterDocument.js";
|
|
@@ -59,6 +60,7 @@ export * from "./types/scout/ScoutTag.js";
|
|
|
59
60
|
export * from "./types/scout/UserScout.js";
|
|
60
61
|
export * from "./types/scout/UserScoutConversation.js";
|
|
61
62
|
export * from "./types/scout/UserScoutConversationMessage.js";
|
|
63
|
+
export * from "./types/state_legislature/StateLegislatureDistrict.js";
|
|
62
64
|
export * from "./types/state_permits/StateFacility.js";
|
|
63
65
|
export * from "./types/state_permits/StatePermit.js";
|
|
64
66
|
export * from "./types/state_permits/StatePermitDocument.js";
|
package/dist/src/index.js
CHANGED
|
@@ -29,6 +29,7 @@ export * from "./types/federal_lobby/FederalLobbyDocument.js";
|
|
|
29
29
|
export * from "./types/federal_lobby/FederalLobbyDocumentInterest.js";
|
|
30
30
|
export * from "./types/federal_congress/FederalCongressBill.js";
|
|
31
31
|
export * from "./types/federal_congress/FederalCongressBillDocument.js";
|
|
32
|
+
export * from "./types/federal_congress/FederalCongressDistrict.js";
|
|
32
33
|
export * from "./types/federal_congress/FederalCongressMember.js";
|
|
33
34
|
export * from "./types/federal_register/FederalRegisterAgency.js";
|
|
34
35
|
export * from "./types/federal_register/FederalRegisterDocument.js";
|
|
@@ -59,6 +60,7 @@ export * from "./types/scout/ScoutTag.js";
|
|
|
59
60
|
export * from "./types/scout/UserScout.js";
|
|
60
61
|
export * from "./types/scout/UserScoutConversation.js";
|
|
61
62
|
export * from "./types/scout/UserScoutConversationMessage.js";
|
|
63
|
+
export * from "./types/state_legislature/StateLegislatureDistrict.js";
|
|
62
64
|
export * from "./types/state_permits/StateFacility.js";
|
|
63
65
|
export * from "./types/state_permits/StatePermit.js";
|
|
64
66
|
export * from "./types/state_permits/StatePermitDocument.js";
|
|
@@ -2,9 +2,9 @@ import { StateID } from "../State.js";
|
|
|
2
2
|
export declare class Prism {
|
|
3
3
|
readonly prism_id: string;
|
|
4
4
|
readonly state_id: StateID;
|
|
5
|
-
readonly
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
5
|
+
readonly federal_congress_district_id?: string;
|
|
6
|
+
readonly state_legislature_house_district_id?: string;
|
|
7
|
+
readonly state_legislature_senate_district_id?: string;
|
|
8
8
|
constructor(prism: any);
|
|
9
9
|
static is(prism: any): prism is Prism;
|
|
10
10
|
}
|
|
@@ -2,26 +2,26 @@ import { is_state_id } from "../State.js";
|
|
|
2
2
|
export class Prism {
|
|
3
3
|
prism_id;
|
|
4
4
|
state_id;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
federal_congress_district_id;
|
|
6
|
+
state_legislature_house_district_id;
|
|
7
|
+
state_legislature_senate_district_id;
|
|
8
8
|
constructor(prism) {
|
|
9
9
|
if (!Prism.is(prism)) {
|
|
10
10
|
throw Error("Invalid input.");
|
|
11
11
|
}
|
|
12
12
|
this.prism_id = prism.prism_id;
|
|
13
13
|
this.state_id = prism.state_id;
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
14
|
+
this.federal_congress_district_id = prism.federal_congress_district_id;
|
|
15
|
+
this.state_legislature_house_district_id = prism.state_legislature_house_district_id;
|
|
16
|
+
this.state_legislature_senate_district_id = prism.state_legislature_senate_district_id;
|
|
17
17
|
}
|
|
18
18
|
static is(prism) {
|
|
19
19
|
return (prism !== undefined &&
|
|
20
20
|
typeof prism.prism_id === "string" &&
|
|
21
21
|
is_state_id(prism.state_id) &&
|
|
22
|
-
(prism.
|
|
23
|
-
(prism.
|
|
24
|
-
(prism.
|
|
22
|
+
(prism.federal_congress_district_id === undefined || typeof prism.federal_congress_district_id === "string") &&
|
|
23
|
+
(prism.state_legislature_house_district_id === undefined || typeof prism.state_legislature_house_district_id === "string") &&
|
|
24
|
+
(prism.state_legislature_senate_district_id === undefined || typeof prism.state_legislature_senate_district_id === "string"));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
// export class PrismAux extends Prism {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { StateID } from "../State.js";
|
|
1
2
|
import { VoterTarget } from "./VoterTarget.js";
|
|
2
3
|
import { VoterTurnout } from "./VoterTurnout.js";
|
|
3
4
|
export declare class Voter {
|
|
4
5
|
readonly voter_id: string;
|
|
5
|
-
readonly state_id:
|
|
6
|
+
readonly state_id: StateID;
|
|
6
7
|
readonly state_voter_id: string;
|
|
7
8
|
readonly name_first: string;
|
|
8
9
|
readonly name_middle?: string;
|
|
@@ -23,9 +24,9 @@ export declare class Voter {
|
|
|
23
24
|
readonly address_mail_city?: string;
|
|
24
25
|
readonly address_mail_state_id: string;
|
|
25
26
|
readonly address_mail_zip?: string;
|
|
26
|
-
readonly
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
27
|
+
readonly federal_congress_district_id: string;
|
|
28
|
+
readonly state_legislature_house_district_id: string;
|
|
29
|
+
readonly state_legislature_senate_district_id: string;
|
|
29
30
|
readonly occupation_group?: string;
|
|
30
31
|
readonly occupation_description?: string;
|
|
31
32
|
readonly phone_home?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { is_state_id } from "../State.js";
|
|
1
2
|
import { VoterTarget } from "./VoterTarget.js";
|
|
2
3
|
import { VoterTurnout } from "./VoterTurnout.js";
|
|
3
4
|
export class Voter {
|
|
@@ -23,9 +24,9 @@ export class Voter {
|
|
|
23
24
|
address_mail_city;
|
|
24
25
|
address_mail_state_id;
|
|
25
26
|
address_mail_zip;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
federal_congress_district_id;
|
|
28
|
+
state_legislature_house_district_id;
|
|
29
|
+
state_legislature_senate_district_id;
|
|
29
30
|
occupation_group;
|
|
30
31
|
occupation_description;
|
|
31
32
|
phone_home;
|
|
@@ -64,9 +65,9 @@ export class Voter {
|
|
|
64
65
|
this.address_mail_city = voter.address_mail_city;
|
|
65
66
|
this.address_mail_state_id = voter.address_mail_state_id;
|
|
66
67
|
this.address_mail_zip = voter.address_mail_zip;
|
|
67
|
-
this.
|
|
68
|
-
this.
|
|
69
|
-
this.
|
|
68
|
+
this.federal_congress_district_id = voter.federal_congress_district_id;
|
|
69
|
+
this.state_legislature_house_district_id = voter.state_legislature_house_district_id;
|
|
70
|
+
this.state_legislature_senate_district_id = voter.state_legislature_senate_district_id;
|
|
70
71
|
this.occupation_group = voter.occupation_group;
|
|
71
72
|
this.occupation_description = voter.occupation_description;
|
|
72
73
|
this.phone_home = voter.phone_home;
|
|
@@ -83,7 +84,7 @@ export class Voter {
|
|
|
83
84
|
static is(voter) {
|
|
84
85
|
return (voter !== undefined &&
|
|
85
86
|
typeof voter.voter_id === "string" &&
|
|
86
|
-
|
|
87
|
+
is_state_id(voter.state_id) &&
|
|
87
88
|
typeof voter.state_voter_id === "string" &&
|
|
88
89
|
typeof voter.name_first === "string" &&
|
|
89
90
|
(voter.name_middle === undefined || typeof voter.name_middle === "string") &&
|
|
@@ -104,9 +105,9 @@ export class Voter {
|
|
|
104
105
|
(voter.address_mail_city === undefined || typeof voter.address_mail_city === "string") &&
|
|
105
106
|
typeof voter.address_mail_state_id === "string" &&
|
|
106
107
|
(voter.address_mail_zip === undefined || typeof voter.address_mail_zip === "string") &&
|
|
107
|
-
typeof voter.
|
|
108
|
-
typeof voter.
|
|
109
|
-
typeof voter.
|
|
108
|
+
typeof voter.federal_congress_district_id === "string" &&
|
|
109
|
+
typeof voter.state_legislature_house_district_id === "string" &&
|
|
110
|
+
typeof voter.state_legislature_senate_district_id === "string" &&
|
|
110
111
|
(voter.occupation_group === undefined || typeof voter.occupation_group === "string") &&
|
|
111
112
|
(voter.occupation_description === undefined || typeof voter.occupation_description === "string") &&
|
|
112
113
|
(voter.phone_home === undefined || typeof voter.phone_home === "string") &&
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { StateID } from "../State.js";
|
|
1
2
|
export declare class VoterTarget {
|
|
2
3
|
readonly voter_target_id: string;
|
|
3
4
|
readonly voter_id: string;
|
|
4
|
-
readonly prism_id: string;
|
|
5
5
|
readonly target_id: string;
|
|
6
|
+
readonly value: number;
|
|
7
|
+
readonly state_id: StateID;
|
|
8
|
+
readonly federal_congress_district_id: string;
|
|
9
|
+
readonly state_legislature_house_district_id: string;
|
|
10
|
+
readonly state_legislature_senate_district_id: string;
|
|
6
11
|
constructor(voter_target: any);
|
|
7
12
|
static is(voter_target: any): voter_target is VoterTarget;
|
|
8
13
|
}
|
|
@@ -1,22 +1,35 @@
|
|
|
1
|
+
import { is_state_id } from "../State.js";
|
|
1
2
|
export class VoterTarget {
|
|
2
3
|
voter_target_id;
|
|
3
4
|
voter_id;
|
|
4
|
-
prism_id;
|
|
5
5
|
target_id;
|
|
6
|
+
value;
|
|
7
|
+
state_id;
|
|
8
|
+
federal_congress_district_id;
|
|
9
|
+
state_legislature_house_district_id;
|
|
10
|
+
state_legislature_senate_district_id;
|
|
6
11
|
constructor(voter_target) {
|
|
7
12
|
if (!VoterTarget.is(voter_target)) {
|
|
8
13
|
throw Error("Invalid input.");
|
|
9
14
|
}
|
|
10
15
|
this.voter_target_id = voter_target.voter_target_id;
|
|
11
16
|
this.voter_id = voter_target.voter_id;
|
|
12
|
-
this.prism_id = voter_target.prism_id;
|
|
13
17
|
this.target_id = voter_target.target_id;
|
|
18
|
+
this.value = voter_target.value;
|
|
19
|
+
this.state_id = voter_target.state_id;
|
|
20
|
+
this.federal_congress_district_id = voter_target.federal_congress_district_id;
|
|
21
|
+
this.state_legislature_house_district_id = voter_target.state_legislature_house_district_id;
|
|
22
|
+
this.state_legislature_senate_district_id = voter_target.state_legislature_senate_district_id;
|
|
14
23
|
}
|
|
15
24
|
static is(voter_target) {
|
|
16
25
|
return (voter_target !== undefined &&
|
|
17
26
|
typeof voter_target.voter_target_id === "string" &&
|
|
18
27
|
typeof voter_target.voter_id === "string" &&
|
|
19
|
-
typeof voter_target.
|
|
20
|
-
typeof voter_target.
|
|
28
|
+
typeof voter_target.target_id === "string" &&
|
|
29
|
+
typeof voter_target.value === "number" &&
|
|
30
|
+
is_state_id(voter_target.state_id) &&
|
|
31
|
+
typeof voter_target.federal_congress_district_id === "string" &&
|
|
32
|
+
typeof voter_target.state_legislature_house_district_id === "string" &&
|
|
33
|
+
typeof voter_target.state_legislature_senate_district_id === "string");
|
|
21
34
|
}
|
|
22
35
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { StateID } from "../State.js";
|
|
1
2
|
export declare class VoterTurnout {
|
|
2
3
|
readonly voter_turnout_id: string;
|
|
3
4
|
readonly voter_id: string;
|
|
4
5
|
readonly turnout_id: string;
|
|
5
6
|
readonly year: number;
|
|
6
|
-
readonly state_id: string;
|
|
7
7
|
readonly turnout_type_id: string;
|
|
8
8
|
readonly value: boolean;
|
|
9
|
+
readonly state_id: StateID;
|
|
10
|
+
readonly federal_congress_district_id: string;
|
|
11
|
+
readonly state_legislature_house_district_id: string;
|
|
12
|
+
readonly state_legislature_senate_district_id: string;
|
|
9
13
|
constructor(voter_turnout: any);
|
|
10
14
|
static is(voter_turnout: any): voter_turnout is VoterTurnout;
|
|
11
15
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { is_state_id } from "../State.js";
|
|
1
2
|
export class VoterTurnout {
|
|
2
3
|
voter_turnout_id;
|
|
3
4
|
voter_id;
|
|
4
5
|
turnout_id;
|
|
5
6
|
year;
|
|
6
|
-
state_id;
|
|
7
7
|
turnout_type_id;
|
|
8
8
|
value;
|
|
9
|
+
state_id;
|
|
10
|
+
federal_congress_district_id;
|
|
11
|
+
state_legislature_house_district_id;
|
|
12
|
+
state_legislature_senate_district_id;
|
|
9
13
|
constructor(voter_turnout) {
|
|
10
14
|
if (!VoterTurnout.is(voter_turnout)) {
|
|
11
15
|
throw Error("Invalid input.");
|
|
@@ -14,9 +18,13 @@ export class VoterTurnout {
|
|
|
14
18
|
this.voter_id = voter_turnout.voter_id;
|
|
15
19
|
this.turnout_id = voter_turnout.turnout_id;
|
|
16
20
|
this.year = voter_turnout.year;
|
|
17
|
-
this.state_id = voter_turnout.state_id;
|
|
18
21
|
this.turnout_type_id = voter_turnout.turnout_type_id;
|
|
19
22
|
this.value = voter_turnout.value;
|
|
23
|
+
this.state_id = voter_turnout.state_id;
|
|
24
|
+
this.state_id = voter_turnout.state_id;
|
|
25
|
+
this.federal_congress_district_id = voter_turnout.federal_congress_district_id;
|
|
26
|
+
this.state_legislature_house_district_id = voter_turnout.state_legislature_house_district_id;
|
|
27
|
+
this.state_legislature_senate_district_id = voter_turnout.state_legislature_senate_district_id;
|
|
20
28
|
}
|
|
21
29
|
static is(voter_turnout) {
|
|
22
30
|
return (voter_turnout !== undefined &&
|
|
@@ -24,8 +32,11 @@ export class VoterTurnout {
|
|
|
24
32
|
typeof voter_turnout.voter_id === "string" &&
|
|
25
33
|
typeof voter_turnout.turnout_id === "string" &&
|
|
26
34
|
typeof voter_turnout.year === "number" &&
|
|
27
|
-
typeof voter_turnout.state_id === "string" &&
|
|
28
35
|
typeof voter_turnout.turnout_type_id === "string" &&
|
|
29
|
-
typeof voter_turnout.value === "boolean"
|
|
36
|
+
typeof voter_turnout.value === "boolean" &&
|
|
37
|
+
is_state_id(voter_turnout.state_id) &&
|
|
38
|
+
typeof voter_turnout.federal_congress_district_id === "string" &&
|
|
39
|
+
typeof voter_turnout.state_legislature_house_district_id === "string" &&
|
|
40
|
+
typeof voter_turnout.state_legislature_senate_district_id === "string");
|
|
30
41
|
}
|
|
31
42
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -33,6 +33,7 @@ export * from "./types/federal_lobby/FederalLobbyDocumentInterest"
|
|
|
33
33
|
|
|
34
34
|
export * from "./types/federal_congress/FederalCongressBill"
|
|
35
35
|
export * from "./types/federal_congress/FederalCongressBillDocument"
|
|
36
|
+
export * from "./types/federal_congress/FederalCongressDistrict"
|
|
36
37
|
export * from "./types/federal_congress/FederalCongressMember"
|
|
37
38
|
|
|
38
39
|
export * from "./types/federal_register/FederalRegisterAgency"
|
|
@@ -71,6 +72,8 @@ export * from "./types/scout/UserScout"
|
|
|
71
72
|
export * from "./types/scout/UserScoutConversation"
|
|
72
73
|
export * from "./types/scout/UserScoutConversationMessage"
|
|
73
74
|
|
|
75
|
+
export * from "./types/state_legislature/StateLegislatureDistrict"
|
|
76
|
+
|
|
74
77
|
export * from "./types/state_permits/StateFacility"
|
|
75
78
|
export * from "./types/state_permits/StatePermit"
|
|
76
79
|
export * from "./types/state_permits/StatePermitDocument"
|
package/src/types/prism/Prism.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { is_state_id, StateID } from "../State"
|
|
|
3
3
|
export class Prism {
|
|
4
4
|
readonly prism_id : string
|
|
5
5
|
readonly state_id : StateID
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
6
|
+
readonly federal_congress_district_id? : string
|
|
7
|
+
readonly state_legislature_house_district_id? : string
|
|
8
|
+
readonly state_legislature_senate_district_id? : string
|
|
9
9
|
|
|
10
10
|
constructor(prism : any) {
|
|
11
11
|
if (!Prism.is(prism)) {
|
|
@@ -13,9 +13,9 @@ export class Prism {
|
|
|
13
13
|
}
|
|
14
14
|
this.prism_id = prism.prism_id
|
|
15
15
|
this.state_id = prism.state_id
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
16
|
+
this.federal_congress_district_id = prism.federal_congress_district_id
|
|
17
|
+
this.state_legislature_house_district_id = prism.state_legislature_house_district_id
|
|
18
|
+
this.state_legislature_senate_district_id = prism.state_legislature_senate_district_id
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
static is(prism : any) : prism is Prism {
|
|
@@ -23,9 +23,9 @@ export class Prism {
|
|
|
23
23
|
prism !== undefined &&
|
|
24
24
|
typeof prism.prism_id === "string" &&
|
|
25
25
|
is_state_id(prism.state_id) &&
|
|
26
|
-
(prism.
|
|
27
|
-
(prism.
|
|
28
|
-
(prism.
|
|
26
|
+
(prism.federal_congress_district_id === undefined || typeof prism.federal_congress_district_id === "string") &&
|
|
27
|
+
(prism.state_legislature_house_district_id === undefined || typeof prism.state_legislature_house_district_id === "string") &&
|
|
28
|
+
(prism.state_legislature_senate_district_id === undefined || typeof prism.state_legislature_senate_district_id === "string")
|
|
29
29
|
)
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/types/prism/Voter.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { is_state_id, StateID } from "../State"
|
|
1
2
|
import { VoterTarget } from "./VoterTarget"
|
|
2
3
|
import { VoterTurnout } from "./VoterTurnout"
|
|
3
4
|
|
|
4
5
|
export class Voter {
|
|
5
6
|
readonly voter_id : string
|
|
6
|
-
readonly state_id :
|
|
7
|
+
readonly state_id : StateID
|
|
7
8
|
readonly state_voter_id : string
|
|
8
9
|
readonly name_first : string
|
|
9
10
|
readonly name_middle? : string
|
|
@@ -24,9 +25,9 @@ export class Voter {
|
|
|
24
25
|
readonly address_mail_city? : string
|
|
25
26
|
readonly address_mail_state_id : string
|
|
26
27
|
readonly address_mail_zip? : string
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
28
|
+
readonly federal_congress_district_id : string
|
|
29
|
+
readonly state_legislature_house_district_id : string
|
|
30
|
+
readonly state_legislature_senate_district_id : string
|
|
30
31
|
readonly occupation_group? : string
|
|
31
32
|
readonly occupation_description? : string
|
|
32
33
|
readonly phone_home? : string
|
|
@@ -67,9 +68,9 @@ export class Voter {
|
|
|
67
68
|
this.address_mail_city = voter.address_mail_city
|
|
68
69
|
this.address_mail_state_id = voter.address_mail_state_id
|
|
69
70
|
this.address_mail_zip = voter.address_mail_zip
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
71
|
+
this.federal_congress_district_id = voter.federal_congress_district_id
|
|
72
|
+
this.state_legislature_house_district_id = voter.state_legislature_house_district_id
|
|
73
|
+
this.state_legislature_senate_district_id = voter.state_legislature_senate_district_id
|
|
73
74
|
this.occupation_group = voter.occupation_group
|
|
74
75
|
this.occupation_description = voter.occupation_description
|
|
75
76
|
this.phone_home = voter.phone_home
|
|
@@ -88,7 +89,7 @@ export class Voter {
|
|
|
88
89
|
return (
|
|
89
90
|
voter !== undefined &&
|
|
90
91
|
typeof voter.voter_id === "string" &&
|
|
91
|
-
|
|
92
|
+
is_state_id(voter.state_id) &&
|
|
92
93
|
typeof voter.state_voter_id === "string" &&
|
|
93
94
|
typeof voter.name_first === "string" &&
|
|
94
95
|
(voter.name_middle === undefined || typeof voter.name_middle === "string") &&
|
|
@@ -109,9 +110,9 @@ export class Voter {
|
|
|
109
110
|
(voter.address_mail_city === undefined || typeof voter.address_mail_city === "string") &&
|
|
110
111
|
typeof voter.address_mail_state_id === "string" &&
|
|
111
112
|
(voter.address_mail_zip === undefined || typeof voter.address_mail_zip === "string") &&
|
|
112
|
-
typeof voter.
|
|
113
|
-
typeof voter.
|
|
114
|
-
typeof voter.
|
|
113
|
+
typeof voter.federal_congress_district_id === "string" &&
|
|
114
|
+
typeof voter.state_legislature_house_district_id === "string" &&
|
|
115
|
+
typeof voter.state_legislature_senate_district_id === "string" &&
|
|
115
116
|
(voter.occupation_group === undefined || typeof voter.occupation_group === "string") &&
|
|
116
117
|
(voter.occupation_description === undefined || typeof voter.occupation_description === "string") &&
|
|
117
118
|
(voter.phone_home === undefined || typeof voter.phone_home === "string") &&
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { is_state_id, StateID } from "../State"
|
|
2
|
+
|
|
1
3
|
export class VoterTarget {
|
|
2
4
|
readonly voter_target_id : string
|
|
3
5
|
readonly voter_id : string
|
|
4
|
-
readonly prism_id : string
|
|
5
6
|
readonly target_id : string
|
|
7
|
+
readonly value : number
|
|
8
|
+
readonly state_id : StateID
|
|
9
|
+
readonly federal_congress_district_id : string
|
|
10
|
+
readonly state_legislature_house_district_id : string
|
|
11
|
+
readonly state_legislature_senate_district_id : string
|
|
6
12
|
|
|
7
13
|
constructor(voter_target : any) {
|
|
8
14
|
if (!VoterTarget.is(voter_target)) {
|
|
@@ -10,8 +16,12 @@ export class VoterTarget {
|
|
|
10
16
|
}
|
|
11
17
|
this.voter_target_id = voter_target.voter_target_id
|
|
12
18
|
this.voter_id = voter_target.voter_id
|
|
13
|
-
this.prism_id = voter_target.prism_id
|
|
14
19
|
this.target_id = voter_target.target_id
|
|
20
|
+
this.value = voter_target.value
|
|
21
|
+
this.state_id = voter_target.state_id
|
|
22
|
+
this.federal_congress_district_id = voter_target.federal_congress_district_id
|
|
23
|
+
this.state_legislature_house_district_id = voter_target.state_legislature_house_district_id
|
|
24
|
+
this.state_legislature_senate_district_id = voter_target.state_legislature_senate_district_id
|
|
15
25
|
}
|
|
16
26
|
|
|
17
27
|
static is(voter_target : any) : voter_target is VoterTarget {
|
|
@@ -19,8 +29,12 @@ export class VoterTarget {
|
|
|
19
29
|
voter_target !== undefined &&
|
|
20
30
|
typeof voter_target.voter_target_id === "string" &&
|
|
21
31
|
typeof voter_target.voter_id === "string" &&
|
|
22
|
-
typeof voter_target.
|
|
23
|
-
typeof voter_target.
|
|
32
|
+
typeof voter_target.target_id === "string" &&
|
|
33
|
+
typeof voter_target.value === "number" &&
|
|
34
|
+
is_state_id(voter_target.state_id) &&
|
|
35
|
+
typeof voter_target.federal_congress_district_id === "string" &&
|
|
36
|
+
typeof voter_target.state_legislature_house_district_id === "string" &&
|
|
37
|
+
typeof voter_target.state_legislature_senate_district_id === "string"
|
|
24
38
|
)
|
|
25
39
|
}
|
|
26
40
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import { is_state_id, StateID } from "../State"
|
|
2
|
+
|
|
1
3
|
export class VoterTurnout {
|
|
2
4
|
readonly voter_turnout_id : string
|
|
3
5
|
readonly voter_id : string
|
|
4
6
|
readonly turnout_id : string
|
|
5
7
|
readonly year : number
|
|
6
|
-
readonly state_id : string
|
|
7
8
|
readonly turnout_type_id : string
|
|
8
9
|
readonly value : boolean
|
|
10
|
+
readonly state_id : StateID
|
|
11
|
+
readonly federal_congress_district_id : string
|
|
12
|
+
readonly state_legislature_house_district_id : string
|
|
13
|
+
readonly state_legislature_senate_district_id : string
|
|
9
14
|
|
|
10
15
|
constructor(voter_turnout : any) {
|
|
11
16
|
if (!VoterTurnout.is(voter_turnout)) {
|
|
@@ -15,9 +20,13 @@ export class VoterTurnout {
|
|
|
15
20
|
this.voter_id = voter_turnout.voter_id
|
|
16
21
|
this.turnout_id = voter_turnout.turnout_id
|
|
17
22
|
this.year = voter_turnout.year
|
|
18
|
-
this.state_id = voter_turnout.state_id
|
|
19
23
|
this.turnout_type_id = voter_turnout.turnout_type_id
|
|
20
24
|
this.value = voter_turnout.value
|
|
25
|
+
this.state_id = voter_turnout.state_id
|
|
26
|
+
this.state_id = voter_turnout.state_id
|
|
27
|
+
this.federal_congress_district_id = voter_turnout.federal_congress_district_id
|
|
28
|
+
this.state_legislature_house_district_id = voter_turnout.state_legislature_house_district_id
|
|
29
|
+
this.state_legislature_senate_district_id = voter_turnout.state_legislature_senate_district_id
|
|
21
30
|
}
|
|
22
31
|
|
|
23
32
|
static is(voter_turnout : any) : voter_turnout is VoterTurnout {
|
|
@@ -26,10 +35,13 @@ export class VoterTurnout {
|
|
|
26
35
|
typeof voter_turnout.voter_turnout_id === "string" &&
|
|
27
36
|
typeof voter_turnout.voter_id === "string" &&
|
|
28
37
|
typeof voter_turnout.turnout_id === "string" &&
|
|
29
|
-
typeof voter_turnout.year === "number"
|
|
30
|
-
typeof voter_turnout.state_id === "string" &&
|
|
38
|
+
typeof voter_turnout.year === "number"&&
|
|
31
39
|
typeof voter_turnout.turnout_type_id === "string" &&
|
|
32
|
-
typeof voter_turnout.value === "boolean"
|
|
40
|
+
typeof voter_turnout.value === "boolean" &&
|
|
41
|
+
is_state_id(voter_turnout.state_id) &&
|
|
42
|
+
typeof voter_turnout.federal_congress_district_id === "string" &&
|
|
43
|
+
typeof voter_turnout.state_legislature_house_district_id === "string" &&
|
|
44
|
+
typeof voter_turnout.state_legislature_senate_district_id === "string"
|
|
33
45
|
)
|
|
34
46
|
}
|
|
35
47
|
}
|