elections-types 1.0.2 → 1.0.4

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.
@@ -2,3 +2,4 @@ export * from "./types/APIError.js";
2
2
  export * from "./types/Tweet.js";
3
3
  export * from "./types/User.js";
4
4
  export * from "./types/ElectionsConfig.js";
5
+ export * from "./types/Donation.js";
package/dist/src/index.js CHANGED
@@ -2,3 +2,4 @@ export * from "./types/APIError.js";
2
2
  export * from "./types/Tweet.js";
3
3
  export * from "./types/User.js";
4
4
  export * from "./types/ElectionsConfig.js";
5
+ export * from "./types/Donation.js";
@@ -0,0 +1,26 @@
1
+ import { StateID } from "./State.js";
2
+ export declare class Donation {
3
+ readonly committee_id: string;
4
+ readonly donation_id: string;
5
+ readonly image_number: string;
6
+ readonly receipt_date: string;
7
+ readonly amount: number;
8
+ readonly donor_id?: string;
9
+ readonly donor_name: string;
10
+ readonly donor_prefix?: string;
11
+ readonly donor_first_name: string;
12
+ readonly donor_middle_name?: string;
13
+ readonly donor_last_name: string;
14
+ readonly donor_suffix?: string;
15
+ readonly donor_occupation: string;
16
+ readonly donor_employer: string;
17
+ readonly donor_address_street_1: string;
18
+ readonly donor_address_street_2?: string;
19
+ readonly donor_address_city: string;
20
+ readonly donor_address_state_id: StateID;
21
+ readonly donor_address_zip: string;
22
+ readonly donor_aggregate_ytd: number;
23
+ readonly memo_text: string;
24
+ constructor(donation: any);
25
+ static is(donation: any): donation is Donation;
26
+ }
@@ -0,0 +1,73 @@
1
+ export class Donation {
2
+ committee_id;
3
+ donation_id;
4
+ image_number;
5
+ receipt_date;
6
+ amount;
7
+ donor_id;
8
+ donor_name;
9
+ donor_prefix;
10
+ donor_first_name;
11
+ donor_middle_name;
12
+ donor_last_name;
13
+ donor_suffix;
14
+ donor_occupation;
15
+ donor_employer;
16
+ donor_address_street_1;
17
+ donor_address_street_2;
18
+ donor_address_city;
19
+ donor_address_state_id;
20
+ donor_address_zip;
21
+ donor_aggregate_ytd;
22
+ memo_text;
23
+ constructor(donation) {
24
+ if (!Donation.is(donation)) {
25
+ throw Error("Invalid input.");
26
+ }
27
+ this.committee_id = donation.committee_id;
28
+ this.donation_id = donation.donation_id;
29
+ this.image_number = donation.image_number;
30
+ this.receipt_date = donation.receipt_date;
31
+ this.amount = donation.amount;
32
+ this.donor_id = donation.donor_id;
33
+ this.donor_name = donation.donor_name;
34
+ this.donor_prefix = donation.donor_prefix;
35
+ this.donor_first_name = donation.donor_first_name;
36
+ this.donor_middle_name = donation.donor_middle_name;
37
+ this.donor_last_name = donation.donor_last_name;
38
+ this.donor_suffix = donation.donor_suffix;
39
+ this.donor_occupation = donation.donor_occupation;
40
+ this.donor_employer = donation.donor_employer;
41
+ this.donor_address_street_1 = donation.donor_address_street_1;
42
+ this.donor_address_street_2 = donation.donor_address_street_2;
43
+ this.donor_address_city = donation.donor_address_city;
44
+ this.donor_address_state_id = donation.donor_address_state_id;
45
+ this.donor_address_zip = donation.donor_address_zip;
46
+ this.donor_aggregate_ytd = donation.donor_aggregate_ytd;
47
+ this.memo_text = donation.memo_text;
48
+ }
49
+ static is(donation) {
50
+ return (donation !== undefined &&
51
+ typeof donation.committee_id === "string" &&
52
+ typeof donation.donation_id === "string" &&
53
+ typeof donation.image_number === "string" &&
54
+ typeof donation.receipt_date === "string" &&
55
+ typeof donation.amount === "number" &&
56
+ (donation.donor_id === undefined || typeof donation.donor_id === "string") &&
57
+ typeof donation.donor_name === "string" &&
58
+ (donation.donor_prefix === undefined || typeof donation.donor_prefix === "string") &&
59
+ typeof donation.donor_first_name === "string" &&
60
+ (donation.donor_middle_name === undefined || typeof donation.donor_middle_name === "string") &&
61
+ typeof donation.donor_last_name === "string" &&
62
+ (donation.donor_suffix === undefined || typeof donation.donor_suffix === "string") &&
63
+ typeof donation.donor_occupation === "string" &&
64
+ typeof donation.donor_employer === "string" &&
65
+ typeof donation.donor_address_street_1 === "string" &&
66
+ (donation.donor_address_street_2 === undefined || typeof donation.donor_address_street_2 === "string") &&
67
+ typeof donation.donor_address_city === "string" &&
68
+ typeof donation.donor_address_state_id === "string" &&
69
+ typeof donation.donor_address_zip === "string" &&
70
+ typeof donation.donor_aggregate_ytd === "number" &&
71
+ typeof donation.memo_text === "string");
72
+ }
73
+ }
@@ -15,7 +15,7 @@ export interface ElectionsConfig extends ElectionsUtilsConfig {
15
15
  cognito_client_id: string;
16
16
  cognito_client_secret: string;
17
17
  secret_key: string;
18
+ super_gov_api_keys: string[];
18
19
  dynamodb_donations: string;
19
20
  s3_bucket: string;
20
- s3vectors_bucket: string;
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./types/APIError"
2
2
  export * from "./types/Tweet"
3
3
  export * from "./types/User"
4
- export * from "./types/ElectionsConfig"
4
+ export * from "./types/ElectionsConfig"
5
+ export * from "./types/Donation"
@@ -0,0 +1,79 @@
1
+ import { StateID } from "./State"
2
+
3
+ export class Donation {
4
+ readonly committee_id : string
5
+ readonly donation_id : string
6
+ readonly image_number : string
7
+ readonly receipt_date : string
8
+ readonly amount : number
9
+ readonly donor_id? : string
10
+ readonly donor_name : string
11
+ readonly donor_prefix? : string
12
+ readonly donor_first_name : string
13
+ readonly donor_middle_name? : string
14
+ readonly donor_last_name : string
15
+ readonly donor_suffix? : string
16
+ readonly donor_occupation : string
17
+ readonly donor_employer : string
18
+ readonly donor_address_street_1 : string
19
+ readonly donor_address_street_2? : string
20
+ readonly donor_address_city : string
21
+ readonly donor_address_state_id : StateID
22
+ readonly donor_address_zip : string
23
+ readonly donor_aggregate_ytd : number
24
+ readonly memo_text : string
25
+
26
+ constructor(donation : any) {
27
+ if (!Donation.is(donation)) {
28
+ throw Error("Invalid input.")
29
+ }
30
+ this.committee_id = donation.committee_id
31
+ this.donation_id = donation.donation_id
32
+ this.image_number = donation.image_number
33
+ this.receipt_date = donation.receipt_date
34
+ this.amount = donation.amount
35
+ this.donor_id = donation.donor_id
36
+ this.donor_name = donation.donor_name
37
+ this.donor_prefix = donation.donor_prefix
38
+ this.donor_first_name = donation.donor_first_name
39
+ this.donor_middle_name = donation.donor_middle_name
40
+ this.donor_last_name = donation.donor_last_name
41
+ this.donor_suffix = donation.donor_suffix
42
+ this.donor_occupation = donation.donor_occupation
43
+ this.donor_employer = donation.donor_employer
44
+ this.donor_address_street_1 = donation.donor_address_street_1
45
+ this.donor_address_street_2 = donation.donor_address_street_2
46
+ this.donor_address_city = donation.donor_address_city
47
+ this.donor_address_state_id = donation.donor_address_state_id
48
+ this.donor_address_zip = donation.donor_address_zip
49
+ this.donor_aggregate_ytd = donation.donor_aggregate_ytd
50
+ this.memo_text = donation.memo_text
51
+ }
52
+
53
+ static is(donation : any) : donation is Donation {
54
+ return (
55
+ donation !== undefined &&
56
+ typeof donation.committee_id === "string" &&
57
+ typeof donation.donation_id === "string" &&
58
+ typeof donation.image_number === "string" &&
59
+ typeof donation.receipt_date === "string" &&
60
+ typeof donation.amount === "number" &&
61
+ (donation.donor_id === undefined || typeof donation.donor_id === "string") &&
62
+ typeof donation.donor_name === "string" &&
63
+ (donation.donor_prefix === undefined || typeof donation.donor_prefix === "string") &&
64
+ typeof donation.donor_first_name === "string" &&
65
+ (donation.donor_middle_name === undefined || typeof donation.donor_middle_name === "string") &&
66
+ typeof donation.donor_last_name === "string" &&
67
+ (donation.donor_suffix === undefined || typeof donation.donor_suffix === "string") &&
68
+ typeof donation.donor_occupation === "string" &&
69
+ typeof donation.donor_employer === "string" &&
70
+ typeof donation.donor_address_street_1 === "string" &&
71
+ (donation.donor_address_street_2 === undefined || typeof donation.donor_address_street_2 === "string") &&
72
+ typeof donation.donor_address_city === "string" &&
73
+ typeof donation.donor_address_state_id === "string" &&
74
+ typeof donation.donor_address_zip === "string" &&
75
+ typeof donation.donor_aggregate_ytd === "number" &&
76
+ typeof donation.memo_text === "string"
77
+ )
78
+ }
79
+ }
@@ -17,7 +17,7 @@ export interface ElectionsConfig extends ElectionsUtilsConfig {
17
17
  cognito_client_secret : string,
18
18
  secret_key : string,
19
19
  // admin_key : string,
20
+ super_gov_api_keys : string[],
20
21
  dynamodb_donations : string,
21
- s3_bucket : string,
22
- s3vectors_bucket : string
22
+ s3_bucket : string
23
23
  }