triangle-types 1.0.94 → 1.0.95

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.
@@ -49,7 +49,6 @@ export * from "./types/fragments/FragmentVector.js";
49
49
  export * from "./types/legistar/LegistarAgency.js";
50
50
  export * from "./types/legistar/LegistarDocument.js";
51
51
  export * from "./types/prism/Prism.js";
52
- export * from "./types/prism/PrismFeature.js";
53
52
  export * from "./types/prism/PrismMetric.js";
54
53
  export * from "./types/prism/PrismSubPrism.js";
55
54
  export * from "./types/prism/PrismSegment.js";
@@ -57,7 +56,6 @@ export * from "./types/prism/PrismTarget.js";
57
56
  export * from "./types/prism/UserPrism.js";
58
57
  export * from "./types/prism/UserPrismSegment.js";
59
58
  export * from "./types/prism/Voter.js";
60
- export * from "./types/prism/VoterFeature.js";
61
59
  export * from "./types/prism/VoterTarget.js";
62
60
  export * from "./types/prism/VoterTurnout.js";
63
61
  export * from "./types/scout/Scout.js";
package/dist/src/index.js CHANGED
@@ -49,7 +49,6 @@ export * from "./types/fragments/FragmentVector.js";
49
49
  export * from "./types/legistar/LegistarAgency.js";
50
50
  export * from "./types/legistar/LegistarDocument.js";
51
51
  export * from "./types/prism/Prism.js";
52
- export * from "./types/prism/PrismFeature.js";
53
52
  export * from "./types/prism/PrismMetric.js";
54
53
  export * from "./types/prism/PrismSubPrism.js";
55
54
  export * from "./types/prism/PrismSegment.js";
@@ -57,7 +56,6 @@ export * from "./types/prism/PrismTarget.js";
57
56
  export * from "./types/prism/UserPrism.js";
58
57
  export * from "./types/prism/UserPrismSegment.js";
59
58
  export * from "./types/prism/Voter.js";
60
- export * from "./types/prism/VoterFeature.js";
61
59
  export * from "./types/prism/VoterTarget.js";
62
60
  export * from "./types/prism/VoterTurnout.js";
63
61
  export * from "./types/scout/Scout.js";
@@ -27,9 +27,9 @@ export declare class Voter {
27
27
  readonly address_mail_city?: string;
28
28
  readonly address_mail_state_id: string;
29
29
  readonly address_mail_zip?: string;
30
- readonly federal_congress_district_id: string;
31
- readonly state_legislature_house_district_id: string;
32
- readonly state_legislature_senate_district_id: string;
30
+ readonly federal_congress_district_id?: string;
31
+ readonly state_legislature_house_district_id?: string;
32
+ readonly state_legislature_senate_district_id?: string;
33
33
  readonly party_description?: string;
34
34
  readonly party_type_id: VoterPartyTypeID;
35
35
  readonly occupation_group?: string;
@@ -111,9 +111,9 @@ export class Voter {
111
111
  (voter.address_mail_city === undefined || typeof voter.address_mail_city === "string") &&
112
112
  typeof voter.address_mail_state_id === "string" &&
113
113
  (voter.address_mail_zip === undefined || typeof voter.address_mail_zip === "string") &&
114
- typeof voter.federal_congress_district_id === "string" &&
115
- typeof voter.state_legislature_house_district_id === "string" &&
116
- typeof voter.state_legislature_senate_district_id === "string" &&
114
+ (voter.federal_congress_district_id === undefined || typeof voter.federal_congress_district_id === "string") &&
115
+ (voter.state_legislature_house_district_id === undefined || typeof voter.state_legislature_house_district_id === "string") &&
116
+ (voter.state_legislature_senate_district_id === undefined || typeof voter.state_legislature_senate_district_id === "string") &&
117
117
  (voter.party_description === undefined || typeof voter.party_description === "string") &&
118
118
  is_voter_party_type_id(voter.party_type_id) &&
119
119
  (voter.occupation_group === undefined || typeof voter.occupation_group === "string") &&
@@ -6,9 +6,9 @@ export declare class VoterTarget {
6
6
  readonly target_id: string;
7
7
  readonly value: number;
8
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;
9
+ readonly federal_congress_district_id?: string;
10
+ readonly state_legislature_house_district_id?: string;
11
+ readonly state_legislature_senate_district_id?: string;
12
12
  readonly party_type_id: VoterPartyTypeID;
13
13
  constructor(voter_target: any);
14
14
  static is(voter_target: any): voter_target is VoterTarget;
@@ -31,9 +31,9 @@ export class VoterTarget {
31
31
  typeof voter_target.target_id === "string" &&
32
32
  typeof voter_target.value === "number" &&
33
33
  is_state_id(voter_target.state_id) &&
34
- typeof voter_target.federal_congress_district_id === "string" &&
35
- typeof voter_target.state_legislature_house_district_id === "string" &&
36
- typeof voter_target.state_legislature_senate_district_id === "string" &&
34
+ (voter_target.federal_congress_district_id === undefined || typeof voter_target.federal_congress_district_id === "string") &&
35
+ (voter_target.state_legislature_house_district_id === undefined || typeof voter_target.state_legislature_house_district_id === "string") &&
36
+ (voter_target.state_legislature_senate_district_id === undefined || typeof voter_target.state_legislature_senate_district_id === "string") &&
37
37
  is_voter_party_type_id(voter_target.party_type_id));
38
38
  }
39
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.94",
3
+ "version": "1.0.95",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -59,7 +59,6 @@ export * from "./types/legistar/LegistarAgency"
59
59
  export * from "./types/legistar/LegistarDocument"
60
60
 
61
61
  export * from "./types/prism/Prism"
62
- export * from "./types/prism/PrismFeature"
63
62
  export * from "./types/prism/PrismMetric"
64
63
  export * from "./types/prism/PrismSubPrism"
65
64
  export * from "./types/prism/PrismSegment"
@@ -67,7 +66,6 @@ export * from "./types/prism/PrismTarget"
67
66
  export * from "./types/prism/UserPrism"
68
67
  export * from "./types/prism/UserPrismSegment"
69
68
  export * from "./types/prism/Voter"
70
- export * from "./types/prism/VoterFeature"
71
69
  export * from "./types/prism/VoterTarget"
72
70
  export * from "./types/prism/VoterTurnout"
73
71
 
@@ -33,9 +33,9 @@ export class Voter {
33
33
  readonly address_mail_city? : string
34
34
  readonly address_mail_state_id : string
35
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
36
+ readonly federal_congress_district_id? : string
37
+ readonly state_legislature_house_district_id? : string
38
+ readonly state_legislature_senate_district_id? : string
39
39
  readonly party_description? : string
40
40
  readonly party_type_id : VoterPartyTypeID
41
41
  readonly occupation_group? : string
@@ -120,9 +120,9 @@ export class Voter {
120
120
  (voter.address_mail_city === undefined || typeof voter.address_mail_city === "string") &&
121
121
  typeof voter.address_mail_state_id === "string" &&
122
122
  (voter.address_mail_zip === undefined || typeof voter.address_mail_zip === "string") &&
123
- typeof voter.federal_congress_district_id === "string" &&
124
- typeof voter.state_legislature_house_district_id === "string" &&
125
- typeof voter.state_legislature_senate_district_id === "string" &&
123
+ (voter.federal_congress_district_id === undefined || typeof voter.federal_congress_district_id === "string") &&
124
+ (voter.state_legislature_house_district_id === undefined || typeof voter.state_legislature_house_district_id === "string") &&
125
+ (voter.state_legislature_senate_district_id === undefined || typeof voter.state_legislature_senate_district_id === "string") &&
126
126
  (voter.party_description === undefined || typeof voter.party_description === "string") &&
127
127
  is_voter_party_type_id(voter.party_type_id) &&
128
128
  (voter.occupation_group === undefined || typeof voter.occupation_group === "string") &&
@@ -7,9 +7,9 @@ export class VoterTarget {
7
7
  readonly target_id : string
8
8
  readonly value : number
9
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
10
+ readonly federal_congress_district_id? : string
11
+ readonly state_legislature_house_district_id? : string
12
+ readonly state_legislature_senate_district_id? : string
13
13
  readonly party_type_id : VoterPartyTypeID
14
14
 
15
15
  constructor(voter_target : any) {
@@ -35,9 +35,9 @@ export class VoterTarget {
35
35
  typeof voter_target.target_id === "string" &&
36
36
  typeof voter_target.value === "number" &&
37
37
  is_state_id(voter_target.state_id) &&
38
- typeof voter_target.federal_congress_district_id === "string" &&
39
- typeof voter_target.state_legislature_house_district_id === "string" &&
40
- typeof voter_target.state_legislature_senate_district_id === "string" &&
38
+ (voter_target.federal_congress_district_id === undefined || typeof voter_target.federal_congress_district_id === "string") &&
39
+ (voter_target.state_legislature_house_district_id === undefined || typeof voter_target.state_legislature_house_district_id === "string") &&
40
+ (voter_target.state_legislature_senate_district_id === undefined || typeof voter_target.state_legislature_senate_district_id === "string") &&
41
41
  is_voter_party_type_id(voter_target.party_type_id)
42
42
  )
43
43
  }
@@ -1,23 +0,0 @@
1
- export class PrismFeature {
2
- readonly prism_feature_id : string
3
- readonly prism_id : string
4
- readonly feature_id : string
5
-
6
- constructor(prism_feature : any) {
7
- if (!PrismFeature.is(prism_feature)) {
8
- throw Error("Invalid input.")
9
- }
10
- this.prism_feature_id = prism_feature.prism_feature_id
11
- this.prism_id = prism_feature.prism_id
12
- this.feature_id = prism_feature.feature_id
13
- }
14
-
15
- static is(prism_feature : any) : prism_feature is PrismFeature {
16
- return (
17
- prism_feature !== undefined &&
18
- typeof prism_feature.prism_feature_id === "string" &&
19
- typeof prism_feature.prism_id === "string" &&
20
- typeof prism_feature.feature_id === "string"
21
- )
22
- }
23
- }
@@ -1,40 +0,0 @@
1
- import { is_state_id, StateID } from "../State"
2
-
3
- export class VoterFeature {
4
- readonly voter_feature_id : string
5
- readonly voter_id : string
6
- readonly feature_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
12
-
13
- constructor(voter_feature : any) {
14
- if (!VoterFeature.is(voter_feature)) {
15
- throw Error("Invalid input.")
16
- }
17
- this.voter_feature_id = voter_feature.voter_feature_id
18
- this.voter_id = voter_feature.voter_id
19
- this.feature_id = voter_feature.feature_id
20
- this.value = voter_feature.value
21
- this.state_id = voter_feature.state_id
22
- this.federal_congress_district_id = voter_feature.federal_congress_district_id
23
- this.state_legislature_house_district_id = voter_feature.state_legislature_house_district_id
24
- this.state_legislature_senate_district_id = voter_feature.state_legislature_senate_district_id
25
- }
26
-
27
- static is(voter_feature : any) : voter_feature is VoterFeature {
28
- return (
29
- voter_feature !== undefined &&
30
- typeof voter_feature.voter_feature_id === "string" &&
31
- typeof voter_feature.voter_id === "string" &&
32
- typeof voter_feature.feature_id === "string" &&
33
- typeof voter_feature.value === "number" &&
34
- is_state_id(voter_feature.state_id) &&
35
- typeof voter_feature.federal_congress_district_id === "string" &&
36
- typeof voter_feature.state_legislature_house_district_id === "string" &&
37
- typeof voter_feature.state_legislature_senate_district_id === "string"
38
- )
39
- }
40
- }