elections-types 1.0.85 → 1.0.87

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 (38) hide show
  1. package/dist/src/index.d.ts +5 -5
  2. package/dist/src/index.js +5 -5
  3. package/dist/src/types/Candidate.d.ts +3 -3
  4. package/dist/src/types/Candidate.js +6 -6
  5. package/dist/src/types/Committee.d.ts +3 -3
  6. package/dist/src/types/Committee.js +11 -11
  7. package/dist/src/types/ElectionsConfig.d.ts +1 -1
  8. package/dist/src/types/Expenditure.d.ts +3 -3
  9. package/dist/src/types/Expenditure.js +7 -7
  10. package/dist/src/types/FederalDonation.d.ts +1 -1
  11. package/dist/src/types/FederalDonation.js +3 -3
  12. package/dist/src/types/FederalElectionF1File.d.ts +18 -0
  13. package/dist/src/types/FederalElectionF1File.js +48 -0
  14. package/dist/src/types/FederalElectionF24File.d.ts +12 -0
  15. package/dist/src/types/FederalElectionF24File.js +32 -0
  16. package/dist/src/types/FederalElectionF2File.d.ts +15 -0
  17. package/dist/src/types/FederalElectionF2File.js +39 -0
  18. package/dist/src/types/FederalElectionF3File.d.ts +13 -0
  19. package/dist/src/types/FederalElectionF3File.js +37 -0
  20. package/dist/src/types/FederalElectionFile.d.ts +15 -0
  21. package/dist/src/types/FederalElectionFile.js +33 -0
  22. package/package.json +1 -1
  23. package/src/index.ts +5 -5
  24. package/src/types/Candidate.ts +7 -7
  25. package/src/types/Committee.ts +11 -11
  26. package/src/types/ElectionsConfig.ts +1 -1
  27. package/src/types/Expenditure.ts +7 -7
  28. package/src/types/FederalDonation.ts +3 -3
  29. package/src/types/FederalElectionF1File.ts +53 -0
  30. package/src/types/FederalElectionF24File.ts +37 -0
  31. package/src/types/FederalElectionF2File.ts +44 -0
  32. package/src/types/FederalElectionF3File.ts +42 -0
  33. package/src/types/FederalElectionFile.ts +43 -0
  34. package/src/types/FECF1File.ts +0 -53
  35. package/src/types/FECF24File.ts +0 -37
  36. package/src/types/FECF2File.ts +0 -44
  37. package/src/types/FECF3File.ts +0 -42
  38. package/src/types/FECFile.ts +0 -43
@@ -1,7 +1,7 @@
1
1
  import { Committee, CommitteeAux } from "./Committee"
2
2
  import { ElectionID, is_election_id, is_office_id, OfficeID } from "./Election"
3
3
  import { Expenditure, ExpenditureAux } from "./Expenditure"
4
- import { FECF3File } from "./FECF3File"
4
+ import { FederalElectionF3File } from "./FederalElectionF3File"
5
5
  import { is_state_id, StateID } from "./State"
6
6
 
7
7
  export class ActivityIndex {
@@ -38,7 +38,7 @@ export class Candidate {
38
38
  readonly party_id? : string
39
39
  readonly active? : boolean
40
40
  readonly status? : string
41
- readonly fec_file_id? : number
41
+ readonly federal_election_file_id? : number
42
42
  readonly ballotpedia_name? : string
43
43
  readonly ballotpedia_url? : string
44
44
  readonly ballotpedia_data? : Record<string, any>
@@ -61,7 +61,7 @@ export class Candidate {
61
61
  this.party_id = candidate.party_id
62
62
  this.active = candidate.active
63
63
  this.status = candidate.status
64
- this.fec_file_id = candidate.fec_file_id
64
+ this.federal_election_file_id = candidate.federal_election_file_id
65
65
  this.ballotpedia_name = candidate.ballotpedia_name
66
66
  this.ballotpedia_url = candidate.ballotpedia_url
67
67
  this.ballotpedia_data = candidate.ballotpedia_data
@@ -80,7 +80,7 @@ export class Candidate {
80
80
  (candidate.party_id === undefined || typeof candidate.party_id === "string") &&
81
81
  (candidate.active === undefined || typeof candidate.active === "boolean") &&
82
82
  (candidate.status === undefined || typeof candidate.status === "string") &&
83
- (candidate.fec_file_id === undefined || typeof candidate.fec_file_id === "number" && !isNaN(candidate.fec_file_id)) &&
83
+ (candidate.federal_election_file_id === undefined || typeof candidate.federal_election_file_id === "number" && !isNaN(candidate.federal_election_file_id)) &&
84
84
  (candidate.ballotpedia_name === undefined || typeof candidate.ballotpedia_name === "string") &&
85
85
  (candidate.ballotpedia_url === undefined || typeof candidate.ballotpedia_url === "string") &&
86
86
  (candidate.ballotpedia_data === undefined || typeof candidate.ballotpedia_data === "object" && Object.keys(candidate.ballotpedia_data).map((key : any) => typeof key === "string")) &&
@@ -91,7 +91,7 @@ export class Candidate {
91
91
 
92
92
  export class CandidateAux extends Candidate {
93
93
  readonly committees : CommitteeAux[]
94
- readonly fec_f3_files : FECF3File[]
94
+ readonly fec_f3_files : FederalElectionF3File[]
95
95
  readonly expenditures : ExpenditureAux[]
96
96
 
97
97
  constructor(candidate : any) {
@@ -100,7 +100,7 @@ export class CandidateAux extends Candidate {
100
100
  }
101
101
  super(candidate)
102
102
  this.committees = candidate.committees
103
- this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
103
+ this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FederalElectionF3File(fec_f3_file))
104
104
  this.expenditures = candidate.expenditures.map(expenditure => new ExpenditureAux(expenditure))
105
105
  }
106
106
 
@@ -110,7 +110,7 @@ export class CandidateAux extends Candidate {
110
110
  Array.isArray(candidate.committees) &&
111
111
  candidate.committees.every(CommitteeAux.is) &&
112
112
  Array.isArray(candidate.fec_f3_files) &&
113
- candidate.fec_f3_files.every(FECF3File.is) &&
113
+ candidate.fec_f3_files.every(FederalElectionF3File.is) &&
114
114
  Array.isArray(candidate.expenditures) &&
115
115
  candidate.expenditures.every(ExpenditureAux.is)
116
116
  )
@@ -1,6 +1,6 @@
1
1
  import { Candidate } from "./Candidate"
2
2
  import { CandidateCommittee } from "./CandidateCommittee"
3
- import { FECF3File } from "./FECF3File"
3
+ import { FederalElectionF3File } from "./FederalElectionF3File"
4
4
 
5
5
  export const designations = ["P", "A", "U", "J", "D", "B"] as const
6
6
 
@@ -15,7 +15,7 @@ export class Committee {
15
15
  readonly name : string
16
16
  readonly url? : string
17
17
  readonly designation? : CommitteeDesignation
18
- readonly fec_file_id? : number
18
+ readonly federal_election_file_id? : number
19
19
  readonly jfp_committee_ids? : string[]
20
20
  readonly jfr_committee_ids : string[]
21
21
  readonly aff_committee_ids : string[]
@@ -29,7 +29,7 @@ export class Committee {
29
29
  this.name = committee.name
30
30
  this.url = committee.url
31
31
  this.designation = committee.designation
32
- this.fec_file_id = committee.fec_file_id
32
+ this.federal_election_file_id = committee.federal_election_file_id
33
33
  this.jfp_committee_ids = committee.jfp_committee_ids
34
34
  this.jfr_committee_ids = committee.jfr_committee_ids
35
35
  this.aff_committee_ids = committee.aff_committee_ids
@@ -42,7 +42,7 @@ export class Committee {
42
42
  typeof committee.name === "string" &&
43
43
  (committee.url === undefined || typeof committee.url === "string") &&
44
44
  (committee.designation === undefined || is_committee_designation(committee.designation)) &&
45
- (committee.fec_file_id === undefined || typeof committee.fec_file_id === "number" && !isNaN(committee.fec_file_id)) &&
45
+ (committee.federal_election_file_id === undefined || typeof committee.federal_election_file_id === "number" && !isNaN(committee.federal_election_file_id)) &&
46
46
  (committee.jfp_committee_ids === undefined || Array.isArray(committee.jfp_committee_ids) && committee.jfp_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
47
47
  (Array.isArray(committee.jfr_committee_ids) && committee.jfr_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
48
48
  (Array.isArray(committee.aff_committee_ids) && committee.aff_committee_ids.every((committee_id : any) => typeof committee_id === "string"))
@@ -52,7 +52,7 @@ export class Committee {
52
52
 
53
53
  export class CommitteeAux extends Committee {
54
54
  readonly candidates : Candidate[]
55
- readonly fec_f3_files : FECF3File[]
55
+ readonly federal_election_f3_files : FederalElectionF3File[]
56
56
  readonly jfp_committees? : Committee[]
57
57
  readonly jfr_committees : Committee[]
58
58
  readonly aff_committees : Committee[]
@@ -63,10 +63,10 @@ export class CommitteeAux extends Committee {
63
63
  }
64
64
  super(committee)
65
65
  this.candidates = committee.candidates
66
- this.fec_f3_files = committee.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
67
- this.jfp_committees = committee.jfp_committees !== undefined ? committee.jfp_committees.map(committee => new Committee(committee)) : undefined
68
- this.jfr_committees = committee.jfr_committees.map(committee => new Committee(committee))
69
- this.aff_committees = committee.aff_committees.map(committee => new Committee(committee))
66
+ this.federal_election_f3_files = committee.federal_election_f3_files
67
+ this.jfp_committees = committee.jfp_committees
68
+ this.jfr_committees = committee.jfr_committees
69
+ this.aff_committees = committee.aff_committees
70
70
  }
71
71
 
72
72
  static is(committee : any) : committee is CommitteeAux {
@@ -74,8 +74,8 @@ export class CommitteeAux extends Committee {
74
74
  Committee.is(committee) &&
75
75
  Array.isArray(committee.candidates) &&
76
76
  committee.candidates.every(Candidate.is) &&
77
- Array.isArray(committee.fec_f3_files) &&
78
- committee.fec_f3_files.every(FECF3File.is) &&
77
+ Array.isArray(committee.federal_election_f3_files) &&
78
+ committee.federal_election_f3_files.every(FederalElectionF3File.is) &&
79
79
  (committee.jfp_committees === undefined || Array.isArray(committee.jfp_committees) && committee.jfp_committees.every(Committee.is)) &&
80
80
  (Array.isArray(committee.jfr_committees) && committee.jfr_committees.every(Committee.is)) &&
81
81
  (Array.isArray(committee.aff_committees) && committee.aff_committees.every(Committee.is))
@@ -33,7 +33,7 @@ export interface ElectionsConfig extends ElectionsUtilsConfig {
33
33
  dynamodb_candidate_tweets : string,
34
34
  dynamodb_videos : string,
35
35
  dynamodb_candidate_videos : string,
36
- dynamodb_fec_files : string,
36
+ dynamodb_federal_election_files : string,
37
37
  dynamodb_federal_donations : string,
38
38
  dynamodb_fetch_history : string,
39
39
  s3_bucket : string
@@ -1,10 +1,10 @@
1
1
  import { Candidate } from "./Candidate"
2
2
  import { Committee } from "./Committee"
3
3
  import { ElectionID, is_election_id } from "./Election"
4
- import { FECF24File } from "./FECF24File"
4
+ import { FederalElectionF24File } from "./FederalElectionF24File"
5
5
 
6
6
  export class Expenditure {
7
- readonly fec_file_id : number
7
+ readonly federal_election_file_id : number
8
8
  readonly expenditure_id : string
9
9
  readonly committee_id : string
10
10
  readonly date : string
@@ -22,7 +22,7 @@ export class Expenditure {
22
22
  if (!Expenditure.is(expenditure)) {
23
23
  throw Error("Invalid input.")
24
24
  }
25
- this.fec_file_id = expenditure.fec_file_id
25
+ this.federal_election_file_id = expenditure.federal_election_file_id
26
26
  this.expenditure_id = expenditure.expenditure_id
27
27
  this.committee_id = expenditure.committee_id
28
28
  this.date = expenditure.date
@@ -39,7 +39,7 @@ export class Expenditure {
39
39
  static is(expenditure : any) : expenditure is Expenditure {
40
40
  return (
41
41
  expenditure !== undefined &&
42
- typeof expenditure.fec_file_id === "number" &&
42
+ typeof expenditure.federal_election_file_id === "number" &&
43
43
  typeof expenditure.expenditure_id === "string" &&
44
44
  typeof expenditure.committee_id === "string" &&
45
45
  typeof expenditure.date === "string" &&
@@ -59,7 +59,7 @@ export class Expenditure {
59
59
  export class ExpenditureAux extends Expenditure {
60
60
  readonly candidate : Candidate
61
61
  readonly committee : Committee
62
- readonly fec_f24_file : FECF24File
62
+ readonly federal_election_f24_file : FederalElectionF24File
63
63
 
64
64
  constructor(expenditure : any) {
65
65
  if (!ExpenditureAux.is(expenditure)) {
@@ -68,7 +68,7 @@ export class ExpenditureAux extends Expenditure {
68
68
  super(expenditure)
69
69
  this.candidate = new Candidate(expenditure.candidate)
70
70
  this.committee = new Committee(expenditure.committee)
71
- this.fec_f24_file = new FECF24File(expenditure.fec_f24_file)
71
+ this.federal_election_f24_file = new FederalElectionF24File(expenditure.federal_election_f24_file)
72
72
  }
73
73
 
74
74
  static is(expenditure : any) : expenditure is ExpenditureAux {
@@ -76,7 +76,7 @@ export class ExpenditureAux extends Expenditure {
76
76
  Expenditure.is(expenditure) &&
77
77
  Candidate.is(expenditure.candidate) &&
78
78
  Committee.is(expenditure.committee) &&
79
- FECF24File.is(expenditure.fec_f24_file)
79
+ FederalElectionF24File.is(expenditure.federal_election_f24_file)
80
80
  )
81
81
  }
82
82
  }
@@ -6,7 +6,7 @@ export class FederalDonation {
6
6
  readonly sub_id : string
7
7
  readonly committee_id : string
8
8
  readonly target_committee_id? : string
9
- readonly fec_file_id : number
9
+ readonly federal_election_file_id : number
10
10
  readonly image_number : string
11
11
  readonly amount : number
12
12
  readonly donor_is_individual : boolean
@@ -36,7 +36,7 @@ export class FederalDonation {
36
36
  this.sub_id = federal_donation.sub_id
37
37
  this.committee_id = federal_donation.committee_id
38
38
  this.target_committee_id = federal_donation.target_committee_id
39
- this.fec_file_id = federal_donation.fec_file_id
39
+ this.federal_election_file_id = federal_donation.federal_election_file_id
40
40
  this.image_number = federal_donation.image_number
41
41
  this.amount = federal_donation.amount
42
42
  this.donor_is_individual = federal_donation.donor_is_individual
@@ -66,7 +66,7 @@ export class FederalDonation {
66
66
  typeof federal_donation.sub_id === "string" &&
67
67
  typeof federal_donation.committee_id === "string" &&
68
68
  (federal_donation.target_committee_id === undefined || typeof federal_donation.target_committee_id === "string") &&
69
- typeof federal_donation.fec_file_id === "number" && !isNaN(federal_donation.fec_file_id) &&
69
+ typeof federal_donation.federal_election_file_id === "number" && !isNaN(federal_donation.federal_election_file_id) &&
70
70
  typeof federal_donation.image_number === "string" &&
71
71
  typeof federal_donation.amount === "number" && !isNaN(federal_donation.amount) &&
72
72
  typeof federal_donation.donor_is_individual === "boolean" &&
@@ -0,0 +1,53 @@
1
+ import { CommitteeDesignation, is_committee_designation } from "./Committee"
2
+ import { ElectionID, is_election_id } from "./Election"
3
+ import { FederalElectionFile } from "./FederalElectionFile"
4
+
5
+ export class FederalElectionF1File extends FederalElectionFile {
6
+ readonly committee_id : string
7
+ readonly name : string
8
+ readonly url? : string
9
+ readonly report_date : string
10
+ readonly designation : CommitteeDesignation
11
+ readonly election_id? : ElectionID
12
+ readonly candidate_id? : string
13
+ readonly jfp_committee_ids? : string[]
14
+ readonly jfr_committee_ids : string[]
15
+ readonly aff_committee_ids : string[]
16
+ readonly sponsor_candidate_ids? : string[]
17
+
18
+ constructor(federal_election_file : any) {
19
+ if (!FederalElectionF1File.is(federal_election_file)) {
20
+ throw Error("Invalid input.")
21
+ }
22
+ super(federal_election_file)
23
+ this.committee_id = federal_election_file.committee_id
24
+ this.name = federal_election_file.name
25
+ this.url = federal_election_file.url
26
+ this.report_date = federal_election_file.report_date
27
+ this.designation = federal_election_file.designation
28
+ this.election_id = federal_election_file.election_id
29
+ this.candidate_id = federal_election_file.candidate_id
30
+ this.jfp_committee_ids = federal_election_file.jfp_committee_ids
31
+ this.jfr_committee_ids = federal_election_file.jfr_committee_ids
32
+ this.aff_committee_ids = federal_election_file.aff_committee_ids
33
+ this.sponsor_candidate_ids = federal_election_file.sponsor_candidate_ids
34
+ }
35
+
36
+ static is(federal_election_file : any) : federal_election_file is FederalElectionF1File {
37
+ return (
38
+ FederalElectionFile.is(federal_election_file) &&
39
+ federal_election_file.form_type_id === "F1" &&
40
+ typeof federal_election_file.committee_id === "string" &&
41
+ typeof federal_election_file.name === "string" &&
42
+ (federal_election_file.url === undefined || typeof federal_election_file.url === "string") &&
43
+ typeof federal_election_file.report_date === "string" &&
44
+ is_committee_designation(federal_election_file.designation) &&
45
+ (federal_election_file.election_id === undefined || is_election_id(federal_election_file.election_id)) &&
46
+ (federal_election_file.candidate_id === undefined || typeof federal_election_file.candidate_id === "string") &&
47
+ (federal_election_file.jfp_committee_ids === undefined || Array.isArray(federal_election_file.jfp_committee_ids) && federal_election_file.jfp_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
48
+ (Array.isArray(federal_election_file.jfr_committee_ids) && federal_election_file.jfr_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
49
+ (Array.isArray(federal_election_file.aff_committee_ids) && federal_election_file.aff_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
50
+ (federal_election_file.sponsor_candidate_ids === undefined || Array.isArray(federal_election_file.sponsor_candidate_ids) && federal_election_file.sponsor_candidate_ids.every((committee_id : any) => typeof committee_id === "string"))
51
+ )
52
+ }
53
+ }
@@ -0,0 +1,37 @@
1
+ import { Expenditure } from "./Expenditure"
2
+ import { FederalElectionFile } from "./FederalElectionFile"
3
+
4
+ export class FederalElectionF24File extends FederalElectionFile {
5
+ readonly committee_id : string
6
+ readonly first_federal_election_file_id : number
7
+ readonly report_type : string
8
+ readonly first_report_date : string
9
+ readonly report_date : string
10
+ readonly expenditures : Expenditure[]
11
+
12
+ constructor(federal_election_file : any) {
13
+ if (!FederalElectionF24File.is(federal_election_file)) {
14
+ throw Error("Invalid input.")
15
+ }
16
+ super(federal_election_file)
17
+ this.committee_id = federal_election_file.committee_id
18
+ this.first_federal_election_file_id = federal_election_file.first_federal_election_file_id
19
+ this.report_type = federal_election_file.report_type
20
+ this.first_report_date = federal_election_file.first_report_date
21
+ this.report_date = federal_election_file.report_date
22
+ this.expenditures = federal_election_file.expenditures
23
+ }
24
+
25
+ static is(federal_election_file : any) : federal_election_file is FederalElectionF24File {
26
+ return (
27
+ FederalElectionFile.is(federal_election_file) &&
28
+ federal_election_file.form_type_id === "F24" &&
29
+ typeof federal_election_file.committee_id === "string" &&
30
+ typeof federal_election_file.first_federal_election_file_id === "number" &&
31
+ typeof federal_election_file.report_type === "string" &&
32
+ typeof federal_election_file.first_report_date === "string" &&
33
+ typeof federal_election_file.report_date === "string" &&
34
+ Array.isArray(federal_election_file.expenditures) && federal_election_file.expenditures.every(Expenditure.is)
35
+ )
36
+ }
37
+ }
@@ -0,0 +1,44 @@
1
+ import { ElectionID, is_election_id, is_office_id, OfficeID } from "./Election"
2
+ import { FederalElectionFile } from "./FederalElectionFile"
3
+ import { is_state_id, StateID } from "./State"
4
+
5
+ export class FederalElectionF2File extends FederalElectionFile {
6
+ readonly candidate_id : string
7
+ readonly fec_name : string
8
+ readonly office_id : OfficeID
9
+ readonly state_id : StateID
10
+ readonly district? : number
11
+ readonly election_id : ElectionID
12
+ readonly party_id? : string
13
+ readonly report_date : string
14
+
15
+ constructor(federal_election_file : any) {
16
+ if (!FederalElectionF2File.is(federal_election_file)) {
17
+ throw Error("Invalid input.")
18
+ }
19
+ super(federal_election_file)
20
+ this.candidate_id = federal_election_file.candidate_id
21
+ this.fec_name = federal_election_file.fec_name
22
+ this.office_id = federal_election_file.office_id
23
+ this.state_id = federal_election_file.state_id
24
+ this.district = federal_election_file.district
25
+ this.election_id = federal_election_file.election_id
26
+ this.party_id = federal_election_file.party_id
27
+ this.report_date = federal_election_file.report_date
28
+ }
29
+
30
+ static is(federal_election_file : any) : federal_election_file is FederalElectionF2File {
31
+ return (
32
+ FederalElectionFile.is(federal_election_file) &&
33
+ federal_election_file.form_type_id === "F2" &&
34
+ typeof federal_election_file.candidate_id === "string" &&
35
+ typeof federal_election_file.fec_name === "string" &&
36
+ is_office_id(federal_election_file.office_id) &&
37
+ is_state_id(federal_election_file.state_id) &&
38
+ (federal_election_file.district === undefined || typeof federal_election_file.district === "number") &&
39
+ is_election_id(federal_election_file.election_id) &&
40
+ (federal_election_file.party_id === undefined || typeof federal_election_file.party_id === "string") &&
41
+ typeof federal_election_file.report_date === "string"
42
+ )
43
+ }
44
+ }
@@ -0,0 +1,42 @@
1
+ import { FederalElectionFile } from "./FederalElectionFile"
2
+
3
+ export class FederalElectionF3File extends FederalElectionFile {
4
+ readonly committee_id : string
5
+ readonly period_id : string
6
+ readonly period_start_date : string
7
+ readonly period_end_date : string
8
+ readonly report_date : string
9
+ readonly cash_on_hand : number
10
+ readonly cumulative_receipts : number
11
+ readonly new_receipts : number
12
+
13
+ constructor(federal_election_file : any) {
14
+ if (!FederalElectionF3File.is(federal_election_file)) {
15
+ throw Error("Invalid input.")
16
+ }
17
+ super(federal_election_file)
18
+ this.committee_id = federal_election_file.committee_id
19
+ this.period_id = federal_election_file.period_id
20
+ this.period_start_date = federal_election_file.period_start_date
21
+ this.period_end_date = federal_election_file.period_end_date
22
+ this.report_date = federal_election_file.report_date
23
+ this.cash_on_hand = federal_election_file.cash_on_hand
24
+ this.cumulative_receipts = federal_election_file.cumulative_receipts
25
+ this.new_receipts = federal_election_file.new_receipts
26
+ }
27
+
28
+ static is(federal_election_file : any) : federal_election_file is FederalElectionF3File {
29
+ return (
30
+ FederalElectionFile.is(federal_election_file) &&
31
+ federal_election_file.form_type_id === "F3" &&
32
+ typeof federal_election_file.committee_id === "string" &&
33
+ typeof federal_election_file.period_id === "string" &&
34
+ typeof federal_election_file.period_start_date === "string" &&
35
+ typeof federal_election_file.period_end_date === "string" &&
36
+ typeof federal_election_file.report_date === "string" &&
37
+ typeof federal_election_file.cash_on_hand === "number" &&
38
+ typeof federal_election_file.cumulative_receipts === "number" &&
39
+ typeof federal_election_file.new_receipts === "number"
40
+ )
41
+ }
42
+ }
@@ -0,0 +1,43 @@
1
+ import { AmendmentTypeID, FormTypeID, is_amendment_type_id, is_form_type_id, is_long_form_type_id, LongFormTypeID } from "./FormTypeID"
2
+
3
+ export const form_version_ids = ["8.1", "8.2", "8.3", "8.4", "8.5"] as const
4
+
5
+ export type FormVersionID = typeof form_version_ids[number]
6
+
7
+ export function is_form_version_id(form_version_id : any) : form_version_id is FormVersionID {
8
+ return form_version_ids.includes(form_version_id)
9
+ }
10
+
11
+ export class FederalElectionFile {
12
+ readonly federal_election_file_id : number
13
+ readonly form_version_id : FormVersionID
14
+ readonly form_type_id : FormTypeID
15
+ readonly amendment_type_id : AmendmentTypeID
16
+ readonly long_form_type_id : LongFormTypeID
17
+ readonly s3_id : string
18
+ [x : string] : any
19
+
20
+ constructor(federal_election_file : any) {
21
+ if (!FederalElectionFile.is(federal_election_file)) {
22
+ throw Error("Invalid input.")
23
+ }
24
+ this.federal_election_file_id = federal_election_file.federal_election_file_id
25
+ this.form_version_id = federal_election_file.form_version_id
26
+ this.form_type_id = federal_election_file.form_type_id
27
+ this.amendment_type_id = federal_election_file.amendment_type_id
28
+ this.long_form_type_id = federal_election_file.long_form_type_id
29
+ this.s3_id = federal_election_file.s3_id
30
+ }
31
+
32
+ static is(federal_election_file : any) : federal_election_file is FederalElectionFile {
33
+ return (
34
+ federal_election_file !== undefined &&
35
+ typeof federal_election_file.federal_election_file_id === "number" &&
36
+ is_form_version_id(federal_election_file.form_version_id) &&
37
+ is_form_type_id(federal_election_file.form_type_id) &&
38
+ is_amendment_type_id(federal_election_file.amendment_type_id) &&
39
+ is_long_form_type_id(federal_election_file.long_form_type_id) &&
40
+ (federal_election_file.s3_id === undefined || typeof federal_election_file.s3_id === "string")
41
+ )
42
+ }
43
+ }
@@ -1,53 +0,0 @@
1
- import { CommitteeDesignation, is_committee_designation } from "./Committee"
2
- import { ElectionID, is_election_id } from "./Election"
3
- import { FECFile } from "./FECFile"
4
-
5
- export class FECF1File extends FECFile {
6
- readonly committee_id : string
7
- readonly name : string
8
- readonly url? : string
9
- readonly report_date : string
10
- readonly designation : CommitteeDesignation
11
- readonly election_id? : ElectionID
12
- readonly candidate_id? : string
13
- readonly jfp_committee_ids? : string[]
14
- readonly jfr_committee_ids : string[]
15
- readonly aff_committee_ids : string[]
16
- readonly sponsor_candidate_ids? : string[]
17
-
18
- constructor(fec_file : any) {
19
- if (!FECF1File.is(fec_file)) {
20
- throw Error("Invalid input.")
21
- }
22
- super(fec_file)
23
- this.committee_id = fec_file.committee_id
24
- this.name = fec_file.name
25
- this.url = fec_file.url
26
- this.report_date = fec_file.report_date
27
- this.designation = fec_file.designation
28
- this.election_id = fec_file.election_id
29
- this.candidate_id = fec_file.candidate_id
30
- this.jfp_committee_ids = fec_file.jfp_committee_ids
31
- this.jfr_committee_ids = fec_file.jfr_committee_ids
32
- this.aff_committee_ids = fec_file.aff_committee_ids
33
- this.sponsor_candidate_ids = fec_file.sponsor_candidate_ids
34
- }
35
-
36
- static is(fec_file : any) : fec_file is FECF1File {
37
- return (
38
- FECFile.is(fec_file) &&
39
- fec_file.form_type_id === "F1" &&
40
- typeof fec_file.committee_id === "string" &&
41
- typeof fec_file.name === "string" &&
42
- (fec_file.url === undefined || typeof fec_file.url === "string") &&
43
- typeof fec_file.report_date === "string" &&
44
- is_committee_designation(fec_file.designation) &&
45
- (fec_file.election_id === undefined || is_election_id(fec_file.election_id)) &&
46
- (fec_file.candidate_id === undefined || typeof fec_file.candidate_id === "string") &&
47
- (fec_file.jfp_committee_ids === undefined || Array.isArray(fec_file.jfp_committee_ids) && fec_file.jfp_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
48
- (Array.isArray(fec_file.jfr_committee_ids) && fec_file.jfr_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
49
- (Array.isArray(fec_file.aff_committee_ids) && fec_file.aff_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
50
- (fec_file.sponsor_candidate_ids === undefined || Array.isArray(fec_file.sponsor_candidate_ids) && fec_file.sponsor_candidate_ids.every((committee_id : any) => typeof committee_id === "string"))
51
- )
52
- }
53
- }
@@ -1,37 +0,0 @@
1
- import { Expenditure } from "./Expenditure"
2
- import { FECFile } from "./FECFile"
3
-
4
- export class FECF24File extends FECFile {
5
- readonly committee_id : string
6
- readonly first_fec_file_id : number
7
- readonly report_type : string
8
- readonly first_report_date : string
9
- readonly report_date : string
10
- readonly expenditures : Expenditure[]
11
-
12
- constructor(fec_file : any) {
13
- if (!FECF24File.is(fec_file)) {
14
- throw Error("Invalid input.")
15
- }
16
- super(fec_file)
17
- this.committee_id = fec_file.committee_id
18
- this.first_fec_file_id = fec_file.first_fec_file_id
19
- this.report_type = fec_file.report_type
20
- this.first_report_date = fec_file.first_report_date
21
- this.report_date = fec_file.report_date
22
- this.expenditures = fec_file.expenditures
23
- }
24
-
25
- static is(fec_file : any) : fec_file is FECF24File {
26
- return (
27
- FECFile.is(fec_file) &&
28
- fec_file.form_type_id === "F24" &&
29
- typeof fec_file.committee_id === "string" &&
30
- typeof fec_file.first_fec_file_id === "number" &&
31
- typeof fec_file.report_type === "string" &&
32
- typeof fec_file.first_report_date === "string" &&
33
- typeof fec_file.report_date === "string" &&
34
- Array.isArray(fec_file.expenditures) && fec_file.expenditures.every(Expenditure.is)
35
- )
36
- }
37
- }
@@ -1,44 +0,0 @@
1
- import { ElectionID, is_election_id, is_office_id, OfficeID } from "./Election"
2
- import { FECFile } from "./FECFile"
3
- import { is_state_id, StateID } from "./State"
4
-
5
- export class FECF2File extends FECFile {
6
- readonly candidate_id : string
7
- readonly fec_name : string
8
- readonly office_id : OfficeID
9
- readonly state_id : StateID
10
- readonly district? : number
11
- readonly election_id : ElectionID
12
- readonly party_id? : string
13
- readonly report_date : string
14
-
15
- constructor(fec_file : any) {
16
- if (!FECF2File.is(fec_file)) {
17
- throw Error("Invalid input.")
18
- }
19
- super(fec_file)
20
- this.candidate_id = fec_file.candidate_id
21
- this.fec_name = fec_file.fec_name
22
- this.office_id = fec_file.office_id
23
- this.state_id = fec_file.state_id
24
- this.district = fec_file.district
25
- this.election_id = fec_file.election_id
26
- this.party_id = fec_file.party_id
27
- this.report_date = fec_file.report_date
28
- }
29
-
30
- static is(fec_file : any) : fec_file is FECF2File {
31
- return (
32
- FECFile.is(fec_file) &&
33
- fec_file.form_type_id === "F2" &&
34
- typeof fec_file.candidate_id === "string" &&
35
- typeof fec_file.fec_name === "string" &&
36
- is_office_id(fec_file.office_id) &&
37
- is_state_id(fec_file.state_id) &&
38
- (fec_file.district === undefined || typeof fec_file.district === "number") &&
39
- is_election_id(fec_file.election_id) &&
40
- (fec_file.party_id === undefined || typeof fec_file.party_id === "string") &&
41
- typeof fec_file.report_date === "string"
42
- )
43
- }
44
- }
@@ -1,42 +0,0 @@
1
- import { FECFile } from "./FECFile"
2
-
3
- export class FECF3File extends FECFile {
4
- readonly committee_id : string
5
- readonly period_id : string
6
- readonly period_start_date : string
7
- readonly period_end_date : string
8
- readonly report_date : string
9
- readonly cash_on_hand : number
10
- readonly cumulative_receipts : number
11
- readonly new_receipts : number
12
-
13
- constructor(fec_file : any) {
14
- if (!FECF3File.is(fec_file)) {
15
- throw Error("Invalid input.")
16
- }
17
- super(fec_file)
18
- this.committee_id = fec_file.committee_id
19
- this.period_id = fec_file.period_id
20
- this.period_start_date = fec_file.period_start_date
21
- this.period_end_date = fec_file.period_end_date
22
- this.report_date = fec_file.report_date
23
- this.cash_on_hand = fec_file.cash_on_hand
24
- this.cumulative_receipts = fec_file.cumulative_receipts
25
- this.new_receipts = fec_file.new_receipts
26
- }
27
-
28
- static is(fec_file : any) : fec_file is FECF3File {
29
- return (
30
- FECFile.is(fec_file) &&
31
- fec_file.form_type_id === "F3" &&
32
- typeof fec_file.committee_id === "string" &&
33
- typeof fec_file.period_id === "string" &&
34
- typeof fec_file.period_start_date === "string" &&
35
- typeof fec_file.period_end_date === "string" &&
36
- typeof fec_file.report_date === "string" &&
37
- typeof fec_file.cash_on_hand === "number" &&
38
- typeof fec_file.cumulative_receipts === "number" &&
39
- typeof fec_file.new_receipts === "number"
40
- )
41
- }
42
- }