triangle-types 1.0.80 → 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/dist/src/types/scout/ScoutDocument.d.ts +2 -0
- package/dist/src/types/scout/ScoutDocument.js +4 -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/src/types/scout/ScoutDocument.ts +5 -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
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { FragmentTypeID } from "../fragments/Fragment.js";
|
|
1
2
|
export declare class ScoutDocument {
|
|
2
3
|
readonly scout_document_id: string;
|
|
3
4
|
readonly scout_id: string;
|
|
4
5
|
readonly document_id: string;
|
|
5
6
|
readonly content_type_id: string;
|
|
6
7
|
readonly name: string;
|
|
8
|
+
readonly fragment_type_id?: FragmentTypeID;
|
|
7
9
|
readonly raw_s3_id: string;
|
|
8
10
|
readonly s3_id: string;
|
|
9
11
|
readonly s3_id_txt?: string;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { is_fragment_type_id } from "../fragments/Fragment.js";
|
|
1
2
|
export class ScoutDocument {
|
|
2
3
|
scout_document_id;
|
|
3
4
|
scout_id;
|
|
4
5
|
document_id;
|
|
5
6
|
content_type_id;
|
|
6
7
|
name;
|
|
8
|
+
fragment_type_id;
|
|
7
9
|
raw_s3_id;
|
|
8
10
|
s3_id;
|
|
9
11
|
s3_id_txt;
|
|
@@ -16,6 +18,7 @@ export class ScoutDocument {
|
|
|
16
18
|
this.document_id = scout_document.document_id;
|
|
17
19
|
this.content_type_id = scout_document.content_type_id;
|
|
18
20
|
this.name = scout_document.name;
|
|
21
|
+
this.fragment_type_id = scout_document.fragment_type_id;
|
|
19
22
|
this.raw_s3_id = scout_document.raw_s3_id;
|
|
20
23
|
this.s3_id = scout_document.s3_id;
|
|
21
24
|
this.s3_id_txt = scout_document.s3_id_txt;
|
|
@@ -27,6 +30,7 @@ export class ScoutDocument {
|
|
|
27
30
|
typeof scout_document.document_id === "string" &&
|
|
28
31
|
typeof scout_document.content_type_id === "string" &&
|
|
29
32
|
typeof scout_document.name === "string" &&
|
|
33
|
+
(scout_document.fragment_type_id === undefined || is_fragment_type_id(scout_document.fragment_type_id)) &&
|
|
30
34
|
typeof scout_document.raw_s3_id === "string" &&
|
|
31
35
|
typeof scout_document.s3_id === "string" &&
|
|
32
36
|
(scout_document.s3_id_txt === undefined || typeof scout_document.s3_id_txt === "string"));
|
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
|
+
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { FragmentTypeID, is_fragment_type_id } from "../fragments/Fragment"
|
|
2
|
+
|
|
1
3
|
export class ScoutDocument {
|
|
2
4
|
readonly scout_document_id : string
|
|
3
5
|
readonly scout_id : string
|
|
4
6
|
readonly document_id : string
|
|
5
7
|
readonly content_type_id : string
|
|
6
8
|
readonly name : string
|
|
9
|
+
readonly fragment_type_id? : FragmentTypeID
|
|
7
10
|
readonly raw_s3_id : string
|
|
8
11
|
readonly s3_id : string
|
|
9
12
|
readonly s3_id_txt? : string
|
|
@@ -18,6 +21,7 @@ export class ScoutDocument {
|
|
|
18
21
|
this.document_id = scout_document.document_id
|
|
19
22
|
this.content_type_id = scout_document.content_type_id
|
|
20
23
|
this.name = scout_document.name
|
|
24
|
+
this.fragment_type_id = scout_document.fragment_type_id
|
|
21
25
|
this.raw_s3_id = scout_document.raw_s3_id
|
|
22
26
|
this.s3_id = scout_document.s3_id
|
|
23
27
|
this.s3_id_txt = scout_document.s3_id_txt
|
|
@@ -31,6 +35,7 @@ export class ScoutDocument {
|
|
|
31
35
|
typeof scout_document.document_id === "string" &&
|
|
32
36
|
typeof scout_document.content_type_id === "string" &&
|
|
33
37
|
typeof scout_document.name === "string" &&
|
|
38
|
+
(scout_document.fragment_type_id === undefined || is_fragment_type_id(scout_document.fragment_type_id)) &&
|
|
34
39
|
typeof scout_document.raw_s3_id === "string" &&
|
|
35
40
|
typeof scout_document.s3_id === "string" &&
|
|
36
41
|
(scout_document.s3_id_txt === undefined || typeof scout_document.s3_id_txt === "string")
|