triangle-types 1.0.265 → 1.0.267

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.
@@ -74,6 +74,7 @@ export * from "./types/prism/Voter.js";
74
74
  export * from "./types/prism/VoterFeature.js";
75
75
  export * from "./types/prism/VoterTarget.js";
76
76
  export * from "./types/regions/County.js";
77
+ export * from "./types/regions/Municipality.js";
77
78
  export * from "./types/regions/SchoolDistrict.js";
78
79
  export * from "./types/regions/State.js";
79
80
  export * from "./types/scout/Scout.js";
package/dist/src/index.js CHANGED
@@ -74,6 +74,7 @@ export * from "./types/prism/Voter.js";
74
74
  export * from "./types/prism/VoterFeature.js";
75
75
  export * from "./types/prism/VoterTarget.js";
76
76
  export * from "./types/regions/County.js";
77
+ export * from "./types/regions/Municipality.js";
77
78
  export * from "./types/regions/SchoolDistrict.js";
78
79
  export * from "./types/regions/State.js";
79
80
  export * from "./types/scout/Scout.js";
@@ -1,8 +1,18 @@
1
+ import { FederalCensusCounty } from "../federal_census/FederalCensusCounty.js";
1
2
  import { StateID } from "./State.js";
2
3
  export declare class County {
3
4
  readonly county_id: string;
4
5
  readonly state_id: StateID;
6
+ readonly county_type_id: string;
7
+ readonly function_type_id: string;
5
8
  readonly name: string;
9
+ readonly federal_census_county_id: string;
10
+ readonly [x: string]: any;
6
11
  constructor(county: any);
7
12
  static is(county: any): county is County;
8
13
  }
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,25 +1,44 @@
1
- // export const county_type_ids = ["H1", "H4", "H5", "H6", "C7"] as const
1
+ import { FederalCensusCounty } from "../federal_census/FederalCensusCounty.js";
2
2
  import { is_state_id } from "./State.js";
3
- // export type CountyTypeID = typeof county_type_ids[number]
4
- // export function is_county_type_id(county_type_id : any) : county_type_id is CountyTypeID {
5
- // return county_type_ids.includes(county_type_id)
6
- // }
7
3
  export class County {
8
4
  county_id;
9
5
  state_id;
6
+ county_type_id;
7
+ function_type_id;
10
8
  name;
9
+ federal_census_county_id;
11
10
  constructor(county) {
12
11
  if (!County.is(county)) {
13
12
  throw Error("Invalid input.");
14
13
  }
15
14
  this.county_id = county.county_id;
16
15
  this.state_id = county.state_id;
16
+ this.county_type_id = county.county_type_id;
17
+ this.function_type_id = county.function_type_id;
17
18
  this.name = county.name;
19
+ this.federal_census_county_id = county.federal_census_county_id;
18
20
  }
19
21
  static is(county) {
20
22
  return (county !== undefined &&
21
23
  typeof county.county_id === "string" &&
22
24
  is_state_id(county.state_id) &&
23
- typeof county.name === "string");
25
+ typeof county.county_type_id === "string" &&
26
+ typeof county.function_type_id === "string" &&
27
+ 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));
24
43
  }
25
44
  }
@@ -0,0 +1,17 @@
1
+ import { FederalCensusMunicipality } from "../federal_census/FederalCensusMunicipality.js";
2
+ import { StateID } from "./State.js";
3
+ export declare class Municipality {
4
+ readonly municipality_id: string;
5
+ readonly state_id: StateID;
6
+ readonly municipality_type_id?: string;
7
+ readonly name: string;
8
+ readonly federal_census_municipality_id: string;
9
+ readonly [x: string]: any;
10
+ constructor(municipality: any);
11
+ static is(municipality: any): municipality is Municipality;
12
+ }
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
+ }
@@ -0,0 +1,41 @@
1
+ import { FederalCensusMunicipality } from "../federal_census/FederalCensusMunicipality.js";
2
+ import { is_state_id } from "./State.js";
3
+ export class Municipality {
4
+ municipality_id;
5
+ state_id;
6
+ municipality_type_id;
7
+ name;
8
+ federal_census_municipality_id;
9
+ constructor(municipality) {
10
+ if (!Municipality.is(municipality)) {
11
+ throw Error("Invalid input.");
12
+ }
13
+ this.municipality_id = municipality.municipality_id;
14
+ this.state_id = municipality.state_id;
15
+ this.municipality_type_id = municipality.municipality_type_id;
16
+ this.name = municipality.name;
17
+ this.federal_census_municipality_id = municipality.federal_census_municipality_id;
18
+ }
19
+ static is(municipality) {
20
+ return (municipality !== undefined &&
21
+ typeof municipality.municipality_id === "string" &&
22
+ is_state_id(municipality.state_id) &&
23
+ (municipality.municipality_type_id === undefined || typeof municipality.municipality_type_id === "string") &&
24
+ 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));
40
+ }
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.265",
3
+ "version": "1.0.267",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -89,6 +89,7 @@ export * from "./types/prism/VoterFeature"
89
89
  export * from "./types/prism/VoterTarget"
90
90
 
91
91
  export * from "./types/regions/County"
92
+ export * from "./types/regions/Municipality"
92
93
  export * from "./types/regions/SchoolDistrict"
93
94
  export * from "./types/regions/State"
94
95
 
@@ -1,17 +1,14 @@
1
- // export const county_type_ids = ["H1", "H4", "H5", "H6", "C7"] as const
2
-
1
+ import { FederalCensusCounty } from "../federal_census/FederalCensusCounty"
3
2
  import { is_state_id, StateID } from "./State"
4
3
 
5
- // export type CountyTypeID = typeof county_type_ids[number]
6
-
7
- // export function is_county_type_id(county_type_id : any) : county_type_id is CountyTypeID {
8
- // return county_type_ids.includes(county_type_id)
9
- // }
10
-
11
4
  export class County {
12
5
  readonly county_id : string
13
6
  readonly state_id : StateID
7
+ readonly county_type_id : string
8
+ readonly function_type_id : string
14
9
  readonly name : string
10
+ readonly federal_census_county_id : string
11
+ readonly [x : string] : any
15
12
 
16
13
  constructor(county : any) {
17
14
  if (!County.is(county)) {
@@ -19,7 +16,10 @@ export class County {
19
16
  }
20
17
  this.county_id = county.county_id
21
18
  this.state_id = county.state_id
19
+ this.county_type_id = county.county_type_id
20
+ this.function_type_id = county.function_type_id
22
21
  this.name = county.name
22
+ this.federal_census_county_id = county.federal_census_county_id
23
23
  }
24
24
 
25
25
  static is(county : any) : county is County {
@@ -27,7 +27,30 @@ export class County {
27
27
  county !== undefined &&
28
28
  typeof county.county_id === "string" &&
29
29
  is_state_id(county.state_id) &&
30
- typeof county.name === "string"
30
+ typeof county.county_type_id === "string" &&
31
+ typeof county.function_type_id === "string" &&
32
+ 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)
31
54
  )
32
55
  }
33
56
  }
@@ -0,0 +1,53 @@
1
+ import { FederalCensusMunicipality } from "../federal_census/FederalCensusMunicipality"
2
+ import { is_state_id, StateID } from "./State"
3
+
4
+ export class Municipality {
5
+ readonly municipality_id : string
6
+ readonly state_id : StateID
7
+ readonly municipality_type_id? : string
8
+ readonly name : string
9
+ readonly federal_census_municipality_id : string
10
+ readonly [x : string] : any
11
+
12
+ constructor(municipality : any) {
13
+ if (!Municipality.is(municipality)) {
14
+ throw Error("Invalid input.")
15
+ }
16
+ this.municipality_id = municipality.municipality_id
17
+ this.state_id = municipality.state_id
18
+ this.municipality_type_id = municipality.municipality_type_id
19
+ this.name = municipality.name
20
+ this.federal_census_municipality_id = municipality.federal_census_municipality_id
21
+ }
22
+
23
+ static is(municipality : any) : municipality is Municipality {
24
+ return (
25
+ municipality !== undefined &&
26
+ typeof municipality.municipality_id === "string" &&
27
+ is_state_id(municipality.state_id) &&
28
+ (municipality.municipality_type_id === undefined || typeof municipality.municipality_type_id === "string") &&
29
+ 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)
51
+ )
52
+ }
53
+ }