triangle-types 1.0.81 → 1.0.82
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 +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/types/prism/PrismFeature.d.ts +7 -0
- package/dist/src/types/prism/PrismFeature.js +19 -0
- package/dist/src/types/prism/VoterFeature.d.ts +13 -0
- package/dist/src/types/prism/VoterFeature.js +35 -0
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/types/prism/PrismFeature.ts +23 -0
- package/src/types/prism/VoterFeature.ts +40 -0
package/dist/src/index.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ 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";
|
|
52
53
|
export * from "./types/prism/PrismMetric.js";
|
|
53
54
|
export * from "./types/prism/PrismSubPrism.js";
|
|
54
55
|
export * from "./types/prism/PrismSegment.js";
|
|
@@ -56,6 +57,7 @@ export * from "./types/prism/PrismTarget.js";
|
|
|
56
57
|
export * from "./types/prism/UserPrism.js";
|
|
57
58
|
export * from "./types/prism/UserPrismSegment.js";
|
|
58
59
|
export * from "./types/prism/Voter.js";
|
|
60
|
+
export * from "./types/prism/VoterFeature.js";
|
|
59
61
|
export * from "./types/prism/VoterTarget.js";
|
|
60
62
|
export * from "./types/prism/VoterTurnout.js";
|
|
61
63
|
export * from "./types/scout/Scout.js";
|
package/dist/src/index.js
CHANGED
|
@@ -49,6 +49,7 @@ 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";
|
|
52
53
|
export * from "./types/prism/PrismMetric.js";
|
|
53
54
|
export * from "./types/prism/PrismSubPrism.js";
|
|
54
55
|
export * from "./types/prism/PrismSegment.js";
|
|
@@ -56,6 +57,7 @@ export * from "./types/prism/PrismTarget.js";
|
|
|
56
57
|
export * from "./types/prism/UserPrism.js";
|
|
57
58
|
export * from "./types/prism/UserPrismSegment.js";
|
|
58
59
|
export * from "./types/prism/Voter.js";
|
|
60
|
+
export * from "./types/prism/VoterFeature.js";
|
|
59
61
|
export * from "./types/prism/VoterTarget.js";
|
|
60
62
|
export * from "./types/prism/VoterTurnout.js";
|
|
61
63
|
export * from "./types/scout/Scout.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class PrismFeature {
|
|
2
|
+
prism_feature_id;
|
|
3
|
+
prism_id;
|
|
4
|
+
feature_id;
|
|
5
|
+
constructor(prism_feature) {
|
|
6
|
+
if (!PrismFeature.is(prism_feature)) {
|
|
7
|
+
throw Error("Invalid input.");
|
|
8
|
+
}
|
|
9
|
+
this.prism_feature_id = prism_feature.prism_feature_id;
|
|
10
|
+
this.prism_id = prism_feature.prism_id;
|
|
11
|
+
this.feature_id = prism_feature.feature_id;
|
|
12
|
+
}
|
|
13
|
+
static is(prism_feature) {
|
|
14
|
+
return (prism_feature !== undefined &&
|
|
15
|
+
typeof prism_feature.prism_feature_id === "string" &&
|
|
16
|
+
typeof prism_feature.prism_id === "string" &&
|
|
17
|
+
typeof prism_feature.feature_id === "string");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StateID } from "../State.js";
|
|
2
|
+
export declare class VoterFeature {
|
|
3
|
+
readonly voter_feature_id: string;
|
|
4
|
+
readonly voter_id: string;
|
|
5
|
+
readonly feature_id: string;
|
|
6
|
+
readonly value: number;
|
|
7
|
+
readonly state_id: StateID;
|
|
8
|
+
readonly federal_congress_district_id: string;
|
|
9
|
+
readonly state_legislature_house_district_id: string;
|
|
10
|
+
readonly state_legislature_senate_district_id: string;
|
|
11
|
+
constructor(voter_feature: any);
|
|
12
|
+
static is(voter_feature: any): voter_feature is VoterFeature;
|
|
13
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { is_state_id } from "../State.js";
|
|
2
|
+
export class VoterFeature {
|
|
3
|
+
voter_feature_id;
|
|
4
|
+
voter_id;
|
|
5
|
+
feature_id;
|
|
6
|
+
value;
|
|
7
|
+
state_id;
|
|
8
|
+
federal_congress_district_id;
|
|
9
|
+
state_legislature_house_district_id;
|
|
10
|
+
state_legislature_senate_district_id;
|
|
11
|
+
constructor(voter_feature) {
|
|
12
|
+
if (!VoterFeature.is(voter_feature)) {
|
|
13
|
+
throw Error("Invalid input.");
|
|
14
|
+
}
|
|
15
|
+
this.voter_feature_id = voter_feature.voter_feature_id;
|
|
16
|
+
this.voter_id = voter_feature.voter_id;
|
|
17
|
+
this.feature_id = voter_feature.feature_id;
|
|
18
|
+
this.value = voter_feature.value;
|
|
19
|
+
this.state_id = voter_feature.state_id;
|
|
20
|
+
this.federal_congress_district_id = voter_feature.federal_congress_district_id;
|
|
21
|
+
this.state_legislature_house_district_id = voter_feature.state_legislature_house_district_id;
|
|
22
|
+
this.state_legislature_senate_district_id = voter_feature.state_legislature_senate_district_id;
|
|
23
|
+
}
|
|
24
|
+
static is(voter_feature) {
|
|
25
|
+
return (voter_feature !== undefined &&
|
|
26
|
+
typeof voter_feature.voter_feature_id === "string" &&
|
|
27
|
+
typeof voter_feature.voter_id === "string" &&
|
|
28
|
+
typeof voter_feature.feature_id === "string" &&
|
|
29
|
+
typeof voter_feature.value === "number" &&
|
|
30
|
+
is_state_id(voter_feature.state_id) &&
|
|
31
|
+
typeof voter_feature.federal_congress_district_id === "string" &&
|
|
32
|
+
typeof voter_feature.state_legislature_house_district_id === "string" &&
|
|
33
|
+
typeof voter_feature.state_legislature_senate_district_id === "string");
|
|
34
|
+
}
|
|
35
|
+
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -59,6 +59,7 @@ 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"
|
|
62
63
|
export * from "./types/prism/PrismMetric"
|
|
63
64
|
export * from "./types/prism/PrismSubPrism"
|
|
64
65
|
export * from "./types/prism/PrismSegment"
|
|
@@ -66,6 +67,7 @@ export * from "./types/prism/PrismTarget"
|
|
|
66
67
|
export * from "./types/prism/UserPrism"
|
|
67
68
|
export * from "./types/prism/UserPrismSegment"
|
|
68
69
|
export * from "./types/prism/Voter"
|
|
70
|
+
export * from "./types/prism/VoterFeature"
|
|
69
71
|
export * from "./types/prism/VoterTarget"
|
|
70
72
|
export * from "./types/prism/VoterTurnout"
|
|
71
73
|
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
}
|