triangle-types 1.0.282 → 1.0.283
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 +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/types/jurisdictions/Jurisdiction.d.ts +44 -0
- package/dist/src/types/jurisdictions/Jurisdiction.js +107 -0
- package/dist/src/types/jurisdictions/JurisdictionMetric.d.ts +1 -1
- package/dist/src/types/jurisdictions/JurisdictionMetric.js +1 -1
- package/dist/src/types/prism/Prism.d.ts +1 -1
- package/dist/src/types/prism/Prism.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/types/jurisdictions/Jurisdiction.ts +148 -0
- package/src/types/jurisdictions/JurisdictionMetric.ts +1 -1
- package/src/types/prism/Prism.ts +1 -1
- package/src/types/jurisdictions/JurisdictionTypeID.ts +0 -7
package/dist/src/index.d.ts
CHANGED
|
@@ -56,8 +56,8 @@ export * from "./types/federal_dockets/FederalDocketCommentAttachment.js";
|
|
|
56
56
|
export * from "./types/federal_rules/FederalRuleTitle.js";
|
|
57
57
|
export * from "./types/federal_rules/FederalRuleSection.js";
|
|
58
58
|
export * from "./types/jurisdictions/County.js";
|
|
59
|
+
export * from "./types/jurisdictions/Jurisdiction.js";
|
|
59
60
|
export * from "./types/jurisdictions/JurisdictionMetric.js";
|
|
60
|
-
export * from "./types/jurisdictions/JurisdictionTypeID.js";
|
|
61
61
|
export * from "./types/jurisdictions/Municipality.js";
|
|
62
62
|
export * from "./types/jurisdictions/SchoolDistrict.js";
|
|
63
63
|
export * from "./types/jurisdictions/State.js";
|
package/dist/src/index.js
CHANGED
|
@@ -56,8 +56,8 @@ export * from "./types/federal_dockets/FederalDocketCommentAttachment.js";
|
|
|
56
56
|
export * from "./types/federal_rules/FederalRuleTitle.js";
|
|
57
57
|
export * from "./types/federal_rules/FederalRuleSection.js";
|
|
58
58
|
export * from "./types/jurisdictions/County.js";
|
|
59
|
+
export * from "./types/jurisdictions/Jurisdiction.js";
|
|
59
60
|
export * from "./types/jurisdictions/JurisdictionMetric.js";
|
|
60
|
-
export * from "./types/jurisdictions/JurisdictionTypeID.js";
|
|
61
61
|
export * from "./types/jurisdictions/Municipality.js";
|
|
62
62
|
export * from "./types/jurisdictions/SchoolDistrict.js";
|
|
63
63
|
export * from "./types/jurisdictions/State.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { FederalCensusTract } from "../federal_census/FederalCensusTract.js";
|
|
2
|
+
import { CountyAux } from "./County.js";
|
|
3
|
+
import { JurisdictionMetric } from "./JurisdictionMetric.js";
|
|
4
|
+
import { MunicipalityAux } from "./Municipality.js";
|
|
5
|
+
import { SchoolDistrict } from "./SchoolDistrict.js";
|
|
6
|
+
export declare const jurisdiction_type_ids: readonly ["state", "federal_congress_district", "state_legislature_district", "county", "municipality", "school_district", "federal_census_tract", "federal_census_block"];
|
|
7
|
+
export type JurisdictionTypeID = typeof jurisdiction_type_ids[number];
|
|
8
|
+
export declare function is_jurisdiction_type_id(jurisdiction_type_id: any): jurisdiction_type_id is JurisdictionTypeID;
|
|
9
|
+
export declare class Jurisdiction {
|
|
10
|
+
readonly jurisdiction_type_id: JurisdictionTypeID;
|
|
11
|
+
readonly jurisdiction_id: string;
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
constructor(jurisdiction: any);
|
|
14
|
+
static is(jurisdiction: any): jurisdiction is Jurisdiction;
|
|
15
|
+
}
|
|
16
|
+
export declare class JurisdictionAux extends Jurisdiction {
|
|
17
|
+
readonly metrics: JurisdictionMetric[];
|
|
18
|
+
constructor(jurisdiction: any);
|
|
19
|
+
static is(jurisdiction: any): jurisdiction is JurisdictionAux;
|
|
20
|
+
}
|
|
21
|
+
export declare class CountyJurisdictionAux extends JurisdictionAux {
|
|
22
|
+
readonly jurisdiction_type_id: "county";
|
|
23
|
+
readonly county: CountyAux;
|
|
24
|
+
constructor(jurisdiction: any);
|
|
25
|
+
static is(jurisdiction: any): jurisdiction is CountyJurisdictionAux;
|
|
26
|
+
}
|
|
27
|
+
export declare class MunicipalityJurisdictionAux extends JurisdictionAux {
|
|
28
|
+
readonly jurisdiction_type_id: "municipality";
|
|
29
|
+
readonly municipality: MunicipalityAux;
|
|
30
|
+
constructor(jurisdiction: any);
|
|
31
|
+
static is(jurisdiction: any): jurisdiction is MunicipalityJurisdictionAux;
|
|
32
|
+
}
|
|
33
|
+
export declare class FederalCensusTractJurisdictionAux extends JurisdictionAux {
|
|
34
|
+
readonly jurisdiction_type_id: "federal_census_tract";
|
|
35
|
+
readonly federal_census_tract: FederalCensusTract;
|
|
36
|
+
constructor(jurisdiction: any);
|
|
37
|
+
static is(jurisdiction: any): jurisdiction is FederalCensusTractJurisdictionAux;
|
|
38
|
+
}
|
|
39
|
+
export declare class SchoolDistrictJurisdictionAux extends JurisdictionAux {
|
|
40
|
+
readonly jurisdiction_type_id: "school_district";
|
|
41
|
+
readonly school_district: SchoolDistrict;
|
|
42
|
+
constructor(jurisdiction: any);
|
|
43
|
+
static is(jurisdiction: any): jurisdiction is SchoolDistrictJurisdictionAux;
|
|
44
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { FederalCensusTract } from "../federal_census/FederalCensusTract.js";
|
|
2
|
+
import { CountyAux } from "./County.js";
|
|
3
|
+
import { JurisdictionMetric } from "./JurisdictionMetric.js";
|
|
4
|
+
import { MunicipalityAux } from "./Municipality.js";
|
|
5
|
+
import { SchoolDistrict } from "./SchoolDistrict.js";
|
|
6
|
+
export const jurisdiction_type_ids = ["state", "federal_congress_district", "state_legislature_district", "county", "municipality", "school_district", "federal_census_tract", "federal_census_block"];
|
|
7
|
+
export function is_jurisdiction_type_id(jurisdiction_type_id) {
|
|
8
|
+
return jurisdiction_type_ids.includes(jurisdiction_type_id);
|
|
9
|
+
}
|
|
10
|
+
export class Jurisdiction {
|
|
11
|
+
jurisdiction_type_id;
|
|
12
|
+
jurisdiction_id;
|
|
13
|
+
constructor(jurisdiction) {
|
|
14
|
+
if (!Jurisdiction.is(jurisdiction)) {
|
|
15
|
+
throw Error("Invalid input.");
|
|
16
|
+
}
|
|
17
|
+
this.jurisdiction_type_id = jurisdiction.jurisdiction_type_id;
|
|
18
|
+
this.jurisdiction_id = jurisdiction.jurisdiction_id;
|
|
19
|
+
}
|
|
20
|
+
static is(jurisdiction) {
|
|
21
|
+
return (jurisdiction !== undefined &&
|
|
22
|
+
is_jurisdiction_type_id(jurisdiction.jurisdiction_type_id) &&
|
|
23
|
+
typeof jurisdiction.jurisdiction_id === "string");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export class JurisdictionAux extends Jurisdiction {
|
|
27
|
+
metrics;
|
|
28
|
+
constructor(jurisdiction) {
|
|
29
|
+
if (!JurisdictionAux.is(jurisdiction)) {
|
|
30
|
+
throw Error("Invalid input.");
|
|
31
|
+
}
|
|
32
|
+
super(jurisdiction);
|
|
33
|
+
this.metrics = jurisdiction.metrics;
|
|
34
|
+
}
|
|
35
|
+
static is(jurisdiction) {
|
|
36
|
+
return (jurisdiction !== undefined &&
|
|
37
|
+
Array.isArray(jurisdiction.metrics) && jurisdiction.metrics.every(JurisdictionMetric.is));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export class CountyJurisdictionAux extends JurisdictionAux {
|
|
41
|
+
jurisdiction_type_id;
|
|
42
|
+
county;
|
|
43
|
+
constructor(jurisdiction) {
|
|
44
|
+
if (!CountyJurisdictionAux.is(jurisdiction)) {
|
|
45
|
+
throw Error("Invalid input.");
|
|
46
|
+
}
|
|
47
|
+
super(jurisdiction);
|
|
48
|
+
this.jurisdiction_type_id = jurisdiction.jurisdiction_type_id;
|
|
49
|
+
this.county = jurisdiction.county;
|
|
50
|
+
}
|
|
51
|
+
static is(jurisdiction) {
|
|
52
|
+
return (jurisdiction !== undefined &&
|
|
53
|
+
jurisdiction.jurisdiction_type_id === "county" &&
|
|
54
|
+
CountyAux.is(jurisdiction.county));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export class MunicipalityJurisdictionAux extends JurisdictionAux {
|
|
58
|
+
jurisdiction_type_id;
|
|
59
|
+
municipality;
|
|
60
|
+
constructor(jurisdiction) {
|
|
61
|
+
if (!MunicipalityJurisdictionAux.is(jurisdiction)) {
|
|
62
|
+
throw Error("Invalid input.");
|
|
63
|
+
}
|
|
64
|
+
super(jurisdiction);
|
|
65
|
+
this.jurisdiction_type_id = jurisdiction.jurisdiction_type_id;
|
|
66
|
+
this.municipality = jurisdiction.municipality;
|
|
67
|
+
}
|
|
68
|
+
static is(jurisdiction) {
|
|
69
|
+
return (jurisdiction !== undefined &&
|
|
70
|
+
jurisdiction.jurisdiction_type_id === "municipality" &&
|
|
71
|
+
MunicipalityAux.is(jurisdiction.municipality));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export class FederalCensusTractJurisdictionAux extends JurisdictionAux {
|
|
75
|
+
jurisdiction_type_id;
|
|
76
|
+
federal_census_tract;
|
|
77
|
+
constructor(jurisdiction) {
|
|
78
|
+
if (!FederalCensusTractJurisdictionAux.is(jurisdiction)) {
|
|
79
|
+
throw Error("Invalid input.");
|
|
80
|
+
}
|
|
81
|
+
super(jurisdiction);
|
|
82
|
+
this.jurisdiction_type_id = jurisdiction.jurisdiction_type_id;
|
|
83
|
+
this.federal_census_tract = jurisdiction.federal_census_tract;
|
|
84
|
+
}
|
|
85
|
+
static is(jurisdiction) {
|
|
86
|
+
return (jurisdiction !== undefined &&
|
|
87
|
+
jurisdiction.jurisdiction_type_id === "federal_census_tract" &&
|
|
88
|
+
FederalCensusTract.is(jurisdiction.federal_census_tract));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export class SchoolDistrictJurisdictionAux extends JurisdictionAux {
|
|
92
|
+
jurisdiction_type_id;
|
|
93
|
+
school_district;
|
|
94
|
+
constructor(jurisdiction) {
|
|
95
|
+
if (!SchoolDistrictJurisdictionAux.is(jurisdiction)) {
|
|
96
|
+
throw Error("Invalid input.");
|
|
97
|
+
}
|
|
98
|
+
super(jurisdiction);
|
|
99
|
+
this.jurisdiction_type_id = jurisdiction.jurisdiction_type_id;
|
|
100
|
+
this.school_district = jurisdiction.school_district;
|
|
101
|
+
}
|
|
102
|
+
static is(jurisdiction) {
|
|
103
|
+
return (jurisdiction !== undefined &&
|
|
104
|
+
jurisdiction.jurisdiction_type_id === "school_district" &&
|
|
105
|
+
SchoolDistrict.is(jurisdiction.school_district));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JurisdictionTypeID } from "../jurisdictions/
|
|
1
|
+
import { JurisdictionTypeID } from "../jurisdictions/Jurisdiction.js";
|
|
2
2
|
import { StateID } from "../jurisdictions/State.js";
|
|
3
3
|
import { VoterPartyTypeID } from "./Voter.js";
|
|
4
4
|
export declare class Prism {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { is_jurisdiction_type_id } from "../jurisdictions/
|
|
1
|
+
import { is_jurisdiction_type_id } from "../jurisdictions/Jurisdiction.js";
|
|
2
2
|
import { is_state_id } from "../jurisdictions/State.js";
|
|
3
3
|
import { is_voter_party_type_id } from "./Voter.js";
|
|
4
4
|
export class Prism {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -67,8 +67,8 @@ export * from "./types/federal_rules/FederalRuleTitle"
|
|
|
67
67
|
export * from "./types/federal_rules/FederalRuleSection"
|
|
68
68
|
|
|
69
69
|
export * from "./types/jurisdictions/County"
|
|
70
|
+
export * from "./types/jurisdictions/Jurisdiction"
|
|
70
71
|
export * from "./types/jurisdictions/JurisdictionMetric"
|
|
71
|
-
export * from "./types/jurisdictions/JurisdictionTypeID"
|
|
72
72
|
export * from "./types/jurisdictions/Municipality"
|
|
73
73
|
export * from "./types/jurisdictions/SchoolDistrict"
|
|
74
74
|
export * from "./types/jurisdictions/State"
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { FederalCensusTract } from "../federal_census/FederalCensusTract"
|
|
2
|
+
import { County, CountyAux } from "./County"
|
|
3
|
+
import { JurisdictionMetric } from "./JurisdictionMetric"
|
|
4
|
+
import { MunicipalityAux } from "./Municipality"
|
|
5
|
+
import { SchoolDistrict } from "./SchoolDistrict"
|
|
6
|
+
|
|
7
|
+
export const jurisdiction_type_ids = ["state", "federal_congress_district", "state_legislature_district", "county", "municipality", "school_district", "federal_census_tract", "federal_census_block"] as const
|
|
8
|
+
|
|
9
|
+
export type JurisdictionTypeID = typeof jurisdiction_type_ids[number]
|
|
10
|
+
|
|
11
|
+
export function is_jurisdiction_type_id(jurisdiction_type_id : any) : jurisdiction_type_id is JurisdictionTypeID {
|
|
12
|
+
return jurisdiction_type_ids.includes(jurisdiction_type_id)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class Jurisdiction {
|
|
16
|
+
readonly jurisdiction_type_id : JurisdictionTypeID
|
|
17
|
+
readonly jurisdiction_id : string
|
|
18
|
+
[x : string] : any
|
|
19
|
+
|
|
20
|
+
constructor(jurisdiction : any) {
|
|
21
|
+
if (!Jurisdiction.is(jurisdiction)) {
|
|
22
|
+
throw Error("Invalid input.")
|
|
23
|
+
}
|
|
24
|
+
this.jurisdiction_type_id = jurisdiction.jurisdiction_type_id
|
|
25
|
+
this.jurisdiction_id = jurisdiction.jurisdiction_id
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static is(jurisdiction : any) : jurisdiction is Jurisdiction {
|
|
29
|
+
return (
|
|
30
|
+
jurisdiction !== undefined &&
|
|
31
|
+
is_jurisdiction_type_id(jurisdiction.jurisdiction_type_id) &&
|
|
32
|
+
typeof jurisdiction.jurisdiction_id === "string"
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class JurisdictionAux extends Jurisdiction {
|
|
39
|
+
readonly metrics : JurisdictionMetric[]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
constructor(jurisdiction : any) {
|
|
43
|
+
if (!JurisdictionAux.is(jurisdiction)) {
|
|
44
|
+
throw Error("Invalid input.")
|
|
45
|
+
}
|
|
46
|
+
super(jurisdiction)
|
|
47
|
+
this.metrics = jurisdiction.metrics
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static is(jurisdiction : any) : jurisdiction is JurisdictionAux {
|
|
51
|
+
return (
|
|
52
|
+
jurisdiction !== undefined &&
|
|
53
|
+
Array.isArray(jurisdiction.metrics) && jurisdiction.metrics.every(JurisdictionMetric.is)
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export class CountyJurisdictionAux extends JurisdictionAux {
|
|
59
|
+
readonly jurisdiction_type_id : "county"
|
|
60
|
+
readonly county : CountyAux
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
constructor(jurisdiction : any) {
|
|
64
|
+
if (!CountyJurisdictionAux.is(jurisdiction)) {
|
|
65
|
+
throw Error("Invalid input.")
|
|
66
|
+
}
|
|
67
|
+
super(jurisdiction)
|
|
68
|
+
this.jurisdiction_type_id = jurisdiction.jurisdiction_type_id
|
|
69
|
+
this.county = jurisdiction.county
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static is(jurisdiction : any) : jurisdiction is CountyJurisdictionAux {
|
|
73
|
+
return (
|
|
74
|
+
jurisdiction !== undefined &&
|
|
75
|
+
jurisdiction.jurisdiction_type_id === "county" &&
|
|
76
|
+
CountyAux.is(jurisdiction.county)
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export class MunicipalityJurisdictionAux extends JurisdictionAux {
|
|
82
|
+
readonly jurisdiction_type_id : "municipality"
|
|
83
|
+
readonly municipality : MunicipalityAux
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
constructor(jurisdiction : any) {
|
|
87
|
+
if (!MunicipalityJurisdictionAux.is(jurisdiction)) {
|
|
88
|
+
throw Error("Invalid input.")
|
|
89
|
+
}
|
|
90
|
+
super(jurisdiction)
|
|
91
|
+
this.jurisdiction_type_id = jurisdiction.jurisdiction_type_id
|
|
92
|
+
this.municipality = jurisdiction.municipality
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
static is(jurisdiction : any) : jurisdiction is MunicipalityJurisdictionAux {
|
|
96
|
+
return (
|
|
97
|
+
jurisdiction !== undefined &&
|
|
98
|
+
jurisdiction.jurisdiction_type_id === "municipality" &&
|
|
99
|
+
MunicipalityAux.is(jurisdiction.municipality)
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export class FederalCensusTractJurisdictionAux extends JurisdictionAux {
|
|
105
|
+
readonly jurisdiction_type_id : "federal_census_tract"
|
|
106
|
+
readonly federal_census_tract : FederalCensusTract
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
constructor(jurisdiction : any) {
|
|
110
|
+
if (!FederalCensusTractJurisdictionAux.is(jurisdiction)) {
|
|
111
|
+
throw Error("Invalid input.")
|
|
112
|
+
}
|
|
113
|
+
super(jurisdiction)
|
|
114
|
+
this.jurisdiction_type_id = jurisdiction.jurisdiction_type_id
|
|
115
|
+
this.federal_census_tract = jurisdiction.federal_census_tract
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
static is(jurisdiction : any) : jurisdiction is FederalCensusTractJurisdictionAux {
|
|
119
|
+
return (
|
|
120
|
+
jurisdiction !== undefined &&
|
|
121
|
+
jurisdiction.jurisdiction_type_id === "federal_census_tract" &&
|
|
122
|
+
FederalCensusTract.is(jurisdiction.federal_census_tract)
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export class SchoolDistrictJurisdictionAux extends JurisdictionAux {
|
|
128
|
+
readonly jurisdiction_type_id : "school_district"
|
|
129
|
+
readonly school_district : SchoolDistrict
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
constructor(jurisdiction : any) {
|
|
133
|
+
if (!SchoolDistrictJurisdictionAux.is(jurisdiction)) {
|
|
134
|
+
throw Error("Invalid input.")
|
|
135
|
+
}
|
|
136
|
+
super(jurisdiction)
|
|
137
|
+
this.jurisdiction_type_id = jurisdiction.jurisdiction_type_id
|
|
138
|
+
this.school_district = jurisdiction.school_district
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static is(jurisdiction : any) : jurisdiction is SchoolDistrictJurisdictionAux {
|
|
142
|
+
return (
|
|
143
|
+
jurisdiction !== undefined &&
|
|
144
|
+
jurisdiction.jurisdiction_type_id === "school_district" &&
|
|
145
|
+
SchoolDistrict.is(jurisdiction.school_district)
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
}
|
package/src/types/prism/Prism.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { is_jurisdiction_type_id, JurisdictionTypeID } from "../jurisdictions/
|
|
1
|
+
import { is_jurisdiction_type_id, JurisdictionTypeID } from "../jurisdictions/Jurisdiction"
|
|
2
2
|
import { is_state_id, StateID } from "../jurisdictions/State"
|
|
3
3
|
import { is_voter_party_type_id, VoterPartyTypeID } from "./Voter"
|
|
4
4
|
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export const jurisdiction_type_ids = ["state", "federal_congress_district", "state_legislature_district", "county", "municipality", "school_district", "federal_census_tract", "federal_census_block"] as const
|
|
2
|
-
|
|
3
|
-
export type JurisdictionTypeID = typeof jurisdiction_type_ids[number]
|
|
4
|
-
|
|
5
|
-
export function is_jurisdiction_type_id(jurisdiction_type_id : any) : jurisdiction_type_id is JurisdictionTypeID {
|
|
6
|
-
return jurisdiction_type_ids.includes(jurisdiction_type_id)
|
|
7
|
-
}
|