triangle-types 1.0.85 → 1.0.87

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.
@@ -1,5 +1,6 @@
1
1
  import { StateID } from "../State.js";
2
2
  import { PrismTarget } from "./PrismTarget.js";
3
+ import { VoterPartyTypeID } from "./Voter.js";
3
4
  export declare class Prism {
4
5
  readonly prism_id: string;
5
6
  readonly state_id: StateID;
@@ -7,6 +8,7 @@ export declare class Prism {
7
8
  readonly federal_congress_district_id?: string;
8
9
  readonly state_legislature_house_district_id?: string;
9
10
  readonly state_legislature_senate_district_id?: string;
11
+ readonly party_type_id: VoterPartyTypeID;
10
12
  readonly [x: string]: any;
11
13
  constructor(prism: any);
12
14
  static is(prism: any): prism is Prism;
@@ -1,5 +1,6 @@
1
1
  import { is_state_id } from "../State.js";
2
2
  import { PrismTarget } from "./PrismTarget.js";
3
+ import { is_voter_party_type_id } from "./Voter.js";
3
4
  export class Prism {
4
5
  prism_id;
5
6
  state_id;
@@ -7,6 +8,7 @@ export class Prism {
7
8
  federal_congress_district_id;
8
9
  state_legislature_house_district_id;
9
10
  state_legislature_senate_district_id;
11
+ party_type_id;
10
12
  constructor(prism) {
11
13
  if (!Prism.is(prism)) {
12
14
  throw Error("Invalid input.");
@@ -17,6 +19,7 @@ export class Prism {
17
19
  this.federal_congress_district_id = prism.federal_congress_district_id;
18
20
  this.state_legislature_house_district_id = prism.state_legislature_house_district_id;
19
21
  this.state_legislature_senate_district_id = prism.state_legislature_senate_district_id;
22
+ this.party_type_id = prism.party_type_id;
20
23
  }
21
24
  static is(prism) {
22
25
  return (prism !== undefined &&
@@ -25,7 +28,8 @@ export class Prism {
25
28
  typeof prism.name === "string" &&
26
29
  (prism.federal_congress_district_id === undefined || typeof prism.federal_congress_district_id === "string") &&
27
30
  (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"));
31
+ (prism.state_legislature_senate_district_id === undefined || typeof prism.state_legislature_senate_district_id === "string") &&
32
+ is_voter_party_type_id(prism.party_type_id));
29
33
  }
30
34
  }
31
35
  export class PrismAux extends Prism {
@@ -12,7 +12,7 @@ export declare class Voter {
12
12
  readonly name_middle?: string;
13
13
  readonly name_last: string;
14
14
  readonly name_suffix?: string;
15
- readonly gender_id: string;
15
+ readonly gender_id?: string;
16
16
  readonly age: number;
17
17
  readonly birth_date?: string;
18
18
  readonly address_residence_1: string;
@@ -96,7 +96,7 @@ export class Voter {
96
96
  (voter.name_middle === undefined || typeof voter.name_middle === "string") &&
97
97
  typeof voter.name_last === "string" &&
98
98
  (voter.name_suffix === undefined || typeof voter.name_suffix === "string") &&
99
- typeof voter.gender_id === "string" &&
99
+ (voter.gender_id === undefined || typeof voter.gender_id === "string") &&
100
100
  typeof voter.age === "number" && !isNaN(voter.age) &&
101
101
  (voter.birth_date === undefined || typeof voter.birth_date === "string") &&
102
102
  typeof voter.address_residence_1 === "string" &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.85",
3
+ "version": "1.0.87",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
@@ -1,5 +1,6 @@
1
1
  import { is_state_id, StateID } from "../State"
2
2
  import { PrismTarget } from "./PrismTarget"
3
+ import { is_voter_party_type_id, VoterPartyTypeID } from "./Voter"
3
4
 
4
5
  export class Prism {
5
6
  readonly prism_id : string
@@ -8,6 +9,7 @@ export class Prism {
8
9
  readonly federal_congress_district_id? : string
9
10
  readonly state_legislature_house_district_id? : string
10
11
  readonly state_legislature_senate_district_id? : string
12
+ readonly party_type_id : VoterPartyTypeID
11
13
  readonly [x : string] : any
12
14
 
13
15
  constructor(prism : any) {
@@ -20,6 +22,7 @@ export class Prism {
20
22
  this.federal_congress_district_id = prism.federal_congress_district_id
21
23
  this.state_legislature_house_district_id = prism.state_legislature_house_district_id
22
24
  this.state_legislature_senate_district_id = prism.state_legislature_senate_district_id
25
+ this.party_type_id = prism.party_type_id
23
26
  }
24
27
 
25
28
  static is(prism : any) : prism is Prism {
@@ -30,7 +33,8 @@ export class Prism {
30
33
  typeof prism.name === "string" &&
31
34
  (prism.federal_congress_district_id === undefined || typeof prism.federal_congress_district_id === "string") &&
32
35
  (prism.state_legislature_house_district_id === undefined || typeof prism.state_legislature_house_district_id === "string") &&
33
- (prism.state_legislature_senate_district_id === undefined || typeof prism.state_legislature_senate_district_id === "string")
36
+ (prism.state_legislature_senate_district_id === undefined || typeof prism.state_legislature_senate_district_id === "string") &&
37
+ is_voter_party_type_id(prism.party_type_id)
34
38
  )
35
39
  }
36
40
  }
@@ -18,7 +18,7 @@ export class Voter {
18
18
  readonly name_middle? : string
19
19
  readonly name_last : string
20
20
  readonly name_suffix? : string
21
- readonly gender_id : string
21
+ readonly gender_id? : string
22
22
  readonly age : number
23
23
  readonly birth_date? : string
24
24
  readonly address_residence_1 : string
@@ -105,7 +105,7 @@ export class Voter {
105
105
  (voter.name_middle === undefined || typeof voter.name_middle === "string") &&
106
106
  typeof voter.name_last === "string" &&
107
107
  (voter.name_suffix === undefined || typeof voter.name_suffix === "string") &&
108
- typeof voter.gender_id === "string" &&
108
+ (voter.gender_id === undefined || typeof voter.gender_id === "string") &&
109
109
  typeof voter.age === "number" && !isNaN(voter.age) &&
110
110
  (voter.birth_date === undefined || typeof voter.birth_date === "string") &&
111
111
  typeof voter.address_residence_1 === "string" &&