triangle-types 1.0.42 → 1.0.43
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 -4
- package/dist/src/index.js +4 -4
- package/dist/src/types/prism/Prism.d.ts +6 -0
- package/dist/src/types/prism/Prism.js +35 -0
- package/dist/src/types/prism/PrismVoter.d.ts +9 -0
- package/dist/src/types/prism/PrismVoter.js +25 -0
- package/dist/src/types/prism/UserPrism.d.ts +7 -0
- package/dist/src/types/prism/UserPrism.js +19 -0
- package/dist/src/types/prism/Voter.d.ts +39 -0
- package/dist/src/types/prism/Voter.js +131 -0
- package/package.json +1 -1
- package/src/index.ts +6 -6
- package/src/types/prism/Prism.ts +42 -0
- package/src/types/prism/PrismVoter.ts +29 -0
- package/src/types/prism/UserPrism.ts +23 -0
- package/src/types/{voters → prism}/Voter.ts +19 -22
- package/src/types/voters/UserStateScore.ts +0 -28
- package/src/types/voters/VoterScore.ts +0 -29
- package/src/types/voters/VoterTurnout.ts +0 -35
package/dist/src/index.d.ts
CHANGED
|
@@ -43,6 +43,10 @@ export * from "./types/fragments/Fragment.js";
|
|
|
43
43
|
export * from "./types/fragments/FragmentVector.js";
|
|
44
44
|
export * from "./types/legistar/LegistarAgency.js";
|
|
45
45
|
export * from "./types/legistar/LegistarDocument.js";
|
|
46
|
+
export * from "./types/prism/Prism.js";
|
|
47
|
+
export * from "./types/prism/PrismVoter.js";
|
|
48
|
+
export * from "./types/prism/UserPrism.js";
|
|
49
|
+
export * from "./types/prism/Voter.js";
|
|
46
50
|
export * from "./types/scout/Scout.js";
|
|
47
51
|
export * from "./types/scout/ScoutDocument.js";
|
|
48
52
|
export * from "./types/scout/ScoutSubScout.js";
|
|
@@ -69,7 +73,3 @@ export * from "./types/state_permits/TN/TNStatePermit.js";
|
|
|
69
73
|
export * from "./types/state_permits/TN/TNStatePermitDocument.js";
|
|
70
74
|
export * from "./types/state_permits/WI/WIStatePermit.js";
|
|
71
75
|
export * from "./types/state_permits/WI/WIStatePermitDocument.js";
|
|
72
|
-
export * from "./types/voters/Voter.js";
|
|
73
|
-
export * from "./types/voters/VoterScore.js";
|
|
74
|
-
export * from "./types/voters/VoterTurnout.js";
|
|
75
|
-
export * from "./types/voters/UserStateScore.js";
|
package/dist/src/index.js
CHANGED
|
@@ -43,6 +43,10 @@ export * from "./types/fragments/Fragment.js";
|
|
|
43
43
|
export * from "./types/fragments/FragmentVector.js";
|
|
44
44
|
export * from "./types/legistar/LegistarAgency.js";
|
|
45
45
|
export * from "./types/legistar/LegistarDocument.js";
|
|
46
|
+
export * from "./types/prism/Prism.js";
|
|
47
|
+
export * from "./types/prism/PrismVoter.js";
|
|
48
|
+
export * from "./types/prism/UserPrism.js";
|
|
49
|
+
export * from "./types/prism/Voter.js";
|
|
46
50
|
export * from "./types/scout/Scout.js";
|
|
47
51
|
export * from "./types/scout/ScoutDocument.js";
|
|
48
52
|
export * from "./types/scout/ScoutSubScout.js";
|
|
@@ -69,7 +73,3 @@ export * from "./types/state_permits/TN/TNStatePermit.js";
|
|
|
69
73
|
export * from "./types/state_permits/TN/TNStatePermitDocument.js";
|
|
70
74
|
export * from "./types/state_permits/WI/WIStatePermit.js";
|
|
71
75
|
export * from "./types/state_permits/WI/WIStatePermitDocument.js";
|
|
72
|
-
export * from "./types/voters/Voter.js";
|
|
73
|
-
export * from "./types/voters/VoterScore.js";
|
|
74
|
-
export * from "./types/voters/VoterTurnout.js";
|
|
75
|
-
export * from "./types/voters/UserStateScore.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export class Prism {
|
|
2
|
+
prism_id;
|
|
3
|
+
state_id;
|
|
4
|
+
constructor(prism) {
|
|
5
|
+
if (!Prism.is(prism)) {
|
|
6
|
+
throw Error("Invalid input.");
|
|
7
|
+
}
|
|
8
|
+
this.prism_id = prism.prism_id;
|
|
9
|
+
this.state_id = prism.state_id;
|
|
10
|
+
}
|
|
11
|
+
static is(prism) {
|
|
12
|
+
return (prism !== undefined &&
|
|
13
|
+
typeof prism.prism_id === "string" &&
|
|
14
|
+
typeof prism.state_id === "string");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
// export class PrismAux extends Prism {
|
|
18
|
+
// readonly scores : PrismScore[]
|
|
19
|
+
// readonly turnouts : PrismTurnout[]
|
|
20
|
+
// constructor(prism : any) {
|
|
21
|
+
// if (!PrismAux.is(prism)) {
|
|
22
|
+
// throw Error("Invalid input.")
|
|
23
|
+
// }
|
|
24
|
+
// super(prism)
|
|
25
|
+
// this.scores = prism.scores
|
|
26
|
+
// this.turnouts = prism.turnouts
|
|
27
|
+
// }
|
|
28
|
+
// static is(prism : any) : prism is Prism {
|
|
29
|
+
// return (
|
|
30
|
+
// Prism.is(prism) &&
|
|
31
|
+
// Array.isArray(prism.scores) && prism.scores.every(PrismScore.is) &&
|
|
32
|
+
// Array.isArray(prism.turnouts) && prism.turnouts.every(PrismTurnout.is)
|
|
33
|
+
// )
|
|
34
|
+
// }
|
|
35
|
+
// }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class PrismVoter {
|
|
2
|
+
readonly prism_voter_id: string;
|
|
3
|
+
readonly prism_id: string;
|
|
4
|
+
readonly voter_id: string;
|
|
5
|
+
readonly state_id: string;
|
|
6
|
+
readonly value: number;
|
|
7
|
+
constructor(prism_voter: any);
|
|
8
|
+
static is(prism_voter: any): prism_voter is PrismVoter;
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class PrismVoter {
|
|
2
|
+
prism_voter_id;
|
|
3
|
+
prism_id;
|
|
4
|
+
voter_id;
|
|
5
|
+
state_id;
|
|
6
|
+
value;
|
|
7
|
+
constructor(prism_voter) {
|
|
8
|
+
if (!PrismVoter.is(prism_voter)) {
|
|
9
|
+
throw Error("Invalid input.");
|
|
10
|
+
}
|
|
11
|
+
this.prism_voter_id = prism_voter.prism_voter_id;
|
|
12
|
+
this.prism_id = prism_voter.prism_id;
|
|
13
|
+
this.voter_id = prism_voter.voter_id;
|
|
14
|
+
this.state_id = prism_voter.state_id;
|
|
15
|
+
this.value = prism_voter.value;
|
|
16
|
+
}
|
|
17
|
+
static is(prism_voter) {
|
|
18
|
+
return (prism_voter !== undefined &&
|
|
19
|
+
typeof prism_voter.prism_voter_id === "string" &&
|
|
20
|
+
typeof prism_voter.prism_id === "string" &&
|
|
21
|
+
typeof prism_voter.voter_id === "string" &&
|
|
22
|
+
typeof prism_voter.state_id === "string" &&
|
|
23
|
+
typeof prism_voter.value === "number");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class UserPrism {
|
|
2
|
+
user_prism_id;
|
|
3
|
+
user_id;
|
|
4
|
+
prism_id;
|
|
5
|
+
constructor(user_prism) {
|
|
6
|
+
if (!UserPrism.is(user_prism)) {
|
|
7
|
+
throw Error("Invalid input.");
|
|
8
|
+
}
|
|
9
|
+
this.user_prism_id = user_prism.user_prism_id;
|
|
10
|
+
this.user_id = user_prism.user_id;
|
|
11
|
+
this.prism_id = user_prism.prism_id;
|
|
12
|
+
}
|
|
13
|
+
static is(user_prism) {
|
|
14
|
+
return (user_prism !== undefined &&
|
|
15
|
+
typeof user_prism.user_prism_id === "string" &&
|
|
16
|
+
typeof user_prism.user_id === "string" &&
|
|
17
|
+
typeof user_prism.prism_id === "string");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare class Voter {
|
|
2
|
+
readonly voter_id: string;
|
|
3
|
+
readonly state_id: string;
|
|
4
|
+
readonly state_voter_id: string;
|
|
5
|
+
readonly name_first: string;
|
|
6
|
+
readonly name_middle?: string;
|
|
7
|
+
readonly name_last: string;
|
|
8
|
+
readonly name_suffix?: string;
|
|
9
|
+
readonly gender_id: string;
|
|
10
|
+
readonly age: number;
|
|
11
|
+
readonly birth_date?: string;
|
|
12
|
+
readonly address_residence_1: string;
|
|
13
|
+
readonly address_residence_2?: string;
|
|
14
|
+
readonly address_residence_city: string;
|
|
15
|
+
readonly address_residence_state_id: string;
|
|
16
|
+
readonly address_residence_zip: string;
|
|
17
|
+
readonly address_residence_latitude: number;
|
|
18
|
+
readonly address_residence_longitude: number;
|
|
19
|
+
readonly address_mail_1: string;
|
|
20
|
+
readonly address_mail_2?: string;
|
|
21
|
+
readonly address_mail_city: string;
|
|
22
|
+
readonly address_mail_state_id: string;
|
|
23
|
+
readonly address_mail_zip: string;
|
|
24
|
+
readonly occupation_group?: string;
|
|
25
|
+
readonly occupation_description?: string;
|
|
26
|
+
readonly phone_home?: string;
|
|
27
|
+
readonly phone_mobile?: string;
|
|
28
|
+
readonly email?: string;
|
|
29
|
+
readonly ethnic_group?: string;
|
|
30
|
+
readonly ethnic_description?: string;
|
|
31
|
+
readonly religion_description?: string;
|
|
32
|
+
readonly party_description?: string;
|
|
33
|
+
readonly language?: string;
|
|
34
|
+
readonly education_level?: string;
|
|
35
|
+
readonly marital_status?: string;
|
|
36
|
+
readonly [x: string]: any;
|
|
37
|
+
constructor(voter: any);
|
|
38
|
+
static is(voter: any): voter is Voter;
|
|
39
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export class Voter {
|
|
2
|
+
voter_id;
|
|
3
|
+
state_id;
|
|
4
|
+
state_voter_id;
|
|
5
|
+
name_first;
|
|
6
|
+
name_middle;
|
|
7
|
+
name_last;
|
|
8
|
+
name_suffix;
|
|
9
|
+
gender_id;
|
|
10
|
+
age;
|
|
11
|
+
birth_date;
|
|
12
|
+
address_residence_1;
|
|
13
|
+
address_residence_2;
|
|
14
|
+
address_residence_city;
|
|
15
|
+
address_residence_state_id;
|
|
16
|
+
address_residence_zip;
|
|
17
|
+
address_residence_latitude;
|
|
18
|
+
address_residence_longitude;
|
|
19
|
+
address_mail_1;
|
|
20
|
+
address_mail_2;
|
|
21
|
+
address_mail_city;
|
|
22
|
+
address_mail_state_id;
|
|
23
|
+
address_mail_zip;
|
|
24
|
+
occupation_group;
|
|
25
|
+
occupation_description;
|
|
26
|
+
phone_home;
|
|
27
|
+
phone_mobile;
|
|
28
|
+
email;
|
|
29
|
+
ethnic_group;
|
|
30
|
+
ethnic_description;
|
|
31
|
+
religion_description;
|
|
32
|
+
party_description;
|
|
33
|
+
language;
|
|
34
|
+
education_level;
|
|
35
|
+
marital_status;
|
|
36
|
+
constructor(voter) {
|
|
37
|
+
if (!Voter.is(voter)) {
|
|
38
|
+
throw Error("Invalid input.");
|
|
39
|
+
}
|
|
40
|
+
this.voter_id = voter.voter_id;
|
|
41
|
+
this.state_id = voter.state_id;
|
|
42
|
+
this.state_voter_id = voter.state_voter_id;
|
|
43
|
+
this.name_first = voter.name_first;
|
|
44
|
+
this.name_middle = voter.name_middle;
|
|
45
|
+
this.name_last = voter.name_last;
|
|
46
|
+
this.name_suffix = voter.name_suffix;
|
|
47
|
+
this.gender_id = voter.gender_id;
|
|
48
|
+
this.age = voter.age;
|
|
49
|
+
this.birth_date = voter.birth_date;
|
|
50
|
+
this.address_residence_1 = voter.address_residence_1;
|
|
51
|
+
this.address_residence_2 = voter.address_residence_2;
|
|
52
|
+
this.address_residence_city = voter.address_residence_city;
|
|
53
|
+
this.address_residence_state_id = voter.address_residence_state_id;
|
|
54
|
+
this.address_residence_zip = voter.address_residence_zip;
|
|
55
|
+
this.address_residence_latitude = voter.address_residence_latitude;
|
|
56
|
+
this.address_residence_longitude = voter.address_residence_longitude;
|
|
57
|
+
this.address_mail_1 = voter.address_mail_1;
|
|
58
|
+
this.address_mail_2 = voter.address_mail_2;
|
|
59
|
+
this.address_mail_city = voter.address_mail_city;
|
|
60
|
+
this.address_mail_state_id = voter.address_mail_state_id;
|
|
61
|
+
this.address_mail_zip = voter.address_mail_zip;
|
|
62
|
+
this.occupation_group = voter.occupation_group;
|
|
63
|
+
this.occupation_description = voter.occupation_description;
|
|
64
|
+
this.phone_home = voter.phone_home;
|
|
65
|
+
this.phone_mobile = voter.phone_mobile;
|
|
66
|
+
this.email = voter.email;
|
|
67
|
+
this.ethnic_group = voter.ethnic_group;
|
|
68
|
+
this.ethnic_description = voter.ethnic_description;
|
|
69
|
+
this.religion_description = voter.religion_description;
|
|
70
|
+
this.party_description = voter.party_description;
|
|
71
|
+
this.language = voter.language;
|
|
72
|
+
this.education_level = voter.education_level;
|
|
73
|
+
this.marital_status = voter.marital_status;
|
|
74
|
+
}
|
|
75
|
+
static is(voter) {
|
|
76
|
+
return (voter !== undefined &&
|
|
77
|
+
typeof voter.voter_id === "string" &&
|
|
78
|
+
typeof voter.state_id === "string" &&
|
|
79
|
+
typeof voter.state_voter_id === "string" &&
|
|
80
|
+
typeof voter.name_first === "string" &&
|
|
81
|
+
(voter.name_middle === undefined || typeof voter.name_middle === "string") &&
|
|
82
|
+
typeof voter.name_last === "string" &&
|
|
83
|
+
(voter.name_suffix === undefined || typeof voter.name_suffix === "string") &&
|
|
84
|
+
typeof voter.gender_id === "string" &&
|
|
85
|
+
typeof voter.age === "number" && !isNaN(voter.age) &&
|
|
86
|
+
(voter.birth_date === undefined || typeof voter.birth_date === "string") &&
|
|
87
|
+
typeof voter.address_residence_1 === "string" &&
|
|
88
|
+
(voter.address_residence_2 === undefined || typeof voter.address_residence_2 === "string") &&
|
|
89
|
+
typeof voter.address_residence_city === "string" &&
|
|
90
|
+
typeof voter.address_residence_state_id === "string" &&
|
|
91
|
+
typeof voter.address_residence_zip === "string" &&
|
|
92
|
+
typeof voter.address_residence_latitude === "number" && !isNaN(voter.address_residence_latitude) &&
|
|
93
|
+
typeof voter.address_residence_longitude === "number" && !isNaN(voter.address_residence_longitude) &&
|
|
94
|
+
typeof voter.address_mail_1 === "string" &&
|
|
95
|
+
(voter.address_mail_2 === undefined || typeof voter.address_mail_2 === "string") &&
|
|
96
|
+
typeof voter.address_mail_city === "string" &&
|
|
97
|
+
typeof voter.address_mail_state_id === "string" &&
|
|
98
|
+
typeof voter.address_mail_zip === "string" &&
|
|
99
|
+
(voter.occupation_group === undefined || typeof voter.occupation_group === "string") &&
|
|
100
|
+
(voter.occupation_description === undefined || typeof voter.occupation_description === "string") &&
|
|
101
|
+
(voter.phone_home === undefined || typeof voter.phone_home === "string") &&
|
|
102
|
+
(voter.phone_mobile === undefined || typeof voter.phone_mobile === "string") &&
|
|
103
|
+
(voter.email === undefined || typeof voter.email === "string") &&
|
|
104
|
+
(voter.ethnic_group === undefined || typeof voter.ethnic_group === "string") &&
|
|
105
|
+
(voter.ethnic_description === undefined || typeof voter.ethnic_description === "string") &&
|
|
106
|
+
(voter.religion_description === undefined || typeof voter.religion_description === "string") &&
|
|
107
|
+
(voter.party_description === undefined || typeof voter.party_description === "string") &&
|
|
108
|
+
(voter.language === undefined || typeof voter.language === "string") &&
|
|
109
|
+
(voter.education_level === undefined || typeof voter.education_level === "string") &&
|
|
110
|
+
(voter.marital_status === undefined || typeof voter.marital_status === "string"));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// export class VoterAux extends Voter {
|
|
114
|
+
// readonly scores : VoterScore[]
|
|
115
|
+
// readonly turnouts : VoterTurnout[]
|
|
116
|
+
// constructor(voter : any) {
|
|
117
|
+
// if (!VoterAux.is(voter)) {
|
|
118
|
+
// throw Error("Invalid input.")
|
|
119
|
+
// }
|
|
120
|
+
// super(voter)
|
|
121
|
+
// this.scores = voter.scores
|
|
122
|
+
// this.turnouts = voter.turnouts
|
|
123
|
+
// }
|
|
124
|
+
// static is(voter : any) : voter is Voter {
|
|
125
|
+
// return (
|
|
126
|
+
// Voter.is(voter) &&
|
|
127
|
+
// Array.isArray(voter.scores) && voter.scores.every(VoterScore.is) &&
|
|
128
|
+
// Array.isArray(voter.turnouts) && voter.turnouts.every(VoterTurnout.is)
|
|
129
|
+
// )
|
|
130
|
+
// }
|
|
131
|
+
// }
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -53,6 +53,11 @@ export * from "./types/fragments/FragmentVector"
|
|
|
53
53
|
export * from "./types/legistar/LegistarAgency"
|
|
54
54
|
export * from "./types/legistar/LegistarDocument"
|
|
55
55
|
|
|
56
|
+
export * from "./types/prism/Prism"
|
|
57
|
+
export * from "./types/prism/PrismVoter"
|
|
58
|
+
export * from "./types/prism/UserPrism"
|
|
59
|
+
export * from "./types/prism/Voter"
|
|
60
|
+
|
|
56
61
|
export * from "./types/scout/Scout"
|
|
57
62
|
export * from "./types/scout/ScoutDocument"
|
|
58
63
|
export * from "./types/scout/ScoutSubScout"
|
|
@@ -84,9 +89,4 @@ export * from "./types/state_permits/TN/TNStatePermit"
|
|
|
84
89
|
export * from "./types/state_permits/TN/TNStatePermitDocument"
|
|
85
90
|
|
|
86
91
|
export * from "./types/state_permits/WI/WIStatePermit"
|
|
87
|
-
export * from "./types/state_permits/WI/WIStatePermitDocument"
|
|
88
|
-
|
|
89
|
-
export * from "./types/voters/Voter"
|
|
90
|
-
export * from "./types/voters/VoterScore"
|
|
91
|
-
export * from "./types/voters/VoterTurnout"
|
|
92
|
-
export * from "./types/voters/UserStateScore"
|
|
92
|
+
export * from "./types/state_permits/WI/WIStatePermitDocument"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export class Prism {
|
|
2
|
+
readonly prism_id : string
|
|
3
|
+
readonly state_id : string
|
|
4
|
+
|
|
5
|
+
constructor(prism : any) {
|
|
6
|
+
if (!Prism.is(prism)) {
|
|
7
|
+
throw Error("Invalid input.")
|
|
8
|
+
}
|
|
9
|
+
this.prism_id = prism.prism_id
|
|
10
|
+
this.state_id = prism.state_id
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static is(prism : any) : prism is Prism {
|
|
14
|
+
return (
|
|
15
|
+
prism !== undefined &&
|
|
16
|
+
typeof prism.prism_id === "string" &&
|
|
17
|
+
typeof prism.state_id === "string"
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// export class PrismAux extends Prism {
|
|
23
|
+
// readonly scores : PrismScore[]
|
|
24
|
+
// readonly turnouts : PrismTurnout[]
|
|
25
|
+
|
|
26
|
+
// constructor(prism : any) {
|
|
27
|
+
// if (!PrismAux.is(prism)) {
|
|
28
|
+
// throw Error("Invalid input.")
|
|
29
|
+
// }
|
|
30
|
+
// super(prism)
|
|
31
|
+
// this.scores = prism.scores
|
|
32
|
+
// this.turnouts = prism.turnouts
|
|
33
|
+
// }
|
|
34
|
+
|
|
35
|
+
// static is(prism : any) : prism is Prism {
|
|
36
|
+
// return (
|
|
37
|
+
// Prism.is(prism) &&
|
|
38
|
+
// Array.isArray(prism.scores) && prism.scores.every(PrismScore.is) &&
|
|
39
|
+
// Array.isArray(prism.turnouts) && prism.turnouts.every(PrismTurnout.is)
|
|
40
|
+
// )
|
|
41
|
+
// }
|
|
42
|
+
// }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export class PrismVoter {
|
|
2
|
+
readonly prism_voter_id : string
|
|
3
|
+
readonly prism_id : string
|
|
4
|
+
readonly voter_id : string
|
|
5
|
+
readonly state_id : string
|
|
6
|
+
readonly value : number
|
|
7
|
+
|
|
8
|
+
constructor(prism_voter : any) {
|
|
9
|
+
if (!PrismVoter.is(prism_voter)) {
|
|
10
|
+
throw Error("Invalid input.")
|
|
11
|
+
}
|
|
12
|
+
this.prism_voter_id = prism_voter.prism_voter_id
|
|
13
|
+
this.prism_id = prism_voter.prism_id
|
|
14
|
+
this.voter_id = prism_voter.voter_id
|
|
15
|
+
this.state_id = prism_voter.state_id
|
|
16
|
+
this.value = prism_voter.value
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static is(prism_voter : any) : prism_voter is PrismVoter {
|
|
20
|
+
return (
|
|
21
|
+
prism_voter !== undefined &&
|
|
22
|
+
typeof prism_voter.prism_voter_id === "string" &&
|
|
23
|
+
typeof prism_voter.prism_id === "string" &&
|
|
24
|
+
typeof prism_voter.voter_id === "string" &&
|
|
25
|
+
typeof prism_voter.state_id === "string" &&
|
|
26
|
+
typeof prism_voter.value === "number"
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export class UserPrism {
|
|
2
|
+
readonly user_prism_id : string
|
|
3
|
+
readonly user_id : string
|
|
4
|
+
readonly prism_id : string
|
|
5
|
+
|
|
6
|
+
constructor(user_prism : any) {
|
|
7
|
+
if (!UserPrism.is(user_prism)) {
|
|
8
|
+
throw Error("Invalid input.")
|
|
9
|
+
}
|
|
10
|
+
this.user_prism_id = user_prism.user_prism_id
|
|
11
|
+
this.user_id = user_prism.user_id
|
|
12
|
+
this.prism_id = user_prism.prism_id
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static is(user_prism : any) : user_prism is UserPrism {
|
|
16
|
+
return (
|
|
17
|
+
user_prism !== undefined &&
|
|
18
|
+
typeof user_prism.user_prism_id === "string" &&
|
|
19
|
+
typeof user_prism.user_id === "string" &&
|
|
20
|
+
typeof user_prism.prism_id === "string"
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { VoterScore } from "./VoterScore"
|
|
2
|
-
import { VoterTurnout } from "./VoterTurnout"
|
|
3
|
-
|
|
4
1
|
export class Voter {
|
|
5
2
|
readonly voter_id : string
|
|
6
3
|
readonly state_id : string
|
|
@@ -119,24 +116,24 @@ export class Voter {
|
|
|
119
116
|
}
|
|
120
117
|
}
|
|
121
118
|
|
|
122
|
-
export class VoterAux extends Voter {
|
|
123
|
-
|
|
124
|
-
|
|
119
|
+
// export class VoterAux extends Voter {
|
|
120
|
+
// readonly scores : VoterScore[]
|
|
121
|
+
// readonly turnouts : VoterTurnout[]
|
|
125
122
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
123
|
+
// constructor(voter : any) {
|
|
124
|
+
// if (!VoterAux.is(voter)) {
|
|
125
|
+
// throw Error("Invalid input.")
|
|
126
|
+
// }
|
|
127
|
+
// super(voter)
|
|
128
|
+
// this.scores = voter.scores
|
|
129
|
+
// this.turnouts = voter.turnouts
|
|
130
|
+
// }
|
|
134
131
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
132
|
+
// static is(voter : any) : voter is Voter {
|
|
133
|
+
// return (
|
|
134
|
+
// Voter.is(voter) &&
|
|
135
|
+
// Array.isArray(voter.scores) && voter.scores.every(VoterScore.is) &&
|
|
136
|
+
// Array.isArray(voter.turnouts) && voter.turnouts.every(VoterTurnout.is)
|
|
137
|
+
// )
|
|
138
|
+
// }
|
|
139
|
+
// }
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { StateID } from "../State"
|
|
2
|
-
|
|
3
|
-
export class UserStateScore {
|
|
4
|
-
readonly user_state_score_id : string
|
|
5
|
-
readonly user_id : string
|
|
6
|
-
readonly state_id : StateID
|
|
7
|
-
readonly score_id : string
|
|
8
|
-
|
|
9
|
-
constructor(user_state_score : any) {
|
|
10
|
-
if (!UserStateScore.is(user_state_score)) {
|
|
11
|
-
throw Error("Invalid input.")
|
|
12
|
-
}
|
|
13
|
-
this.user_state_score_id = user_state_score.user_state_score_id
|
|
14
|
-
this.user_id = user_state_score.user_id
|
|
15
|
-
this.state_id = user_state_score.state_id
|
|
16
|
-
this.score_id = user_state_score.score_id
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static is(user_state_score : any) : user_state_score is UserStateScore {
|
|
20
|
-
return (
|
|
21
|
-
user_state_score !== undefined &&
|
|
22
|
-
typeof user_state_score.user_state_score_id === "string" &&
|
|
23
|
-
typeof user_state_score.user_id === "string" &&
|
|
24
|
-
typeof user_state_score.state_id === "string" &&
|
|
25
|
-
typeof user_state_score.score_id === "string"
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export class VoterScore {
|
|
2
|
-
readonly voter_score_id : string
|
|
3
|
-
readonly voter_id : string
|
|
4
|
-
readonly score_id : string
|
|
5
|
-
readonly state_id : string
|
|
6
|
-
readonly value : number
|
|
7
|
-
|
|
8
|
-
constructor(voter_score : any) {
|
|
9
|
-
if (!VoterScore.is(voter_score)) {
|
|
10
|
-
throw Error("Invalid input.")
|
|
11
|
-
}
|
|
12
|
-
this.voter_score_id = voter_score.voter_score_id
|
|
13
|
-
this.voter_id = voter_score.voter_id
|
|
14
|
-
this.score_id = voter_score.score_id
|
|
15
|
-
this.state_id = voter_score.state_id
|
|
16
|
-
this.value = voter_score.value
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static is(voter_score : any) : voter_score is VoterScore {
|
|
20
|
-
return (
|
|
21
|
-
voter_score !== undefined &&
|
|
22
|
-
typeof voter_score.voter_score_id === "string" &&
|
|
23
|
-
typeof voter_score.voter_id === "string" &&
|
|
24
|
-
typeof voter_score.score_id === "string" &&
|
|
25
|
-
typeof voter_score.state_id === "string" &&
|
|
26
|
-
typeof voter_score.value === "number"
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export class VoterTurnout {
|
|
2
|
-
readonly voter_turnout_id : string
|
|
3
|
-
readonly voter_id : string
|
|
4
|
-
readonly turnout_id : string
|
|
5
|
-
readonly year : number
|
|
6
|
-
readonly state_id : string
|
|
7
|
-
readonly turnout_type_id : string
|
|
8
|
-
readonly value : boolean
|
|
9
|
-
|
|
10
|
-
constructor(voter_turnout : any) {
|
|
11
|
-
if (!VoterTurnout.is(voter_turnout)) {
|
|
12
|
-
throw Error("Invalid input.")
|
|
13
|
-
}
|
|
14
|
-
this.voter_turnout_id = voter_turnout.voter_turnout_id
|
|
15
|
-
this.voter_id = voter_turnout.voter_id
|
|
16
|
-
this.turnout_id = voter_turnout.turnout_id
|
|
17
|
-
this.year = voter_turnout.year
|
|
18
|
-
this.state_id = voter_turnout.state_id
|
|
19
|
-
this.turnout_type_id = voter_turnout.turnout_type_id
|
|
20
|
-
this.value = voter_turnout.value
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static is(voter_turnout : any) : voter_turnout is VoterTurnout {
|
|
24
|
-
return (
|
|
25
|
-
voter_turnout !== undefined &&
|
|
26
|
-
typeof voter_turnout.voter_turnout_id === "string" &&
|
|
27
|
-
typeof voter_turnout.voter_id === "string" &&
|
|
28
|
-
typeof voter_turnout.turnout_id === "string" &&
|
|
29
|
-
typeof voter_turnout.year === "number" &&
|
|
30
|
-
typeof voter_turnout.state_id === "string" &&
|
|
31
|
-
typeof voter_turnout.turnout_type_id === "string" &&
|
|
32
|
-
typeof voter_turnout.value === "boolean"
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
}
|