triangle-types 1.0.166 → 1.0.168
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 -0
- package/dist/src/index.js +1 -0
- package/dist/src/types/federal_census/FederalCensusSchoolDistrict.d.ts +15 -0
- package/dist/src/types/federal_census/FederalCensusSchoolDistrict.js +36 -0
- package/dist/src/types/federal_congress/FederalCongressDistrict.d.ts +1 -0
- package/dist/src/types/federal_congress/FederalCongressDistrict.js +4 -1
- package/dist/src/types/state_legislature/StateLegislatureDistrict.d.ts +1 -0
- package/dist/src/types/state_legislature/StateLegislatureDistrict.js +4 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/types/federal_census/FederalCensusSchoolDistrict.ts +46 -0
- package/src/types/federal_congress/FederalCongressDistrict.ts +4 -1
- package/src/types/state_legislature/StateLegislatureDistrict.ts +4 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./types/federal_census/FederalCensus.js";
|
|
|
12
12
|
export * from "./types/federal_census/FederalCensusBlock.js";
|
|
13
13
|
export * from "./types/federal_census/FederalCensusCounty.js";
|
|
14
14
|
export * from "./types/federal_census/FederalCensusMunicipality.js";
|
|
15
|
+
export * from "./types/federal_census/FederalCensusSchoolDistrict.js";
|
|
15
16
|
export * from "./types/federal_census/FederalCensusTract.js";
|
|
16
17
|
export * from "./types/federal_elections/FederalElection.js";
|
|
17
18
|
export * from "./types/federal_elections/FederalElectionCommittee.js";
|
package/dist/src/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./types/federal_census/FederalCensus.js";
|
|
|
12
12
|
export * from "./types/federal_census/FederalCensusBlock.js";
|
|
13
13
|
export * from "./types/federal_census/FederalCensusCounty.js";
|
|
14
14
|
export * from "./types/federal_census/FederalCensusMunicipality.js";
|
|
15
|
+
export * from "./types/federal_census/FederalCensusSchoolDistrict.js";
|
|
15
16
|
export * from "./types/federal_census/FederalCensusTract.js";
|
|
16
17
|
export * from "./types/federal_elections/FederalElection.js";
|
|
17
18
|
export * from "./types/federal_elections/FederalElectionCommittee.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StateID } from "../regions/State.js";
|
|
2
|
+
export declare const federal_census_school_district_type_ids: readonly ["UNIFIED", "PRIMARY", "SECONDARY"];
|
|
3
|
+
export type FederalCensusSchoolDistrictTypeID = typeof federal_census_school_district_type_ids[number];
|
|
4
|
+
export declare function is_federal_census_school_district_type_id(federal_census_school_district_type_id: any): federal_census_school_district_type_id is FederalCensusSchoolDistrictTypeID;
|
|
5
|
+
export declare class FederalCensusSchoolDistrict {
|
|
6
|
+
readonly federal_census_school_district_id: string;
|
|
7
|
+
readonly federal_census_id: number;
|
|
8
|
+
readonly school_district_id: string;
|
|
9
|
+
readonly state_id: StateID;
|
|
10
|
+
readonly school_district_type_id?: FederalCensusSchoolDistrictTypeID;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly s3_id: string;
|
|
13
|
+
constructor(federal_census_school_district: any);
|
|
14
|
+
static is(federal_census_school_district: any): federal_census_school_district is FederalCensusSchoolDistrict;
|
|
15
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { is_state_id } from "../regions/State.js";
|
|
2
|
+
export const federal_census_school_district_type_ids = ["UNIFIED", "PRIMARY", "SECONDARY"];
|
|
3
|
+
export function is_federal_census_school_district_type_id(federal_census_school_district_type_id) {
|
|
4
|
+
return federal_census_school_district_type_ids.includes(federal_census_school_district_type_id);
|
|
5
|
+
}
|
|
6
|
+
export class FederalCensusSchoolDistrict {
|
|
7
|
+
federal_census_school_district_id;
|
|
8
|
+
federal_census_id;
|
|
9
|
+
school_district_id;
|
|
10
|
+
state_id;
|
|
11
|
+
school_district_type_id;
|
|
12
|
+
name;
|
|
13
|
+
s3_id;
|
|
14
|
+
constructor(federal_census_school_district) {
|
|
15
|
+
if (!FederalCensusSchoolDistrict.is(federal_census_school_district)) {
|
|
16
|
+
throw Error("Invalid input.");
|
|
17
|
+
}
|
|
18
|
+
this.federal_census_school_district_id = federal_census_school_district.federal_census_school_district_id;
|
|
19
|
+
this.federal_census_id = federal_census_school_district.federal_census_id;
|
|
20
|
+
this.school_district_id = federal_census_school_district.school_district_id;
|
|
21
|
+
this.state_id = federal_census_school_district.state_id;
|
|
22
|
+
this.school_district_type_id = federal_census_school_district.school_district_type_id;
|
|
23
|
+
this.name = federal_census_school_district.name;
|
|
24
|
+
this.s3_id = federal_census_school_district.s3_id;
|
|
25
|
+
}
|
|
26
|
+
static is(federal_census_school_district) {
|
|
27
|
+
return (federal_census_school_district !== undefined &&
|
|
28
|
+
typeof federal_census_school_district.federal_census_school_district_id === "string" &&
|
|
29
|
+
typeof federal_census_school_district.federal_census_id === "number" &&
|
|
30
|
+
typeof federal_census_school_district.school_district_id === "string" &&
|
|
31
|
+
is_state_id(federal_census_school_district.state_id) &&
|
|
32
|
+
(federal_census_school_district.school_district_type_id === undefined || typeof federal_census_school_district.school_district_type_id === "string") &&
|
|
33
|
+
typeof federal_census_school_district.name === "string" &&
|
|
34
|
+
typeof federal_census_school_district.s3_id === "string");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -5,6 +5,7 @@ export declare class FederalCongressDistrict {
|
|
|
5
5
|
readonly chamber_id: string;
|
|
6
6
|
readonly state_id: StateID;
|
|
7
7
|
readonly district_id: number;
|
|
8
|
+
readonly s3_id: string;
|
|
8
9
|
constructor(federal_congress_district: any);
|
|
9
10
|
static is(federal_congress_district: any): federal_congress_district is FederalCongressDistrict;
|
|
10
11
|
}
|
|
@@ -5,6 +5,7 @@ export class FederalCongressDistrict {
|
|
|
5
5
|
chamber_id;
|
|
6
6
|
state_id;
|
|
7
7
|
district_id;
|
|
8
|
+
s3_id;
|
|
8
9
|
constructor(federal_congress_district) {
|
|
9
10
|
if (!FederalCongressDistrict.is(federal_congress_district)) {
|
|
10
11
|
throw Error("Invalid input.");
|
|
@@ -14,6 +15,7 @@ export class FederalCongressDistrict {
|
|
|
14
15
|
this.chamber_id = federal_congress_district.chamber_id;
|
|
15
16
|
this.state_id = federal_congress_district.state_id;
|
|
16
17
|
this.district_id = federal_congress_district.district_id;
|
|
18
|
+
this.s3_id = federal_congress_district.s3_id;
|
|
17
19
|
}
|
|
18
20
|
static is(federal_congress_district) {
|
|
19
21
|
return (federal_congress_district !== undefined &&
|
|
@@ -21,6 +23,7 @@ export class FederalCongressDistrict {
|
|
|
21
23
|
typeof federal_congress_district.federal_congress_id === "number" &&
|
|
22
24
|
typeof federal_congress_district.chamber_id === "string" &&
|
|
23
25
|
is_state_id(federal_congress_district.state_id) &&
|
|
24
|
-
typeof federal_congress_district.district_id === "number"
|
|
26
|
+
typeof federal_congress_district.district_id === "number" &&
|
|
27
|
+
typeof federal_congress_district.s3_id === "number");
|
|
25
28
|
}
|
|
26
29
|
}
|
|
@@ -6,6 +6,7 @@ export declare class StateLegislatureDistrict {
|
|
|
6
6
|
readonly chamber_id: string;
|
|
7
7
|
readonly district_id: number;
|
|
8
8
|
readonly name: string;
|
|
9
|
+
readonly s3_id: string;
|
|
9
10
|
constructor(state_legislature_district: any);
|
|
10
11
|
static is(state_legislature_district: any): state_legislature_district is StateLegislatureDistrict;
|
|
11
12
|
}
|
|
@@ -6,6 +6,7 @@ export class StateLegislatureDistrict {
|
|
|
6
6
|
chamber_id;
|
|
7
7
|
district_id;
|
|
8
8
|
name;
|
|
9
|
+
s3_id;
|
|
9
10
|
constructor(state_legislature_district) {
|
|
10
11
|
if (!StateLegislatureDistrict.is(state_legislature_district)) {
|
|
11
12
|
throw Error("Invalid input.");
|
|
@@ -16,6 +17,7 @@ export class StateLegislatureDistrict {
|
|
|
16
17
|
this.chamber_id = state_legislature_district.chamber_id;
|
|
17
18
|
this.district_id = state_legislature_district.district_id;
|
|
18
19
|
this.name = state_legislature_district.name;
|
|
20
|
+
this.s3_id = state_legislature_district.s3_id;
|
|
19
21
|
}
|
|
20
22
|
static is(state_legislature_district) {
|
|
21
23
|
return (state_legislature_district !== undefined &&
|
|
@@ -24,6 +26,7 @@ export class StateLegislatureDistrict {
|
|
|
24
26
|
typeof state_legislature_district.legislature_id === "number" &&
|
|
25
27
|
typeof state_legislature_district.chamber_id === "string" &&
|
|
26
28
|
typeof state_legislature_district.district_id === "number" &&
|
|
27
|
-
typeof state_legislature_district.name === "string"
|
|
29
|
+
typeof state_legislature_district.name === "string" &&
|
|
30
|
+
typeof state_legislature_district.s3_id === "string");
|
|
28
31
|
}
|
|
29
32
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from "./types/federal_census/FederalCensus"
|
|
|
15
15
|
export * from "./types/federal_census/FederalCensusBlock"
|
|
16
16
|
export * from "./types/federal_census/FederalCensusCounty"
|
|
17
17
|
export * from "./types/federal_census/FederalCensusMunicipality"
|
|
18
|
+
export * from "./types/federal_census/FederalCensusSchoolDistrict"
|
|
18
19
|
export * from "./types/federal_census/FederalCensusTract"
|
|
19
20
|
|
|
20
21
|
export * from "./types/federal_elections/FederalElection"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { is_state_id, StateID } from "../regions/State"
|
|
2
|
+
|
|
3
|
+
export const federal_census_school_district_type_ids = ["UNIFIED", "PRIMARY", "SECONDARY"] as const
|
|
4
|
+
|
|
5
|
+
export type FederalCensusSchoolDistrictTypeID = typeof federal_census_school_district_type_ids[number]
|
|
6
|
+
|
|
7
|
+
export function is_federal_census_school_district_type_id(federal_census_school_district_type_id : any) : federal_census_school_district_type_id is FederalCensusSchoolDistrictTypeID {
|
|
8
|
+
return federal_census_school_district_type_ids.includes(federal_census_school_district_type_id)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class FederalCensusSchoolDistrict {
|
|
12
|
+
readonly federal_census_school_district_id : string
|
|
13
|
+
readonly federal_census_id : number
|
|
14
|
+
readonly school_district_id : string
|
|
15
|
+
readonly state_id : StateID
|
|
16
|
+
readonly school_district_type_id? : FederalCensusSchoolDistrictTypeID
|
|
17
|
+
readonly name : string
|
|
18
|
+
readonly s3_id : string
|
|
19
|
+
|
|
20
|
+
constructor(federal_census_school_district : any) {
|
|
21
|
+
if (!FederalCensusSchoolDistrict.is(federal_census_school_district)) {
|
|
22
|
+
throw Error("Invalid input.")
|
|
23
|
+
}
|
|
24
|
+
this.federal_census_school_district_id = federal_census_school_district.federal_census_school_district_id
|
|
25
|
+
this.federal_census_id = federal_census_school_district.federal_census_id
|
|
26
|
+
this.school_district_id = federal_census_school_district.school_district_id
|
|
27
|
+
this.state_id = federal_census_school_district.state_id
|
|
28
|
+
this.school_district_type_id = federal_census_school_district.school_district_type_id
|
|
29
|
+
this.name = federal_census_school_district.name
|
|
30
|
+
this.s3_id = federal_census_school_district.s3_id
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static is(federal_census_school_district : any) : federal_census_school_district is FederalCensusSchoolDistrict {
|
|
34
|
+
return (
|
|
35
|
+
federal_census_school_district !== undefined &&
|
|
36
|
+
typeof federal_census_school_district.federal_census_school_district_id === "string" &&
|
|
37
|
+
typeof federal_census_school_district.federal_census_id === "number" &&
|
|
38
|
+
typeof federal_census_school_district.school_district_id === "string" &&
|
|
39
|
+
is_state_id(federal_census_school_district.state_id) &&
|
|
40
|
+
(federal_census_school_district.school_district_type_id === undefined || typeof federal_census_school_district.school_district_type_id === "string") &&
|
|
41
|
+
typeof federal_census_school_district.name === "string" &&
|
|
42
|
+
typeof federal_census_school_district.s3_id === "string"
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
@@ -6,6 +6,7 @@ export class FederalCongressDistrict {
|
|
|
6
6
|
readonly chamber_id : string
|
|
7
7
|
readonly state_id : StateID
|
|
8
8
|
readonly district_id : number
|
|
9
|
+
readonly s3_id : string
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
constructor(federal_congress_district : any) {
|
|
@@ -17,6 +18,7 @@ export class FederalCongressDistrict {
|
|
|
17
18
|
this.chamber_id = federal_congress_district.chamber_id
|
|
18
19
|
this.state_id = federal_congress_district.state_id
|
|
19
20
|
this.district_id = federal_congress_district.district_id
|
|
21
|
+
this.s3_id = federal_congress_district.s3_id
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
static is(federal_congress_district : any) : federal_congress_district is FederalCongressDistrict {
|
|
@@ -26,7 +28,8 @@ export class FederalCongressDistrict {
|
|
|
26
28
|
typeof federal_congress_district.federal_congress_id === "number" &&
|
|
27
29
|
typeof federal_congress_district.chamber_id === "string" &&
|
|
28
30
|
is_state_id(federal_congress_district.state_id) &&
|
|
29
|
-
typeof federal_congress_district.district_id === "number"
|
|
31
|
+
typeof federal_congress_district.district_id === "number" &&
|
|
32
|
+
typeof federal_congress_district.s3_id === "number"
|
|
30
33
|
)
|
|
31
34
|
}
|
|
32
35
|
|
|
@@ -7,6 +7,7 @@ export class StateLegislatureDistrict {
|
|
|
7
7
|
readonly chamber_id : string
|
|
8
8
|
readonly district_id : number
|
|
9
9
|
readonly name : string
|
|
10
|
+
readonly s3_id : string
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
constructor(state_legislature_district : any) {
|
|
@@ -19,6 +20,7 @@ export class StateLegislatureDistrict {
|
|
|
19
20
|
this.chamber_id = state_legislature_district.chamber_id
|
|
20
21
|
this.district_id = state_legislature_district.district_id
|
|
21
22
|
this.name = state_legislature_district.name
|
|
23
|
+
this.s3_id = state_legislature_district.s3_id
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
static is(state_legislature_district : any) : state_legislature_district is StateLegislatureDistrict {
|
|
@@ -29,7 +31,8 @@ export class StateLegislatureDistrict {
|
|
|
29
31
|
typeof state_legislature_district.legislature_id === "number" &&
|
|
30
32
|
typeof state_legislature_district.chamber_id === "string" &&
|
|
31
33
|
typeof state_legislature_district.district_id === "number" &&
|
|
32
|
-
typeof state_legislature_district.name === "string"
|
|
34
|
+
typeof state_legislature_district.name === "string" &&
|
|
35
|
+
typeof state_legislature_district.s3_id === "string"
|
|
33
36
|
)
|
|
34
37
|
}
|
|
35
38
|
|