elections-types 1.0.66 → 1.0.68
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.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CommitteeAux } from "./Committee.js";
|
|
2
2
|
import { ElectionID, OfficeID } from "./Election.js";
|
|
3
|
-
import { FECF3File } from "./FECF3File.js";
|
|
4
3
|
import { StateID } from "./State.js";
|
|
5
4
|
export declare class ActivityIndex {
|
|
6
5
|
readonly news_index: number;
|
|
@@ -31,7 +30,6 @@ export declare class Candidate {
|
|
|
31
30
|
}
|
|
32
31
|
export declare class CandidateAux extends Candidate {
|
|
33
32
|
readonly committees: CommitteeAux[];
|
|
34
|
-
readonly fec_f3_files: FECF3File[];
|
|
35
33
|
constructor(candidate: any);
|
|
36
34
|
static is(candidate: any): candidate is CandidateAux;
|
|
37
35
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CommitteeAux } from "./Committee.js";
|
|
2
2
|
import { is_election_id, is_office_id } from "./Election.js";
|
|
3
|
-
import { FECF3File } from "./FECF3File.js";
|
|
4
3
|
import { is_state_id } from "./State.js";
|
|
5
4
|
export class ActivityIndex {
|
|
6
5
|
news_index;
|
|
@@ -78,20 +77,18 @@ export class Candidate {
|
|
|
78
77
|
}
|
|
79
78
|
export class CandidateAux extends Candidate {
|
|
80
79
|
committees;
|
|
81
|
-
fec_f3_files
|
|
80
|
+
// readonly fec_f3_files : FECF3File[]
|
|
82
81
|
constructor(candidate) {
|
|
83
82
|
if (!CandidateAux.is(candidate)) {
|
|
84
83
|
throw Error("Invalid input.");
|
|
85
84
|
}
|
|
86
85
|
super(candidate);
|
|
87
86
|
this.committees = candidate.committees;
|
|
88
|
-
this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
|
|
87
|
+
// this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
|
|
89
88
|
}
|
|
90
89
|
static is(candidate) {
|
|
91
90
|
return (Candidate.is(candidate) &&
|
|
92
91
|
Array.isArray(candidate.committees) &&
|
|
93
|
-
candidate.committees.every(CommitteeAux.is)
|
|
94
|
-
Array.isArray(candidate.fec_f3_files) &&
|
|
95
|
-
candidate.fec_f3_files.every(FECF3File.is));
|
|
92
|
+
candidate.committees.every(CommitteeAux.is));
|
|
96
93
|
}
|
|
97
94
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Candidate } from "./Candidate.js";
|
|
2
|
-
import {
|
|
2
|
+
import { FECF3File } from "./FECF3File.js";
|
|
3
3
|
export declare const designations: readonly ["P", "A", "U", "J", "D", "B"];
|
|
4
4
|
export type CommitteeDesignation = typeof designations[number];
|
|
5
5
|
export declare function is_committee_designation(designation: any): designation is CommitteeDesignation;
|
|
@@ -9,20 +9,19 @@ export declare class Committee {
|
|
|
9
9
|
readonly url?: string;
|
|
10
10
|
readonly designation?: CommitteeDesignation;
|
|
11
11
|
readonly fec_file_id?: number;
|
|
12
|
-
readonly sponsor_candidate_ids?: string[];
|
|
13
12
|
readonly jfp_committee_ids?: string[];
|
|
14
|
-
readonly jfr_committee_ids
|
|
15
|
-
readonly aff_committee_ids
|
|
16
|
-
readonly candidate_ids?: string[];
|
|
17
|
-
readonly election_ids?: string[];
|
|
13
|
+
readonly jfr_committee_ids: string[];
|
|
14
|
+
readonly aff_committee_ids: string[];
|
|
18
15
|
readonly [x: string]: any;
|
|
19
16
|
constructor(committee: Committee);
|
|
20
17
|
static is(committee: any): committee is Committee;
|
|
21
18
|
}
|
|
22
19
|
export declare class CommitteeAux extends Committee {
|
|
23
20
|
readonly candidates: Candidate[];
|
|
24
|
-
readonly
|
|
25
|
-
readonly jfp_committees
|
|
21
|
+
readonly fec_f3_files: FECF3File[];
|
|
22
|
+
readonly jfp_committees?: Committee[];
|
|
23
|
+
readonly jfr_committees: Committee[];
|
|
24
|
+
readonly aff_committees: Committee[];
|
|
26
25
|
constructor(committee: any);
|
|
27
26
|
static is(committee: any): committee is CommitteeAux;
|
|
28
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Candidate } from "./Candidate.js";
|
|
2
|
-
import {
|
|
2
|
+
import { FECF3File } from "./FECF3File.js";
|
|
3
3
|
export const designations = ["P", "A", "U", "J", "D", "B"];
|
|
4
4
|
export function is_committee_designation(designation) {
|
|
5
5
|
return designations.includes(designation);
|
|
@@ -10,12 +10,9 @@ export class Committee {
|
|
|
10
10
|
url;
|
|
11
11
|
designation;
|
|
12
12
|
fec_file_id;
|
|
13
|
-
sponsor_candidate_ids;
|
|
14
13
|
jfp_committee_ids;
|
|
15
14
|
jfr_committee_ids;
|
|
16
15
|
aff_committee_ids;
|
|
17
|
-
candidate_ids;
|
|
18
|
-
election_ids;
|
|
19
16
|
constructor(committee) {
|
|
20
17
|
if (!Committee.is(committee)) {
|
|
21
18
|
throw Error("Invalid input.");
|
|
@@ -25,12 +22,9 @@ export class Committee {
|
|
|
25
22
|
this.url = committee.url;
|
|
26
23
|
this.designation = committee.designation;
|
|
27
24
|
this.fec_file_id = committee.fec_file_id;
|
|
28
|
-
this.sponsor_candidate_ids = committee.sponsor_candidate_ids;
|
|
29
25
|
this.jfp_committee_ids = committee.jfp_committee_ids;
|
|
30
26
|
this.jfr_committee_ids = committee.jfr_committee_ids;
|
|
31
27
|
this.aff_committee_ids = committee.aff_committee_ids;
|
|
32
|
-
this.candidate_ids = committee.candidate_ids;
|
|
33
|
-
this.election_ids = committee.election_ids;
|
|
34
28
|
}
|
|
35
29
|
static is(committee) {
|
|
36
30
|
return (committee !== undefined &&
|
|
@@ -39,34 +33,36 @@ export class Committee {
|
|
|
39
33
|
(committee.url === undefined || typeof committee.url === "string") &&
|
|
40
34
|
(committee.designation === undefined || is_committee_designation(committee.designation)) &&
|
|
41
35
|
(committee.fec_file_id === undefined || typeof committee.fec_file_id === "number" && !isNaN(committee.fec_file_id)) &&
|
|
42
|
-
(committee.sponsor_candidate_ids === undefined || Array.isArray(committee.sponsor_candidate_ids) && committee.sponsor_candidate_ids.every((committee_id) => typeof committee_id === "string")) &&
|
|
43
36
|
(committee.jfp_committee_ids === undefined || Array.isArray(committee.jfp_committee_ids) && committee.jfp_committee_ids.every((committee_id) => typeof committee_id === "string")) &&
|
|
44
|
-
(
|
|
45
|
-
(
|
|
46
|
-
(committee.candidate_ids === undefined || Array.isArray(committee.candidate_ids) && committee.candidate_ids.every((committee_id) => typeof committee_id === "string")) &&
|
|
47
|
-
(committee.election_ids === undefined || Array.isArray(committee.election_ids) && committee.election_ids.every((committee_id) => typeof committee_id === "string")));
|
|
37
|
+
(Array.isArray(committee.jfr_committee_ids) && committee.jfr_committee_ids.every((committee_id) => typeof committee_id === "string")) &&
|
|
38
|
+
(Array.isArray(committee.aff_committee_ids) && committee.aff_committee_ids.every((committee_id) => typeof committee_id === "string")));
|
|
48
39
|
}
|
|
49
40
|
}
|
|
50
41
|
export class CommitteeAux extends Committee {
|
|
51
42
|
candidates;
|
|
52
|
-
|
|
43
|
+
fec_f3_files;
|
|
53
44
|
jfp_committees;
|
|
45
|
+
jfr_committees;
|
|
46
|
+
aff_committees;
|
|
54
47
|
constructor(committee) {
|
|
55
48
|
if (!CommitteeAux.is(committee)) {
|
|
56
49
|
throw Error("Invalid input.");
|
|
57
50
|
}
|
|
58
51
|
super(committee);
|
|
59
52
|
this.candidates = committee.candidates;
|
|
60
|
-
this.
|
|
53
|
+
this.fec_f3_files = committee.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file));
|
|
61
54
|
this.jfp_committees = committee.jfp_committees;
|
|
55
|
+
this.jfr_committees = committee.jfr_committees;
|
|
56
|
+
this.aff_committees = committee.aff_committees;
|
|
62
57
|
}
|
|
63
58
|
static is(committee) {
|
|
64
59
|
return (Committee.is(committee) &&
|
|
65
60
|
Array.isArray(committee.candidates) &&
|
|
66
61
|
committee.candidates.every(Candidate.is) &&
|
|
67
|
-
Array.isArray(committee.
|
|
68
|
-
committee.
|
|
69
|
-
Array.isArray(committee.jfp_committees) &&
|
|
70
|
-
committee.
|
|
62
|
+
Array.isArray(committee.fec_f3_files) &&
|
|
63
|
+
committee.fec_f3_files.every(FECF3File.is) &&
|
|
64
|
+
(committee.jfp_committees === undefined || Array.isArray(committee.jfp_committees) && committee.jfp_committees.every(Committee.is)) &&
|
|
65
|
+
(Array.isArray(committee.jfr_committees) && committee.jfr_committees.every(Committee.is)) &&
|
|
66
|
+
(Array.isArray(committee.aff_committees) && committee.aff_committees.every(Committee.is)));
|
|
71
67
|
}
|
|
72
68
|
}
|
package/package.json
CHANGED
package/src/types/Candidate.ts
CHANGED
|
@@ -95,7 +95,7 @@ export class Candidate {
|
|
|
95
95
|
|
|
96
96
|
export class CandidateAux extends Candidate {
|
|
97
97
|
readonly committees : CommitteeAux[]
|
|
98
|
-
readonly fec_f3_files : FECF3File[]
|
|
98
|
+
// readonly fec_f3_files : FECF3File[]
|
|
99
99
|
|
|
100
100
|
constructor(candidate : any) {
|
|
101
101
|
if (!CandidateAux.is(candidate)) {
|
|
@@ -103,16 +103,14 @@ export class CandidateAux extends Candidate {
|
|
|
103
103
|
}
|
|
104
104
|
super(candidate)
|
|
105
105
|
this.committees = candidate.committees
|
|
106
|
-
this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
|
|
106
|
+
// this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
static is(candidate : any) : candidate is CandidateAux {
|
|
110
110
|
return (
|
|
111
111
|
Candidate.is(candidate) &&
|
|
112
112
|
Array.isArray(candidate.committees) &&
|
|
113
|
-
candidate.committees.every(CommitteeAux.is)
|
|
114
|
-
Array.isArray(candidate.fec_f3_files) &&
|
|
115
|
-
candidate.fec_f3_files.every(FECF3File.is)
|
|
113
|
+
candidate.committees.every(CommitteeAux.is)
|
|
116
114
|
)
|
|
117
115
|
}
|
|
118
116
|
}
|
package/src/types/Committee.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Candidate } from "./Candidate"
|
|
2
|
+
import { CandidateCommittee } from "./CandidateCommittee"
|
|
3
|
+
import { FECF3File } from "./FECF3File"
|
|
2
4
|
import { FECReport } from "./FECReport"
|
|
3
5
|
|
|
4
6
|
export const designations = ["P", "A", "U", "J", "D", "B"] as const
|
|
@@ -15,12 +17,9 @@ export class Committee {
|
|
|
15
17
|
readonly url? : string
|
|
16
18
|
readonly designation? : CommitteeDesignation
|
|
17
19
|
readonly fec_file_id? : number
|
|
18
|
-
readonly sponsor_candidate_ids? : string[]
|
|
19
20
|
readonly jfp_committee_ids? : string[]
|
|
20
|
-
readonly jfr_committee_ids
|
|
21
|
-
readonly aff_committee_ids
|
|
22
|
-
readonly candidate_ids? : string[]
|
|
23
|
-
readonly election_ids? : string[]
|
|
21
|
+
readonly jfr_committee_ids : string[]
|
|
22
|
+
readonly aff_committee_ids : string[]
|
|
24
23
|
readonly [x : string] : any
|
|
25
24
|
|
|
26
25
|
constructor(committee : Committee) {
|
|
@@ -32,12 +31,9 @@ export class Committee {
|
|
|
32
31
|
this.url = committee.url
|
|
33
32
|
this.designation = committee.designation
|
|
34
33
|
this.fec_file_id = committee.fec_file_id
|
|
35
|
-
this.sponsor_candidate_ids = committee.sponsor_candidate_ids
|
|
36
34
|
this.jfp_committee_ids = committee.jfp_committee_ids
|
|
37
35
|
this.jfr_committee_ids = committee.jfr_committee_ids
|
|
38
36
|
this.aff_committee_ids = committee.aff_committee_ids
|
|
39
|
-
this.candidate_ids = committee.candidate_ids
|
|
40
|
-
this.election_ids = committee.election_ids
|
|
41
37
|
}
|
|
42
38
|
|
|
43
39
|
static is(committee : any) : committee is Committee {
|
|
@@ -48,20 +44,19 @@ export class Committee {
|
|
|
48
44
|
(committee.url === undefined || typeof committee.url === "string") &&
|
|
49
45
|
(committee.designation === undefined || is_committee_designation(committee.designation)) &&
|
|
50
46
|
(committee.fec_file_id === undefined || typeof committee.fec_file_id === "number" && !isNaN(committee.fec_file_id)) &&
|
|
51
|
-
(committee.sponsor_candidate_ids === undefined || Array.isArray(committee.sponsor_candidate_ids) && committee.sponsor_candidate_ids.every((committee_id : any) => typeof committee_id === "string")) &&
|
|
52
47
|
(committee.jfp_committee_ids === undefined || Array.isArray(committee.jfp_committee_ids) && committee.jfp_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
|
|
53
|
-
(
|
|
54
|
-
(
|
|
55
|
-
(committee.candidate_ids === undefined || Array.isArray(committee.candidate_ids) && committee.candidate_ids.every((committee_id : any) => typeof committee_id === "string")) &&
|
|
56
|
-
(committee.election_ids === undefined || Array.isArray(committee.election_ids) && committee.election_ids.every((committee_id : any) => typeof committee_id === "string"))
|
|
48
|
+
(Array.isArray(committee.jfr_committee_ids) && committee.jfr_committee_ids.every((committee_id : any) => typeof committee_id === "string")) &&
|
|
49
|
+
(Array.isArray(committee.aff_committee_ids) && committee.aff_committee_ids.every((committee_id : any) => typeof committee_id === "string"))
|
|
57
50
|
)
|
|
58
51
|
}
|
|
59
52
|
}
|
|
60
53
|
|
|
61
54
|
export class CommitteeAux extends Committee {
|
|
62
55
|
readonly candidates : Candidate[]
|
|
63
|
-
readonly
|
|
64
|
-
readonly jfp_committees : Committee[]
|
|
56
|
+
readonly fec_f3_files : FECF3File[]
|
|
57
|
+
readonly jfp_committees? : Committee[]
|
|
58
|
+
readonly jfr_committees : Committee[]
|
|
59
|
+
readonly aff_committees : Committee[]
|
|
65
60
|
|
|
66
61
|
constructor(committee : any) {
|
|
67
62
|
if (!CommitteeAux.is(committee)) {
|
|
@@ -69,8 +64,10 @@ export class CommitteeAux extends Committee {
|
|
|
69
64
|
}
|
|
70
65
|
super(committee)
|
|
71
66
|
this.candidates = committee.candidates
|
|
72
|
-
this.
|
|
67
|
+
this.fec_f3_files = committee.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
|
|
73
68
|
this.jfp_committees = committee.jfp_committees
|
|
69
|
+
this.jfr_committees = committee.jfr_committees
|
|
70
|
+
this.aff_committees = committee.aff_committees
|
|
74
71
|
}
|
|
75
72
|
|
|
76
73
|
static is(committee : any) : committee is CommitteeAux {
|
|
@@ -78,10 +75,11 @@ export class CommitteeAux extends Committee {
|
|
|
78
75
|
Committee.is(committee) &&
|
|
79
76
|
Array.isArray(committee.candidates) &&
|
|
80
77
|
committee.candidates.every(Candidate.is) &&
|
|
81
|
-
Array.isArray(committee.
|
|
82
|
-
committee.
|
|
83
|
-
Array.isArray(committee.jfp_committees) &&
|
|
84
|
-
committee.
|
|
78
|
+
Array.isArray(committee.fec_f3_files) &&
|
|
79
|
+
committee.fec_f3_files.every(FECF3File.is) &&
|
|
80
|
+
(committee.jfp_committees === undefined || Array.isArray(committee.jfp_committees) && committee.jfp_committees.every(Committee.is)) &&
|
|
81
|
+
(Array.isArray(committee.jfr_committees) && committee.jfr_committees.every(Committee.is)) &&
|
|
82
|
+
(Array.isArray(committee.aff_committees) && committee.aff_committees.every(Committee.is))
|
|
85
83
|
)
|
|
86
84
|
}
|
|
87
85
|
}
|