elections-types 1.0.62 → 1.0.64
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.
- package/dist/src/types/Candidate.d.ts +2 -2
- package/dist/src/types/Candidate.js +5 -6
- package/dist/src/types/ElectionsConfig.d.ts +1 -0
- package/dist/src/types/FECF24File.d.ts +1 -0
- package/dist/src/types/FECF24File.js +3 -0
- package/package.json +1 -1
- package/src/types/Candidate.ts +6 -5
- package/src/types/ElectionsConfig.ts +1 -0
- package/src/types/FECF24File.ts +3 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommitteeAux } from "./Committee.js";
|
|
2
2
|
import { ElectionID, OfficeID } from "./Election.js";
|
|
3
|
-
import {
|
|
3
|
+
import { FECF3File } from "./FECF3File.js";
|
|
4
4
|
import { StateID } from "./State.js";
|
|
5
5
|
export declare class ActivityIndex {
|
|
6
6
|
readonly news_index: number;
|
|
@@ -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
|
|
34
|
+
readonly fec_f3_files: FECF3File[];
|
|
35
35
|
constructor(candidate: any);
|
|
36
36
|
static is(candidate: any): candidate is CandidateAux;
|
|
37
37
|
}
|
|
@@ -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 {
|
|
3
|
+
import { FECF3File } from "./FECF3File.js";
|
|
4
4
|
import { is_state_id } from "./State.js";
|
|
5
5
|
export class ActivityIndex {
|
|
6
6
|
news_index;
|
|
@@ -78,21 +78,20 @@ export class Candidate {
|
|
|
78
78
|
}
|
|
79
79
|
export class CandidateAux extends Candidate {
|
|
80
80
|
committees;
|
|
81
|
-
|
|
82
|
-
// readonly fec_f3_files : FEC
|
|
81
|
+
fec_f3_files;
|
|
83
82
|
constructor(candidate) {
|
|
84
83
|
if (!CandidateAux.is(candidate)) {
|
|
85
84
|
throw Error("Invalid input.");
|
|
86
85
|
}
|
|
87
86
|
super(candidate);
|
|
88
87
|
this.committees = candidate.committees;
|
|
89
|
-
this.
|
|
88
|
+
this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file));
|
|
90
89
|
}
|
|
91
90
|
static is(candidate) {
|
|
92
91
|
return (Candidate.is(candidate) &&
|
|
93
92
|
Array.isArray(candidate.committees) &&
|
|
94
93
|
candidate.committees.every(CommitteeAux.is) &&
|
|
95
|
-
Array.isArray(candidate.
|
|
96
|
-
candidate.
|
|
94
|
+
Array.isArray(candidate.fec_f3_files) &&
|
|
95
|
+
candidate.fec_f3_files.every(FECF3File.is));
|
|
97
96
|
}
|
|
98
97
|
}
|
|
@@ -20,6 +20,7 @@ export interface ElectionsConfig extends ElectionsUtilsConfig {
|
|
|
20
20
|
dynamodb_elections: string;
|
|
21
21
|
dynamodb_candidates: string;
|
|
22
22
|
dynamodb_committees: string;
|
|
23
|
+
dynamodb_expenditures: string;
|
|
23
24
|
dynamodb_users: string;
|
|
24
25
|
dynamodb_user_elections: string;
|
|
25
26
|
dynamodb_articles: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { is_election_id } from "./Election.js";
|
|
2
2
|
import { FECFile } from "./FECFile.js";
|
|
3
3
|
export class Expenditure {
|
|
4
|
+
fec_file_id;
|
|
4
5
|
expenditure_id;
|
|
5
6
|
date;
|
|
6
7
|
payee;
|
|
@@ -15,6 +16,7 @@ export class Expenditure {
|
|
|
15
16
|
if (!Expenditure.is(expenditure)) {
|
|
16
17
|
throw Error("Invalid input.");
|
|
17
18
|
}
|
|
19
|
+
this.fec_file_id = expenditure.fec_file_id;
|
|
18
20
|
this.expenditure_id = expenditure.expenditure_id;
|
|
19
21
|
this.date = expenditure.date;
|
|
20
22
|
this.payee = expenditure.payee;
|
|
@@ -28,6 +30,7 @@ export class Expenditure {
|
|
|
28
30
|
}
|
|
29
31
|
static is(expenditure) {
|
|
30
32
|
return (expenditure !== undefined &&
|
|
33
|
+
typeof expenditure.fec_file_id === "number" &&
|
|
31
34
|
typeof expenditure.expenditure_id === "string" &&
|
|
32
35
|
typeof expenditure.date === "string" &&
|
|
33
36
|
typeof expenditure.payee === "string" &&
|
package/package.json
CHANGED
package/src/types/Candidate.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Committee, CommitteeAux } from "./Committee"
|
|
2
2
|
import { ElectionID, is_election_id, is_office_id, OfficeID } from "./Election"
|
|
3
|
+
import { FECF24File } from "./FECF24File"
|
|
4
|
+
import { FECF3File } from "./FECF3File"
|
|
3
5
|
import { FECReport } from "./FECReport"
|
|
4
6
|
import { is_state_id, StateID } from "./State"
|
|
5
7
|
|
|
@@ -93,8 +95,7 @@ export class Candidate {
|
|
|
93
95
|
|
|
94
96
|
export class CandidateAux extends Candidate {
|
|
95
97
|
readonly committees : CommitteeAux[]
|
|
96
|
-
readonly
|
|
97
|
-
// readonly fec_f3_files : FEC
|
|
98
|
+
readonly fec_f3_files : FECF3File[]
|
|
98
99
|
|
|
99
100
|
constructor(candidate : any) {
|
|
100
101
|
if (!CandidateAux.is(candidate)) {
|
|
@@ -102,7 +103,7 @@ export class CandidateAux extends Candidate {
|
|
|
102
103
|
}
|
|
103
104
|
super(candidate)
|
|
104
105
|
this.committees = candidate.committees
|
|
105
|
-
this.
|
|
106
|
+
this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
static is(candidate : any) : candidate is CandidateAux {
|
|
@@ -110,8 +111,8 @@ export class CandidateAux extends Candidate {
|
|
|
110
111
|
Candidate.is(candidate) &&
|
|
111
112
|
Array.isArray(candidate.committees) &&
|
|
112
113
|
candidate.committees.every(CommitteeAux.is) &&
|
|
113
|
-
Array.isArray(candidate.
|
|
114
|
-
candidate.
|
|
114
|
+
Array.isArray(candidate.fec_f3_files) &&
|
|
115
|
+
candidate.fec_f3_files.every(FECF3File.is)
|
|
115
116
|
)
|
|
116
117
|
}
|
|
117
118
|
}
|
|
@@ -22,6 +22,7 @@ export interface ElectionsConfig extends ElectionsUtilsConfig {
|
|
|
22
22
|
dynamodb_elections : string,
|
|
23
23
|
dynamodb_candidates : string,
|
|
24
24
|
dynamodb_committees : string,
|
|
25
|
+
dynamodb_expenditures : string,
|
|
25
26
|
dynamodb_users : string,
|
|
26
27
|
dynamodb_user_elections : string,
|
|
27
28
|
dynamodb_articles : string,
|
package/src/types/FECF24File.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ElectionID, is_election_id } from "./Election"
|
|
|
2
2
|
import { FECFile } from "./FECFile"
|
|
3
3
|
|
|
4
4
|
export class Expenditure {
|
|
5
|
+
readonly fec_file_id : number
|
|
5
6
|
readonly expenditure_id : string
|
|
6
7
|
readonly date : string
|
|
7
8
|
readonly payee : string
|
|
@@ -17,6 +18,7 @@ export class Expenditure {
|
|
|
17
18
|
if (!Expenditure.is(expenditure)) {
|
|
18
19
|
throw Error("Invalid input.")
|
|
19
20
|
}
|
|
21
|
+
this.fec_file_id = expenditure.fec_file_id
|
|
20
22
|
this.expenditure_id = expenditure.expenditure_id
|
|
21
23
|
this.date = expenditure.date
|
|
22
24
|
this.payee = expenditure.payee
|
|
@@ -32,6 +34,7 @@ export class Expenditure {
|
|
|
32
34
|
static is(expenditure : any) : expenditure is Expenditure {
|
|
33
35
|
return (
|
|
34
36
|
expenditure !== undefined &&
|
|
37
|
+
typeof expenditure.fec_file_id === "number" &&
|
|
35
38
|
typeof expenditure.expenditure_id === "string" &&
|
|
36
39
|
typeof expenditure.date === "string" &&
|
|
37
40
|
typeof expenditure.payee === "string" &&
|