elections-types 1.0.87 → 1.0.89

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.
@@ -9,7 +9,7 @@ export * from "./types/Committee.js";
9
9
  export * from "./types/Election.js";
10
10
  export * from "./types/ElectionsConfig.js";
11
11
  export * from "./types/Expenditure.js";
12
- export * from "./types/FederalDonation.js";
12
+ export * from "./types/FederalElectionDonation.js";
13
13
  export * from "./types/FederalElectionFile.js";
14
14
  export * from "./types/FederalElectionF1File.js";
15
15
  export * from "./types/FederalElectionF2File.js";
package/dist/src/index.js CHANGED
@@ -9,7 +9,7 @@ export * from "./types/Committee.js";
9
9
  export * from "./types/Election.js";
10
10
  export * from "./types/ElectionsConfig.js";
11
11
  export * from "./types/Expenditure.js";
12
- export * from "./types/FederalDonation.js";
12
+ export * from "./types/FederalElectionDonation.js";
13
13
  export * from "./types/FederalElectionFile.js";
14
14
  export * from "./types/FederalElectionF1File.js";
15
15
  export * from "./types/FederalElectionF2File.js";
@@ -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: FederalElectionF3File[];
34
+ readonly federal_election_f3_files: FederalElectionF3File[];
35
35
  readonly expenditures: ExpenditureAux[];
36
36
  constructor(candidate: any);
37
37
  static is(candidate: any): candidate is CandidateAux;
@@ -76,7 +76,7 @@ export class Candidate {
76
76
  }
77
77
  export class CandidateAux extends Candidate {
78
78
  committees;
79
- fec_f3_files;
79
+ federal_election_f3_files;
80
80
  expenditures;
81
81
  constructor(candidate) {
82
82
  if (!CandidateAux.is(candidate)) {
@@ -84,15 +84,15 @@ 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 FederalElectionF3File(fec_f3_file));
88
- this.expenditures = candidate.expenditures.map(expenditure => new ExpenditureAux(expenditure));
87
+ this.federal_election_f3_files = candidate.federal_election_f3_files;
88
+ this.expenditures = candidate.expenditures;
89
89
  }
90
90
  static is(candidate) {
91
91
  return (Candidate.is(candidate) &&
92
92
  Array.isArray(candidate.committees) &&
93
93
  candidate.committees.every(CommitteeAux.is) &&
94
- Array.isArray(candidate.fec_f3_files) &&
95
- candidate.fec_f3_files.every(FederalElectionF3File.is) &&
94
+ Array.isArray(candidate.federal_election_f3_files) &&
95
+ candidate.federal_election_f3_files.every(FederalElectionF3File.is) &&
96
96
  Array.isArray(candidate.expenditures) &&
97
97
  candidate.expenditures.every(ExpenditureAux.is));
98
98
  }
@@ -0,0 +1,30 @@
1
+ import { StateID } from "./State.js";
2
+ export declare class FederalElectionDonation {
3
+ readonly federal_election_donation_id: string;
4
+ readonly receipt_date: string;
5
+ readonly sub_id: string;
6
+ readonly committee_id: string;
7
+ readonly federal_election_file_id: number;
8
+ readonly image_number: string;
9
+ readonly amount: number;
10
+ readonly donor_is_individual: boolean;
11
+ readonly donor_committee_id?: string;
12
+ readonly donor_name: string;
13
+ readonly donor_name_prefix?: string;
14
+ readonly donor_name_first: string;
15
+ readonly donor_name_middle?: string;
16
+ readonly donor_name_last: string;
17
+ readonly donor_name_suffix?: string;
18
+ readonly donor_occupation: string;
19
+ readonly donor_employer: string;
20
+ readonly donor_address_street_1: string;
21
+ readonly donor_address_street_2?: string;
22
+ readonly donor_address_city: string;
23
+ readonly donor_address_state_id: StateID;
24
+ readonly donor_address_zip: string;
25
+ readonly donor_aggregate_ytd: number;
26
+ readonly memo_text: string;
27
+ readonly target_committee_id?: string;
28
+ constructor(federal_election_donation: FederalElectionDonation);
29
+ static is(federal_election_donation: any): federal_election_donation is FederalElectionDonation;
30
+ }
@@ -0,0 +1,85 @@
1
+ export class FederalElectionDonation {
2
+ federal_election_donation_id;
3
+ receipt_date;
4
+ sub_id;
5
+ committee_id;
6
+ federal_election_file_id;
7
+ image_number;
8
+ amount;
9
+ donor_is_individual;
10
+ donor_committee_id;
11
+ donor_name;
12
+ donor_name_prefix;
13
+ donor_name_first;
14
+ donor_name_middle;
15
+ donor_name_last;
16
+ donor_name_suffix;
17
+ donor_occupation;
18
+ donor_employer;
19
+ donor_address_street_1;
20
+ donor_address_street_2;
21
+ donor_address_city;
22
+ donor_address_state_id;
23
+ donor_address_zip;
24
+ donor_aggregate_ytd;
25
+ memo_text;
26
+ target_committee_id;
27
+ constructor(federal_election_donation) {
28
+ if (!FederalElectionDonation.is(federal_election_donation)) {
29
+ throw Error("Invalid input.");
30
+ }
31
+ this.federal_election_donation_id = federal_election_donation.federal_election_donation_id;
32
+ this.receipt_date = federal_election_donation.receipt_date;
33
+ this.sub_id = federal_election_donation.sub_id;
34
+ this.committee_id = federal_election_donation.committee_id;
35
+ this.federal_election_file_id = federal_election_donation.federal_election_file_id;
36
+ this.image_number = federal_election_donation.image_number;
37
+ this.amount = federal_election_donation.amount;
38
+ this.donor_is_individual = federal_election_donation.donor_is_individual;
39
+ this.donor_committee_id = federal_election_donation.donor_committee_id;
40
+ this.donor_name = federal_election_donation.donor_name;
41
+ this.donor_name_prefix = federal_election_donation.donor_name_prefix;
42
+ this.donor_name_first = federal_election_donation.donor_name_first;
43
+ this.donor_name_middle = federal_election_donation.donor_name_middle;
44
+ this.donor_name_last = federal_election_donation.donor_name_last;
45
+ this.donor_name_suffix = federal_election_donation.donor_name_suffix;
46
+ this.donor_occupation = federal_election_donation.donor_occupation;
47
+ this.donor_employer = federal_election_donation.donor_employer;
48
+ this.donor_address_street_1 = federal_election_donation.donor_address_street_1;
49
+ this.donor_address_street_2 = federal_election_donation.donor_address_street_2;
50
+ this.donor_address_city = federal_election_donation.donor_address_city;
51
+ this.donor_address_state_id = federal_election_donation.donor_address_state_id;
52
+ this.donor_address_zip = federal_election_donation.donor_address_zip;
53
+ this.donor_aggregate_ytd = federal_election_donation.donor_aggregate_ytd;
54
+ this.memo_text = federal_election_donation.memo_text;
55
+ this.target_committee_id = federal_election_donation.target_committee_id;
56
+ }
57
+ static is(federal_election_donation) {
58
+ return (federal_election_donation !== undefined &&
59
+ typeof federal_election_donation.federal_election_donation_id === "string" &&
60
+ typeof federal_election_donation.receipt_date === "string" &&
61
+ typeof federal_election_donation.sub_id === "string" &&
62
+ typeof federal_election_donation.committee_id === "string" &&
63
+ typeof federal_election_donation.federal_election_file_id === "number" && !isNaN(federal_election_donation.federal_election_file_id) &&
64
+ typeof federal_election_donation.image_number === "string" &&
65
+ typeof federal_election_donation.amount === "number" && !isNaN(federal_election_donation.amount) &&
66
+ typeof federal_election_donation.donor_is_individual === "boolean" &&
67
+ (federal_election_donation.donor_committee_id === undefined || typeof federal_election_donation.donor_committee_id === "string") &&
68
+ typeof federal_election_donation.donor_name === "string" &&
69
+ (federal_election_donation.donor_name_prefix === undefined || typeof federal_election_donation.donor_name_prefix === "string") &&
70
+ typeof federal_election_donation.donor_name_first === "string" &&
71
+ (federal_election_donation.donor_name_middle === undefined || typeof federal_election_donation.donor_name_middle === "string") &&
72
+ typeof federal_election_donation.donor_name_last === "string" &&
73
+ (federal_election_donation.donor_name_suffix === undefined || typeof federal_election_donation.donor_name_suffix === "string") &&
74
+ typeof federal_election_donation.donor_occupation === "string" &&
75
+ typeof federal_election_donation.donor_employer === "string" &&
76
+ typeof federal_election_donation.donor_address_street_1 === "string" &&
77
+ (federal_election_donation.donor_address_street_2 === undefined || typeof federal_election_donation.donor_address_street_2 === "string") &&
78
+ typeof federal_election_donation.donor_address_city === "string" &&
79
+ typeof federal_election_donation.donor_address_state_id === "string" &&
80
+ typeof federal_election_donation.donor_address_zip === "string" &&
81
+ typeof federal_election_donation.donor_aggregate_ytd === "number" && !isNaN(federal_election_donation.donor_aggregate_ytd) &&
82
+ typeof federal_election_donation.memo_text === "string" &&
83
+ (federal_election_donation.target_committee_id === undefined || typeof federal_election_donation.target_committee_id === "string"));
84
+ }
85
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.0.87",
3
+ "version": "1.0.89",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
package/src/index.ts CHANGED
@@ -9,7 +9,7 @@ export * from "./types/Committee"
9
9
  export * from "./types/Election"
10
10
  export * from "./types/ElectionsConfig"
11
11
  export * from "./types/Expenditure"
12
- export * from "./types/FederalDonation"
12
+ export * from "./types/FederalElectionDonation"
13
13
  export * from "./types/FederalElectionFile"
14
14
  export * from "./types/FederalElectionF1File"
15
15
  export * from "./types/FederalElectionF2File"
@@ -91,7 +91,7 @@ export class Candidate {
91
91
 
92
92
  export class CandidateAux extends Candidate {
93
93
  readonly committees : CommitteeAux[]
94
- readonly fec_f3_files : FederalElectionF3File[]
94
+ readonly federal_election_f3_files : FederalElectionF3File[]
95
95
  readonly expenditures : ExpenditureAux[]
96
96
 
97
97
  constructor(candidate : any) {
@@ -100,8 +100,8 @@ export class CandidateAux extends Candidate {
100
100
  }
101
101
  super(candidate)
102
102
  this.committees = candidate.committees
103
- this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FederalElectionF3File(fec_f3_file))
104
- this.expenditures = candidate.expenditures.map(expenditure => new ExpenditureAux(expenditure))
103
+ this.federal_election_f3_files = candidate.federal_election_f3_files
104
+ this.expenditures = candidate.expenditures
105
105
  }
106
106
 
107
107
  static is(candidate : any) : candidate is CandidateAux {
@@ -109,8 +109,8 @@ export class CandidateAux extends Candidate {
109
109
  Candidate.is(candidate) &&
110
110
  Array.isArray(candidate.committees) &&
111
111
  candidate.committees.every(CommitteeAux.is) &&
112
- Array.isArray(candidate.fec_f3_files) &&
113
- candidate.fec_f3_files.every(FederalElectionF3File.is) &&
112
+ Array.isArray(candidate.federal_election_f3_files) &&
113
+ candidate.federal_election_f3_files.every(FederalElectionF3File.is) &&
114
114
  Array.isArray(candidate.expenditures) &&
115
115
  candidate.expenditures.every(ExpenditureAux.is)
116
116
  )
@@ -0,0 +1,91 @@
1
+ import { StateID } from "./State"
2
+
3
+ export class FederalElectionDonation {
4
+ readonly federal_election_donation_id : string
5
+ readonly receipt_date : string
6
+ readonly sub_id : string
7
+ readonly committee_id : string
8
+ readonly federal_election_file_id : number
9
+ readonly image_number : string
10
+ readonly amount : number
11
+ readonly donor_is_individual : boolean
12
+ readonly donor_committee_id? : string
13
+ readonly donor_name : string
14
+ readonly donor_name_prefix? : string
15
+ readonly donor_name_first : string
16
+ readonly donor_name_middle? : string
17
+ readonly donor_name_last : string
18
+ readonly donor_name_suffix? : string
19
+ readonly donor_occupation : string
20
+ readonly donor_employer : string
21
+ readonly donor_address_street_1 : string
22
+ readonly donor_address_street_2? : string
23
+ readonly donor_address_city : string
24
+ readonly donor_address_state_id : StateID
25
+ readonly donor_address_zip : string
26
+ readonly donor_aggregate_ytd : number
27
+ readonly memo_text : string
28
+ readonly target_committee_id? : string
29
+
30
+ constructor(federal_election_donation : FederalElectionDonation) {
31
+ if (!FederalElectionDonation.is(federal_election_donation)) {
32
+ throw Error("Invalid input.")
33
+ }
34
+ this.federal_election_donation_id = federal_election_donation.federal_election_donation_id
35
+ this.receipt_date = federal_election_donation.receipt_date
36
+ this.sub_id = federal_election_donation.sub_id
37
+ this.committee_id = federal_election_donation.committee_id
38
+ this.federal_election_file_id = federal_election_donation.federal_election_file_id
39
+ this.image_number = federal_election_donation.image_number
40
+ this.amount = federal_election_donation.amount
41
+ this.donor_is_individual = federal_election_donation.donor_is_individual
42
+ this.donor_committee_id = federal_election_donation.donor_committee_id
43
+ this.donor_name = federal_election_donation.donor_name
44
+ this.donor_name_prefix = federal_election_donation.donor_name_prefix
45
+ this.donor_name_first = federal_election_donation.donor_name_first
46
+ this.donor_name_middle = federal_election_donation.donor_name_middle
47
+ this.donor_name_last = federal_election_donation.donor_name_last
48
+ this.donor_name_suffix = federal_election_donation.donor_name_suffix
49
+ this.donor_occupation = federal_election_donation.donor_occupation
50
+ this.donor_employer = federal_election_donation.donor_employer
51
+ this.donor_address_street_1 = federal_election_donation.donor_address_street_1
52
+ this.donor_address_street_2 = federal_election_donation.donor_address_street_2
53
+ this.donor_address_city = federal_election_donation.donor_address_city
54
+ this.donor_address_state_id = federal_election_donation.donor_address_state_id
55
+ this.donor_address_zip = federal_election_donation.donor_address_zip
56
+ this.donor_aggregate_ytd = federal_election_donation.donor_aggregate_ytd
57
+ this.memo_text = federal_election_donation.memo_text
58
+ this.target_committee_id = federal_election_donation.target_committee_id
59
+ }
60
+
61
+ static is(federal_election_donation : any) : federal_election_donation is FederalElectionDonation {
62
+ return (
63
+ federal_election_donation !== undefined &&
64
+ typeof federal_election_donation.federal_election_donation_id === "string" &&
65
+ typeof federal_election_donation.receipt_date === "string" &&
66
+ typeof federal_election_donation.sub_id === "string" &&
67
+ typeof federal_election_donation.committee_id === "string" &&
68
+ typeof federal_election_donation.federal_election_file_id === "number" && !isNaN(federal_election_donation.federal_election_file_id) &&
69
+ typeof federal_election_donation.image_number === "string" &&
70
+ typeof federal_election_donation.amount === "number" && !isNaN(federal_election_donation.amount) &&
71
+ typeof federal_election_donation.donor_is_individual === "boolean" &&
72
+ (federal_election_donation.donor_committee_id === undefined || typeof federal_election_donation.donor_committee_id === "string") &&
73
+ typeof federal_election_donation.donor_name === "string" &&
74
+ (federal_election_donation.donor_name_prefix === undefined || typeof federal_election_donation.donor_name_prefix === "string") &&
75
+ typeof federal_election_donation.donor_name_first === "string" &&
76
+ (federal_election_donation.donor_name_middle === undefined || typeof federal_election_donation.donor_name_middle === "string") &&
77
+ typeof federal_election_donation.donor_name_last === "string" &&
78
+ (federal_election_donation.donor_name_suffix === undefined || typeof federal_election_donation.donor_name_suffix === "string") &&
79
+ typeof federal_election_donation.donor_occupation === "string" &&
80
+ typeof federal_election_donation.donor_employer === "string" &&
81
+ typeof federal_election_donation.donor_address_street_1 === "string" &&
82
+ (federal_election_donation.donor_address_street_2 === undefined || typeof federal_election_donation.donor_address_street_2 === "string") &&
83
+ typeof federal_election_donation.donor_address_city === "string" &&
84
+ typeof federal_election_donation.donor_address_state_id === "string" &&
85
+ typeof federal_election_donation.donor_address_zip === "string" &&
86
+ typeof federal_election_donation.donor_aggregate_ytd === "number" && !isNaN(federal_election_donation.donor_aggregate_ytd) &&
87
+ typeof federal_election_donation.memo_text === "string" &&
88
+ (federal_election_donation.target_committee_id === undefined || typeof federal_election_donation.target_committee_id === "string")
89
+ )
90
+ }
91
+ }
@@ -1,91 +0,0 @@
1
- import { StateID } from "./State"
2
-
3
- export class FederalDonation {
4
- readonly federal_donation_id : string
5
- readonly receipt_date : string
6
- readonly sub_id : string
7
- readonly committee_id : string
8
- readonly target_committee_id? : string
9
- readonly federal_election_file_id : number
10
- readonly image_number : string
11
- readonly amount : number
12
- readonly donor_is_individual : boolean
13
- readonly donor_id? : string
14
- readonly donor_name : string
15
- readonly donor_prefix? : string
16
- readonly donor_first_name : string
17
- readonly donor_middle_name? : string
18
- readonly donor_last_name : string
19
- readonly donor_suffix? : string
20
- readonly donor_occupation : string
21
- readonly donor_employer : string
22
- readonly donor_address_street_1 : string
23
- readonly donor_address_street_2? : string
24
- readonly donor_address_city : string
25
- readonly donor_address_state_id : StateID
26
- readonly donor_address_zip : string
27
- readonly donor_aggregate_ytd : number
28
- readonly memo_text : string
29
-
30
- constructor(federal_donation : FederalDonation) {
31
- if (!FederalDonation.is(federal_donation)) {
32
- throw Error("Invalid input.")
33
- }
34
- this.federal_donation_id = federal_donation.federal_donation_id
35
- this.receipt_date = federal_donation.receipt_date
36
- this.sub_id = federal_donation.sub_id
37
- this.committee_id = federal_donation.committee_id
38
- this.target_committee_id = federal_donation.target_committee_id
39
- this.federal_election_file_id = federal_donation.federal_election_file_id
40
- this.image_number = federal_donation.image_number
41
- this.amount = federal_donation.amount
42
- this.donor_is_individual = federal_donation.donor_is_individual
43
- this.donor_id = federal_donation.donor_id
44
- this.donor_name = federal_donation.donor_name
45
- this.donor_prefix = federal_donation.donor_prefix
46
- this.donor_first_name = federal_donation.donor_first_name
47
- this.donor_middle_name = federal_donation.donor_middle_name
48
- this.donor_last_name = federal_donation.donor_last_name
49
- this.donor_suffix = federal_donation.donor_suffix
50
- this.donor_occupation = federal_donation.donor_occupation
51
- this.donor_employer = federal_donation.donor_employer
52
- this.donor_address_street_1 = federal_donation.donor_address_street_1
53
- this.donor_address_street_2 = federal_donation.donor_address_street_2
54
- this.donor_address_city = federal_donation.donor_address_city
55
- this.donor_address_state_id = federal_donation.donor_address_state_id
56
- this.donor_address_zip = federal_donation.donor_address_zip
57
- this.donor_aggregate_ytd = federal_donation.donor_aggregate_ytd
58
- this.memo_text = federal_donation.memo_text
59
- }
60
-
61
- static is(federal_donation : any) : federal_donation is FederalDonation {
62
- return (
63
- federal_donation !== undefined &&
64
- typeof federal_donation.federal_donation_id === "string" &&
65
- typeof federal_donation.receipt_date === "string" &&
66
- typeof federal_donation.sub_id === "string" &&
67
- typeof federal_donation.committee_id === "string" &&
68
- (federal_donation.target_committee_id === undefined || typeof federal_donation.target_committee_id === "string") &&
69
- typeof federal_donation.federal_election_file_id === "number" && !isNaN(federal_donation.federal_election_file_id) &&
70
- typeof federal_donation.image_number === "string" &&
71
- typeof federal_donation.amount === "number" && !isNaN(federal_donation.amount) &&
72
- typeof federal_donation.donor_is_individual === "boolean" &&
73
- (federal_donation.donor_id === undefined || typeof federal_donation.donor_id === "string") &&
74
- typeof federal_donation.donor_name === "string" &&
75
- (federal_donation.donor_prefix === undefined || typeof federal_donation.donor_prefix === "string") &&
76
- typeof federal_donation.donor_first_name === "string" &&
77
- (federal_donation.donor_middle_name === undefined || typeof federal_donation.donor_middle_name === "string") &&
78
- typeof federal_donation.donor_last_name === "string" &&
79
- (federal_donation.donor_suffix === undefined || typeof federal_donation.donor_suffix === "string") &&
80
- typeof federal_donation.donor_occupation === "string" &&
81
- typeof federal_donation.donor_employer === "string" &&
82
- typeof federal_donation.donor_address_street_1 === "string" &&
83
- (federal_donation.donor_address_street_2 === undefined || typeof federal_donation.donor_address_street_2 === "string") &&
84
- typeof federal_donation.donor_address_city === "string" &&
85
- typeof federal_donation.donor_address_state_id === "string" &&
86
- typeof federal_donation.donor_address_zip === "string" &&
87
- typeof federal_donation.donor_aggregate_ytd === "number" && !isNaN(federal_donation.donor_aggregate_ytd) &&
88
- typeof federal_donation.memo_text === "string"
89
- )
90
- }
91
- }