elections-types 1.0.73 → 1.0.74
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/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/types/Candidate.d.ts +1 -1
- package/dist/src/types/Candidate.js +1 -1
- package/dist/src/types/Election.d.ts +1 -1
- package/dist/src/types/Election.js +1 -1
- package/dist/src/types/Expenditure.d.ts +24 -0
- package/dist/src/types/Expenditure.js +62 -0
- package/dist/src/types/FECF24File.d.ts +1 -16
- package/dist/src/types/FECF24File.js +1 -44
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/types/Candidate.ts +2 -2
- package/src/types/Committee.ts +0 -1
- package/src/types/Election.ts +1 -1
- package/src/types/Expenditure.ts +74 -0
- package/src/types/FECF24File.ts +1 -50
- package/src/types/FECIndependentExpenditureReport.ts +0 -81
- package/src/types/FECReport.ts +0 -32
package/dist/src/index.d.ts
CHANGED
|
@@ -8,13 +8,13 @@ export * from "./types/CandidateVideo.js";
|
|
|
8
8
|
export * from "./types/Committee.js";
|
|
9
9
|
export * from "./types/Election.js";
|
|
10
10
|
export * from "./types/ElectionsConfig.js";
|
|
11
|
+
export * from "./types/Expenditure.js";
|
|
11
12
|
export * from "./types/FederalDonation.js";
|
|
12
13
|
export * from "./types/FECFile.js";
|
|
13
14
|
export * from "./types/FECF1File.js";
|
|
14
15
|
export * from "./types/FECF2File.js";
|
|
15
16
|
export * from "./types/FECF3File.js";
|
|
16
17
|
export * from "./types/FECF24File.js";
|
|
17
|
-
export * from "./types/FECReport.js";
|
|
18
18
|
export * from "./types/FormTypeID.js";
|
|
19
19
|
export * from "./types/State.js";
|
|
20
20
|
export * from "./types/Tweet.js";
|
package/dist/src/index.js
CHANGED
|
@@ -8,13 +8,13 @@ export * from "./types/CandidateVideo.js";
|
|
|
8
8
|
export * from "./types/Committee.js";
|
|
9
9
|
export * from "./types/Election.js";
|
|
10
10
|
export * from "./types/ElectionsConfig.js";
|
|
11
|
+
export * from "./types/Expenditure.js";
|
|
11
12
|
export * from "./types/FederalDonation.js";
|
|
12
13
|
export * from "./types/FECFile.js";
|
|
13
14
|
export * from "./types/FECF1File.js";
|
|
14
15
|
export * from "./types/FECF2File.js";
|
|
15
16
|
export * from "./types/FECF3File.js";
|
|
16
17
|
export * from "./types/FECF24File.js";
|
|
17
|
-
export * from "./types/FECReport.js";
|
|
18
18
|
export * from "./types/FormTypeID.js";
|
|
19
19
|
export * from "./types/State.js";
|
|
20
20
|
export * from "./types/Tweet.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommitteeAux } from "./Committee.js";
|
|
2
2
|
import { ElectionID, OfficeID } from "./Election.js";
|
|
3
|
-
import { Expenditure } from "./
|
|
3
|
+
import { Expenditure } from "./Expenditure.js";
|
|
4
4
|
import { FECF3File } from "./FECF3File.js";
|
|
5
5
|
import { StateID } from "./State.js";
|
|
6
6
|
export declare class ActivityIndex {
|
|
@@ -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 { Expenditure } from "./
|
|
3
|
+
import { Expenditure } from "./Expenditure.js";
|
|
4
4
|
import { FECF3File } from "./FECF3File.js";
|
|
5
5
|
import { is_state_id } from "./State.js";
|
|
6
6
|
export class ActivityIndex {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CandidateAux } from "./Candidate.js";
|
|
2
2
|
import { CommitteeAux } from "./Committee.js";
|
|
3
|
-
import { Expenditure } from "./
|
|
3
|
+
import { Expenditure } from "./Expenditure.js";
|
|
4
4
|
import { StateID } from "./State.js";
|
|
5
5
|
declare const office_ids: readonly ["H", "S"];
|
|
6
6
|
export type OfficeID = typeof office_ids[number];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CandidateAux } from "./Candidate.js";
|
|
2
2
|
import { CommitteeAux } from "./Committee.js";
|
|
3
|
-
import { Expenditure } from "./
|
|
3
|
+
import { Expenditure } from "./Expenditure.js";
|
|
4
4
|
import { is_state_id } from "./State.js";
|
|
5
5
|
const office_ids = ["H", "S"];
|
|
6
6
|
export function is_office_id(office_id) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Committee } from "./Committee.js";
|
|
2
|
+
import { ElectionID } from "./Election.js";
|
|
3
|
+
export declare class Expenditure {
|
|
4
|
+
readonly fec_file_id: number;
|
|
5
|
+
readonly expenditure_id: string;
|
|
6
|
+
readonly committee_id: string;
|
|
7
|
+
readonly date: string;
|
|
8
|
+
readonly payee: string;
|
|
9
|
+
readonly election_stage: string;
|
|
10
|
+
readonly election_id: ElectionID;
|
|
11
|
+
readonly candidate_id: string;
|
|
12
|
+
readonly amount: number;
|
|
13
|
+
readonly cumulative_amount: number;
|
|
14
|
+
readonly purpose: string;
|
|
15
|
+
readonly is_support: boolean;
|
|
16
|
+
readonly [x: string]: any;
|
|
17
|
+
constructor(expenditure: any);
|
|
18
|
+
static is(expenditure: any): expenditure is Expenditure;
|
|
19
|
+
}
|
|
20
|
+
export declare class ExpenditureAux extends Expenditure {
|
|
21
|
+
readonly committee: Committee[];
|
|
22
|
+
constructor(expenditure: any);
|
|
23
|
+
static is(expenditure: any): expenditure is ExpenditureAux;
|
|
24
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Committee } from "./Committee.js";
|
|
2
|
+
import { is_election_id } from "./Election.js";
|
|
3
|
+
export class Expenditure {
|
|
4
|
+
fec_file_id;
|
|
5
|
+
expenditure_id;
|
|
6
|
+
committee_id;
|
|
7
|
+
date;
|
|
8
|
+
payee;
|
|
9
|
+
election_stage;
|
|
10
|
+
election_id;
|
|
11
|
+
candidate_id;
|
|
12
|
+
amount;
|
|
13
|
+
cumulative_amount;
|
|
14
|
+
purpose;
|
|
15
|
+
is_support;
|
|
16
|
+
constructor(expenditure) {
|
|
17
|
+
if (!Expenditure.is(expenditure)) {
|
|
18
|
+
throw Error("Invalid input.");
|
|
19
|
+
}
|
|
20
|
+
this.fec_file_id = expenditure.fec_file_id;
|
|
21
|
+
this.expenditure_id = expenditure.expenditure_id;
|
|
22
|
+
this.committee_id = expenditure.committee_id;
|
|
23
|
+
this.date = expenditure.date;
|
|
24
|
+
this.payee = expenditure.payee;
|
|
25
|
+
this.election_stage = expenditure.election_stage;
|
|
26
|
+
this.election_id = expenditure.election_id;
|
|
27
|
+
this.candidate_id = expenditure.candidate_id;
|
|
28
|
+
this.amount = expenditure.amount;
|
|
29
|
+
this.cumulative_amount = expenditure.cumulative_amount;
|
|
30
|
+
this.purpose = expenditure.purpose;
|
|
31
|
+
this.is_support = expenditure.is_support;
|
|
32
|
+
}
|
|
33
|
+
static is(expenditure) {
|
|
34
|
+
return (expenditure !== undefined &&
|
|
35
|
+
typeof expenditure.fec_file_id === "number" &&
|
|
36
|
+
typeof expenditure.expenditure_id === "string" &&
|
|
37
|
+
typeof expenditure.committee_id === "string" &&
|
|
38
|
+
typeof expenditure.date === "string" &&
|
|
39
|
+
typeof expenditure.payee === "string" &&
|
|
40
|
+
typeof expenditure.election_stage === "string" &&
|
|
41
|
+
is_election_id(expenditure.election_id) &&
|
|
42
|
+
typeof expenditure.candidate_id === "string" &&
|
|
43
|
+
typeof expenditure.amount === "number" &&
|
|
44
|
+
typeof expenditure.cumulative_amount === "number" &&
|
|
45
|
+
typeof expenditure.purpose === "string" &&
|
|
46
|
+
typeof expenditure.is_support === "boolean");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export class ExpenditureAux extends Expenditure {
|
|
50
|
+
committee;
|
|
51
|
+
constructor(expenditure) {
|
|
52
|
+
if (!ExpenditureAux.is(expenditure)) {
|
|
53
|
+
throw Error("Invalid input.");
|
|
54
|
+
}
|
|
55
|
+
super(expenditure);
|
|
56
|
+
this.committee = expenditure.committee;
|
|
57
|
+
}
|
|
58
|
+
static is(expenditure) {
|
|
59
|
+
return (Expenditure.is(expenditure) &&
|
|
60
|
+
Committee.is(expenditure.committee));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Expenditure } from "./Expenditure.js";
|
|
2
2
|
import { FECFile } from "./FECFile.js";
|
|
3
|
-
export declare class Expenditure {
|
|
4
|
-
readonly fec_file_id: number;
|
|
5
|
-
readonly expenditure_id: string;
|
|
6
|
-
readonly date: string;
|
|
7
|
-
readonly payee: string;
|
|
8
|
-
readonly election_stage: string;
|
|
9
|
-
readonly election_id: ElectionID;
|
|
10
|
-
readonly candidate_id: string;
|
|
11
|
-
readonly amount: number;
|
|
12
|
-
readonly cumulative_amount: number;
|
|
13
|
-
readonly purpose: string;
|
|
14
|
-
readonly is_support: boolean;
|
|
15
|
-
constructor(expenditure: any);
|
|
16
|
-
static is(expenditure: any): expenditure is Expenditure;
|
|
17
|
-
}
|
|
18
3
|
export declare class FECF24File extends FECFile {
|
|
19
4
|
readonly committee_id: string;
|
|
20
5
|
readonly first_fec_file_id: number;
|
|
@@ -1,48 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Expenditure } from "./Expenditure.js";
|
|
2
2
|
import { FECFile } from "./FECFile.js";
|
|
3
|
-
export class Expenditure {
|
|
4
|
-
fec_file_id;
|
|
5
|
-
expenditure_id;
|
|
6
|
-
date;
|
|
7
|
-
payee;
|
|
8
|
-
election_stage;
|
|
9
|
-
election_id;
|
|
10
|
-
candidate_id;
|
|
11
|
-
amount;
|
|
12
|
-
cumulative_amount;
|
|
13
|
-
purpose;
|
|
14
|
-
is_support;
|
|
15
|
-
constructor(expenditure) {
|
|
16
|
-
if (!Expenditure.is(expenditure)) {
|
|
17
|
-
throw Error("Invalid input.");
|
|
18
|
-
}
|
|
19
|
-
this.fec_file_id = expenditure.fec_file_id;
|
|
20
|
-
this.expenditure_id = expenditure.expenditure_id;
|
|
21
|
-
this.date = expenditure.date;
|
|
22
|
-
this.payee = expenditure.payee;
|
|
23
|
-
this.election_stage = expenditure.election_stage;
|
|
24
|
-
this.election_id = expenditure.election_id;
|
|
25
|
-
this.candidate_id = expenditure.candidate_id;
|
|
26
|
-
this.amount = expenditure.amount;
|
|
27
|
-
this.cumulative_amount = expenditure.cumulative_amount;
|
|
28
|
-
this.purpose = expenditure.purpose;
|
|
29
|
-
this.is_support = expenditure.is_support;
|
|
30
|
-
}
|
|
31
|
-
static is(expenditure) {
|
|
32
|
-
return (expenditure !== undefined &&
|
|
33
|
-
typeof expenditure.fec_file_id === "number" &&
|
|
34
|
-
typeof expenditure.expenditure_id === "string" &&
|
|
35
|
-
typeof expenditure.date === "string" &&
|
|
36
|
-
typeof expenditure.payee === "string" &&
|
|
37
|
-
typeof expenditure.election_stage === "string" &&
|
|
38
|
-
is_election_id(expenditure.election_id) &&
|
|
39
|
-
typeof expenditure.candidate_id === "string" &&
|
|
40
|
-
typeof expenditure.amount === "number" &&
|
|
41
|
-
typeof expenditure.cumulative_amount === "number" &&
|
|
42
|
-
typeof expenditure.purpose === "string" &&
|
|
43
|
-
typeof expenditure.is_support === "boolean");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
3
|
export class FECF24File extends FECFile {
|
|
47
4
|
committee_id;
|
|
48
5
|
first_fec_file_id;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -8,13 +8,13 @@ export * from "./types/CandidateVideo"
|
|
|
8
8
|
export * from "./types/Committee"
|
|
9
9
|
export * from "./types/Election"
|
|
10
10
|
export * from "./types/ElectionsConfig"
|
|
11
|
+
export * from "./types/Expenditure"
|
|
11
12
|
export * from "./types/FederalDonation"
|
|
12
13
|
export * from "./types/FECFile"
|
|
13
14
|
export * from "./types/FECF1File"
|
|
14
15
|
export * from "./types/FECF2File"
|
|
15
16
|
export * from "./types/FECF3File"
|
|
16
17
|
export * from "./types/FECF24File"
|
|
17
|
-
export * from "./types/FECReport"
|
|
18
18
|
export * from "./types/FormTypeID"
|
|
19
19
|
export * from "./types/State"
|
|
20
20
|
export * from "./types/Tweet"
|
package/src/types/Candidate.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Committee, CommitteeAux } from "./Committee"
|
|
2
2
|
import { ElectionID, is_election_id, is_office_id, OfficeID } from "./Election"
|
|
3
|
-
import { Expenditure
|
|
3
|
+
import { Expenditure } from "./Expenditure"
|
|
4
|
+
import { FECF24File } from "./FECF24File"
|
|
4
5
|
import { FECF3File } from "./FECF3File"
|
|
5
|
-
import { FECReport } from "./FECReport"
|
|
6
6
|
import { is_state_id, StateID } from "./State"
|
|
7
7
|
|
|
8
8
|
export class ActivityIndex {
|
package/src/types/Committee.ts
CHANGED
package/src/types/Election.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Candidate, CandidateAux } from "./Candidate"
|
|
2
2
|
import { Committee, CommitteeAux } from "./Committee"
|
|
3
|
-
import { Expenditure } from "./
|
|
3
|
+
import { Expenditure } from "./Expenditure"
|
|
4
4
|
import { is_state_id, state_ids, StateID } from "./State"
|
|
5
5
|
|
|
6
6
|
const office_ids = ["H", "S"] as const
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Committee } from "./Committee"
|
|
2
|
+
import { ElectionID, is_election_id } from "./Election"
|
|
3
|
+
|
|
4
|
+
export class Expenditure {
|
|
5
|
+
readonly fec_file_id : number
|
|
6
|
+
readonly expenditure_id : string
|
|
7
|
+
readonly committee_id : string
|
|
8
|
+
readonly date : string
|
|
9
|
+
readonly payee : string
|
|
10
|
+
readonly election_stage : string
|
|
11
|
+
readonly election_id : ElectionID
|
|
12
|
+
readonly candidate_id : string
|
|
13
|
+
readonly amount : number
|
|
14
|
+
readonly cumulative_amount : number
|
|
15
|
+
readonly purpose : string
|
|
16
|
+
readonly is_support : boolean
|
|
17
|
+
readonly [x : string] : any
|
|
18
|
+
|
|
19
|
+
constructor(expenditure : any) {
|
|
20
|
+
if (!Expenditure.is(expenditure)) {
|
|
21
|
+
throw Error("Invalid input.")
|
|
22
|
+
}
|
|
23
|
+
this.fec_file_id = expenditure.fec_file_id
|
|
24
|
+
this.expenditure_id = expenditure.expenditure_id
|
|
25
|
+
this.committee_id = expenditure.committee_id
|
|
26
|
+
this.date = expenditure.date
|
|
27
|
+
this.payee = expenditure.payee
|
|
28
|
+
this.election_stage = expenditure.election_stage
|
|
29
|
+
this.election_id = expenditure.election_id
|
|
30
|
+
this.candidate_id = expenditure.candidate_id
|
|
31
|
+
this.amount = expenditure.amount
|
|
32
|
+
this.cumulative_amount = expenditure.cumulative_amount
|
|
33
|
+
this.purpose = expenditure.purpose
|
|
34
|
+
this.is_support = expenditure.is_support
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static is(expenditure : any) : expenditure is Expenditure {
|
|
38
|
+
return (
|
|
39
|
+
expenditure !== undefined &&
|
|
40
|
+
typeof expenditure.fec_file_id === "number" &&
|
|
41
|
+
typeof expenditure.expenditure_id === "string" &&
|
|
42
|
+
typeof expenditure.committee_id === "string" &&
|
|
43
|
+
typeof expenditure.date === "string" &&
|
|
44
|
+
typeof expenditure.payee === "string" &&
|
|
45
|
+
typeof expenditure.election_stage === "string" &&
|
|
46
|
+
is_election_id(expenditure.election_id) &&
|
|
47
|
+
typeof expenditure.candidate_id === "string" &&
|
|
48
|
+
typeof expenditure.amount === "number" &&
|
|
49
|
+
typeof expenditure.cumulative_amount === "number" &&
|
|
50
|
+
typeof expenditure.purpose === "string" &&
|
|
51
|
+
typeof expenditure.is_support === "boolean"
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export class ExpenditureAux extends Expenditure {
|
|
58
|
+
readonly committee : Committee[]
|
|
59
|
+
|
|
60
|
+
constructor(expenditure : any) {
|
|
61
|
+
if (!ExpenditureAux.is(expenditure)) {
|
|
62
|
+
throw Error("Invalid input.")
|
|
63
|
+
}
|
|
64
|
+
super(expenditure)
|
|
65
|
+
this.committee = expenditure.committee
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static is(expenditure : any) : expenditure is ExpenditureAux {
|
|
69
|
+
return (
|
|
70
|
+
Expenditure.is(expenditure) &&
|
|
71
|
+
Committee.is(expenditure.committee)
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
}
|
package/src/types/FECF24File.ts
CHANGED
|
@@ -1,55 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Expenditure } from "./Expenditure"
|
|
2
2
|
import { FECFile } from "./FECFile"
|
|
3
3
|
|
|
4
|
-
export class Expenditure {
|
|
5
|
-
readonly fec_file_id : number
|
|
6
|
-
readonly expenditure_id : string
|
|
7
|
-
readonly date : string
|
|
8
|
-
readonly payee : string
|
|
9
|
-
readonly election_stage : string
|
|
10
|
-
readonly election_id : ElectionID
|
|
11
|
-
readonly candidate_id : string
|
|
12
|
-
readonly amount : number
|
|
13
|
-
readonly cumulative_amount : number
|
|
14
|
-
readonly purpose : string
|
|
15
|
-
readonly is_support : boolean
|
|
16
|
-
|
|
17
|
-
constructor(expenditure : any) {
|
|
18
|
-
if (!Expenditure.is(expenditure)) {
|
|
19
|
-
throw Error("Invalid input.")
|
|
20
|
-
}
|
|
21
|
-
this.fec_file_id = expenditure.fec_file_id
|
|
22
|
-
this.expenditure_id = expenditure.expenditure_id
|
|
23
|
-
this.date = expenditure.date
|
|
24
|
-
this.payee = expenditure.payee
|
|
25
|
-
this.election_stage = expenditure.election_stage
|
|
26
|
-
this.election_id = expenditure.election_id
|
|
27
|
-
this.candidate_id = expenditure.candidate_id
|
|
28
|
-
this.amount = expenditure.amount
|
|
29
|
-
this.cumulative_amount = expenditure.cumulative_amount
|
|
30
|
-
this.purpose = expenditure.purpose
|
|
31
|
-
this.is_support = expenditure.is_support
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
static is(expenditure : any) : expenditure is Expenditure {
|
|
35
|
-
return (
|
|
36
|
-
expenditure !== undefined &&
|
|
37
|
-
typeof expenditure.fec_file_id === "number" &&
|
|
38
|
-
typeof expenditure.expenditure_id === "string" &&
|
|
39
|
-
typeof expenditure.date === "string" &&
|
|
40
|
-
typeof expenditure.payee === "string" &&
|
|
41
|
-
typeof expenditure.election_stage === "string" &&
|
|
42
|
-
is_election_id(expenditure.election_id) &&
|
|
43
|
-
typeof expenditure.candidate_id === "string" &&
|
|
44
|
-
typeof expenditure.amount === "number" &&
|
|
45
|
-
typeof expenditure.cumulative_amount === "number" &&
|
|
46
|
-
typeof expenditure.purpose === "string" &&
|
|
47
|
-
typeof expenditure.is_support === "boolean"
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
4
|
export class FECF24File extends FECFile {
|
|
54
5
|
readonly committee_id : string
|
|
55
6
|
readonly first_fec_file_id : number
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// export class IndependentExpenditure {
|
|
2
|
-
// readonly transaction_id : string
|
|
3
|
-
// readonly date : string
|
|
4
|
-
// readonly payee : string
|
|
5
|
-
// readonly election_stage : string
|
|
6
|
-
// readonly election_id : string
|
|
7
|
-
// readonly amount : number
|
|
8
|
-
// readonly cumulative_amount : number
|
|
9
|
-
// readonly purpose : string
|
|
10
|
-
// readonly candidate_id : string
|
|
11
|
-
// readonly support : string
|
|
12
|
-
|
|
13
|
-
// constructor(independent_expenditure : any) {
|
|
14
|
-
// if (!IndependentExpenditure.is(independent_expenditure)) {
|
|
15
|
-
// throw Error("Invalid input.")
|
|
16
|
-
// }
|
|
17
|
-
// this.transaction_id = independent_expenditure.transaction_id
|
|
18
|
-
// this.date = independent_expenditure.date
|
|
19
|
-
// this.payee = independent_expenditure.payee
|
|
20
|
-
// this.election_stage = independent_expenditure.election_stage
|
|
21
|
-
// this.election_id = independent_expenditure.election_id
|
|
22
|
-
// this.amount = independent_expenditure.amount
|
|
23
|
-
// this.cumulative_amount = independent_expenditure.cumulative_amount
|
|
24
|
-
// this.purpose = independent_expenditure.purpose
|
|
25
|
-
// this.candidate_id = independent_expenditure.candidate_id
|
|
26
|
-
// this.support = independent_expenditure.support
|
|
27
|
-
// }
|
|
28
|
-
|
|
29
|
-
// static is(independent_expenditure : any) : independent_expenditure is IndependentExpenditure {
|
|
30
|
-
// return (
|
|
31
|
-
// independent_expenditure !== undefined &&
|
|
32
|
-
// typeof independent_expenditure.independent_expenditure === "string" &&
|
|
33
|
-
// typeof independent_expenditure.date === "string" &&
|
|
34
|
-
// typeof independent_expenditure.payee === "string" &&
|
|
35
|
-
// typeof independent_expenditure.election_stage === "string" &&
|
|
36
|
-
// typeof independent_expenditure.election_id === "string" &&
|
|
37
|
-
// typeof independent_expenditure.amount === "number" &&
|
|
38
|
-
// typeof independent_expenditure.cumulative_amount === "number" &&
|
|
39
|
-
// typeof independent_expenditure.purpose === "string" &&
|
|
40
|
-
// typeof independent_expenditure.candidate_id === "string" &&
|
|
41
|
-
// typeof independent_expenditure.support === "string"
|
|
42
|
-
// )
|
|
43
|
-
// }
|
|
44
|
-
// }
|
|
45
|
-
|
|
46
|
-
// export class FECIndependentExpenditureReport {
|
|
47
|
-
// readonly committee_id : string
|
|
48
|
-
// readonly first_file_number : number
|
|
49
|
-
// readonly report_type : string
|
|
50
|
-
// readonly first_report_date : string
|
|
51
|
-
// readonly report_date : string
|
|
52
|
-
// readonly transaction_ids : string[]
|
|
53
|
-
// readonly expenditures_by_transaction_id : Record<string, IndependentExpenditure>
|
|
54
|
-
|
|
55
|
-
// constructor(fec_independent_expenditure_report : any) {
|
|
56
|
-
// if (!FECIndependentExpenditureReport.is(fec_independent_expenditure_report)) {
|
|
57
|
-
// throw Error("Invalid input.")
|
|
58
|
-
// }
|
|
59
|
-
// this.committee_id = fec_independent_expenditure_report.committee_id
|
|
60
|
-
// this.first_file_number = fec_independent_expenditure_report.first_file_number
|
|
61
|
-
// this.report_type = fec_independent_expenditure_report.report_type
|
|
62
|
-
// this.first_report_date = fec_independent_expenditure_report.first_report_date
|
|
63
|
-
// this.report_date = fec_independent_expenditure_report.report_date
|
|
64
|
-
// this.transaction_ids = fec_independent_expenditure_report.transaction_ids
|
|
65
|
-
// this.expenditures_by_transaction_id = fec_independent_expenditure_report.expenditures_by_transaction_id
|
|
66
|
-
// }
|
|
67
|
-
|
|
68
|
-
// static is(fec_independent_expenditure_report : any) : fec_independent_expenditure_report is FECIndependentExpenditureReport {
|
|
69
|
-
// return (
|
|
70
|
-
// fec_independent_expenditure_report !== undefined &&
|
|
71
|
-
// typeof fec_independent_expenditure_report.committee_id === "string" &&
|
|
72
|
-
// typeof fec_independent_expenditure_report.first_file_number === "number" &&
|
|
73
|
-
// typeof fec_independent_expenditure_report.report_type === "string" &&
|
|
74
|
-
// typeof fec_independent_expenditure_report.first_report_date === "string" &&
|
|
75
|
-
// typeof fec_independent_expenditure_report.report_date === "string" &&
|
|
76
|
-
// Array.isArray(fec_independent_expenditure_report.transaction_ids) && fec_independent_expenditure_report.transaction_ids.map((transaction_id : any) => typeof transaction_id === "string") &&
|
|
77
|
-
// typeof fec_independent_expenditure_report.expenditures_by_transaction_id === "object" &&
|
|
78
|
-
// Object.entries(fec_independent_expenditure_report.expenditures_by_transaction_id).every(([key, value]) => typeof key === "string" && IndependentExpenditure.is(value))
|
|
79
|
-
// )
|
|
80
|
-
// }
|
|
81
|
-
// }
|
package/src/types/FECReport.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export class FECReport {
|
|
2
|
-
readonly committee_id : string
|
|
3
|
-
readonly report_type : string
|
|
4
|
-
readonly file_number : number
|
|
5
|
-
readonly cash_on_hand : number
|
|
6
|
-
readonly cumulative_receipts : number
|
|
7
|
-
readonly new_receipts : number
|
|
8
|
-
|
|
9
|
-
constructor(fec_report : any) {
|
|
10
|
-
if (!FECReport.is(fec_report)) {
|
|
11
|
-
throw Error("Invalid input.")
|
|
12
|
-
}
|
|
13
|
-
this.committee_id = fec_report.committee_id
|
|
14
|
-
this.report_type = fec_report.report_type
|
|
15
|
-
this.file_number = fec_report.file_number
|
|
16
|
-
this.cash_on_hand = fec_report.cash_on_hand
|
|
17
|
-
this.cumulative_receipts = fec_report.cumulative_receipts
|
|
18
|
-
this.new_receipts = fec_report.new_receipts
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
static is(fec_report : any) : fec_report is FECReport {
|
|
22
|
-
return (
|
|
23
|
-
fec_report !== undefined &&
|
|
24
|
-
typeof fec_report.committee_id === "string" &&
|
|
25
|
-
typeof fec_report.report_type === "string" &&
|
|
26
|
-
typeof fec_report.file_number === "number" &&
|
|
27
|
-
typeof fec_report.cash_on_hand === "number" &&
|
|
28
|
-
typeof fec_report.cumulative_receipts === "number" &&
|
|
29
|
-
typeof fec_report.new_receipts === "number"
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
}
|