elections-types 1.0.2 → 1.0.3

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,25 @@
1
+ export declare class Donation {
2
+ readonly committee_id: string;
3
+ readonly donation_id: string;
4
+ readonly image_number: string;
5
+ readonly receipt_date: string;
6
+ readonly amount: number;
7
+ readonly donor_id?: string;
8
+ readonly donor_name: string;
9
+ readonly donor_prefix?: string;
10
+ readonly donor_first_name: string;
11
+ readonly donor_middle_name?: string;
12
+ readonly donor_last_name: string;
13
+ readonly donor_suffix?: string;
14
+ readonly donor_occupation: string;
15
+ readonly donor_employer: string;
16
+ readonly donor_address_street_1: string;
17
+ readonly donor_address_street_2?: string;
18
+ readonly donor_address_city: string;
19
+ readonly donor_address_state: string;
20
+ readonly donor_address_zip: string;
21
+ readonly donor_aggregate_ytd: number;
22
+ readonly memo_text: string;
23
+ constructor(donation: any);
24
+ static is(donation: any): donation is Donation;
25
+ }
@@ -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;
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 = donation.donor_address_state;
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 === "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.3",
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,77 @@
1
+ export class Donation {
2
+ readonly committee_id : string
3
+ readonly donation_id : string
4
+ readonly image_number : string
5
+ readonly receipt_date : string
6
+ readonly amount : number
7
+ readonly donor_id? : string
8
+ readonly donor_name : string
9
+ readonly donor_prefix? : string
10
+ readonly donor_first_name : string
11
+ readonly donor_middle_name? : string
12
+ readonly donor_last_name : string
13
+ readonly donor_suffix? : string
14
+ readonly donor_occupation : string
15
+ readonly donor_employer : string
16
+ readonly donor_address_street_1 : string
17
+ readonly donor_address_street_2? : string
18
+ readonly donor_address_city : string
19
+ readonly donor_address_state : string
20
+ readonly donor_address_zip : string
21
+ readonly donor_aggregate_ytd : number
22
+ readonly memo_text : string
23
+
24
+ constructor(donation : any) {
25
+ if (!Donation.is(donation)) {
26
+ throw Error("Invalid input.")
27
+ }
28
+ this.committee_id = donation.committee_id
29
+ this.donation_id = donation.donation_id
30
+ this.image_number = donation.image_number
31
+ this.receipt_date = donation.receipt_date
32
+ this.amount = donation.amount
33
+ this.donor_id = donation.donor_id
34
+ this.donor_name = donation.donor_name
35
+ this.donor_prefix = donation.donor_prefix
36
+ this.donor_first_name = donation.donor_first_name
37
+ this.donor_middle_name = donation.donor_middle_name
38
+ this.donor_last_name = donation.donor_last_name
39
+ this.donor_suffix = donation.donor_suffix
40
+ this.donor_occupation = donation.donor_occupation
41
+ this.donor_employer = donation.donor_employer
42
+ this.donor_address_street_1 = donation.donor_address_street_1
43
+ this.donor_address_street_2 = donation.donor_address_street_2
44
+ this.donor_address_city = donation.donor_address_city
45
+ this.donor_address_state = donation.donor_address_state
46
+ this.donor_address_zip = donation.donor_address_zip
47
+ this.donor_aggregate_ytd = donation.donor_aggregate_ytd
48
+ this.memo_text = donation.memo_text
49
+ }
50
+
51
+ static is(donation : any) : donation is Donation {
52
+ return (
53
+ donation !== undefined &&
54
+ typeof donation.committee_id === "string" &&
55
+ typeof donation.donation_id === "string" &&
56
+ typeof donation.image_number === "string" &&
57
+ typeof donation.receipt_date === "string" &&
58
+ typeof donation.amount === "number" &&
59
+ (donation.donor_id === undefined || typeof donation.donor_id === "string") &&
60
+ typeof donation.donor_name === "string" &&
61
+ (donation.donor_prefix === undefined || typeof donation.donor_prefix === "string") &&
62
+ typeof donation.donor_first_name === "string" &&
63
+ (donation.donor_middle_name === undefined || typeof donation.donor_middle_name === "string") &&
64
+ typeof donation.donor_last_name === "string" &&
65
+ (donation.donor_suffix === undefined || typeof donation.donor_suffix === "string") &&
66
+ typeof donation.donor_occupation === "string" &&
67
+ typeof donation.donor_employer === "string" &&
68
+ typeof donation.donor_address_street_1 === "string" &&
69
+ (donation.donor_address_street_2 === undefined || typeof donation.donor_address_street_2 === "string") &&
70
+ typeof donation.donor_address_city === "string" &&
71
+ typeof donation.donor_address_state === "string" &&
72
+ typeof donation.donor_address_zip === "string" &&
73
+ typeof donation.donor_aggregate_ytd === "number" &&
74
+ typeof donation.memo_text === "string"
75
+ )
76
+ }
77
+ }
@@ -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
  }