elections-types 1.0.73 → 1.0.75

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,13 +8,13 @@ export * from "./types/CandidateVideo.js";
8
8
  export * from "./types/Committee.js";
9
9
  export * from "./types/Election.js";
10
10
  export * from "./types/ElectionsConfig.js";
11
+ export * from "./types/Expenditure.js";
11
12
  export * from "./types/FederalDonation.js";
12
13
  export * from "./types/FECFile.js";
13
14
  export * from "./types/FECF1File.js";
14
15
  export * from "./types/FECF2File.js";
15
16
  export * from "./types/FECF3File.js";
16
17
  export * from "./types/FECF24File.js";
17
- export * from "./types/FECReport.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
@@ -8,13 +8,13 @@ export * from "./types/CandidateVideo.js";
8
8
  export * from "./types/Committee.js";
9
9
  export * from "./types/Election.js";
10
10
  export * from "./types/ElectionsConfig.js";
11
+ export * from "./types/Expenditure.js";
11
12
  export * from "./types/FederalDonation.js";
12
13
  export * from "./types/FECFile.js";
13
14
  export * from "./types/FECF1File.js";
14
15
  export * from "./types/FECF2File.js";
15
16
  export * from "./types/FECF3File.js";
16
17
  export * from "./types/FECF24File.js";
17
- export * from "./types/FECReport.js";
18
18
  export * from "./types/FormTypeID.js";
19
19
  export * from "./types/State.js";
20
20
  export * from "./types/Tweet.js";
@@ -1,6 +1,6 @@
1
1
  import { CommitteeAux } from "./Committee.js";
2
2
  import { ElectionID, OfficeID } from "./Election.js";
3
- import { Expenditure } from "./FECF24File.js";
3
+ import { ExpenditureAux } from "./Expenditure.js";
4
4
  import { FECF3File } from "./FECF3File.js";
5
5
  import { StateID } from "./State.js";
6
6
  export declare class ActivityIndex {
@@ -32,7 +32,7 @@ export declare class Candidate {
32
32
  export declare class CandidateAux extends Candidate {
33
33
  readonly committees: CommitteeAux[];
34
34
  readonly fec_f3_files: FECF3File[];
35
- readonly expenditures: Expenditure[];
35
+ readonly expenditures: ExpenditureAux[];
36
36
  constructor(candidate: any);
37
37
  static is(candidate: any): candidate is CandidateAux;
38
38
  }
@@ -1,6 +1,6 @@
1
1
  import { CommitteeAux } from "./Committee.js";
2
2
  import { is_election_id, is_office_id } from "./Election.js";
3
- import { Expenditure } from "./FECF24File.js";
3
+ import { ExpenditureAux } from "./Expenditure.js";
4
4
  import { FECF3File } from "./FECF3File.js";
5
5
  import { is_state_id } from "./State.js";
6
6
  export class ActivityIndex {
@@ -85,7 +85,7 @@ export class CandidateAux extends Candidate {
85
85
  super(candidate);
86
86
  this.committees = candidate.committees;
87
87
  this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file));
88
- this.expenditures = candidate.expenditures.map(expenditure => new Expenditure(expenditure));
88
+ this.expenditures = candidate.expenditures.map(expenditure => new ExpenditureAux(expenditure));
89
89
  }
90
90
  static is(candidate) {
91
91
  return (Candidate.is(candidate) &&
@@ -94,6 +94,6 @@ export class CandidateAux extends Candidate {
94
94
  Array.isArray(candidate.fec_f3_files) &&
95
95
  candidate.fec_f3_files.every(FECF3File.is) &&
96
96
  Array.isArray(candidate.expenditures) &&
97
- candidate.expenditures.every(Expenditure.is));
97
+ candidate.expenditures.every(ExpenditureAux.is));
98
98
  }
99
99
  }
@@ -51,9 +51,9 @@ export class CommitteeAux extends Committee {
51
51
  super(committee);
52
52
  this.candidates = committee.candidates;
53
53
  this.fec_f3_files = committee.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file));
54
- this.jfp_committees = committee.jfp_committees;
55
- this.jfr_committees = committee.jfr_committees;
56
- this.aff_committees = committee.aff_committees;
54
+ this.jfp_committees = committee.jfp_committees !== undefined ? committee.jfp_committees.map(committee => new Committee(committee)) : undefined;
55
+ this.jfr_committees = committee.jfr_committees.map(committee => new Committee(committee));
56
+ this.aff_committees = committee.aff_committees.map(committee => new Committee(committee));
57
57
  }
58
58
  static is(committee) {
59
59
  return (Committee.is(committee) &&
@@ -1,6 +1,6 @@
1
1
  import { CandidateAux } from "./Candidate.js";
2
2
  import { CommitteeAux } from "./Committee.js";
3
- import { Expenditure } from "./FECF24File.js";
3
+ import { ExpenditureAux } from "./Expenditure.js";
4
4
  import { StateID } from "./State.js";
5
5
  declare const office_ids: readonly ["H", "S"];
6
6
  export type OfficeID = typeof office_ids[number];
@@ -20,7 +20,7 @@ export declare class Election {
20
20
  export declare class ElectionAux extends Election {
21
21
  readonly candidates: CandidateAux[];
22
22
  readonly committees: CommitteeAux[];
23
- readonly expenditures: Expenditure[];
23
+ readonly expenditures: ExpenditureAux[];
24
24
  constructor(election: any);
25
25
  static is(election: any): election is ElectionAux;
26
26
  }
@@ -1,6 +1,6 @@
1
1
  import { CandidateAux } from "./Candidate.js";
2
2
  import { CommitteeAux } from "./Committee.js";
3
- import { Expenditure } from "./FECF24File.js";
3
+ import { ExpenditureAux } from "./Expenditure.js";
4
4
  import { is_state_id } from "./State.js";
5
5
  const office_ids = ["H", "S"];
6
6
  export function is_office_id(office_id) {
@@ -54,9 +54,9 @@ export class ElectionAux extends Election {
54
54
  throw Error("Invalid input.");
55
55
  }
56
56
  super(election);
57
- this.candidates = election.candidates;
58
- this.committees = election.committees;
59
- this.expenditures = election.expenditures;
57
+ this.candidates = election.candidates.map(candidate => new CandidateAux(candidate));
58
+ this.committees = election.committees.map(committee => new CommitteeAux(committee));
59
+ this.expenditures = election.expenditures.map(expenditure => new ExpenditureAux(expenditure));
60
60
  }
61
61
  static is(election) {
62
62
  return (Election.is(election) &&
@@ -65,6 +65,6 @@ export class ElectionAux extends Election {
65
65
  Array.isArray(election.committees) &&
66
66
  election.committees.every(CommitteeAux.is) &&
67
67
  Array.isArray(election.expenditures) &&
68
- election.expenditures.every(Expenditure.is));
68
+ election.expenditures.every(ExpenditureAux.is));
69
69
  }
70
70
  }
@@ -0,0 +1,24 @@
1
+ import { Committee } from "./Committee.js";
2
+ import { ElectionID } from "./Election.js";
3
+ export declare class Expenditure {
4
+ readonly fec_file_id: number;
5
+ readonly expenditure_id: string;
6
+ readonly committee_id: string;
7
+ readonly date: string;
8
+ readonly payee: string;
9
+ readonly election_stage: string;
10
+ readonly election_id: ElectionID;
11
+ readonly candidate_id: string;
12
+ readonly amount: number;
13
+ readonly cumulative_amount: number;
14
+ readonly purpose: string;
15
+ readonly is_support: boolean;
16
+ readonly [x: string]: any;
17
+ constructor(expenditure: any);
18
+ static is(expenditure: any): expenditure is Expenditure;
19
+ }
20
+ export declare class ExpenditureAux extends Expenditure {
21
+ readonly committee: Committee[];
22
+ constructor(expenditure: any);
23
+ static is(expenditure: any): expenditure is ExpenditureAux;
24
+ }
@@ -0,0 +1,62 @@
1
+ import { Committee } from "./Committee.js";
2
+ import { is_election_id } from "./Election.js";
3
+ export class Expenditure {
4
+ fec_file_id;
5
+ expenditure_id;
6
+ committee_id;
7
+ date;
8
+ payee;
9
+ election_stage;
10
+ election_id;
11
+ candidate_id;
12
+ amount;
13
+ cumulative_amount;
14
+ purpose;
15
+ is_support;
16
+ constructor(expenditure) {
17
+ if (!Expenditure.is(expenditure)) {
18
+ throw Error("Invalid input.");
19
+ }
20
+ this.fec_file_id = expenditure.fec_file_id;
21
+ this.expenditure_id = expenditure.expenditure_id;
22
+ this.committee_id = expenditure.committee_id;
23
+ this.date = expenditure.date;
24
+ this.payee = expenditure.payee;
25
+ this.election_stage = expenditure.election_stage;
26
+ this.election_id = expenditure.election_id;
27
+ this.candidate_id = expenditure.candidate_id;
28
+ this.amount = expenditure.amount;
29
+ this.cumulative_amount = expenditure.cumulative_amount;
30
+ this.purpose = expenditure.purpose;
31
+ this.is_support = expenditure.is_support;
32
+ }
33
+ static is(expenditure) {
34
+ return (expenditure !== undefined &&
35
+ typeof expenditure.fec_file_id === "number" &&
36
+ typeof expenditure.expenditure_id === "string" &&
37
+ typeof expenditure.committee_id === "string" &&
38
+ typeof expenditure.date === "string" &&
39
+ typeof expenditure.payee === "string" &&
40
+ typeof expenditure.election_stage === "string" &&
41
+ is_election_id(expenditure.election_id) &&
42
+ typeof expenditure.candidate_id === "string" &&
43
+ typeof expenditure.amount === "number" &&
44
+ typeof expenditure.cumulative_amount === "number" &&
45
+ typeof expenditure.purpose === "string" &&
46
+ typeof expenditure.is_support === "boolean");
47
+ }
48
+ }
49
+ export class ExpenditureAux extends Expenditure {
50
+ committee;
51
+ constructor(expenditure) {
52
+ if (!ExpenditureAux.is(expenditure)) {
53
+ throw Error("Invalid input.");
54
+ }
55
+ super(expenditure);
56
+ this.committee = expenditure.committee;
57
+ }
58
+ static is(expenditure) {
59
+ return (Expenditure.is(expenditure) &&
60
+ Committee.is(expenditure.committee));
61
+ }
62
+ }
@@ -1,20 +1,5 @@
1
- import { ElectionID } from "./Election.js";
1
+ import { Expenditure } from "./Expenditure.js";
2
2
  import { FECFile } from "./FECFile.js";
3
- export declare class Expenditure {
4
- readonly fec_file_id: number;
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
- constructor(expenditure: any);
16
- static is(expenditure: any): expenditure is Expenditure;
17
- }
18
3
  export declare class FECF24File extends FECFile {
19
4
  readonly committee_id: string;
20
5
  readonly first_fec_file_id: number;
@@ -1,48 +1,5 @@
1
- import { is_election_id } from "./Election.js";
1
+ import { Expenditure } from "./Expenditure.js";
2
2
  import { FECFile } from "./FECFile.js";
3
- export class Expenditure {
4
- fec_file_id;
5
- expenditure_id;
6
- date;
7
- payee;
8
- election_stage;
9
- election_id;
10
- candidate_id;
11
- amount;
12
- cumulative_amount;
13
- purpose;
14
- is_support;
15
- constructor(expenditure) {
16
- if (!Expenditure.is(expenditure)) {
17
- throw Error("Invalid input.");
18
- }
19
- this.fec_file_id = expenditure.fec_file_id;
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
- static is(expenditure) {
32
- return (expenditure !== undefined &&
33
- typeof expenditure.fec_file_id === "number" &&
34
- typeof expenditure.expenditure_id === "string" &&
35
- typeof expenditure.date === "string" &&
36
- typeof expenditure.payee === "string" &&
37
- typeof expenditure.election_stage === "string" &&
38
- is_election_id(expenditure.election_id) &&
39
- typeof expenditure.candidate_id === "string" &&
40
- typeof expenditure.amount === "number" &&
41
- typeof expenditure.cumulative_amount === "number" &&
42
- typeof expenditure.purpose === "string" &&
43
- typeof expenditure.is_support === "boolean");
44
- }
45
- }
46
3
  export class FECF24File extends FECFile {
47
4
  committee_id;
48
5
  first_fec_file_id;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.0.73",
3
+ "version": "1.0.75",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
package/src/index.ts CHANGED
@@ -8,13 +8,13 @@ export * from "./types/CandidateVideo"
8
8
  export * from "./types/Committee"
9
9
  export * from "./types/Election"
10
10
  export * from "./types/ElectionsConfig"
11
+ export * from "./types/Expenditure"
11
12
  export * from "./types/FederalDonation"
12
13
  export * from "./types/FECFile"
13
14
  export * from "./types/FECF1File"
14
15
  export * from "./types/FECF2File"
15
16
  export * from "./types/FECF3File"
16
17
  export * from "./types/FECF24File"
17
- export * from "./types/FECReport"
18
18
  export * from "./types/FormTypeID"
19
19
  export * from "./types/State"
20
20
  export * from "./types/Tweet"
@@ -1,8 +1,7 @@
1
1
  import { Committee, CommitteeAux } from "./Committee"
2
2
  import { ElectionID, is_election_id, is_office_id, OfficeID } from "./Election"
3
- import { Expenditure, FECF24File } from "./FECF24File"
3
+ import { Expenditure, ExpenditureAux } from "./Expenditure"
4
4
  import { FECF3File } from "./FECF3File"
5
- import { FECReport } from "./FECReport"
6
5
  import { is_state_id, StateID } from "./State"
7
6
 
8
7
  export class ActivityIndex {
@@ -93,7 +92,7 @@ export class Candidate {
93
92
  export class CandidateAux extends Candidate {
94
93
  readonly committees : CommitteeAux[]
95
94
  readonly fec_f3_files : FECF3File[]
96
- readonly expenditures : Expenditure[]
95
+ readonly expenditures : ExpenditureAux[]
97
96
 
98
97
  constructor(candidate : any) {
99
98
  if (!CandidateAux.is(candidate)) {
@@ -102,7 +101,7 @@ export class CandidateAux extends Candidate {
102
101
  super(candidate)
103
102
  this.committees = candidate.committees
104
103
  this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
105
- this.expenditures = candidate.expenditures.map(expenditure => new Expenditure(expenditure))
104
+ this.expenditures = candidate.expenditures.map(expenditure => new ExpenditureAux(expenditure))
106
105
  }
107
106
 
108
107
  static is(candidate : any) : candidate is CandidateAux {
@@ -113,7 +112,7 @@ export class CandidateAux extends Candidate {
113
112
  Array.isArray(candidate.fec_f3_files) &&
114
113
  candidate.fec_f3_files.every(FECF3File.is) &&
115
114
  Array.isArray(candidate.expenditures) &&
116
- candidate.expenditures.every(Expenditure.is)
115
+ candidate.expenditures.every(ExpenditureAux.is)
117
116
  )
118
117
  }
119
118
  }
@@ -1,7 +1,6 @@
1
1
  import { Candidate } from "./Candidate"
2
2
  import { CandidateCommittee } from "./CandidateCommittee"
3
3
  import { FECF3File } from "./FECF3File"
4
- import { FECReport } from "./FECReport"
5
4
 
6
5
  export const designations = ["P", "A", "U", "J", "D", "B"] as const
7
6
 
@@ -65,9 +64,9 @@ export class CommitteeAux extends Committee {
65
64
  super(committee)
66
65
  this.candidates = committee.candidates
67
66
  this.fec_f3_files = committee.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
68
- this.jfp_committees = committee.jfp_committees
69
- this.jfr_committees = committee.jfr_committees
70
- this.aff_committees = committee.aff_committees
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))
71
70
  }
72
71
 
73
72
  static is(committee : any) : committee is CommitteeAux {
@@ -1,6 +1,6 @@
1
1
  import { Candidate, CandidateAux } from "./Candidate"
2
2
  import { Committee, CommitteeAux } from "./Committee"
3
- import { Expenditure } from "./FECF24File"
3
+ import { ExpenditureAux } from "./Expenditure"
4
4
  import { is_state_id, state_ids, StateID } from "./State"
5
5
 
6
6
  const office_ids = ["H", "S"] as const
@@ -65,16 +65,16 @@ export class Election {
65
65
  export class ElectionAux extends Election {
66
66
  readonly candidates : CandidateAux[]
67
67
  readonly committees : CommitteeAux[]
68
- readonly expenditures : Expenditure[]
68
+ readonly expenditures : ExpenditureAux[]
69
69
 
70
70
  constructor(election : any) {
71
71
  if (!ElectionAux.is(election)) {
72
72
  throw Error("Invalid input.")
73
73
  }
74
74
  super(election)
75
- this.candidates = election.candidates
76
- this.committees = election.committees
77
- this.expenditures = election.expenditures
75
+ this.candidates = election.candidates.map(candidate => new CandidateAux(candidate))
76
+ this.committees = election.committees.map(committee => new CommitteeAux(committee))
77
+ this.expenditures = election.expenditures.map(expenditure => new ExpenditureAux(expenditure))
78
78
  }
79
79
 
80
80
  static is(election : any) : election is ElectionAux {
@@ -85,7 +85,7 @@ export class ElectionAux extends Election {
85
85
  Array.isArray(election.committees) &&
86
86
  election.committees.every(CommitteeAux.is) &&
87
87
  Array.isArray(election.expenditures) &&
88
- election.expenditures.every(Expenditure.is)
88
+ election.expenditures.every(ExpenditureAux.is)
89
89
  )
90
90
  }
91
91
  }
@@ -0,0 +1,74 @@
1
+ import { Committee } from "./Committee"
2
+ import { ElectionID, is_election_id } from "./Election"
3
+
4
+ export class Expenditure {
5
+ readonly fec_file_id : number
6
+ readonly expenditure_id : string
7
+ readonly committee_id : string
8
+ readonly date : string
9
+ readonly payee : string
10
+ readonly election_stage : string
11
+ readonly election_id : ElectionID
12
+ readonly candidate_id : string
13
+ readonly amount : number
14
+ readonly cumulative_amount : number
15
+ readonly purpose : string
16
+ readonly is_support : boolean
17
+ readonly [x : string] : any
18
+
19
+ constructor(expenditure : any) {
20
+ if (!Expenditure.is(expenditure)) {
21
+ throw Error("Invalid input.")
22
+ }
23
+ this.fec_file_id = expenditure.fec_file_id
24
+ this.expenditure_id = expenditure.expenditure_id
25
+ this.committee_id = expenditure.committee_id
26
+ this.date = expenditure.date
27
+ this.payee = expenditure.payee
28
+ this.election_stage = expenditure.election_stage
29
+ this.election_id = expenditure.election_id
30
+ this.candidate_id = expenditure.candidate_id
31
+ this.amount = expenditure.amount
32
+ this.cumulative_amount = expenditure.cumulative_amount
33
+ this.purpose = expenditure.purpose
34
+ this.is_support = expenditure.is_support
35
+ }
36
+
37
+ static is(expenditure : any) : expenditure is Expenditure {
38
+ return (
39
+ expenditure !== undefined &&
40
+ typeof expenditure.fec_file_id === "number" &&
41
+ typeof expenditure.expenditure_id === "string" &&
42
+ typeof expenditure.committee_id === "string" &&
43
+ typeof expenditure.date === "string" &&
44
+ typeof expenditure.payee === "string" &&
45
+ typeof expenditure.election_stage === "string" &&
46
+ is_election_id(expenditure.election_id) &&
47
+ typeof expenditure.candidate_id === "string" &&
48
+ typeof expenditure.amount === "number" &&
49
+ typeof expenditure.cumulative_amount === "number" &&
50
+ typeof expenditure.purpose === "string" &&
51
+ typeof expenditure.is_support === "boolean"
52
+ )
53
+ }
54
+
55
+ }
56
+
57
+ export class ExpenditureAux extends Expenditure {
58
+ readonly committee : Committee[]
59
+
60
+ constructor(expenditure : any) {
61
+ if (!ExpenditureAux.is(expenditure)) {
62
+ throw Error("Invalid input.")
63
+ }
64
+ super(expenditure)
65
+ this.committee = expenditure.committee
66
+ }
67
+
68
+ static is(expenditure : any) : expenditure is ExpenditureAux {
69
+ return (
70
+ Expenditure.is(expenditure) &&
71
+ Committee.is(expenditure.committee)
72
+ )
73
+ }
74
+ }
@@ -1,55 +1,6 @@
1
- import { ElectionID, is_election_id } from "./Election"
1
+ import { Expenditure } from "./Expenditure"
2
2
  import { FECFile } from "./FECFile"
3
3
 
4
- export class Expenditure {
5
- readonly fec_file_id : number
6
- readonly expenditure_id : string
7
- readonly date : string
8
- readonly payee : string
9
- readonly election_stage : string
10
- readonly election_id : ElectionID
11
- readonly candidate_id : string
12
- readonly amount : number
13
- readonly cumulative_amount : number
14
- readonly purpose : string
15
- readonly is_support : boolean
16
-
17
- constructor(expenditure : any) {
18
- if (!Expenditure.is(expenditure)) {
19
- throw Error("Invalid input.")
20
- }
21
- this.fec_file_id = expenditure.fec_file_id
22
- this.expenditure_id = expenditure.expenditure_id
23
- this.date = expenditure.date
24
- this.payee = expenditure.payee
25
- this.election_stage = expenditure.election_stage
26
- this.election_id = expenditure.election_id
27
- this.candidate_id = expenditure.candidate_id
28
- this.amount = expenditure.amount
29
- this.cumulative_amount = expenditure.cumulative_amount
30
- this.purpose = expenditure.purpose
31
- this.is_support = expenditure.is_support
32
- }
33
-
34
- static is(expenditure : any) : expenditure is Expenditure {
35
- return (
36
- expenditure !== undefined &&
37
- typeof expenditure.fec_file_id === "number" &&
38
- typeof expenditure.expenditure_id === "string" &&
39
- typeof expenditure.date === "string" &&
40
- typeof expenditure.payee === "string" &&
41
- typeof expenditure.election_stage === "string" &&
42
- is_election_id(expenditure.election_id) &&
43
- typeof expenditure.candidate_id === "string" &&
44
- typeof expenditure.amount === "number" &&
45
- typeof expenditure.cumulative_amount === "number" &&
46
- typeof expenditure.purpose === "string" &&
47
- typeof expenditure.is_support === "boolean"
48
- )
49
- }
50
-
51
- }
52
-
53
4
  export class FECF24File extends FECFile {
54
5
  readonly committee_id : string
55
6
  readonly first_fec_file_id : number
@@ -1,81 +0,0 @@
1
- // export class IndependentExpenditure {
2
- // readonly transaction_id : string
3
- // readonly date : string
4
- // readonly payee : string
5
- // readonly election_stage : string
6
- // readonly election_id : string
7
- // readonly amount : number
8
- // readonly cumulative_amount : number
9
- // readonly purpose : string
10
- // readonly candidate_id : string
11
- // readonly support : string
12
-
13
- // constructor(independent_expenditure : any) {
14
- // if (!IndependentExpenditure.is(independent_expenditure)) {
15
- // throw Error("Invalid input.")
16
- // }
17
- // this.transaction_id = independent_expenditure.transaction_id
18
- // this.date = independent_expenditure.date
19
- // this.payee = independent_expenditure.payee
20
- // this.election_stage = independent_expenditure.election_stage
21
- // this.election_id = independent_expenditure.election_id
22
- // this.amount = independent_expenditure.amount
23
- // this.cumulative_amount = independent_expenditure.cumulative_amount
24
- // this.purpose = independent_expenditure.purpose
25
- // this.candidate_id = independent_expenditure.candidate_id
26
- // this.support = independent_expenditure.support
27
- // }
28
-
29
- // static is(independent_expenditure : any) : independent_expenditure is IndependentExpenditure {
30
- // return (
31
- // independent_expenditure !== undefined &&
32
- // typeof independent_expenditure.independent_expenditure === "string" &&
33
- // typeof independent_expenditure.date === "string" &&
34
- // typeof independent_expenditure.payee === "string" &&
35
- // typeof independent_expenditure.election_stage === "string" &&
36
- // typeof independent_expenditure.election_id === "string" &&
37
- // typeof independent_expenditure.amount === "number" &&
38
- // typeof independent_expenditure.cumulative_amount === "number" &&
39
- // typeof independent_expenditure.purpose === "string" &&
40
- // typeof independent_expenditure.candidate_id === "string" &&
41
- // typeof independent_expenditure.support === "string"
42
- // )
43
- // }
44
- // }
45
-
46
- // export class FECIndependentExpenditureReport {
47
- // readonly committee_id : string
48
- // readonly first_file_number : number
49
- // readonly report_type : string
50
- // readonly first_report_date : string
51
- // readonly report_date : string
52
- // readonly transaction_ids : string[]
53
- // readonly expenditures_by_transaction_id : Record<string, IndependentExpenditure>
54
-
55
- // constructor(fec_independent_expenditure_report : any) {
56
- // if (!FECIndependentExpenditureReport.is(fec_independent_expenditure_report)) {
57
- // throw Error("Invalid input.")
58
- // }
59
- // this.committee_id = fec_independent_expenditure_report.committee_id
60
- // this.first_file_number = fec_independent_expenditure_report.first_file_number
61
- // this.report_type = fec_independent_expenditure_report.report_type
62
- // this.first_report_date = fec_independent_expenditure_report.first_report_date
63
- // this.report_date = fec_independent_expenditure_report.report_date
64
- // this.transaction_ids = fec_independent_expenditure_report.transaction_ids
65
- // this.expenditures_by_transaction_id = fec_independent_expenditure_report.expenditures_by_transaction_id
66
- // }
67
-
68
- // static is(fec_independent_expenditure_report : any) : fec_independent_expenditure_report is FECIndependentExpenditureReport {
69
- // return (
70
- // fec_independent_expenditure_report !== undefined &&
71
- // typeof fec_independent_expenditure_report.committee_id === "string" &&
72
- // typeof fec_independent_expenditure_report.first_file_number === "number" &&
73
- // typeof fec_independent_expenditure_report.report_type === "string" &&
74
- // typeof fec_independent_expenditure_report.first_report_date === "string" &&
75
- // typeof fec_independent_expenditure_report.report_date === "string" &&
76
- // Array.isArray(fec_independent_expenditure_report.transaction_ids) && fec_independent_expenditure_report.transaction_ids.map((transaction_id : any) => typeof transaction_id === "string") &&
77
- // typeof fec_independent_expenditure_report.expenditures_by_transaction_id === "object" &&
78
- // Object.entries(fec_independent_expenditure_report.expenditures_by_transaction_id).every(([key, value]) => typeof key === "string" && IndependentExpenditure.is(value))
79
- // )
80
- // }
81
- // }
@@ -1,32 +0,0 @@
1
- export class FECReport {
2
- readonly committee_id : string
3
- readonly report_type : string
4
- readonly file_number : number
5
- readonly cash_on_hand : number
6
- readonly cumulative_receipts : number
7
- readonly new_receipts : number
8
-
9
- constructor(fec_report : any) {
10
- if (!FECReport.is(fec_report)) {
11
- throw Error("Invalid input.")
12
- }
13
- this.committee_id = fec_report.committee_id
14
- this.report_type = fec_report.report_type
15
- this.file_number = fec_report.file_number
16
- this.cash_on_hand = fec_report.cash_on_hand
17
- this.cumulative_receipts = fec_report.cumulative_receipts
18
- this.new_receipts = fec_report.new_receipts
19
- }
20
-
21
- static is(fec_report : any) : fec_report is FECReport {
22
- return (
23
- fec_report !== undefined &&
24
- typeof fec_report.committee_id === "string" &&
25
- typeof fec_report.report_type === "string" &&
26
- typeof fec_report.file_number === "number" &&
27
- typeof fec_report.cash_on_hand === "number" &&
28
- typeof fec_report.cumulative_receipts === "number" &&
29
- typeof fec_report.new_receipts === "number"
30
- )
31
- }
32
- }