elections-types 1.0.48 → 1.0.50

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,7 @@ export * from "./types/Committee.js";
8
8
  export * from "./types/Donation.js";
9
9
  export * from "./types/Election.js";
10
10
  export * from "./types/ElectionsConfig.js";
11
+ export * from "./types/FederalDonation.js";
11
12
  export * from "./types/FECReport.js";
12
13
  export * from "./types/FormTypeID.js";
13
14
  export * from "./types/State.js";
package/dist/src/index.js CHANGED
@@ -8,6 +8,7 @@ export * from "./types/Committee.js";
8
8
  export * from "./types/Donation.js";
9
9
  export * from "./types/Election.js";
10
10
  export * from "./types/ElectionsConfig.js";
11
+ export * from "./types/FederalDonation.js";
11
12
  export * from "./types/FECReport.js";
12
13
  export * from "./types/FormTypeID.js";
13
14
  export * from "./types/State.js";
@@ -0,0 +1,29 @@
1
+ import { StateID } from "./State.js";
2
+ export declare class FederalDonation {
3
+ readonly federal_donation_id: string;
4
+ readonly receipt_date: string;
5
+ readonly sub_id: string;
6
+ readonly committee_id: string;
7
+ readonly recipient_committee_id?: string;
8
+ readonly file_number: number;
9
+ readonly image_number: string;
10
+ readonly amount: number;
11
+ readonly donor_id?: string;
12
+ readonly donor_name: string;
13
+ readonly donor_prefix?: string;
14
+ readonly donor_first_name: string;
15
+ readonly donor_middle_name?: string;
16
+ readonly donor_last_name: string;
17
+ readonly donor_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
+ constructor(federal_donation: any);
28
+ static is(federal_donation: any): federal_donation is FederalDonation;
29
+ }
@@ -0,0 +1,82 @@
1
+ export class FederalDonation {
2
+ federal_donation_id;
3
+ receipt_date;
4
+ sub_id;
5
+ committee_id;
6
+ recipient_committee_id;
7
+ file_number;
8
+ image_number;
9
+ amount;
10
+ donor_id;
11
+ donor_name;
12
+ donor_prefix;
13
+ donor_first_name;
14
+ donor_middle_name;
15
+ donor_last_name;
16
+ donor_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
+ constructor(federal_donation) {
27
+ if (!FederalDonation.is(federal_donation)) {
28
+ throw Error("Invalid input.");
29
+ }
30
+ this.federal_donation_id = federal_donation.federal_donation_id;
31
+ this.receipt_date = federal_donation.receipt_date;
32
+ this.sub_id = federal_donation.sub_id;
33
+ this.committee_id = federal_donation.committee_id;
34
+ this.recipient_committee_id = federal_donation.recipient_committee_id;
35
+ this.file_number = federal_donation.file_number;
36
+ this.image_number = federal_donation.image_number;
37
+ this.amount = federal_donation.amount;
38
+ this.donor_id = federal_donation.donor_id;
39
+ this.donor_name = federal_donation.donor_name;
40
+ this.donor_prefix = federal_donation.donor_prefix;
41
+ this.donor_first_name = federal_donation.donor_first_name;
42
+ this.donor_middle_name = federal_donation.donor_middle_name;
43
+ this.donor_last_name = federal_donation.donor_last_name;
44
+ this.donor_suffix = federal_donation.donor_suffix;
45
+ this.donor_occupation = federal_donation.donor_occupation;
46
+ this.donor_employer = federal_donation.donor_employer;
47
+ this.donor_address_street_1 = federal_donation.donor_address_street_1;
48
+ this.donor_address_street_2 = federal_donation.donor_address_street_2;
49
+ this.donor_address_city = federal_donation.donor_address_city;
50
+ this.donor_address_state_id = federal_donation.donor_address_state_id;
51
+ this.donor_address_zip = federal_donation.donor_address_zip;
52
+ this.donor_aggregate_ytd = federal_donation.donor_aggregate_ytd;
53
+ this.memo_text = federal_donation.memo_text;
54
+ }
55
+ static is(federal_donation) {
56
+ return (federal_donation !== undefined &&
57
+ typeof federal_donation.federal_donation_id === "string" &&
58
+ typeof federal_donation.receipt_date === "string" &&
59
+ typeof federal_donation.sub_id === "string" &&
60
+ typeof federal_donation.committee_id === "string" &&
61
+ typeof federal_donation.recipient_committee_id === "string" &&
62
+ typeof federal_donation.file_number === "number" && !isNaN(federal_donation.file_number) &&
63
+ typeof federal_donation.image_number === "string" &&
64
+ typeof federal_donation.amount === "number" && !isNaN(federal_donation.amount) &&
65
+ (federal_donation.donor_id === undefined || typeof federal_donation.donor_id === "string") &&
66
+ typeof federal_donation.donor_name === "string" &&
67
+ (federal_donation.donor_prefix === undefined || typeof federal_donation.donor_prefix === "string") &&
68
+ typeof federal_donation.donor_first_name === "string" &&
69
+ (federal_donation.donor_middle_name === undefined || typeof federal_donation.donor_middle_name === "string") &&
70
+ typeof federal_donation.donor_last_name === "string" &&
71
+ (federal_donation.donor_suffix === undefined || typeof federal_donation.donor_suffix === "string") &&
72
+ typeof federal_donation.donor_occupation === "string" &&
73
+ typeof federal_donation.donor_employer === "string" &&
74
+ typeof federal_donation.donor_address_street_1 === "string" &&
75
+ (federal_donation.donor_address_street_2 === undefined || typeof federal_donation.donor_address_street_2 === "string") &&
76
+ typeof federal_donation.donor_address_city === "string" &&
77
+ typeof federal_donation.donor_address_state_id === "string" &&
78
+ typeof federal_donation.donor_address_zip === "string" &&
79
+ typeof federal_donation.donor_aggregate_ytd === "number" && !isNaN(federal_donation.donor_aggregate_ytd) &&
80
+ typeof federal_donation.memo_text === "string");
81
+ }
82
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
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,7 @@ export * from "./types/Committee"
8
8
  export * from "./types/Donation"
9
9
  export * from "./types/Election"
10
10
  export * from "./types/ElectionsConfig"
11
+ export * from "./types/FederalDonation"
11
12
  export * from "./types/FECReport"
12
13
  export * from "./types/FormTypeID"
13
14
  export * from "./types/State"
@@ -0,0 +1,88 @@
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 recipient_committee_id? : string
9
+ readonly file_number : number
10
+ readonly image_number : string
11
+ readonly amount : number
12
+ readonly donor_id? : string
13
+ readonly donor_name : string
14
+ readonly donor_prefix? : string
15
+ readonly donor_first_name : string
16
+ readonly donor_middle_name? : string
17
+ readonly donor_last_name : string
18
+ readonly donor_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
+
29
+ constructor(federal_donation : any) {
30
+ if (!FederalDonation.is(federal_donation)) {
31
+ throw Error("Invalid input.")
32
+ }
33
+ this.federal_donation_id = federal_donation.federal_donation_id
34
+ this.receipt_date = federal_donation.receipt_date
35
+ this.sub_id = federal_donation.sub_id
36
+ this.committee_id = federal_donation.committee_id
37
+ this.recipient_committee_id = federal_donation.recipient_committee_id
38
+ this.file_number = federal_donation.file_number
39
+ this.image_number = federal_donation.image_number
40
+ this.amount = federal_donation.amount
41
+ this.donor_id = federal_donation.donor_id
42
+ this.donor_name = federal_donation.donor_name
43
+ this.donor_prefix = federal_donation.donor_prefix
44
+ this.donor_first_name = federal_donation.donor_first_name
45
+ this.donor_middle_name = federal_donation.donor_middle_name
46
+ this.donor_last_name = federal_donation.donor_last_name
47
+ this.donor_suffix = federal_donation.donor_suffix
48
+ this.donor_occupation = federal_donation.donor_occupation
49
+ this.donor_employer = federal_donation.donor_employer
50
+ this.donor_address_street_1 = federal_donation.donor_address_street_1
51
+ this.donor_address_street_2 = federal_donation.donor_address_street_2
52
+ this.donor_address_city = federal_donation.donor_address_city
53
+ this.donor_address_state_id = federal_donation.donor_address_state_id
54
+ this.donor_address_zip = federal_donation.donor_address_zip
55
+ this.donor_aggregate_ytd = federal_donation.donor_aggregate_ytd
56
+ this.memo_text = federal_donation.memo_text
57
+ }
58
+
59
+ static is(federal_donation : any) : federal_donation is FederalDonation {
60
+ return (
61
+ federal_donation !== undefined &&
62
+ typeof federal_donation.federal_donation_id === "string" &&
63
+ typeof federal_donation.receipt_date === "string" &&
64
+ typeof federal_donation.sub_id === "string" &&
65
+ typeof federal_donation.committee_id === "string" &&
66
+ typeof federal_donation.recipient_committee_id === "string" &&
67
+ typeof federal_donation.file_number === "number" && !isNaN(federal_donation.file_number) &&
68
+ typeof federal_donation.image_number === "string" &&
69
+ typeof federal_donation.amount === "number" && !isNaN(federal_donation.amount) &&
70
+ (federal_donation.donor_id === undefined || typeof federal_donation.donor_id === "string") &&
71
+ typeof federal_donation.donor_name === "string" &&
72
+ (federal_donation.donor_prefix === undefined || typeof federal_donation.donor_prefix === "string") &&
73
+ typeof federal_donation.donor_first_name === "string" &&
74
+ (federal_donation.donor_middle_name === undefined || typeof federal_donation.donor_middle_name === "string") &&
75
+ typeof federal_donation.donor_last_name === "string" &&
76
+ (federal_donation.donor_suffix === undefined || typeof federal_donation.donor_suffix === "string") &&
77
+ typeof federal_donation.donor_occupation === "string" &&
78
+ typeof federal_donation.donor_employer === "string" &&
79
+ typeof federal_donation.donor_address_street_1 === "string" &&
80
+ (federal_donation.donor_address_street_2 === undefined || typeof federal_donation.donor_address_street_2 === "string") &&
81
+ typeof federal_donation.donor_address_city === "string" &&
82
+ typeof federal_donation.donor_address_state_id === "string" &&
83
+ typeof federal_donation.donor_address_zip === "string" &&
84
+ typeof federal_donation.donor_aggregate_ytd === "number" && !isNaN(federal_donation.donor_aggregate_ytd) &&
85
+ typeof federal_donation.memo_text === "string"
86
+ )
87
+ }
88
+ }