triangle-types 1.0.44 → 1.0.46

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.
@@ -44,6 +44,7 @@ export * from "./types/fragments/FragmentVector.js";
44
44
  export * from "./types/legistar/LegistarAgency.js";
45
45
  export * from "./types/legistar/LegistarDocument.js";
46
46
  export * from "./types/prism/Prism.js";
47
+ export * from "./types/prism/PrismMetric.js";
47
48
  export * from "./types/prism/PrismVoter.js";
48
49
  export * from "./types/prism/UserPrism.js";
49
50
  export * from "./types/prism/Voter.js";
package/dist/src/index.js CHANGED
@@ -44,6 +44,7 @@ export * from "./types/fragments/FragmentVector.js";
44
44
  export * from "./types/legistar/LegistarAgency.js";
45
45
  export * from "./types/legistar/LegistarDocument.js";
46
46
  export * from "./types/prism/Prism.js";
47
+ export * from "./types/prism/PrismMetric.js";
47
48
  export * from "./types/prism/PrismVoter.js";
48
49
  export * from "./types/prism/UserPrism.js";
49
50
  export * from "./types/prism/Voter.js";
@@ -0,0 +1,9 @@
1
+ export declare class PrismMetric {
2
+ readonly prism_metric_id: string;
3
+ readonly prism_id: string;
4
+ readonly metric_id: string;
5
+ readonly state_id: string;
6
+ readonly value: number;
7
+ constructor(prism_metric: any);
8
+ static is(prism_metric: any): prism_metric is PrismMetric;
9
+ }
@@ -0,0 +1,25 @@
1
+ export class PrismMetric {
2
+ prism_metric_id;
3
+ prism_id;
4
+ metric_id;
5
+ state_id;
6
+ value;
7
+ constructor(prism_metric) {
8
+ if (!PrismMetric.is(prism_metric)) {
9
+ throw Error("Invalid input.");
10
+ }
11
+ this.prism_metric_id = prism_metric.prism_metric_id;
12
+ this.prism_id = prism_metric.prism_id;
13
+ this.metric_id = prism_metric.metric_id;
14
+ this.state_id = prism_metric.state_id;
15
+ this.value = prism_metric.value;
16
+ }
17
+ static is(prism_metric) {
18
+ return (prism_metric !== undefined &&
19
+ typeof prism_metric.prism_metric_id === "string" &&
20
+ typeof prism_metric.prism_id === "string" &&
21
+ typeof prism_metric.metric_id === "string" &&
22
+ typeof prism_metric.state_id === "string" &&
23
+ typeof prism_metric.value === "number");
24
+ }
25
+ }
@@ -21,6 +21,9 @@ export declare class Voter {
21
21
  readonly address_mail_city: string;
22
22
  readonly address_mail_state_id: string;
23
23
  readonly address_mail_zip: string;
24
+ readonly federal_house_district: number;
25
+ readonly state_house_district: number;
26
+ readonly state_senate_district: number;
24
27
  readonly occupation_group?: string;
25
28
  readonly occupation_description?: string;
26
29
  readonly phone_home?: string;
@@ -21,6 +21,9 @@ export class Voter {
21
21
  address_mail_city;
22
22
  address_mail_state_id;
23
23
  address_mail_zip;
24
+ federal_house_district;
25
+ state_house_district;
26
+ state_senate_district;
24
27
  occupation_group;
25
28
  occupation_description;
26
29
  phone_home;
@@ -59,6 +62,9 @@ export class Voter {
59
62
  this.address_mail_city = voter.address_mail_city;
60
63
  this.address_mail_state_id = voter.address_mail_state_id;
61
64
  this.address_mail_zip = voter.address_mail_zip;
65
+ this.federal_house_district = voter.federal_house_district;
66
+ this.state_house_district = voter.state_house_district;
67
+ this.state_senate_district = voter.state_senate_district;
62
68
  this.occupation_group = voter.occupation_group;
63
69
  this.occupation_description = voter.occupation_description;
64
70
  this.phone_home = voter.phone_home;
@@ -96,6 +102,9 @@ export class Voter {
96
102
  typeof voter.address_mail_city === "string" &&
97
103
  typeof voter.address_mail_state_id === "string" &&
98
104
  typeof voter.address_mail_zip === "string" &&
105
+ typeof voter.federal_house_district === "number" &&
106
+ typeof voter.state_house_district === "number" &&
107
+ typeof voter.state_senate_district === "number" &&
99
108
  (voter.occupation_group === undefined || typeof voter.occupation_group === "string") &&
100
109
  (voter.occupation_description === undefined || typeof voter.occupation_description === "string") &&
101
110
  (voter.phone_home === undefined || typeof voter.phone_home === "string") &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -54,6 +54,7 @@ export * from "./types/legistar/LegistarAgency"
54
54
  export * from "./types/legistar/LegistarDocument"
55
55
 
56
56
  export * from "./types/prism/Prism"
57
+ export * from "./types/prism/PrismMetric"
57
58
  export * from "./types/prism/PrismVoter"
58
59
  export * from "./types/prism/UserPrism"
59
60
  export * from "./types/prism/Voter"
@@ -0,0 +1,29 @@
1
+ export class PrismMetric {
2
+ readonly prism_metric_id : string
3
+ readonly prism_id : string
4
+ readonly metric_id : string
5
+ readonly state_id : string
6
+ readonly value : number
7
+
8
+ constructor(prism_metric : any) {
9
+ if (!PrismMetric.is(prism_metric)) {
10
+ throw Error("Invalid input.")
11
+ }
12
+ this.prism_metric_id = prism_metric.prism_metric_id
13
+ this.prism_id = prism_metric.prism_id
14
+ this.metric_id = prism_metric.metric_id
15
+ this.state_id = prism_metric.state_id
16
+ this.value = prism_metric.value
17
+ }
18
+
19
+ static is(prism_metric : any) : prism_metric is PrismMetric {
20
+ return (
21
+ prism_metric !== undefined &&
22
+ typeof prism_metric.prism_metric_id === "string" &&
23
+ typeof prism_metric.prism_id === "string" &&
24
+ typeof prism_metric.metric_id === "string" &&
25
+ typeof prism_metric.state_id === "string" &&
26
+ typeof prism_metric.value === "number"
27
+ )
28
+ }
29
+ }
@@ -21,6 +21,9 @@ export class Voter {
21
21
  readonly address_mail_city : string
22
22
  readonly address_mail_state_id : string
23
23
  readonly address_mail_zip : string
24
+ readonly federal_house_district : number
25
+ readonly state_house_district : number
26
+ readonly state_senate_district : number
24
27
  readonly occupation_group? : string
25
28
  readonly occupation_description? : string
26
29
  readonly phone_home? : string
@@ -61,6 +64,9 @@ export class Voter {
61
64
  this.address_mail_city = voter.address_mail_city
62
65
  this.address_mail_state_id = voter.address_mail_state_id
63
66
  this.address_mail_zip = voter.address_mail_zip
67
+ this.federal_house_district = voter.federal_house_district
68
+ this.state_house_district = voter.state_house_district
69
+ this.state_senate_district = voter.state_senate_district
64
70
  this.occupation_group = voter.occupation_group
65
71
  this.occupation_description = voter.occupation_description
66
72
  this.phone_home = voter.phone_home
@@ -100,6 +106,9 @@ export class Voter {
100
106
  typeof voter.address_mail_city === "string" &&
101
107
  typeof voter.address_mail_state_id === "string" &&
102
108
  typeof voter.address_mail_zip === "string" &&
109
+ typeof voter.federal_house_district === "number" &&
110
+ typeof voter.state_house_district === "number" &&
111
+ typeof voter.state_senate_district === "number" &&
103
112
  (voter.occupation_group === undefined || typeof voter.occupation_group === "string") &&
104
113
  (voter.occupation_description === undefined || typeof voter.occupation_description === "string") &&
105
114
  (voter.phone_home === undefined || typeof voter.phone_home === "string") &&