triangle-types 1.0.5 → 1.0.7
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 +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/types/User.d.ts +3 -0
- package/dist/src/types/User.js +10 -1
- package/dist/src/types/voters/VoterTurnout.d.ts +11 -0
- package/dist/src/types/voters/VoterTurnout.js +31 -0
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/types/User.ts +10 -1
- package/src/types/voters/VoterTurnout.ts +35 -0
package/dist/src/index.d.ts
CHANGED
|
@@ -59,3 +59,4 @@ export * from "./types/state_permits/WI/WIStatePermit.js";
|
|
|
59
59
|
export * from "./types/state_permits/WI/WIStatePermitDocument.js";
|
|
60
60
|
export * from "./types/voters/Voter.js";
|
|
61
61
|
export * from "./types/voters/VoterScore.js";
|
|
62
|
+
export * from "./types/voters/VoterTurnout.js";
|
package/dist/src/index.js
CHANGED
|
@@ -59,3 +59,4 @@ export * from "./types/state_permits/WI/WIStatePermit.js";
|
|
|
59
59
|
export * from "./types/state_permits/WI/WIStatePermitDocument.js";
|
|
60
60
|
export * from "./types/voters/Voter.js";
|
|
61
61
|
export * from "./types/voters/VoterScore.js";
|
|
62
|
+
export * from "./types/voters/VoterTurnout.js";
|
package/dist/src/types/User.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ export declare class User {
|
|
|
2
2
|
readonly user_id: string;
|
|
3
3
|
readonly email: string;
|
|
4
4
|
readonly is_admin_elections: boolean;
|
|
5
|
+
readonly is_admin_prism: boolean;
|
|
6
|
+
readonly is_admin_scout: boolean;
|
|
7
|
+
readonly is_admin_triage: boolean;
|
|
5
8
|
constructor(user: User);
|
|
6
9
|
static is(user: any): user is User;
|
|
7
10
|
}
|
package/dist/src/types/User.js
CHANGED
|
@@ -2,6 +2,9 @@ export class User {
|
|
|
2
2
|
user_id;
|
|
3
3
|
email;
|
|
4
4
|
is_admin_elections;
|
|
5
|
+
is_admin_prism;
|
|
6
|
+
is_admin_scout;
|
|
7
|
+
is_admin_triage;
|
|
5
8
|
// readonly [x : string] : any
|
|
6
9
|
constructor(user) {
|
|
7
10
|
if (!User.is(user)) {
|
|
@@ -10,11 +13,17 @@ export class User {
|
|
|
10
13
|
this.user_id = user.user_id;
|
|
11
14
|
this.email = user.email;
|
|
12
15
|
this.is_admin_elections = user.is_admin_elections;
|
|
16
|
+
this.is_admin_prism = user.is_admin_prism;
|
|
17
|
+
this.is_admin_scout = user.is_admin_scout;
|
|
18
|
+
this.is_admin_triage = user.is_admin_triage;
|
|
13
19
|
}
|
|
14
20
|
static is(user) {
|
|
15
21
|
return (user !== undefined &&
|
|
16
22
|
typeof user.user_id === "string" &&
|
|
17
23
|
typeof user.email === "string" &&
|
|
18
|
-
typeof user.is_admin_elections === "boolean"
|
|
24
|
+
typeof user.is_admin_elections === "boolean" &&
|
|
25
|
+
typeof user.is_admin_prism === "boolean" &&
|
|
26
|
+
typeof user.is_admin_scout === "boolean" &&
|
|
27
|
+
typeof user.is_admin_triage === "boolean");
|
|
19
28
|
}
|
|
20
29
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare 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
|
+
constructor(voter_turnout: any);
|
|
10
|
+
static is(voter_turnout: any): voter_turnout is VoterTurnout;
|
|
11
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export class VoterTurnout {
|
|
2
|
+
voter_turnout_id;
|
|
3
|
+
voter_id;
|
|
4
|
+
turnout_id;
|
|
5
|
+
year;
|
|
6
|
+
state_id;
|
|
7
|
+
turnout_type_id;
|
|
8
|
+
value;
|
|
9
|
+
constructor(voter_turnout) {
|
|
10
|
+
if (!VoterTurnout.is(voter_turnout)) {
|
|
11
|
+
throw Error("Invalid input.");
|
|
12
|
+
}
|
|
13
|
+
this.voter_turnout_id = voter_turnout.voter_turnout_id;
|
|
14
|
+
this.voter_id = voter_turnout.voter_id;
|
|
15
|
+
this.turnout_id = voter_turnout.turnout_id;
|
|
16
|
+
this.year = voter_turnout.year;
|
|
17
|
+
this.state_id = voter_turnout.state_id;
|
|
18
|
+
this.turnout_type_id = voter_turnout.turnout_type_id;
|
|
19
|
+
this.value = voter_turnout.value;
|
|
20
|
+
}
|
|
21
|
+
static is(voter_turnout) {
|
|
22
|
+
return (voter_turnout !== undefined &&
|
|
23
|
+
typeof voter_turnout.voter_turnout_id === "string" &&
|
|
24
|
+
typeof voter_turnout.voter_id === "string" &&
|
|
25
|
+
typeof voter_turnout.turnout_id === "string" &&
|
|
26
|
+
typeof voter_turnout.year === "number" &&
|
|
27
|
+
typeof voter_turnout.state_id === "string" &&
|
|
28
|
+
typeof voter_turnout.turnout_type_id === "string" &&
|
|
29
|
+
(voter_turnout.value === undefined || typeof voter_turnout.value === "boolean"));
|
|
30
|
+
}
|
|
31
|
+
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -72,4 +72,5 @@ export * from "./types/state_permits/WI/WIStatePermit"
|
|
|
72
72
|
export * from "./types/state_permits/WI/WIStatePermitDocument"
|
|
73
73
|
|
|
74
74
|
export * from "./types/voters/Voter"
|
|
75
|
-
export * from "./types/voters/VoterScore"
|
|
75
|
+
export * from "./types/voters/VoterScore"
|
|
76
|
+
export * from "./types/voters/VoterTurnout"
|
package/src/types/User.ts
CHANGED
|
@@ -2,6 +2,9 @@ export class User {
|
|
|
2
2
|
readonly user_id : string
|
|
3
3
|
readonly email : string
|
|
4
4
|
readonly is_admin_elections : boolean
|
|
5
|
+
readonly is_admin_prism : boolean
|
|
6
|
+
readonly is_admin_scout : boolean
|
|
7
|
+
readonly is_admin_triage : boolean
|
|
5
8
|
// readonly [x : string] : any
|
|
6
9
|
|
|
7
10
|
constructor(user : User) {
|
|
@@ -11,6 +14,9 @@ export class User {
|
|
|
11
14
|
this.user_id = user.user_id
|
|
12
15
|
this.email = user.email
|
|
13
16
|
this.is_admin_elections = user.is_admin_elections
|
|
17
|
+
this.is_admin_prism = user.is_admin_prism
|
|
18
|
+
this.is_admin_scout = user.is_admin_scout
|
|
19
|
+
this.is_admin_triage = user.is_admin_triage
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
static is(user : any) : user is User {
|
|
@@ -18,7 +24,10 @@ export class User {
|
|
|
18
24
|
user !== undefined &&
|
|
19
25
|
typeof user.user_id === "string" &&
|
|
20
26
|
typeof user.email === "string" &&
|
|
21
|
-
typeof user.is_admin_elections === "boolean"
|
|
27
|
+
typeof user.is_admin_elections === "boolean" &&
|
|
28
|
+
typeof user.is_admin_prism === "boolean" &&
|
|
29
|
+
typeof user.is_admin_scout === "boolean" &&
|
|
30
|
+
typeof user.is_admin_triage === "boolean"
|
|
22
31
|
)
|
|
23
32
|
}
|
|
24
33
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
(voter_turnout.value === undefined || typeof voter_turnout.value === "boolean")
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
}
|