elections-types 1.0.60 → 1.0.62

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.
@@ -8,6 +8,11 @@ export * from "./types/Committee.js";
8
8
  export * from "./types/Election.js";
9
9
  export * from "./types/ElectionsConfig.js";
10
10
  export * from "./types/FederalDonation.js";
11
+ export * from "./types/FECFile.js";
12
+ export * from "./types/FECF1File.js";
13
+ export * from "./types/FECF2File.js";
14
+ export * from "./types/FECF3File.js";
15
+ export * from "./types/FECF24File.js";
11
16
  export * from "./types/FECReport.js";
12
17
  export * from "./types/FormTypeID.js";
13
18
  export * from "./types/State.js";
package/dist/src/index.js CHANGED
@@ -8,6 +8,11 @@ export * from "./types/Committee.js";
8
8
  export * from "./types/Election.js";
9
9
  export * from "./types/ElectionsConfig.js";
10
10
  export * from "./types/FederalDonation.js";
11
+ export * from "./types/FECFile.js";
12
+ export * from "./types/FECF1File.js";
13
+ export * from "./types/FECF2File.js";
14
+ export * from "./types/FECF3File.js";
15
+ export * from "./types/FECF24File.js";
11
16
  export * from "./types/FECReport.js";
12
17
  export * from "./types/FormTypeID.js";
13
18
  export * from "./types/State.js";
@@ -21,10 +21,6 @@ export declare class Candidate {
21
21
  readonly status?: string;
22
22
  readonly fec_file_id?: number;
23
23
  readonly committee_ids?: string[];
24
- readonly principal_committee_ids?: string[];
25
- readonly authorized_committee_ids?: string[];
26
- readonly sponsor_committee_ids?: string[];
27
- readonly expenditure_ids?: string[];
28
24
  readonly ballotpedia_name?: string;
29
25
  readonly ballotpedia_url?: string;
30
26
  readonly ballotpedia_data?: Record<string, any>;
@@ -33,10 +33,6 @@ export class Candidate {
33
33
  status;
34
34
  fec_file_id;
35
35
  committee_ids;
36
- principal_committee_ids;
37
- authorized_committee_ids;
38
- sponsor_committee_ids;
39
- expenditure_ids;
40
36
  ballotpedia_name;
41
37
  ballotpedia_url;
42
38
  ballotpedia_data;
@@ -56,10 +52,6 @@ export class Candidate {
56
52
  this.status = candidate.status;
57
53
  this.fec_file_id = candidate.fec_file_id;
58
54
  this.committee_ids = candidate.committee_ids;
59
- this.principal_committee_ids = candidate.principal_committee_ids;
60
- this.authorized_committee_ids = candidate.authorized_committee_ids;
61
- this.sponsor_committee_ids = candidate.sponsor_committee_ids;
62
- this.expenditure_ids = candidate.expenditure_ids;
63
55
  this.ballotpedia_name = candidate.ballotpedia_name;
64
56
  this.ballotpedia_url = candidate.ballotpedia_url;
65
57
  this.ballotpedia_data = candidate.ballotpedia_data;
@@ -78,10 +70,6 @@ export class Candidate {
78
70
  (candidate.status === undefined || typeof candidate.status === "string") &&
79
71
  (candidate.fec_file_id === undefined || typeof candidate.fec_file_id === "number" && !isNaN(candidate.fec_file_id)) &&
80
72
  (candidate.committee_ids === undefined || Array.isArray(candidate.committee_ids) && candidate.committee_ids.map((committee_id) => typeof committee_id === "string")) &&
81
- (candidate.principal_committee_ids === undefined || Array.isArray(candidate.principal_committee_ids) && candidate.principal_committee_ids.map((committee_id) => typeof committee_id === "string")) &&
82
- (candidate.authorized_committee_ids === undefined || Array.isArray(candidate.authorized_committee_ids) && candidate.authorized_committee_ids.map((committee_id) => typeof committee_id === "string")) &&
83
- (candidate.sponsor_committee_ids === undefined || Array.isArray(candidate.sponsor_committee_ids) && candidate.sponsor_committee_ids.map((committee_id) => typeof committee_id === "string")) &&
84
- (candidate.expenditure_ids === undefined || Array.isArray(candidate.expenditure_ids) && candidate.expenditure_ids.map((committee_id) => typeof committee_id === "string")) &&
85
73
  (candidate.ballotpedia_name === undefined || typeof candidate.ballotpedia_name === "string") &&
86
74
  (candidate.ballotpedia_url === undefined || typeof candidate.ballotpedia_url === "string") &&
87
75
  (candidate.ballotpedia_data === undefined || typeof candidate.ballotpedia_data === "object" && Object.keys(candidate.ballotpedia_data).map((key) => typeof key === "string")) &&
@@ -9,9 +9,7 @@ export declare class Committee {
9
9
  readonly url?: string;
10
10
  readonly designation?: CommitteeDesignation;
11
11
  readonly fec_file_id?: number;
12
- readonly principal_committee_ids?: string[];
13
- readonly authorized_committee_ids?: string[];
14
- readonly sponsor_committee_ids?: string[];
12
+ readonly sponsor_candidate_ids?: string[];
15
13
  readonly jfp_committee_ids?: string[];
16
14
  readonly jfr_committee_ids?: string[];
17
15
  readonly aff_committee_ids?: string[];
@@ -10,9 +10,7 @@ export class Committee {
10
10
  url;
11
11
  designation;
12
12
  fec_file_id;
13
- principal_committee_ids;
14
- authorized_committee_ids;
15
- sponsor_committee_ids;
13
+ sponsor_candidate_ids;
16
14
  jfp_committee_ids;
17
15
  jfr_committee_ids;
18
16
  aff_committee_ids;
@@ -27,9 +25,7 @@ export class Committee {
27
25
  this.url = committee.url;
28
26
  this.designation = committee.designation;
29
27
  this.fec_file_id = committee.fec_file_id;
30
- this.principal_committee_ids = committee.principal_committee_ids;
31
- this.authorized_committee_ids = committee.authorized_committee_ids;
32
- this.sponsor_committee_ids = committee.sponsor_committee_ids;
28
+ this.sponsor_candidate_ids = committee.sponsor_candidate_ids;
33
29
  this.jfp_committee_ids = committee.jfp_committee_ids;
34
30
  this.jfr_committee_ids = committee.jfr_committee_ids;
35
31
  this.aff_committee_ids = committee.aff_committee_ids;
@@ -43,9 +39,7 @@ export class Committee {
43
39
  (committee.url === undefined || typeof committee.url === "string") &&
44
40
  (committee.designation === undefined || is_committee_designation(committee.designation)) &&
45
41
  (committee.fec_file_id === undefined || typeof committee.fec_file_id === "number" && !isNaN(committee.fec_file_id)) &&
46
- (committee.principal_committee_ids === undefined || Array.isArray(committee.principal_committee_ids) && committee.principal_committee_ids.every((committee_id) => typeof committee_id === "string")) &&
47
- (committee.authorized_committee_ids === undefined || Array.isArray(committee.authorized_committee_ids) && committee.authorized_committee_ids.every((committee_id) => typeof committee_id === "string")) &&
48
- (committee.sponsor_committee_ids === undefined || Array.isArray(committee.sponsor_committee_ids) && committee.sponsor_committee_ids.every((committee_id) => typeof committee_id === "string")) &&
42
+ (committee.sponsor_candidate_ids === undefined || Array.isArray(committee.sponsor_candidate_ids) && committee.sponsor_candidate_ids.every((committee_id) => typeof committee_id === "string")) &&
49
43
  (committee.jfp_committee_ids === undefined || Array.isArray(committee.jfp_committee_ids) && committee.jfp_committee_ids.every((committee_id) => typeof committee_id === "string")) &&
50
44
  (committee.jfr_committee_ids === undefined || Array.isArray(committee.jfr_committee_ids) && committee.jfr_committee_ids.every((committee_id) => typeof committee_id === "string")) &&
51
45
  (committee.aff_committee_ids === undefined || Array.isArray(committee.aff_committee_ids) && committee.aff_committee_ids.every((committee_id) => typeof committee_id === "string")) &&
@@ -0,0 +1,18 @@
1
+ import { CommitteeDesignation } from "./Committee.js";
2
+ import { ElectionID } from "./Election.js";
3
+ import { FECFile } from "./FECFile.js";
4
+ export declare class FECF1File extends FECFile {
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(fec_file: any);
17
+ static is(fec_file: any): fec_file is FECF1File;
18
+ }
@@ -0,0 +1,48 @@
1
+ import { is_committee_designation } from "./Committee.js";
2
+ import { is_election_id } from "./Election.js";
3
+ import { FECFile } from "./FECFile.js";
4
+ export class FECF1File extends FECFile {
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(fec_file) {
17
+ if (!FECF1File.is(fec_file)) {
18
+ throw Error("Invalid input.");
19
+ }
20
+ super(fec_file);
21
+ this.committee_id = fec_file.committee_id;
22
+ this.name = fec_file.name;
23
+ this.url = fec_file.url;
24
+ this.report_date = fec_file.report_date;
25
+ this.designation = fec_file.designation;
26
+ this.election_id = fec_file.election_id;
27
+ this.candidate_id = fec_file.candidate_id;
28
+ this.jfp_committee_ids = fec_file.jfp_committee_ids;
29
+ this.jfr_committee_ids = fec_file.jfr_committee_ids;
30
+ this.aff_committee_ids = fec_file.aff_committee_ids;
31
+ this.sponsor_candidate_ids = fec_file.sponsor_candidate_ids;
32
+ }
33
+ static is(fec_file) {
34
+ return (FECFile.is(fec_file) &&
35
+ fec_file.form_type_id === "F1" &&
36
+ typeof fec_file.committee_id === "string" &&
37
+ typeof fec_file.name === "string" &&
38
+ (fec_file.url === undefined || typeof fec_file.url === "string") &&
39
+ typeof fec_file.report_date === "string" &&
40
+ is_committee_designation(fec_file.designation) &&
41
+ (fec_file.election_id === undefined || is_election_id(fec_file.election_id)) &&
42
+ (fec_file.candidate_id === undefined || typeof fec_file.election_id === "string") &&
43
+ (fec_file.jfp_committee_ids === undefined || Array.isArray(fec_file.jfp_committee_ids) && fec_file.jfp_committee_ids.every((committee_id) => typeof committee_id === "string")) &&
44
+ (Array.isArray(fec_file.jfr_committee_ids) && fec_file.jfr_committee_ids.every((committee_id) => typeof committee_id === "string")) &&
45
+ (Array.isArray(fec_file.aff_committee_ids) && fec_file.aff_committee_ids.every((committee_id) => typeof committee_id === "string")) &&
46
+ (fec_file.sponsor_candidate_ids === undefined || Array.isArray(fec_file.sponsor_candidate_ids) && fec_file.sponsor_candidate_ids.every((committee_id) => typeof committee_id === "string")));
47
+ }
48
+ }
@@ -0,0 +1,26 @@
1
+ import { ElectionID } from "./Election.js";
2
+ import { FECFile } from "./FECFile.js";
3
+ export declare class Expenditure {
4
+ readonly expenditure_id: string;
5
+ readonly date: string;
6
+ readonly payee: string;
7
+ readonly election_stage: string;
8
+ readonly election_id: ElectionID;
9
+ readonly candidate_id: string;
10
+ readonly amount: number;
11
+ readonly cumulative_amount: number;
12
+ readonly purpose: string;
13
+ readonly is_support: boolean;
14
+ constructor(expenditure: any);
15
+ static is(expenditure: any): expenditure is Expenditure;
16
+ }
17
+ export declare class FECF24File extends FECFile {
18
+ readonly committee_id: string;
19
+ readonly first_fec_file_id: number;
20
+ readonly report_type: string;
21
+ readonly first_report_date: string;
22
+ readonly report_date: string;
23
+ readonly expenditures: Expenditure[];
24
+ constructor(fec_file: any);
25
+ static is(fec_file: any): fec_file is FECF24File;
26
+ }
@@ -0,0 +1,72 @@
1
+ import { is_election_id } from "./Election.js";
2
+ import { FECFile } from "./FECFile.js";
3
+ export class Expenditure {
4
+ expenditure_id;
5
+ date;
6
+ payee;
7
+ election_stage;
8
+ election_id;
9
+ candidate_id;
10
+ amount;
11
+ cumulative_amount;
12
+ purpose;
13
+ is_support;
14
+ constructor(expenditure) {
15
+ if (!Expenditure.is(expenditure)) {
16
+ throw Error("Invalid input.");
17
+ }
18
+ this.expenditure_id = expenditure.expenditure_id;
19
+ this.date = expenditure.date;
20
+ this.payee = expenditure.payee;
21
+ this.election_stage = expenditure.election_stage;
22
+ this.election_id = expenditure.election_id;
23
+ this.candidate_id = expenditure.candidate_id;
24
+ this.amount = expenditure.amount;
25
+ this.cumulative_amount = expenditure.cumulative_amount;
26
+ this.purpose = expenditure.purpose;
27
+ this.is_support = expenditure.is_support;
28
+ }
29
+ static is(expenditure) {
30
+ return (expenditure !== undefined &&
31
+ typeof expenditure.expenditure_id === "string" &&
32
+ typeof expenditure.date === "string" &&
33
+ typeof expenditure.payee === "string" &&
34
+ typeof expenditure.election_stage === "string" &&
35
+ is_election_id(expenditure.election_id) &&
36
+ typeof expenditure.candidate_id === "string" &&
37
+ typeof expenditure.amount === "number" &&
38
+ typeof expenditure.cumulative_amount === "number" &&
39
+ typeof expenditure.purpose === "string" &&
40
+ typeof expenditure.is_support === "boolean");
41
+ }
42
+ }
43
+ export class FECF24File extends FECFile {
44
+ committee_id;
45
+ first_fec_file_id;
46
+ report_type;
47
+ first_report_date;
48
+ report_date;
49
+ expenditures;
50
+ constructor(fec_file) {
51
+ if (!FECF24File.is(fec_file)) {
52
+ throw Error("Invalid input.");
53
+ }
54
+ super(fec_file);
55
+ this.committee_id = fec_file.committee_id;
56
+ this.first_fec_file_id = fec_file.first_fec_file_id;
57
+ this.report_type = fec_file.report_type;
58
+ this.first_report_date = fec_file.first_report_date;
59
+ this.report_date = fec_file.report_date;
60
+ this.expenditures = fec_file.expenditures;
61
+ }
62
+ static is(fec_file) {
63
+ return (FECFile.is(fec_file) &&
64
+ fec_file.form_type_id === "F24" &&
65
+ typeof fec_file.committee_id === "string" &&
66
+ typeof fec_file.first_fec_file_id === "number" &&
67
+ typeof fec_file.report_type === "string" &&
68
+ typeof fec_file.first_report_date === "string" &&
69
+ typeof fec_file.report_date === "string" &&
70
+ Array.isArray(fec_file.expenditures) && fec_file.expenditures.every(Expenditure.is));
71
+ }
72
+ }
@@ -0,0 +1,15 @@
1
+ import { ElectionID, OfficeID } from "./Election.js";
2
+ import { FECFile } from "./FECFile.js";
3
+ import { StateID } from "./State.js";
4
+ export declare class FECF2File extends FECFile {
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(fec_file: any);
14
+ static is(fec_file: any): fec_file is FECF2File;
15
+ }
@@ -0,0 +1,39 @@
1
+ import { is_election_id, is_office_id } from "./Election.js";
2
+ import { FECFile } from "./FECFile.js";
3
+ import { is_state_id } from "./State.js";
4
+ export class FECF2File extends FECFile {
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(fec_file) {
14
+ if (!FECF2File.is(fec_file)) {
15
+ throw Error("Invalid input.");
16
+ }
17
+ super(fec_file);
18
+ this.candidate_id = fec_file.candidate_id;
19
+ this.fec_name = fec_file.fec_name;
20
+ this.office_id = fec_file.office_id;
21
+ this.state_id = fec_file.state_id;
22
+ this.district = fec_file.district;
23
+ this.election_id = fec_file.election_id;
24
+ this.party_id = fec_file.party_id;
25
+ this.report_date = fec_file.report_date;
26
+ }
27
+ static is(fec_file) {
28
+ return (FECFile.is(fec_file) &&
29
+ fec_file.form_type_id === "F2" &&
30
+ typeof fec_file.candidate_id === "string" &&
31
+ typeof fec_file.fec_name === "string" &&
32
+ is_office_id(fec_file.office_id) &&
33
+ is_state_id(fec_file.state_id) &&
34
+ (fec_file.district === undefined || typeof fec_file.district === "number") &&
35
+ is_election_id(fec_file.election_id) &&
36
+ (fec_file.party_id === undefined || typeof fec_file.party_id === "string") &&
37
+ typeof fec_file.report_date === "string");
38
+ }
39
+ }
@@ -0,0 +1,13 @@
1
+ import { FECFile } from "./FECFile.js";
2
+ export declare class FECF3File extends FECFile {
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(fec_file: any);
12
+ static is(fec_file: any): fec_file is FECF3File;
13
+ }
@@ -0,0 +1,37 @@
1
+ import { FECFile } from "./FECFile.js";
2
+ export class FECF3File extends FECFile {
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(fec_file) {
12
+ if (!FECF3File.is(fec_file)) {
13
+ throw Error("Invalid input.");
14
+ }
15
+ super(fec_file);
16
+ this.committee_id = fec_file.committee_id;
17
+ this.period_id = fec_file.period_id;
18
+ this.period_start_date = fec_file.period_start_date;
19
+ this.period_end_date = fec_file.period_end_date;
20
+ this.report_date = fec_file.report_date;
21
+ this.cash_on_hand = fec_file.cash_on_hand;
22
+ this.cumulative_receipts = fec_file.cumulative_receipts;
23
+ this.new_receipts = fec_file.new_receipts;
24
+ }
25
+ static is(fec_file) {
26
+ return (FECFile.is(fec_file) &&
27
+ fec_file.form_type_id === "F3" &&
28
+ typeof fec_file.committee_id === "string" &&
29
+ typeof fec_file.period_id === "string" &&
30
+ typeof fec_file.period_start_date === "string" &&
31
+ typeof fec_file.period_end_date === "string" &&
32
+ typeof fec_file.report_date === "string" &&
33
+ typeof fec_file.cash_on_hand === "number" &&
34
+ typeof fec_file.cumulative_receipts === "number" &&
35
+ typeof fec_file.new_receipts === "number");
36
+ }
37
+ }
@@ -0,0 +1,11 @@
1
+ import { AmendmentTypeID, FormTypeID, LongFormTypeID } from "./FormTypeID.js";
2
+ export declare class FECFile {
3
+ readonly fec_file_id: number;
4
+ readonly form_type_id: FormTypeID;
5
+ readonly amendment_type_id: AmendmentTypeID;
6
+ readonly long_form_type_id: LongFormTypeID;
7
+ readonly s3_filename: string;
8
+ [x: string]: any;
9
+ constructor(fec_file: any);
10
+ static is(fec_file: any): fec_file is FECFile;
11
+ }
@@ -0,0 +1,26 @@
1
+ import { is_amendment_type_id, is_form_type_id, is_long_form_type_id } from "./FormTypeID.js";
2
+ export class FECFile {
3
+ fec_file_id;
4
+ form_type_id;
5
+ amendment_type_id;
6
+ long_form_type_id;
7
+ s3_filename;
8
+ constructor(fec_file) {
9
+ if (!FECFile.is(fec_file)) {
10
+ throw Error("Invalid input.");
11
+ }
12
+ this.fec_file_id = fec_file.fec_file_id;
13
+ this.form_type_id = fec_file.form_type_id;
14
+ this.amendment_type_id = fec_file.amendment_type_id;
15
+ this.long_form_type_id = fec_file.long_form_type_id;
16
+ this.s3_filename = fec_file.s3_filename;
17
+ }
18
+ static is(fec_file) {
19
+ return (fec_file !== undefined &&
20
+ typeof fec_file.fec_file_id === "number" &&
21
+ is_form_type_id(fec_file.form_type_id) &&
22
+ is_amendment_type_id(fec_file.amendment_type_id) &&
23
+ is_long_form_type_id(fec_file.long_form_type_id) &&
24
+ (fec_file.s3_filename === undefined || typeof fec_file.s3_filename === "string"));
25
+ }
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.0.60",
3
+ "version": "1.0.62",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
package/src/index.ts CHANGED
@@ -8,6 +8,11 @@ export * from "./types/Committee"
8
8
  export * from "./types/Election"
9
9
  export * from "./types/ElectionsConfig"
10
10
  export * from "./types/FederalDonation"
11
+ export * from "./types/FECFile"
12
+ export * from "./types/FECF1File"
13
+ export * from "./types/FECF2File"
14
+ export * from "./types/FECF3File"
15
+ export * from "./types/FECF24File"
11
16
  export * from "./types/FECReport"
12
17
  export * from "./types/FormTypeID"
13
18
  export * from "./types/State"
@@ -39,10 +39,6 @@ export class Candidate {
39
39
  readonly status? : string
40
40
  readonly fec_file_id? : number
41
41
  readonly committee_ids? : string[]
42
- readonly principal_committee_ids? : string[]
43
- readonly authorized_committee_ids? : string[]
44
- readonly sponsor_committee_ids? : string[]
45
- readonly expenditure_ids? : string[]
46
42
  readonly ballotpedia_name? : string
47
43
  readonly ballotpedia_url? : string
48
44
  readonly ballotpedia_data? : Record<string, any>
@@ -67,10 +63,6 @@ export class Candidate {
67
63
  this.status = candidate.status
68
64
  this.fec_file_id = candidate.fec_file_id
69
65
  this.committee_ids = candidate.committee_ids
70
- this.principal_committee_ids = candidate.principal_committee_ids
71
- this.authorized_committee_ids = candidate.authorized_committee_ids
72
- this.sponsor_committee_ids = candidate.sponsor_committee_ids
73
- this.expenditure_ids = candidate.expenditure_ids
74
66
  this.ballotpedia_name = candidate.ballotpedia_name
75
67
  this.ballotpedia_url = candidate.ballotpedia_url
76
68
  this.ballotpedia_data = candidate.ballotpedia_data
@@ -91,10 +83,6 @@ export class Candidate {
91
83
  (candidate.status === undefined || typeof candidate.status === "string") &&
92
84
  (candidate.fec_file_id === undefined || typeof candidate.fec_file_id === "number" && !isNaN(candidate.fec_file_id)) &&
93
85
  (candidate.committee_ids === undefined || Array.isArray(candidate.committee_ids) && candidate.committee_ids.map((committee_id : any) => typeof committee_id === "string")) &&
94
- (candidate.principal_committee_ids === undefined || Array.isArray(candidate.principal_committee_ids) && candidate.principal_committee_ids.map((committee_id : any) => typeof committee_id === "string")) &&
95
- (candidate.authorized_committee_ids === undefined || Array.isArray(candidate.authorized_committee_ids) && candidate.authorized_committee_ids.map((committee_id : any) => typeof committee_id === "string")) &&
96
- (candidate.sponsor_committee_ids === undefined || Array.isArray(candidate.sponsor_committee_ids) && candidate.sponsor_committee_ids.map((committee_id : any) => typeof committee_id === "string")) &&
97
- (candidate.expenditure_ids === undefined || Array.isArray(candidate.expenditure_ids) && candidate.expenditure_ids.map((committee_id : any) => typeof committee_id === "string")) &&
98
86
  (candidate.ballotpedia_name === undefined || typeof candidate.ballotpedia_name === "string") &&
99
87
  (candidate.ballotpedia_url === undefined || typeof candidate.ballotpedia_url === "string") &&
100
88
  (candidate.ballotpedia_data === undefined || typeof candidate.ballotpedia_data === "object" && Object.keys(candidate.ballotpedia_data).map((key : any) => typeof key === "string")) &&
@@ -15,9 +15,7 @@ export class Committee {
15
15
  readonly url? : string
16
16
  readonly designation? : CommitteeDesignation
17
17
  readonly fec_file_id? : number
18
- readonly principal_committee_ids? : string[]
19
- readonly authorized_committee_ids? : string[]
20
- readonly sponsor_committee_ids? : string[]
18
+ readonly sponsor_candidate_ids? : string[]
21
19
  readonly jfp_committee_ids? : string[]
22
20
  readonly jfr_committee_ids? : string[]
23
21
  readonly aff_committee_ids? : string[]
@@ -34,9 +32,7 @@ export class Committee {
34
32
  this.url = committee.url
35
33
  this.designation = committee.designation
36
34
  this.fec_file_id = committee.fec_file_id
37
- this.principal_committee_ids = committee.principal_committee_ids
38
- this.authorized_committee_ids = committee.authorized_committee_ids
39
- this.sponsor_committee_ids = committee.sponsor_committee_ids
35
+ this.sponsor_candidate_ids = committee.sponsor_candidate_ids
40
36
  this.jfp_committee_ids = committee.jfp_committee_ids
41
37
  this.jfr_committee_ids = committee.jfr_committee_ids
42
38
  this.aff_committee_ids = committee.aff_committee_ids
@@ -52,9 +48,7 @@ export class Committee {
52
48
  (committee.url === undefined || typeof committee.url === "string") &&
53
49
  (committee.designation === undefined || is_committee_designation(committee.designation)) &&
54
50
  (committee.fec_file_id === undefined || typeof committee.fec_file_id === "number" && !isNaN(committee.fec_file_id)) &&
55
- (committee.principal_committee_ids === undefined || Array.isArray(committee.principal_committee_ids) && committee.principal_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
56
- (committee.authorized_committee_ids === undefined || Array.isArray(committee.authorized_committee_ids) && committee.authorized_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
57
- (committee.sponsor_committee_ids === undefined || Array.isArray(committee.sponsor_committee_ids) && committee.sponsor_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
51
+ (committee.sponsor_candidate_ids === undefined || Array.isArray(committee.sponsor_candidate_ids) && committee.sponsor_candidate_ids.every((committee_id : any) => typeof committee_id === "string")) &&
58
52
  (committee.jfp_committee_ids === undefined || Array.isArray(committee.jfp_committee_ids) && committee.jfp_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
59
53
  (committee.jfr_committee_ids === undefined || Array.isArray(committee.jfr_committee_ids) && committee.jfr_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
60
54
  (committee.aff_committee_ids === undefined || Array.isArray(committee.aff_committee_ids) && committee.aff_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
@@ -0,0 +1,53 @@
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.election_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
+ }
@@ -0,0 +1,83 @@
1
+ import { ElectionID, is_election_id } from "./Election"
2
+ import { FECFile } from "./FECFile"
3
+
4
+ export class Expenditure {
5
+ readonly expenditure_id : string
6
+ readonly date : string
7
+ readonly payee : string
8
+ readonly election_stage : string
9
+ readonly election_id : ElectionID
10
+ readonly candidate_id : string
11
+ readonly amount : number
12
+ readonly cumulative_amount : number
13
+ readonly purpose : string
14
+ readonly is_support : boolean
15
+
16
+ constructor(expenditure : any) {
17
+ if (!Expenditure.is(expenditure)) {
18
+ throw Error("Invalid input.")
19
+ }
20
+ this.expenditure_id = expenditure.expenditure_id
21
+ this.date = expenditure.date
22
+ this.payee = expenditure.payee
23
+ this.election_stage = expenditure.election_stage
24
+ this.election_id = expenditure.election_id
25
+ this.candidate_id = expenditure.candidate_id
26
+ this.amount = expenditure.amount
27
+ this.cumulative_amount = expenditure.cumulative_amount
28
+ this.purpose = expenditure.purpose
29
+ this.is_support = expenditure.is_support
30
+ }
31
+
32
+ static is(expenditure : any) : expenditure is Expenditure {
33
+ return (
34
+ expenditure !== undefined &&
35
+ typeof expenditure.expenditure_id === "string" &&
36
+ typeof expenditure.date === "string" &&
37
+ typeof expenditure.payee === "string" &&
38
+ typeof expenditure.election_stage === "string" &&
39
+ is_election_id(expenditure.election_id) &&
40
+ typeof expenditure.candidate_id === "string" &&
41
+ typeof expenditure.amount === "number" &&
42
+ typeof expenditure.cumulative_amount === "number" &&
43
+ typeof expenditure.purpose === "string" &&
44
+ typeof expenditure.is_support === "boolean"
45
+ )
46
+ }
47
+
48
+ }
49
+
50
+ export class FECF24File extends FECFile {
51
+ readonly committee_id : string
52
+ readonly first_fec_file_id : number
53
+ readonly report_type : string
54
+ readonly first_report_date : string
55
+ readonly report_date : string
56
+ readonly expenditures : Expenditure[]
57
+
58
+ constructor(fec_file : any) {
59
+ if (!FECF24File.is(fec_file)) {
60
+ throw Error("Invalid input.")
61
+ }
62
+ super(fec_file)
63
+ this.committee_id = fec_file.committee_id
64
+ this.first_fec_file_id = fec_file.first_fec_file_id
65
+ this.report_type = fec_file.report_type
66
+ this.first_report_date = fec_file.first_report_date
67
+ this.report_date = fec_file.report_date
68
+ this.expenditures = fec_file.expenditures
69
+ }
70
+
71
+ static is(fec_file : any) : fec_file is FECF24File {
72
+ return (
73
+ FECFile.is(fec_file) &&
74
+ fec_file.form_type_id === "F24" &&
75
+ typeof fec_file.committee_id === "string" &&
76
+ typeof fec_file.first_fec_file_id === "number" &&
77
+ typeof fec_file.report_type === "string" &&
78
+ typeof fec_file.first_report_date === "string" &&
79
+ typeof fec_file.report_date === "string" &&
80
+ Array.isArray(fec_file.expenditures) && fec_file.expenditures.every(Expenditure.is)
81
+ )
82
+ }
83
+ }
@@ -0,0 +1,44 @@
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
+ }
@@ -0,0 +1,42 @@
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
+ }
@@ -0,0 +1,32 @@
1
+ import { AmendmentTypeID, FormTypeID, is_amendment_type_id, is_form_type_id, is_long_form_type_id, LongFormTypeID } from "./FormTypeID"
2
+
3
+ export class FECFile {
4
+ readonly fec_file_id : number
5
+ readonly form_type_id : FormTypeID
6
+ readonly amendment_type_id : AmendmentTypeID
7
+ readonly long_form_type_id : LongFormTypeID
8
+ readonly s3_filename : string
9
+ [x : string] : any
10
+
11
+ constructor(fec_file : any) {
12
+ if (!FECFile.is(fec_file)) {
13
+ throw Error("Invalid input.")
14
+ }
15
+ this.fec_file_id = fec_file.fec_file_id
16
+ this.form_type_id = fec_file.form_type_id
17
+ this.amendment_type_id = fec_file.amendment_type_id
18
+ this.long_form_type_id = fec_file.long_form_type_id
19
+ this.s3_filename = fec_file.s3_filename
20
+ }
21
+
22
+ static is(fec_file : any) : fec_file is FECFile {
23
+ return (
24
+ fec_file !== undefined &&
25
+ typeof fec_file.fec_file_id === "number" &&
26
+ is_form_type_id(fec_file.form_type_id) &&
27
+ is_amendment_type_id(fec_file.amendment_type_id) &&
28
+ is_long_form_type_id(fec_file.long_form_type_id) &&
29
+ (fec_file.s3_filename === undefined || typeof fec_file.s3_filename === "string")
30
+ )
31
+ }
32
+ }