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.
Files changed (107) hide show
  1. package/dist/src/index.d.ts +6 -4
  2. package/dist/src/index.js +6 -4
  3. package/dist/src/types/ballotpedia/BallotpediaOffice.d.ts +1 -1
  4. package/dist/src/types/ballotpedia/BallotpediaOffice.js +1 -1
  5. package/dist/src/types/federal_census/FederalCensusBlock.d.ts +1 -1
  6. package/dist/src/types/federal_census/FederalCensusBlock.js +1 -1
  7. package/dist/src/types/federal_census/FederalCensusCounty.d.ts +1 -1
  8. package/dist/src/types/federal_census/FederalCensusCounty.js +1 -1
  9. package/dist/src/types/federal_census/FederalCensusMunicipality.d.ts +1 -1
  10. package/dist/src/types/federal_census/FederalCensusMunicipality.js +1 -1
  11. package/dist/src/types/federal_census/FederalCensusSchoolDistrict.d.ts +1 -1
  12. package/dist/src/types/federal_census/FederalCensusSchoolDistrict.js +1 -1
  13. package/dist/src/types/federal_census/FederalCensusTract.d.ts +1 -1
  14. package/dist/src/types/federal_census/FederalCensusTract.js +1 -1
  15. package/dist/src/types/federal_congress/FederalCongress.d.ts +1 -1
  16. package/dist/src/types/federal_congress/FederalCongress.js +1 -1
  17. package/dist/src/types/federal_congress/FederalCongressDistrict.d.ts +1 -1
  18. package/dist/src/types/federal_congress/FederalCongressDistrict.js +1 -1
  19. package/dist/src/types/federal_congress/FederalCongressMember.d.ts +1 -1
  20. package/dist/src/types/federal_congress/FederalCongressMember.js +1 -1
  21. package/dist/src/types/federal_elections/FederalElection.d.ts +1 -1
  22. package/dist/src/types/federal_elections/FederalElection.js +1 -1
  23. package/dist/src/types/federal_elections/FederalElectionCandidate.d.ts +1 -1
  24. package/dist/src/types/federal_elections/FederalElectionCandidate.js +1 -1
  25. package/dist/src/types/federal_elections/FederalElectionDonation.d.ts +1 -1
  26. package/dist/src/types/federal_elections/FederalElectionF2File.d.ts +1 -1
  27. package/dist/src/types/federal_elections/FederalElectionF2File.js +1 -1
  28. package/dist/src/types/jurisdictions/County.d.ts +18 -0
  29. package/dist/src/types/jurisdictions/County.js +44 -0
  30. package/dist/src/types/jurisdictions/JurisdictionMetric.d.ts +10 -0
  31. package/dist/src/types/jurisdictions/JurisdictionMetric.js +23 -0
  32. package/dist/src/types/jurisdictions/JurisdictionTypeID.d.ts +3 -0
  33. package/dist/src/types/jurisdictions/JurisdictionTypeID.js +4 -0
  34. package/dist/src/types/jurisdictions/Municipality.d.ts +17 -0
  35. package/dist/src/types/jurisdictions/Municipality.js +41 -0
  36. package/dist/src/types/jurisdictions/SchoolDistrict.d.ts +16 -0
  37. package/dist/src/types/jurisdictions/SchoolDistrict.js +38 -0
  38. package/dist/src/types/jurisdictions/State.d.ts +12 -0
  39. package/dist/src/types/jurisdictions/State.js +364 -0
  40. package/dist/src/types/lal/LALFile.d.ts +1 -1
  41. package/dist/src/types/lal/LALFile.js +1 -1
  42. package/dist/src/types/lal/LALFileVoter.d.ts +1 -1
  43. package/dist/src/types/lal/LALFileVoter.js +1 -1
  44. package/dist/src/types/prism/Prism.d.ts +4 -6
  45. package/dist/src/types/prism/Prism.js +8 -16
  46. package/dist/src/types/prism/StateVoter.d.ts +1 -1
  47. package/dist/src/types/prism/StateVoter.js +1 -1
  48. package/dist/src/types/prism/StateVoterFeature.d.ts +1 -1
  49. package/dist/src/types/prism/StateVoterFeature.js +1 -1
  50. package/dist/src/types/prism/StateVoterTarget.d.ts +1 -1
  51. package/dist/src/types/prism/StateVoterTarget.js +1 -1
  52. package/dist/src/types/prism/Voter.d.ts +1 -1
  53. package/dist/src/types/prism/Voter.js +1 -1
  54. package/dist/src/types/prism/VoterFeature.d.ts +1 -1
  55. package/dist/src/types/prism/VoterFeature.js +1 -1
  56. package/dist/src/types/prism/VoterTarget.d.ts +1 -1
  57. package/dist/src/types/prism/VoterTarget.js +1 -1
  58. package/dist/src/types/state_legislature/StateLegislatureDistrict.d.ts +1 -1
  59. package/dist/src/types/state_legislature/StateLegislatureDistrict.js +1 -1
  60. package/dist/src/types/state_permits/StateFacility.d.ts +1 -1
  61. package/dist/src/types/state_permits/StateFacility.js +1 -1
  62. package/dist/src/types/state_permits/StatePermit.d.ts +1 -1
  63. package/dist/src/types/state_permits/StatePermit.js +1 -1
  64. package/dist/src/types/state_permits/StatePermitDocument.d.ts +1 -1
  65. package/dist/src/types/state_permits/StatePermitDocument.js +1 -1
  66. package/dist/src/types/state_permits/StatePermitDocumentSource.d.ts +1 -1
  67. package/dist/src/types/state_permits/StatePermitDocumentSource.js +1 -1
  68. package/dist/src/types/state_permits/StatePermitDocumentSourcePollutant.d.ts +1 -1
  69. package/dist/src/types/state_permits/StatePermitDocumentSourcePollutant.js +1 -1
  70. package/package.json +1 -1
  71. package/src/index.ts +7 -5
  72. package/src/types/ballotpedia/BallotpediaOffice.ts +1 -1
  73. package/src/types/federal_census/FederalCensusBlock.ts +1 -1
  74. package/src/types/federal_census/FederalCensusCounty.ts +1 -1
  75. package/src/types/federal_census/FederalCensusMunicipality.ts +1 -1
  76. package/src/types/federal_census/FederalCensusSchoolDistrict.ts +1 -1
  77. package/src/types/federal_census/FederalCensusTract.ts +1 -1
  78. package/src/types/federal_congress/FederalCongress.ts +1 -1
  79. package/src/types/federal_congress/FederalCongressDistrict.ts +1 -1
  80. package/src/types/federal_congress/FederalCongressMember.ts +1 -1
  81. package/src/types/federal_elections/FederalElection.ts +1 -1
  82. package/src/types/federal_elections/FederalElectionCandidate.ts +1 -1
  83. package/src/types/federal_elections/FederalElectionDonation.ts +1 -1
  84. package/src/types/federal_elections/FederalElectionF2File.ts +1 -1
  85. package/src/types/jurisdictions/JurisdictionMetric.ts +29 -0
  86. package/src/types/jurisdictions/JurisdictionTypeID.ts +7 -0
  87. package/src/types/lal/LALFile.ts +1 -1
  88. package/src/types/lal/LALFileVoter.ts +1 -1
  89. package/src/types/prism/Prism.ts +8 -16
  90. package/src/types/prism/StateVoter.ts +1 -1
  91. package/src/types/prism/StateVoterFeature.ts +1 -1
  92. package/src/types/prism/StateVoterTarget.ts +1 -1
  93. package/src/types/prism/TenantVoterTag.ts +1 -1
  94. package/src/types/prism/Voter.ts +1 -1
  95. package/src/types/prism/VoterFeature.ts +1 -1
  96. package/src/types/prism/VoterTarget.ts +1 -1
  97. package/src/types/state_legislature/StateLegislatureDistrict.ts +1 -1
  98. package/src/types/state_permits/KY/KYStateFacility.ts +1 -1
  99. package/src/types/state_permits/StateFacility.ts +1 -1
  100. package/src/types/state_permits/StatePermit.ts +1 -1
  101. package/src/types/state_permits/StatePermitDocument.ts +1 -1
  102. package/src/types/state_permits/StatePermitDocumentSource.ts +1 -1
  103. package/src/types/state_permits/StatePermitDocumentSourcePollutant.ts +1 -1
  104. /package/src/types/{regions → jurisdictions}/County.ts +0 -0
  105. /package/src/types/{regions → jurisdictions}/Municipality.ts +0 -0
  106. /package/src/types/{regions → jurisdictions}/SchoolDistrict.ts +0 -0
  107. /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,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
 
3
3
  const ballotpedia_office_type_ids = ["F", "S", "L"] as const
4
4
 
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
 
3
3
  export class FederalCensusBlock {
4
4
  readonly federal_census_block_id : string
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
 
3
3
  export class FederalCensusCounty {
4
4
  readonly federal_census_county_id : string
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
 
3
3
  export class FederalCensusMunicipality {
4
4
  readonly federal_census_municipality_id : string
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
 
3
3
  export const federal_census_school_district_type_ids = ["UNIFIED", "PRIMARY", "SECONDARY"] as const
4
4
 
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
 
3
3
  export class FederalCensusTract {
4
4
  readonly federal_census_tract_id : string
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
 
3
3
  export class FederalCongress {
4
4
  readonly federal_congress_id : number
@@ -1,4 +1,4 @@
1
- import { is_state_id, state_ids, StateID } from "../regions/State"
1
+ import { is_state_id, state_ids, StateID } from "../jurisdictions/State"
2
2
 
3
3
  export class FederalCongressDistrict {
4
4
  readonly federal_congress_district_id : string
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
 
3
3
  export class FederalCongressMember {
4
4
  readonly federal_congress_member_id : string
@@ -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 "../regions/State"
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 "../regions/State"
5
+ import { is_state_id, StateID } from "../jurisdictions/State"
6
6
 
7
7
  // export class ActivityIndex {
8
8
  // readonly news_index : number
@@ -1,4 +1,4 @@
1
- import { StateID } from "../regions/State"
1
+ import { StateID } from "../jurisdictions/State"
2
2
 
3
3
  export class FederalElectionDonation {
4
4
  readonly federal_election_donation_id : string
@@ -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 "../regions/State"
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
+ }
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
 
3
3
  export class LALFile {
4
4
  readonly lal_file_id : string
@@ -1,5 +1,5 @@
1
1
  import { is_voter_party_type_id, VoterPartyTypeID } from "../prism/Voter"
2
- import { is_state_id, StateID } from "../regions/State"
2
+ import { is_state_id, StateID } from "../jurisdictions/State"
3
3
 
4
4
  export class LALFileVoter {
5
5
  readonly lal_file_id : string
@@ -1,15 +1,13 @@
1
- import { is_state_id, StateID } from "../regions/State"
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 federal_congress_district_id? : string
9
- readonly state_legislature_house_district_id? : string
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.federal_congress_district_id = prism.federal_congress_district_id
25
- this.state_legislature_house_district_id = prism.state_legislature_house_district_id
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.federal_congress_district_id === undefined || typeof prism.federal_congress_district_id === "string") &&
40
- (prism.state_legislature_house_district_id === undefined || typeof prism.state_legislature_house_district_id === "string") &&
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 "../regions/State"
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"
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
  import { is_voter_party_type_id, VoterPartyTypeID } from "./Voter"
3
3
 
4
4
  export class StateVoterFeature {
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
  import { is_voter_party_type_id, VoterPartyTypeID } from "./Voter"
3
3
 
4
4
  export class StateVoterTarget {
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
 
3
3
  export class TenantVoterTag {
4
4
  readonly tenant_voter_tag_id : string
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
  import { VoterFeature } from "./VoterFeature"
3
3
  import { VoterTarget } from "./VoterTarget"
4
4
 
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
  import { is_voter_party_type_id, VoterPartyTypeID } from "./Voter"
3
3
 
4
4
  export class VoterFeature {
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
  import { is_voter_party_type_id, VoterPartyTypeID } from "./Voter"
3
3
 
4
4
  export class VoterTarget {
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
 
3
3
  export class StateLegislatureDistrict {
4
4
  readonly state_legislature_district_id : string
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../../regions/State"
1
+ import { is_state_id, StateID } from "../../jurisdictions/State"
2
2
  import { StateFacility } from "../StateFacility"
3
3
 
4
4
  export class KYStateFacility extends StateFacility {
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
  import { StatePermitAux } from "./StatePermit"
3
3
 
4
4
  export class StateFacility {
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
  import { StateFacility } from "./StateFacility"
3
3
 
4
4
  export class StatePermit {
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
  import { StatePermitDocumentSourceAux } from "./StatePermitDocumentSource"
3
3
 
4
4
  export class StatePermitComment {
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
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"
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../regions/State"
1
+ import { is_state_id, StateID } from "../jurisdictions/State"
2
2
 
3
3
  export class StatePermitDocumentSourcePollutant {
4
4
  readonly state_permit_document_source_pollutant_id : string
File without changes
File without changes