triangle-types 1.0.347 → 1.0.348
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 +4 -11
- package/dist/src/index.js +4 -11
- package/dist/src/types/federal_elections/FederalElectionCandidate.d.ts +2 -2
- package/dist/src/types/federal_elections/FederalElectionCandidate.js +2 -2
- package/dist/src/types/federal_elections/FederalElectionCommittee.d.ts +2 -2
- package/dist/src/types/federal_elections/FederalElectionCommittee.js +2 -2
- package/dist/src/types/federal_elections/FederalElectionF1FileBody.d.ts +14 -0
- package/dist/src/types/federal_elections/FederalElectionF1FileBody.js +39 -0
- package/dist/src/types/federal_elections/FederalElectionF24FileBody.d.ts +11 -0
- package/dist/src/types/federal_elections/FederalElectionF24FileBody.js +29 -0
- package/dist/src/types/federal_elections/FederalElectionF2FileBody.d.ts +19 -0
- package/dist/src/types/federal_elections/FederalElectionF2FileBody.js +51 -0
- package/dist/src/types/federal_elections/FederalElectionF3FileBody.d.ts +12 -0
- package/dist/src/types/federal_elections/FederalElectionF3FileBody.js +34 -0
- package/dist/src/types/federal_elections/FederalElectionFile.d.ts +4 -0
- package/dist/src/types/federal_elections/FederalElectionFile.js +13 -1
- package/dist/src/types/federal_elections/FederalElectionFileExpenditure.d.ts +2 -2
- package/dist/src/types/federal_elections/FederalElectionFileExpenditure.js +2 -2
- package/dist/src/types/lal/LALFileVoter.d.ts +3 -1
- package/dist/src/types/lal/LALFileVoter.js +4 -1
- package/dist/src/types/prism/Prism.d.ts +1 -1
- package/dist/src/types/prism/Prism.js +1 -1
- package/dist/src/types/prism/StateVoter.d.ts +1 -1
- package/dist/src/types/prism/StateVoter.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -11
- package/src/types/federal_elections/FederalElectionCandidate.ts +3 -3
- package/src/types/federal_elections/FederalElectionCommittee.ts +3 -3
- package/src/types/federal_elections/FederalElectionF1FileBody.ts +45 -0
- package/src/types/federal_elections/FederalElectionF24FileBody.ts +34 -0
- package/src/types/federal_elections/FederalElectionF2FileBody.ts +57 -0
- package/src/types/federal_elections/FederalElectionF3FileBody.ts +39 -0
- package/src/types/federal_elections/FederalElectionFile.ts +13 -1
- package/src/types/federal_elections/FederalElectionFileExpenditure.ts +3 -3
- package/src/types/lal/LALFileVoter.ts +8 -1
- package/src/types/prism/Prism.ts +1 -1
- package/src/types/prism/StateVoter.ts +1 -2
- package/src/types/prism/StateVoterTarget.ts +0 -1
- package/src/types/federal_elections/FederalElectionF1File.ts +0 -49
- package/src/types/federal_elections/FederalElectionF24File.ts +0 -37
- package/src/types/federal_elections/FederalElectionF2File.ts +0 -62
- package/src/types/federal_elections/FederalElectionF3File.ts +0 -42
- package/src/types/prism/PrismFeature.ts +0 -26
- package/src/types/prism/PrismSegment.ts +0 -79
- package/src/types/prism/StateVoterFeature.ts +0 -29
- package/src/types/prism/TenantVoterTag.ts +0 -36
- package/src/types/prism/UserPrismSegment.ts +0 -61
- package/src/types/prism/Voter.ts +0 -170
- package/src/types/prism/VoterFeature.ts +0 -50
- package/src/types/prism/VoterTarget.ts +0 -50
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { is_state_id, StateID } from "../jurisdictions/State"
|
|
2
|
-
|
|
3
|
-
export class TenantVoterTag {
|
|
4
|
-
readonly tenant_voter_tag_id : string
|
|
5
|
-
readonly tenant_id : string
|
|
6
|
-
readonly voter_id : string
|
|
7
|
-
readonly tag_id : string
|
|
8
|
-
readonly target_id? : string
|
|
9
|
-
readonly user_id : string
|
|
10
|
-
readonly time : string
|
|
11
|
-
|
|
12
|
-
constructor(tenant_voter_tag : any) {
|
|
13
|
-
if (!TenantVoterTag.is(tenant_voter_tag)) {
|
|
14
|
-
throw Error("Invalid input.")
|
|
15
|
-
}
|
|
16
|
-
this.tenant_voter_tag_id = tenant_voter_tag.tenant_voter_tag_id
|
|
17
|
-
this.tenant_id = tenant_voter_tag.tenant_id
|
|
18
|
-
this.voter_id = tenant_voter_tag.voter_id
|
|
19
|
-
this.tag_id = tenant_voter_tag.tag_id
|
|
20
|
-
this.user_id = tenant_voter_tag.user_id
|
|
21
|
-
this.time = tenant_voter_tag.time
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
static is(tenant_voter_tag : any) : tenant_voter_tag is TenantVoterTag {
|
|
25
|
-
return (
|
|
26
|
-
tenant_voter_tag !== undefined &&
|
|
27
|
-
typeof tenant_voter_tag.tenant_voter_tag_id === "string" &&
|
|
28
|
-
typeof tenant_voter_tag.tenant_id === "string" &&
|
|
29
|
-
typeof tenant_voter_tag.voter_id === "string" &&
|
|
30
|
-
typeof tenant_voter_tag.tag_id === "string" &&
|
|
31
|
-
(tenant_voter_tag.target_id === undefined || typeof tenant_voter_tag === "string") &&
|
|
32
|
-
typeof tenant_voter_tag.user_id === "string" &&
|
|
33
|
-
typeof tenant_voter_tag.time === "string"
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export class UserPrismSegmentFilter {
|
|
2
|
-
readonly target_id : string
|
|
3
|
-
readonly min : number
|
|
4
|
-
readonly max : number
|
|
5
|
-
|
|
6
|
-
constructor(filter : any) {
|
|
7
|
-
if (!UserPrismSegmentFilter.is(filter)) {
|
|
8
|
-
throw Error("Invalid input.")
|
|
9
|
-
}
|
|
10
|
-
this.target_id = filter.target_id
|
|
11
|
-
this.min = filter.min
|
|
12
|
-
this.max = filter.max
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
static is(filter : any) : filter is UserPrismSegmentFilter {
|
|
16
|
-
return (
|
|
17
|
-
filter !== undefined &&
|
|
18
|
-
typeof filter.target_id === "string" &&
|
|
19
|
-
typeof filter.min === "number" &&
|
|
20
|
-
typeof filter.max === "number"
|
|
21
|
-
)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export class UserPrismSegment {
|
|
27
|
-
readonly user_prism_segment_id : string
|
|
28
|
-
readonly user_id : string
|
|
29
|
-
readonly prism_id : string
|
|
30
|
-
readonly segment_id : string
|
|
31
|
-
readonly name : string
|
|
32
|
-
readonly prism_segment_ids : string[]
|
|
33
|
-
readonly filters : UserPrismSegmentFilter[]
|
|
34
|
-
readonly [x : string] : any
|
|
35
|
-
|
|
36
|
-
constructor(user_prism_segment : any) {
|
|
37
|
-
if (!UserPrismSegment.is(user_prism_segment)) {
|
|
38
|
-
throw Error("Invalid input.")
|
|
39
|
-
}
|
|
40
|
-
this.user_prism_segment_id = user_prism_segment.user_prism_segment_id
|
|
41
|
-
this.user_id = user_prism_segment.user_id
|
|
42
|
-
this.prism_id = user_prism_segment.prism_id
|
|
43
|
-
this.segment_id = user_prism_segment.segment_id
|
|
44
|
-
this.name = user_prism_segment.name
|
|
45
|
-
this.prism_segment_ids = user_prism_segment.prism_segment_ids
|
|
46
|
-
this.filters = user_prism_segment.filters
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
static is(user_prism_segment : any) : user_prism_segment is UserPrismSegment {
|
|
50
|
-
return (
|
|
51
|
-
user_prism_segment !== undefined &&
|
|
52
|
-
typeof user_prism_segment.user_prism_segment_id === "string" &&
|
|
53
|
-
typeof user_prism_segment.user_id === "string" &&
|
|
54
|
-
typeof user_prism_segment.prism_id === "string" &&
|
|
55
|
-
typeof user_prism_segment.segment_id === "string" &&
|
|
56
|
-
typeof user_prism_segment.name === "string" &&
|
|
57
|
-
Array.isArray(user_prism_segment.prism_segment_ids) && user_prism_segment.prism_segment_ids.every((prism_segment_id : any) => typeof prism_segment_id === "string") &&
|
|
58
|
-
Array.isArray(user_prism_segment.filters) && user_prism_segment.filters.every(UserPrismSegmentFilter.is)
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
}
|
package/src/types/prism/Voter.ts
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { is_state_id, StateID } from "../jurisdictions/State"
|
|
2
|
-
import { VoterFeature } from "./VoterFeature"
|
|
3
|
-
import { VoterTarget } from "./VoterTarget"
|
|
4
|
-
|
|
5
|
-
export const voter_party_type_ids = ["D", "R", "I"] as const
|
|
6
|
-
|
|
7
|
-
export type VoterPartyTypeID = typeof voter_party_type_ids[number]
|
|
8
|
-
|
|
9
|
-
export function is_voter_party_type_id(voter_party_type_id : any) : voter_party_type_id is VoterPartyTypeID {
|
|
10
|
-
return voter_party_type_ids.includes(voter_party_type_id)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class Voter {
|
|
14
|
-
readonly voter_id : string
|
|
15
|
-
readonly state_id : StateID
|
|
16
|
-
readonly state_voter_id : string
|
|
17
|
-
readonly name_first : string
|
|
18
|
-
readonly name_middle? : string
|
|
19
|
-
readonly name_last : string
|
|
20
|
-
readonly name_suffix? : string
|
|
21
|
-
readonly gender_id? : string
|
|
22
|
-
readonly age : number
|
|
23
|
-
readonly birth_date? : string
|
|
24
|
-
readonly address_residence_1 : string
|
|
25
|
-
readonly address_residence_2? : string
|
|
26
|
-
readonly address_residence_city? : string
|
|
27
|
-
readonly address_residence_state_id : string
|
|
28
|
-
readonly address_residence_zip? : string
|
|
29
|
-
readonly address_residence_latitude : number
|
|
30
|
-
readonly address_residence_longitude : number
|
|
31
|
-
readonly address_mail_1 : string
|
|
32
|
-
readonly address_mail_2? : string
|
|
33
|
-
readonly address_mail_city? : string
|
|
34
|
-
readonly address_mail_state_id : string
|
|
35
|
-
readonly address_mail_zip? : string
|
|
36
|
-
readonly federal_congress_district_id? : string
|
|
37
|
-
readonly state_legislature_house_district_id? : string
|
|
38
|
-
readonly state_legislature_senate_district_id? : string
|
|
39
|
-
readonly county_id? : string
|
|
40
|
-
readonly school_district_id? : string
|
|
41
|
-
readonly party_description? : string
|
|
42
|
-
readonly party_type_id : VoterPartyTypeID
|
|
43
|
-
readonly occupation_group? : string
|
|
44
|
-
readonly occupation_description? : string
|
|
45
|
-
readonly phone_home? : string
|
|
46
|
-
readonly phone_mobile? : string
|
|
47
|
-
readonly email? : string
|
|
48
|
-
readonly ethnic_group? : string
|
|
49
|
-
readonly ethnic_description? : string
|
|
50
|
-
readonly religion_description? : string
|
|
51
|
-
readonly language? : string
|
|
52
|
-
readonly education_level? : string
|
|
53
|
-
readonly marital_status? : string
|
|
54
|
-
readonly [x : string] : any
|
|
55
|
-
|
|
56
|
-
constructor(voter : any) {
|
|
57
|
-
if (!Voter.is(voter)) {
|
|
58
|
-
throw Error("Invalid input.")
|
|
59
|
-
}
|
|
60
|
-
this.voter_id = voter.voter_id
|
|
61
|
-
this.state_id = voter.state_id
|
|
62
|
-
this.state_voter_id = voter.state_voter_id
|
|
63
|
-
this.name_first = voter.name_first
|
|
64
|
-
this.name_middle = voter.name_middle
|
|
65
|
-
this.name_last = voter.name_last
|
|
66
|
-
this.name_suffix = voter.name_suffix
|
|
67
|
-
this.gender_id = voter.gender_id
|
|
68
|
-
this.age = voter.age
|
|
69
|
-
this.birth_date = voter.birth_date
|
|
70
|
-
this.address_residence_1 = voter.address_residence_1
|
|
71
|
-
this.address_residence_2 = voter.address_residence_2
|
|
72
|
-
this.address_residence_city = voter.address_residence_city
|
|
73
|
-
this.address_residence_state_id = voter.address_residence_state_id
|
|
74
|
-
this.address_residence_zip = voter.address_residence_zip
|
|
75
|
-
this.address_residence_latitude = voter.address_residence_latitude
|
|
76
|
-
this.address_residence_longitude = voter.address_residence_longitude
|
|
77
|
-
this.address_mail_1 = voter.address_mail_1
|
|
78
|
-
this.address_mail_2 = voter.address_mail_2
|
|
79
|
-
this.address_mail_city = voter.address_mail_city
|
|
80
|
-
this.address_mail_state_id = voter.address_mail_state_id
|
|
81
|
-
this.address_mail_zip = voter.address_mail_zip
|
|
82
|
-
this.federal_congress_district_id = voter.federal_congress_district_id
|
|
83
|
-
this.state_legislature_house_district_id = voter.state_legislature_house_district_id
|
|
84
|
-
this.state_legislature_senate_district_id = voter.state_legislature_senate_district_id
|
|
85
|
-
this.county_id = voter.county_id
|
|
86
|
-
this.school_district_id = voter.school_district_id
|
|
87
|
-
this.party_description = voter.party_description
|
|
88
|
-
this.party_type_id = voter.party_type_id
|
|
89
|
-
this.occupation_group = voter.occupation_group
|
|
90
|
-
this.occupation_description = voter.occupation_description
|
|
91
|
-
this.phone_home = voter.phone_home
|
|
92
|
-
this.phone_mobile = voter.phone_mobile
|
|
93
|
-
this.email = voter.email
|
|
94
|
-
this.ethnic_group = voter.ethnic_group
|
|
95
|
-
this.ethnic_description = voter.ethnic_description
|
|
96
|
-
this.religion_description = voter.religion_description
|
|
97
|
-
this.language = voter.language
|
|
98
|
-
this.education_level = voter.education_level
|
|
99
|
-
this.marital_status = voter.marital_status
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
static is(voter : any) : voter is Voter {
|
|
103
|
-
return (
|
|
104
|
-
voter !== undefined &&
|
|
105
|
-
typeof voter.voter_id === "string" &&
|
|
106
|
-
is_state_id(voter.state_id) &&
|
|
107
|
-
typeof voter.state_voter_id === "string" &&
|
|
108
|
-
typeof voter.name_first === "string" &&
|
|
109
|
-
(voter.name_middle === undefined || typeof voter.name_middle === "string") &&
|
|
110
|
-
typeof voter.name_last === "string" &&
|
|
111
|
-
(voter.name_suffix === undefined || typeof voter.name_suffix === "string") &&
|
|
112
|
-
(voter.gender_id === undefined || typeof voter.gender_id === "string") &&
|
|
113
|
-
typeof voter.age === "number" && !isNaN(voter.age) &&
|
|
114
|
-
(voter.birth_date === undefined || typeof voter.birth_date === "string") &&
|
|
115
|
-
typeof voter.address_residence_1 === "string" &&
|
|
116
|
-
(voter.address_residence_2 === undefined || typeof voter.address_residence_2 === "string") &&
|
|
117
|
-
(voter.address_residence_city === undefined || typeof voter.address_residence_city === "string") &&
|
|
118
|
-
typeof voter.address_residence_state_id === "string" &&
|
|
119
|
-
(voter.address_residence_zip === undefined || typeof voter.address_residence_zip === "string") &&
|
|
120
|
-
typeof voter.address_residence_latitude === "number" && !isNaN(voter.address_residence_latitude) &&
|
|
121
|
-
typeof voter.address_residence_longitude === "number" && !isNaN(voter.address_residence_longitude) &&
|
|
122
|
-
typeof voter.address_mail_1 === "string" &&
|
|
123
|
-
(voter.address_mail_2 === undefined || typeof voter.address_mail_2 === "string") &&
|
|
124
|
-
(voter.address_mail_city === undefined || typeof voter.address_mail_city === "string") &&
|
|
125
|
-
typeof voter.address_mail_state_id === "string" &&
|
|
126
|
-
(voter.address_mail_zip === undefined || typeof voter.address_mail_zip === "string") &&
|
|
127
|
-
(voter.federal_congress_district_id === undefined || typeof voter.federal_congress_district_id === "string") &&
|
|
128
|
-
(voter.state_legislature_house_district_id === undefined || typeof voter.state_legislature_house_district_id === "string") &&
|
|
129
|
-
(voter.state_legislature_senate_district_id === undefined || typeof voter.state_legislature_senate_district_id === "string") &&
|
|
130
|
-
(voter.county_id === undefined || typeof voter.county_id === "string") &&
|
|
131
|
-
(voter.school_district_id === undefined || typeof voter.school_district_id === "string") &&
|
|
132
|
-
(voter.party_description === undefined || typeof voter.party_description === "string") &&
|
|
133
|
-
is_voter_party_type_id(voter.party_type_id) &&
|
|
134
|
-
(voter.occupation_group === undefined || typeof voter.occupation_group === "string") &&
|
|
135
|
-
(voter.occupation_description === undefined || typeof voter.occupation_description === "string") &&
|
|
136
|
-
(voter.phone_home === undefined || typeof voter.phone_home === "string") &&
|
|
137
|
-
(voter.phone_mobile === undefined || typeof voter.phone_mobile === "string") &&
|
|
138
|
-
(voter.email === undefined || typeof voter.email === "string") &&
|
|
139
|
-
(voter.ethnic_group === undefined || typeof voter.ethnic_group === "string") &&
|
|
140
|
-
(voter.ethnic_description === undefined || typeof voter.ethnic_description === "string") &&
|
|
141
|
-
(voter.religion_description === undefined || typeof voter.religion_description === "string") &&
|
|
142
|
-
(voter.language === undefined || typeof voter.language === "string") &&
|
|
143
|
-
(voter.education_level === undefined || typeof voter.education_level === "string") &&
|
|
144
|
-
(voter.marital_status === undefined || typeof voter.marital_status === "string")
|
|
145
|
-
)
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export class VoterAux extends Voter {
|
|
150
|
-
readonly features : VoterFeature[]
|
|
151
|
-
readonly targets : VoterTarget[]
|
|
152
|
-
// readonly turnouts : VoterTurnout[]
|
|
153
|
-
|
|
154
|
-
constructor(voter : any) {
|
|
155
|
-
if (!VoterAux.is(voter)) {
|
|
156
|
-
throw Error("Invalid input.")
|
|
157
|
-
}
|
|
158
|
-
super(voter)
|
|
159
|
-
this.features = voter.features
|
|
160
|
-
this.targets = voter.targets
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
static is(voter : any) : voter is Voter {
|
|
164
|
-
return (
|
|
165
|
-
Voter.is(voter) &&
|
|
166
|
-
Array.isArray(voter.features) && voter.features.every(VoterFeature.is) &&
|
|
167
|
-
Array.isArray(voter.targets) && voter.targets.every(VoterTarget.is)
|
|
168
|
-
)
|
|
169
|
-
}
|
|
170
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { is_state_id, StateID } from "../jurisdictions/State"
|
|
2
|
-
import { is_voter_party_type_id, VoterPartyTypeID } from "./Voter"
|
|
3
|
-
|
|
4
|
-
export class VoterFeature {
|
|
5
|
-
readonly voter_feature_id : string
|
|
6
|
-
readonly voter_id : string
|
|
7
|
-
readonly feature_id : string
|
|
8
|
-
readonly value : string
|
|
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
|
|
13
|
-
readonly county_id? : string
|
|
14
|
-
readonly school_district_id? : string
|
|
15
|
-
readonly party_type_id : VoterPartyTypeID
|
|
16
|
-
|
|
17
|
-
constructor(voter_feature : any) {
|
|
18
|
-
if (!VoterFeature.is(voter_feature)) {
|
|
19
|
-
throw Error("Invalid input.")
|
|
20
|
-
}
|
|
21
|
-
this.voter_feature_id = voter_feature.voter_feature_id
|
|
22
|
-
this.voter_id = voter_feature.voter_id
|
|
23
|
-
this.feature_id = voter_feature.feature_id
|
|
24
|
-
this.value = voter_feature.value
|
|
25
|
-
this.state_id = voter_feature.state_id
|
|
26
|
-
this.federal_congress_district_id = voter_feature.federal_congress_district_id
|
|
27
|
-
this.state_legislature_house_district_id = voter_feature.state_legislature_house_district_id
|
|
28
|
-
this.state_legislature_senate_district_id = voter_feature.state_legislature_senate_district_id
|
|
29
|
-
this.county_id = voter_feature.county_id
|
|
30
|
-
this.school_district_id = voter_feature.school_district_id
|
|
31
|
-
this.party_type_id = voter_feature.party_type_id
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
static is(voter_feature : any) : voter_feature is VoterFeature {
|
|
35
|
-
return (
|
|
36
|
-
voter_feature !== undefined &&
|
|
37
|
-
typeof voter_feature.voter_feature_id === "string" &&
|
|
38
|
-
typeof voter_feature.voter_id === "string" &&
|
|
39
|
-
typeof voter_feature.feature_id === "string" &&
|
|
40
|
-
typeof voter_feature.value === "string" &&
|
|
41
|
-
is_state_id(voter_feature.state_id) &&
|
|
42
|
-
(voter_feature.federal_congress_district_id === undefined || typeof voter_feature.federal_congress_district_id === "string") &&
|
|
43
|
-
(voter_feature.state_legislature_house_district_id === undefined || typeof voter_feature.state_legislature_house_district_id === "string") &&
|
|
44
|
-
(voter_feature.state_legislature_senate_district_id === undefined || typeof voter_feature.state_legislature_senate_district_id === "string") &&
|
|
45
|
-
(voter_feature.county_id === undefined || typeof voter_feature.county_id === "string") &&
|
|
46
|
-
(voter_feature.school_district_id === undefined || typeof voter_feature.school_district_id === "string") &&
|
|
47
|
-
is_voter_party_type_id(voter_feature.party_type_id)
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { is_state_id, StateID } from "../jurisdictions/State"
|
|
2
|
-
import { is_voter_party_type_id, VoterPartyTypeID } from "./Voter"
|
|
3
|
-
|
|
4
|
-
export class VoterTarget {
|
|
5
|
-
readonly voter_target_id : string
|
|
6
|
-
readonly voter_id : string
|
|
7
|
-
readonly target_id : string
|
|
8
|
-
readonly value : number
|
|
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
|
|
13
|
-
readonly county_id? : string
|
|
14
|
-
readonly school_district_id? : string
|
|
15
|
-
readonly party_type_id : VoterPartyTypeID
|
|
16
|
-
|
|
17
|
-
constructor(voter_target : any) {
|
|
18
|
-
if (!VoterTarget.is(voter_target)) {
|
|
19
|
-
throw Error("Invalid input.")
|
|
20
|
-
}
|
|
21
|
-
this.voter_target_id = voter_target.voter_target_id
|
|
22
|
-
this.voter_id = voter_target.voter_id
|
|
23
|
-
this.target_id = voter_target.target_id
|
|
24
|
-
this.value = voter_target.value
|
|
25
|
-
this.state_id = voter_target.state_id
|
|
26
|
-
this.federal_congress_district_id = voter_target.federal_congress_district_id
|
|
27
|
-
this.state_legislature_house_district_id = voter_target.state_legislature_house_district_id
|
|
28
|
-
this.state_legislature_senate_district_id = voter_target.state_legislature_senate_district_id
|
|
29
|
-
this.county_id = voter_target.county_id
|
|
30
|
-
this.school_district_id = voter_target.school_district_id
|
|
31
|
-
this.party_type_id = voter_target.party_type_id
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
static is(voter_target : any) : voter_target is VoterTarget {
|
|
35
|
-
return (
|
|
36
|
-
voter_target !== undefined &&
|
|
37
|
-
typeof voter_target.voter_target_id === "string" &&
|
|
38
|
-
typeof voter_target.voter_id === "string" &&
|
|
39
|
-
typeof voter_target.target_id === "string" &&
|
|
40
|
-
typeof voter_target.value === "number" &&
|
|
41
|
-
is_state_id(voter_target.state_id) &&
|
|
42
|
-
(voter_target.federal_congress_district_id === undefined || typeof voter_target.federal_congress_district_id === "string") &&
|
|
43
|
-
(voter_target.state_legislature_house_district_id === undefined || typeof voter_target.state_legislature_house_district_id === "string") &&
|
|
44
|
-
(voter_target.state_legislature_senate_district_id === undefined || typeof voter_target.state_legislature_senate_district_id === "string") &&
|
|
45
|
-
(voter_target.county_id === undefined || typeof voter_target.county_id === "string") &&
|
|
46
|
-
(voter_target.school_district_id === undefined || typeof voter_target.school_district_id === "string") &&
|
|
47
|
-
is_voter_party_type_id(voter_target.party_type_id)
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
}
|