triangle-types 1.0.271 → 1.0.272
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 +6 -4
- package/dist/src/index.js +6 -4
- package/dist/src/types/ballotpedia/BallotpediaOffice.d.ts +1 -1
- package/dist/src/types/ballotpedia/BallotpediaOffice.js +1 -1
- package/dist/src/types/federal_census/FederalCensusBlock.d.ts +1 -1
- package/dist/src/types/federal_census/FederalCensusBlock.js +1 -1
- package/dist/src/types/federal_census/FederalCensusCounty.d.ts +1 -1
- package/dist/src/types/federal_census/FederalCensusCounty.js +1 -1
- package/dist/src/types/federal_census/FederalCensusMunicipality.d.ts +1 -1
- package/dist/src/types/federal_census/FederalCensusMunicipality.js +1 -1
- package/dist/src/types/federal_census/FederalCensusSchoolDistrict.d.ts +1 -1
- package/dist/src/types/federal_census/FederalCensusSchoolDistrict.js +1 -1
- package/dist/src/types/federal_census/FederalCensusTract.d.ts +1 -1
- package/dist/src/types/federal_census/FederalCensusTract.js +1 -1
- package/dist/src/types/federal_congress/FederalCongress.d.ts +1 -1
- package/dist/src/types/federal_congress/FederalCongress.js +1 -1
- package/dist/src/types/federal_congress/FederalCongressDistrict.d.ts +1 -1
- package/dist/src/types/federal_congress/FederalCongressDistrict.js +1 -1
- package/dist/src/types/federal_congress/FederalCongressMember.d.ts +1 -1
- package/dist/src/types/federal_congress/FederalCongressMember.js +1 -1
- package/dist/src/types/federal_elections/FederalElection.d.ts +1 -1
- package/dist/src/types/federal_elections/FederalElection.js +1 -1
- package/dist/src/types/federal_elections/FederalElectionCandidate.d.ts +1 -1
- package/dist/src/types/federal_elections/FederalElectionCandidate.js +1 -1
- package/dist/src/types/federal_elections/FederalElectionDonation.d.ts +1 -1
- package/dist/src/types/federal_elections/FederalElectionF2File.d.ts +1 -1
- package/dist/src/types/federal_elections/FederalElectionF2File.js +1 -1
- package/dist/src/types/jurisdictions/County.d.ts +18 -0
- package/dist/src/types/jurisdictions/County.js +44 -0
- package/dist/src/types/jurisdictions/JurisdictionMetric.d.ts +10 -0
- package/dist/src/types/jurisdictions/JurisdictionMetric.js +23 -0
- package/dist/src/types/jurisdictions/JurisdictionTypeID.d.ts +3 -0
- package/dist/src/types/jurisdictions/JurisdictionTypeID.js +4 -0
- package/dist/src/types/jurisdictions/Municipality.d.ts +17 -0
- package/dist/src/types/jurisdictions/Municipality.js +41 -0
- package/dist/src/types/jurisdictions/SchoolDistrict.d.ts +16 -0
- package/dist/src/types/jurisdictions/SchoolDistrict.js +38 -0
- package/dist/src/types/jurisdictions/State.d.ts +12 -0
- package/dist/src/types/jurisdictions/State.js +364 -0
- package/dist/src/types/lal/LALFile.d.ts +1 -1
- package/dist/src/types/lal/LALFile.js +1 -1
- package/dist/src/types/lal/LALFileVoter.d.ts +1 -1
- package/dist/src/types/lal/LALFileVoter.js +1 -1
- package/dist/src/types/prism/Prism.d.ts +4 -6
- package/dist/src/types/prism/Prism.js +8 -16
- package/dist/src/types/prism/StateVoter.d.ts +1 -1
- package/dist/src/types/prism/StateVoter.js +1 -1
- package/dist/src/types/prism/StateVoterFeature.d.ts +1 -1
- package/dist/src/types/prism/StateVoterFeature.js +1 -1
- package/dist/src/types/prism/StateVoterTarget.d.ts +1 -1
- package/dist/src/types/prism/StateVoterTarget.js +1 -1
- package/dist/src/types/prism/Voter.d.ts +1 -1
- package/dist/src/types/prism/Voter.js +1 -1
- package/dist/src/types/prism/VoterFeature.d.ts +1 -1
- package/dist/src/types/prism/VoterFeature.js +1 -1
- package/dist/src/types/prism/VoterTarget.d.ts +1 -1
- package/dist/src/types/prism/VoterTarget.js +1 -1
- package/dist/src/types/state_legislature/StateLegislatureDistrict.d.ts +1 -1
- package/dist/src/types/state_legislature/StateLegislatureDistrict.js +1 -1
- package/dist/src/types/state_permits/StateFacility.d.ts +1 -1
- package/dist/src/types/state_permits/StateFacility.js +1 -1
- package/dist/src/types/state_permits/StatePermit.d.ts +1 -1
- package/dist/src/types/state_permits/StatePermit.js +1 -1
- package/dist/src/types/state_permits/StatePermitDocument.d.ts +1 -1
- package/dist/src/types/state_permits/StatePermitDocument.js +1 -1
- package/dist/src/types/state_permits/StatePermitDocumentSource.d.ts +1 -1
- package/dist/src/types/state_permits/StatePermitDocumentSource.js +1 -1
- package/dist/src/types/state_permits/StatePermitDocumentSourcePollutant.d.ts +1 -1
- package/dist/src/types/state_permits/StatePermitDocumentSourcePollutant.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +7 -5
- package/src/types/ballotpedia/BallotpediaOffice.ts +1 -1
- package/src/types/federal_census/FederalCensusBlock.ts +1 -1
- package/src/types/federal_census/FederalCensusCounty.ts +1 -1
- package/src/types/federal_census/FederalCensusMunicipality.ts +1 -1
- package/src/types/federal_census/FederalCensusSchoolDistrict.ts +1 -1
- package/src/types/federal_census/FederalCensusTract.ts +1 -1
- package/src/types/federal_congress/FederalCongress.ts +1 -1
- package/src/types/federal_congress/FederalCongressDistrict.ts +1 -1
- package/src/types/federal_congress/FederalCongressMember.ts +1 -1
- package/src/types/federal_elections/FederalElection.ts +1 -1
- package/src/types/federal_elections/FederalElectionCandidate.ts +1 -1
- package/src/types/federal_elections/FederalElectionDonation.ts +1 -1
- package/src/types/federal_elections/FederalElectionF2File.ts +1 -1
- package/src/types/jurisdictions/JurisdictionMetric.ts +29 -0
- package/src/types/jurisdictions/JurisdictionTypeID.ts +7 -0
- package/src/types/lal/LALFile.ts +1 -1
- package/src/types/lal/LALFileVoter.ts +1 -1
- package/src/types/prism/Prism.ts +8 -16
- package/src/types/prism/StateVoter.ts +1 -1
- package/src/types/prism/StateVoterFeature.ts +1 -1
- package/src/types/prism/StateVoterTarget.ts +1 -1
- package/src/types/prism/TenantVoterTag.ts +1 -1
- package/src/types/prism/Voter.ts +1 -1
- package/src/types/prism/VoterFeature.ts +1 -1
- package/src/types/prism/VoterTarget.ts +1 -1
- package/src/types/state_legislature/StateLegislatureDistrict.ts +1 -1
- package/src/types/state_permits/KY/KYStateFacility.ts +1 -1
- package/src/types/state_permits/StateFacility.ts +1 -1
- package/src/types/state_permits/StatePermit.ts +1 -1
- package/src/types/state_permits/StatePermitDocument.ts +1 -1
- package/src/types/state_permits/StatePermitDocumentSource.ts +1 -1
- package/src/types/state_permits/StatePermitDocumentSourcePollutant.ts +1 -1
- /package/src/types/{regions → jurisdictions}/County.ts +0 -0
- /package/src/types/{regions → jurisdictions}/Municipality.ts +0 -0
- /package/src/types/{regions → jurisdictions}/SchoolDistrict.ts +0 -0
- /package/src/types/{regions → jurisdictions}/State.ts +0 -0
package/src/index.ts
CHANGED
|
@@ -66,6 +66,13 @@ export * from "./types/federal_dockets/FederalDocketCommentAttachment"
|
|
|
66
66
|
export * from "./types/federal_rules/FederalRuleTitle"
|
|
67
67
|
export * from "./types/federal_rules/FederalRuleSection"
|
|
68
68
|
|
|
69
|
+
export * from "./types/jurisdictions/County"
|
|
70
|
+
export * from "./types/jurisdictions/JurisdictionMetric"
|
|
71
|
+
export * from "./types/jurisdictions/JurisdictionTypeID"
|
|
72
|
+
export * from "./types/jurisdictions/Municipality"
|
|
73
|
+
export * from "./types/jurisdictions/SchoolDistrict"
|
|
74
|
+
export * from "./types/jurisdictions/State"
|
|
75
|
+
|
|
69
76
|
export * from "./types/label/Label"
|
|
70
77
|
|
|
71
78
|
export * from "./types/lal/LALFile"
|
|
@@ -88,11 +95,6 @@ export * from "./types/prism/Voter"
|
|
|
88
95
|
export * from "./types/prism/VoterFeature"
|
|
89
96
|
export * from "./types/prism/VoterTarget"
|
|
90
97
|
|
|
91
|
-
export * from "./types/regions/County"
|
|
92
|
-
export * from "./types/regions/Municipality"
|
|
93
|
-
export * from "./types/regions/SchoolDistrict"
|
|
94
|
-
export * from "./types/regions/State"
|
|
95
|
-
|
|
96
98
|
export * from "./types/scout/Scout"
|
|
97
99
|
export * from "./types/scout/UserScout"
|
|
98
100
|
export * from "./types/scout/UserScoutConversation"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FederalElectionCandidateAux } from "./FederalElectionCandidate"
|
|
2
2
|
import { FederalElectionCommitteeAux } from "./FederalElectionCommittee"
|
|
3
3
|
import { FederalElectionFileExpenditureAux } from "./FederalElectionFileExpenditure"
|
|
4
|
-
import { is_state_id, StateID } from "../
|
|
4
|
+
import { is_state_id, StateID } from "../jurisdictions/State"
|
|
5
5
|
|
|
6
6
|
export const federal_election_office_ids = ["H", "S", "P"] as const
|
|
7
7
|
|
|
@@ -2,7 +2,7 @@ import { FederalElectionCommitteeAux } from "./FederalElectionCommittee"
|
|
|
2
2
|
import { is_federal_election_office_id, FederalElectionOfficeID } from "./FederalElection"
|
|
3
3
|
import { FederalElectionFileExpenditureAux } from "./FederalElectionFileExpenditure"
|
|
4
4
|
import { FederalElectionF3File } from "./FederalElectionF3File"
|
|
5
|
-
import { is_state_id, StateID } from "../
|
|
5
|
+
import { is_state_id, StateID } from "../jurisdictions/State"
|
|
6
6
|
|
|
7
7
|
// export class ActivityIndex {
|
|
8
8
|
// readonly news_index : number
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { is_federal_election_office_id, FederalElectionOfficeID } from "./FederalElection"
|
|
2
2
|
import { FederalElectionFile } from "./FederalElectionFile"
|
|
3
|
-
import { is_state_id, StateID } from "../
|
|
3
|
+
import { is_state_id, StateID } from "../jurisdictions/State"
|
|
4
4
|
|
|
5
5
|
export class FederalElectionF2File extends FederalElectionFile {
|
|
6
6
|
readonly federal_election_candidate_id : string
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { is_jurisdiction_type_id, JurisdictionTypeID } from "./JurisdictionTypeID"
|
|
2
|
+
|
|
3
|
+
export class JurisdictionMetric {
|
|
4
|
+
readonly jurisdiction_type_id : JurisdictionTypeID
|
|
5
|
+
readonly jurisdiction_id : string
|
|
6
|
+
readonly metric_id : string
|
|
7
|
+
readonly value : number
|
|
8
|
+
readonly [x : string] : any
|
|
9
|
+
|
|
10
|
+
constructor(jurisdiction_metric : any) {
|
|
11
|
+
if (!JurisdictionMetric.is(jurisdiction_metric)) {
|
|
12
|
+
throw Error("Invalid input.")
|
|
13
|
+
}
|
|
14
|
+
this.jurisdiction_type_id = jurisdiction_metric.jurisdiction_type_id
|
|
15
|
+
this.jurisdiction_id = jurisdiction_metric.jurisdiction_id
|
|
16
|
+
this.metric_id = jurisdiction_metric.metric_id
|
|
17
|
+
this.value = jurisdiction_metric.value
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static is(jurisdiction_metric : any) : jurisdiction_metric is JurisdictionMetric {
|
|
21
|
+
return (
|
|
22
|
+
jurisdiction_metric !== undefined &&
|
|
23
|
+
is_jurisdiction_type_id(jurisdiction_metric.jurisdiction_type_id) &&
|
|
24
|
+
typeof jurisdiction_metric.jurisdiction_id === "string" &&
|
|
25
|
+
typeof jurisdiction_metric.metric_id === "string" &&
|
|
26
|
+
typeof jurisdiction_metric.value === "number"
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const jurisdiction_type_ids = ["state", "federal_congress_district", "state_legislature_district", "county", "municipality", "school_district"] 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
|
+
}
|
package/src/types/lal/LALFile.ts
CHANGED
package/src/types/prism/Prism.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { is_jurisdiction_type_id, JurisdictionTypeID } from "../jurisdictions/JurisdictionTypeID"
|
|
2
|
+
import { is_state_id, StateID } from "../jurisdictions/State"
|
|
2
3
|
import { is_voter_party_type_id, VoterPartyTypeID } from "./Voter"
|
|
3
4
|
|
|
4
5
|
export class Prism {
|
|
5
6
|
readonly prism_id : string
|
|
6
7
|
readonly state_id : StateID
|
|
7
8
|
readonly name : string
|
|
8
|
-
readonly
|
|
9
|
-
readonly
|
|
10
|
-
readonly state_legislature_senate_district_id? : string
|
|
11
|
-
readonly county_id? : string
|
|
12
|
-
readonly school_district_id? : string
|
|
9
|
+
readonly jurisdiction_type_id : JurisdictionTypeID
|
|
10
|
+
readonly jurisdiction_id : string
|
|
13
11
|
readonly party_type_ids? : VoterPartyTypeID[]
|
|
14
12
|
readonly target_ids : string[]
|
|
15
13
|
readonly [x : string] : any
|
|
@@ -21,11 +19,8 @@ export class Prism {
|
|
|
21
19
|
this.prism_id = prism.prism_id
|
|
22
20
|
this.state_id = prism.state_id
|
|
23
21
|
this.name = prism.name
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.state_legislature_senate_district_id = prism.state_legislature_senate_district_id
|
|
27
|
-
this.county_id = prism.county_id
|
|
28
|
-
this.school_district_id = prism.school_district_id
|
|
22
|
+
this.jurisdiction_type_id = prism.jurisdiction_type_id
|
|
23
|
+
this.jurisdiction_id = prism.jurisdiction_id
|
|
29
24
|
this.party_type_ids = prism.party_type_ids
|
|
30
25
|
this.target_ids = prism.target_ids
|
|
31
26
|
}
|
|
@@ -36,11 +31,8 @@ export class Prism {
|
|
|
36
31
|
typeof prism.prism_id === "string" &&
|
|
37
32
|
is_state_id(prism.state_id) &&
|
|
38
33
|
typeof prism.name === "string" &&
|
|
39
|
-
(prism.
|
|
40
|
-
|
|
41
|
-
(prism.state_legislature_senate_district_id === undefined || typeof prism.state_legislature_senate_district_id === "string") &&
|
|
42
|
-
(prism.county_id === undefined || typeof prism.county_id === "string") &&
|
|
43
|
-
(prism.school_district_id === undefined || typeof prism.school_district_id === "string") &&
|
|
34
|
+
is_jurisdiction_type_id(prism.jurisdiction_type_id) &&
|
|
35
|
+
typeof prism.jurisdiction_id === "string" &&
|
|
44
36
|
(prism.party_type_ids === undefined || Array.isArray(prism.party_type_ids) && prism.party_type_ids.every(is_voter_party_type_id)) &&
|
|
45
37
|
Array.isArray(prism.target_ids) && prism.target_ids.every((target_id : any) => typeof target_id === "string")
|
|
46
38
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LALFileVoter } from "../lal/LALFileVoter"
|
|
2
|
-
import { is_state_id, StateID } from "../
|
|
2
|
+
import { is_state_id, StateID } from "../jurisdictions/State"
|
|
3
3
|
import { StateVoterFeature } from "./StateVoterFeature"
|
|
4
4
|
import { StateVoterTarget } from "./StateVoterTarget"
|
|
5
5
|
import { is_voter_party_type_id, VoterPartyTypeID } from "./Voter"
|
package/src/types/prism/Voter.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { is_state_id, StateID } from "../
|
|
1
|
+
import { is_state_id, StateID } from "../jurisdictions/State"
|
|
2
2
|
import { StatePermitAux } from "./StatePermit"
|
|
3
3
|
import { StatePermitDocument } from "./StatePermitDocument"
|
|
4
4
|
import { StatePermitDocumentSourcePollutant } from "./StatePermitDocumentSourcePollutant"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|