elections-types 1.0.76 → 1.0.78
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,5 +1,7 @@
|
|
|
1
|
+
import { Candidate } from "./Candidate.js";
|
|
1
2
|
import { Committee } from "./Committee.js";
|
|
2
3
|
import { ElectionID } from "./Election.js";
|
|
4
|
+
import { FECF24File } from "./FECF24File.js";
|
|
3
5
|
export declare class Expenditure {
|
|
4
6
|
readonly fec_file_id: number;
|
|
5
7
|
readonly expenditure_id: string;
|
|
@@ -18,7 +20,9 @@ export declare class Expenditure {
|
|
|
18
20
|
static is(expenditure: any): expenditure is Expenditure;
|
|
19
21
|
}
|
|
20
22
|
export declare class ExpenditureAux extends Expenditure {
|
|
23
|
+
readonly candidate: Candidate;
|
|
21
24
|
readonly committee: Committee;
|
|
25
|
+
readonly fec_f24_file: FECF24File;
|
|
22
26
|
constructor(expenditure: any);
|
|
23
27
|
static is(expenditure: any): expenditure is ExpenditureAux;
|
|
24
28
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Candidate } from "./Candidate.js";
|
|
1
2
|
import { Committee } from "./Committee.js";
|
|
2
3
|
import { is_election_id } from "./Election.js";
|
|
4
|
+
import { FECF24File } from "./FECF24File.js";
|
|
3
5
|
export class Expenditure {
|
|
4
6
|
fec_file_id;
|
|
5
7
|
expenditure_id;
|
|
@@ -47,16 +49,22 @@ export class Expenditure {
|
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
export class ExpenditureAux extends Expenditure {
|
|
52
|
+
candidate;
|
|
50
53
|
committee;
|
|
54
|
+
fec_f24_file;
|
|
51
55
|
constructor(expenditure) {
|
|
52
56
|
if (!ExpenditureAux.is(expenditure)) {
|
|
53
57
|
throw Error("Invalid input.");
|
|
54
58
|
}
|
|
55
59
|
super(expenditure);
|
|
56
|
-
this.
|
|
60
|
+
this.candidate = new Candidate(expenditure.candidate);
|
|
61
|
+
this.committee = new Committee(expenditure.committee);
|
|
62
|
+
this.fec_f24_file = new FECF24File(expenditure.fec_f24_file);
|
|
57
63
|
}
|
|
58
64
|
static is(expenditure) {
|
|
59
65
|
return (Expenditure.is(expenditure) &&
|
|
60
|
-
|
|
66
|
+
Candidate.is(expenditure.candidate) &&
|
|
67
|
+
Committee.is(expenditure.committee) &&
|
|
68
|
+
FECF24File.is(expenditure.fec_f24_file));
|
|
61
69
|
}
|
|
62
70
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { AmendmentTypeID, FormTypeID, LongFormTypeID } from "./FormTypeID.js";
|
|
2
|
+
export declare const form_version_ids: readonly ["8.1", "8.2", "8.3", "8.4", "8.5"];
|
|
3
|
+
export type FormVersionID = typeof form_version_ids[number];
|
|
4
|
+
export declare function is_form_version_id(form_version_id: any): form_version_id is FormVersionID;
|
|
2
5
|
export declare class FECFile {
|
|
3
6
|
readonly fec_file_id: number;
|
|
7
|
+
readonly form_version_id: FormVersionID;
|
|
4
8
|
readonly form_type_id: FormTypeID;
|
|
5
9
|
readonly amendment_type_id: AmendmentTypeID;
|
|
6
10
|
readonly long_form_type_id: LongFormTypeID;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { is_amendment_type_id, is_form_type_id, is_long_form_type_id } from "./FormTypeID.js";
|
|
2
|
+
export const form_version_ids = ["8.1", "8.2", "8.3", "8.4", "8.5"];
|
|
3
|
+
export function is_form_version_id(form_version_id) {
|
|
4
|
+
return form_version_ids.includes(form_version_id);
|
|
5
|
+
}
|
|
2
6
|
export class FECFile {
|
|
3
7
|
fec_file_id;
|
|
8
|
+
form_version_id;
|
|
4
9
|
form_type_id;
|
|
5
10
|
amendment_type_id;
|
|
6
11
|
long_form_type_id;
|
|
@@ -10,6 +15,7 @@ export class FECFile {
|
|
|
10
15
|
throw Error("Invalid input.");
|
|
11
16
|
}
|
|
12
17
|
this.fec_file_id = fec_file.fec_file_id;
|
|
18
|
+
this.form_version_id = fec_file.form_version_id;
|
|
13
19
|
this.form_type_id = fec_file.form_type_id;
|
|
14
20
|
this.amendment_type_id = fec_file.amendment_type_id;
|
|
15
21
|
this.long_form_type_id = fec_file.long_form_type_id;
|
|
@@ -18,6 +24,7 @@ export class FECFile {
|
|
|
18
24
|
static is(fec_file) {
|
|
19
25
|
return (fec_file !== undefined &&
|
|
20
26
|
typeof fec_file.fec_file_id === "number" &&
|
|
27
|
+
is_form_version_id(fec_file.form_version_id) &&
|
|
21
28
|
is_form_type_id(fec_file.form_type_id) &&
|
|
22
29
|
is_amendment_type_id(fec_file.amendment_type_id) &&
|
|
23
30
|
is_long_form_type_id(fec_file.long_form_type_id) &&
|
package/package.json
CHANGED
package/src/types/Expenditure.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Candidate } from "./Candidate"
|
|
1
2
|
import { Committee } from "./Committee"
|
|
2
3
|
import { ElectionID, is_election_id } from "./Election"
|
|
4
|
+
import { FECF24File } from "./FECF24File"
|
|
3
5
|
|
|
4
6
|
export class Expenditure {
|
|
5
7
|
readonly fec_file_id : number
|
|
@@ -55,20 +57,26 @@ export class Expenditure {
|
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
export class ExpenditureAux extends Expenditure {
|
|
60
|
+
readonly candidate : Candidate
|
|
58
61
|
readonly committee : Committee
|
|
62
|
+
readonly fec_f24_file : FECF24File
|
|
59
63
|
|
|
60
64
|
constructor(expenditure : any) {
|
|
61
65
|
if (!ExpenditureAux.is(expenditure)) {
|
|
62
66
|
throw Error("Invalid input.")
|
|
63
67
|
}
|
|
64
68
|
super(expenditure)
|
|
65
|
-
this.
|
|
69
|
+
this.candidate = new Candidate(expenditure.candidate)
|
|
70
|
+
this.committee = new Committee(expenditure.committee)
|
|
71
|
+
this.fec_f24_file = new FECF24File(expenditure.fec_f24_file)
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
static is(expenditure : any) : expenditure is ExpenditureAux {
|
|
69
75
|
return (
|
|
70
76
|
Expenditure.is(expenditure) &&
|
|
71
|
-
|
|
77
|
+
Candidate.is(expenditure.candidate) &&
|
|
78
|
+
Committee.is(expenditure.committee) &&
|
|
79
|
+
FECF24File.is(expenditure.fec_f24_file)
|
|
72
80
|
)
|
|
73
81
|
}
|
|
74
82
|
}
|
package/src/types/FECFile.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { AmendmentTypeID, FormTypeID, is_amendment_type_id, is_form_type_id, is_long_form_type_id, LongFormTypeID } from "./FormTypeID"
|
|
2
2
|
|
|
3
|
+
export const form_version_ids = ["8.1", "8.2", "8.3", "8.4", "8.5"] as const
|
|
4
|
+
|
|
5
|
+
export type FormVersionID = typeof form_version_ids[number]
|
|
6
|
+
|
|
7
|
+
export function is_form_version_id(form_version_id : any) : form_version_id is FormVersionID {
|
|
8
|
+
return form_version_ids.includes(form_version_id)
|
|
9
|
+
}
|
|
10
|
+
|
|
3
11
|
export class FECFile {
|
|
4
12
|
readonly fec_file_id : number
|
|
13
|
+
readonly form_version_id : FormVersionID
|
|
5
14
|
readonly form_type_id : FormTypeID
|
|
6
15
|
readonly amendment_type_id : AmendmentTypeID
|
|
7
16
|
readonly long_form_type_id : LongFormTypeID
|
|
@@ -13,6 +22,7 @@ export class FECFile {
|
|
|
13
22
|
throw Error("Invalid input.")
|
|
14
23
|
}
|
|
15
24
|
this.fec_file_id = fec_file.fec_file_id
|
|
25
|
+
this.form_version_id = fec_file.form_version_id
|
|
16
26
|
this.form_type_id = fec_file.form_type_id
|
|
17
27
|
this.amendment_type_id = fec_file.amendment_type_id
|
|
18
28
|
this.long_form_type_id = fec_file.long_form_type_id
|
|
@@ -23,6 +33,7 @@ export class FECFile {
|
|
|
23
33
|
return (
|
|
24
34
|
fec_file !== undefined &&
|
|
25
35
|
typeof fec_file.fec_file_id === "number" &&
|
|
36
|
+
is_form_version_id(fec_file.form_version_id) &&
|
|
26
37
|
is_form_type_id(fec_file.form_type_id) &&
|
|
27
38
|
is_amendment_type_id(fec_file.amendment_type_id) &&
|
|
28
39
|
is_long_form_type_id(fec_file.long_form_type_id) &&
|