elections-types 1.0.85 → 1.0.86

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