triangle-types 1.0.282 → 1.0.284

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.
@@ -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";
@@ -1,4 +1,4 @@
1
- import { FederalCensusCounty } from "../federal_census/FederalCensusCounty.js";
1
+ import { Geom } from "./Geom.js";
2
2
  import { StateID } from "./State.js";
3
3
  export declare class County {
4
4
  readonly county_id: string;
@@ -7,12 +7,8 @@ export declare class County {
7
7
  readonly function_type_id: string;
8
8
  readonly name: string;
9
9
  readonly federal_census_county_id: string;
10
+ readonly geom: Geom;
10
11
  readonly [x: string]: any;
11
12
  constructor(county: any);
12
13
  static is(county: any): county is County;
13
14
  }
14
- export declare class CountyAux extends County {
15
- readonly federal_census_county: FederalCensusCounty;
16
- constructor(county: CountyAux);
17
- static is(county: any): county is CountyAux;
18
- }
@@ -1,4 +1,4 @@
1
- import { FederalCensusCounty } from "../federal_census/FederalCensusCounty.js";
1
+ import { Geom } from "./Geom.js";
2
2
  import { is_state_id } from "./State.js";
3
3
  export class County {
4
4
  county_id;
@@ -7,6 +7,7 @@ export class County {
7
7
  function_type_id;
8
8
  name;
9
9
  federal_census_county_id;
10
+ geom;
10
11
  constructor(county) {
11
12
  if (!County.is(county)) {
12
13
  throw Error("Invalid input.");
@@ -17,6 +18,7 @@ export class County {
17
18
  this.function_type_id = county.function_type_id;
18
19
  this.name = county.name;
19
20
  this.federal_census_county_id = county.federal_census_county_id;
21
+ this.geom = county.geom;
20
22
  }
21
23
  static is(county) {
22
24
  return (county !== undefined &&
@@ -25,20 +27,7 @@ export class County {
25
27
  typeof county.county_type_id === "string" &&
26
28
  typeof county.function_type_id === "string" &&
27
29
  typeof county.name === "string" &&
28
- typeof county.federal_census_county_id === "string");
29
- }
30
- }
31
- export class CountyAux extends County {
32
- federal_census_county;
33
- constructor(county) {
34
- if (!CountyAux.is(county)) {
35
- throw Error("Invalid input.");
36
- }
37
- super(county);
38
- this.federal_census_county = county.federal_census_county;
39
- }
40
- static is(county) {
41
- return (County.is(county) &&
42
- FederalCensusCounty.is(county.federal_census_county));
30
+ typeof county.federal_census_county_id === "string" &&
31
+ Geom.is(county.geom));
43
32
  }
44
33
  }
@@ -0,0 +1,44 @@
1
+ import { FederalCensusTract } from "../federal_census/FederalCensusTract.js";
2
+ import { County } from "./County.js";
3
+ import { JurisdictionMetric } from "./JurisdictionMetric.js";
4
+ import { Municipality } 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: County;
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: Municipality;
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 { County } from "./County.js";
3
+ import { JurisdictionMetric } from "./JurisdictionMetric.js";
4
+ import { Municipality } 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
+ County.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
+ Municipality.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 "./JurisdictionTypeID.js";
1
+ import { JurisdictionTypeID } from "./Jurisdiction.js";
2
2
  export declare class JurisdictionMetric {
3
3
  readonly jurisdiction_type_id: JurisdictionTypeID;
4
4
  readonly jurisdiction_id: string;
@@ -1,4 +1,4 @@
1
- import { is_jurisdiction_type_id } from "./JurisdictionTypeID.js";
1
+ import { is_jurisdiction_type_id } from "./Jurisdiction.js";
2
2
  export class JurisdictionMetric {
3
3
  jurisdiction_type_id;
4
4
  jurisdiction_id;
@@ -1,4 +1,4 @@
1
- import { FederalCensusMunicipality } from "../federal_census/FederalCensusMunicipality.js";
1
+ import { Geom } from "./Geom.js";
2
2
  import { StateID } from "./State.js";
3
3
  export declare class Municipality {
4
4
  readonly municipality_id: string;
@@ -6,12 +6,8 @@ export declare class Municipality {
6
6
  readonly municipality_type_id?: string;
7
7
  readonly name: string;
8
8
  readonly federal_census_municipality_id: string;
9
+ readonly geom: Geom;
9
10
  readonly [x: string]: any;
10
11
  constructor(municipality: any);
11
12
  static is(municipality: any): municipality is Municipality;
12
13
  }
13
- export declare class MunicipalityAux extends Municipality {
14
- readonly federal_census_municipality: FederalCensusMunicipality;
15
- constructor(municipality: MunicipalityAux);
16
- static is(municipality: any): municipality is MunicipalityAux;
17
- }
@@ -1,4 +1,4 @@
1
- import { FederalCensusMunicipality } from "../federal_census/FederalCensusMunicipality.js";
1
+ import { Geom } from "./Geom.js";
2
2
  import { is_state_id } from "./State.js";
3
3
  export class Municipality {
4
4
  municipality_id;
@@ -6,6 +6,7 @@ export class Municipality {
6
6
  municipality_type_id;
7
7
  name;
8
8
  federal_census_municipality_id;
9
+ geom;
9
10
  constructor(municipality) {
10
11
  if (!Municipality.is(municipality)) {
11
12
  throw Error("Invalid input.");
@@ -15,6 +16,7 @@ export class Municipality {
15
16
  this.municipality_type_id = municipality.municipality_type_id;
16
17
  this.name = municipality.name;
17
18
  this.federal_census_municipality_id = municipality.federal_census_municipality_id;
19
+ this.geom = municipality.geom;
18
20
  }
19
21
  static is(municipality) {
20
22
  return (municipality !== undefined &&
@@ -22,20 +24,7 @@ export class Municipality {
22
24
  is_state_id(municipality.state_id) &&
23
25
  (municipality.municipality_type_id === undefined || typeof municipality.municipality_type_id === "string") &&
24
26
  typeof municipality.name === "string" &&
25
- typeof municipality.federal_census_municipality_id === "string");
26
- }
27
- }
28
- export class MunicipalityAux extends Municipality {
29
- federal_census_municipality;
30
- constructor(municipality) {
31
- if (!MunicipalityAux.is(municipality)) {
32
- throw Error("Invalid input.");
33
- }
34
- super(municipality);
35
- this.federal_census_municipality = municipality.federal_census_municipality;
36
- }
37
- static is(municipality) {
38
- return (Municipality.is(municipality) &&
39
- FederalCensusMunicipality.is(municipality.federal_census_municipality));
27
+ typeof municipality.federal_census_municipality_id === "string" &&
28
+ Geom.is(municipality.geom));
40
29
  }
41
30
  }
@@ -1,4 +1,4 @@
1
- import { JurisdictionTypeID } from "../jurisdictions/JurisdictionTypeID.js";
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/JurisdictionTypeID.js";
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.282",
3
+ "version": "1.0.284",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
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"
@@ -1,4 +1,5 @@
1
1
  import { FederalCensusCounty } from "../federal_census/FederalCensusCounty"
2
+ import { Geom } from "./Geom"
2
3
  import { is_state_id, StateID } from "./State"
3
4
 
4
5
  export class County {
@@ -8,6 +9,7 @@ export class County {
8
9
  readonly function_type_id : string
9
10
  readonly name : string
10
11
  readonly federal_census_county_id : string
12
+ readonly geom : Geom
11
13
  readonly [x : string] : any
12
14
 
13
15
  constructor(county : any) {
@@ -20,6 +22,7 @@ export class County {
20
22
  this.function_type_id = county.function_type_id
21
23
  this.name = county.name
22
24
  this.federal_census_county_id = county.federal_census_county_id
25
+ this.geom = county.geom
23
26
  }
24
27
 
25
28
  static is(county : any) : county is County {
@@ -30,27 +33,8 @@ export class County {
30
33
  typeof county.county_type_id === "string" &&
31
34
  typeof county.function_type_id === "string" &&
32
35
  typeof county.name === "string" &&
33
- typeof county.federal_census_county_id === "string"
34
- )
35
- }
36
- }
37
-
38
- export class CountyAux extends County {
39
- readonly federal_census_county : FederalCensusCounty
40
-
41
-
42
- constructor(county : CountyAux) {
43
- if (!CountyAux.is(county)) {
44
- throw Error("Invalid input.")
45
- }
46
- super(county)
47
- this.federal_census_county = county.federal_census_county
48
- }
49
-
50
- static is(county : any) : county is CountyAux {
51
- return (
52
- County.is(county) &&
53
- FederalCensusCounty.is(county.federal_census_county)
36
+ typeof county.federal_census_county_id === "string" &&
37
+ Geom.is(county.geom)
54
38
  )
55
39
  }
56
40
  }
@@ -0,0 +1,148 @@
1
+ import { FederalCensusTract } from "../federal_census/FederalCensusTract"
2
+ import { County } from "./County"
3
+ import { JurisdictionMetric } from "./JurisdictionMetric"
4
+ import { Municipality } 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 : County
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
+ County.is(jurisdiction.county)
77
+ )
78
+ }
79
+ }
80
+
81
+ export class MunicipalityJurisdictionAux extends JurisdictionAux {
82
+ readonly jurisdiction_type_id : "municipality"
83
+ readonly municipality : Municipality
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
+ Municipality.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
+ }
@@ -1,4 +1,4 @@
1
- import { is_jurisdiction_type_id, JurisdictionTypeID } from "./JurisdictionTypeID"
1
+ import { is_jurisdiction_type_id, JurisdictionTypeID } from "./Jurisdiction"
2
2
 
3
3
  export class JurisdictionMetric {
4
4
  readonly jurisdiction_type_id : JurisdictionTypeID
@@ -1,4 +1,5 @@
1
1
  import { FederalCensusMunicipality } from "../federal_census/FederalCensusMunicipality"
2
+ import { Geom } from "./Geom"
2
3
  import { is_state_id, StateID } from "./State"
3
4
 
4
5
  export class Municipality {
@@ -7,6 +8,7 @@ export class Municipality {
7
8
  readonly municipality_type_id? : string
8
9
  readonly name : string
9
10
  readonly federal_census_municipality_id : string
11
+ readonly geom : Geom
10
12
  readonly [x : string] : any
11
13
 
12
14
  constructor(municipality : any) {
@@ -18,6 +20,7 @@ export class Municipality {
18
20
  this.municipality_type_id = municipality.municipality_type_id
19
21
  this.name = municipality.name
20
22
  this.federal_census_municipality_id = municipality.federal_census_municipality_id
23
+ this.geom = municipality.geom
21
24
  }
22
25
 
23
26
  static is(municipality : any) : municipality is Municipality {
@@ -27,27 +30,8 @@ export class Municipality {
27
30
  is_state_id(municipality.state_id) &&
28
31
  (municipality.municipality_type_id === undefined || typeof municipality.municipality_type_id === "string") &&
29
32
  typeof municipality.name === "string" &&
30
- typeof municipality.federal_census_municipality_id === "string"
31
- )
32
- }
33
- }
34
-
35
- export class MunicipalityAux extends Municipality {
36
- readonly federal_census_municipality : FederalCensusMunicipality
37
-
38
-
39
- constructor(municipality : MunicipalityAux) {
40
- if (!MunicipalityAux.is(municipality)) {
41
- throw Error("Invalid input.")
42
- }
43
- super(municipality)
44
- this.federal_census_municipality = municipality.federal_census_municipality
45
- }
46
-
47
- static is(municipality : any) : municipality is MunicipalityAux {
48
- return (
49
- Municipality.is(municipality) &&
50
- FederalCensusMunicipality.is(municipality.federal_census_municipality)
33
+ typeof municipality.federal_census_municipality_id === "string" &&
34
+ Geom.is(municipality.geom)
51
35
  )
52
36
  }
53
37
  }
@@ -1,4 +1,4 @@
1
- import { is_jurisdiction_type_id, JurisdictionTypeID } from "../jurisdictions/JurisdictionTypeID"
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
- }