triangle-types 1.0.43 → 1.0.45

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,9 +44,11 @@ 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";
51
+ export * from "./types/prism/VoterTurnout.js";
50
52
  export * from "./types/scout/Scout.js";
51
53
  export * from "./types/scout/ScoutDocument.js";
52
54
  export * from "./types/scout/ScoutSubScout.js";
package/dist/src/index.js CHANGED
@@ -44,9 +44,11 @@ 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";
51
+ export * from "./types/prism/VoterTurnout.js";
50
52
  export * from "./types/scout/Scout.js";
51
53
  export * from "./types/scout/ScoutDocument.js";
52
54
  export * from "./types/scout/ScoutSubScout.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
+ }
@@ -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
+ typeof voter_turnout.value === "boolean");
30
+ }
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -54,9 +54,11 @@ 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"
61
+ export * from "./types/prism/VoterTurnout"
60
62
 
61
63
  export * from "./types/scout/Scout"
62
64
  export * from "./types/scout/ScoutDocument"
@@ -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
+ }
@@ -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
+ typeof voter_turnout.value === "boolean"
33
+ )
34
+ }
35
+ }