elections-types 1.0.84 → 1.0.86
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 +5 -5
- package/dist/src/index.js +5 -5
- package/dist/src/types/Candidate.d.ts +3 -3
- package/dist/src/types/Candidate.js +6 -6
- package/dist/src/types/Committee.d.ts +3 -3
- package/dist/src/types/Committee.js +6 -6
- package/dist/src/types/ElectionsConfig.d.ts +1 -1
- package/dist/src/types/Expenditure.d.ts +3 -3
- package/dist/src/types/Expenditure.js +6 -6
- package/dist/src/types/FECFile.d.ts +1 -1
- package/dist/src/types/FECFile.js +3 -3
- package/dist/src/types/FederalDonation.d.ts +1 -1
- package/dist/src/types/FederalDonation.js +3 -3
- package/dist/src/types/FederalElectionF1File.d.ts +18 -0
- package/dist/src/types/FederalElectionF1File.js +48 -0
- package/dist/src/types/FederalElectionF24File.d.ts +12 -0
- package/dist/src/types/FederalElectionF24File.js +32 -0
- package/dist/src/types/FederalElectionF2File.d.ts +15 -0
- package/dist/src/types/FederalElectionF2File.js +39 -0
- package/dist/src/types/FederalElectionF3File.d.ts +13 -0
- package/dist/src/types/FederalElectionF3File.js +37 -0
- package/dist/src/types/FederalElectionFile.d.ts +15 -0
- package/dist/src/types/FederalElectionFile.js +33 -0
- package/dist/src/types/Video.d.ts +1 -1
- package/dist/src/types/Video.js +3 -3
- package/package.json +1 -1
- package/src/index.ts +5 -5
- package/src/types/Candidate.ts +7 -7
- package/src/types/Committee.ts +7 -7
- package/src/types/ElectionsConfig.ts +1 -1
- package/src/types/Expenditure.ts +7 -7
- package/src/types/FederalDonation.ts +3 -3
- package/src/types/FederalElectionF1File.ts +53 -0
- package/src/types/FederalElectionF24File.ts +37 -0
- package/src/types/FederalElectionF2File.ts +44 -0
- package/src/types/FederalElectionF3File.ts +42 -0
- package/src/types/FederalElectionFile.ts +43 -0
- package/src/types/Video.ts +3 -3
- package/src/types/FECF1File.ts +0 -53
- package/src/types/FECF24File.ts +0 -37
- package/src/types/FECF2File.ts +0 -44
- package/src/types/FECF3File.ts +0 -42
- package/src/types/FECFile.ts +0 -43
package/src/types/FECF2File.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ElectionID, is_election_id, is_office_id, OfficeID } from "./Election"
|
|
2
|
-
import { FECFile } from "./FECFile"
|
|
3
|
-
import { is_state_id, StateID } from "./State"
|
|
4
|
-
|
|
5
|
-
export class FECF2File extends FECFile {
|
|
6
|
-
readonly candidate_id : string
|
|
7
|
-
readonly fec_name : string
|
|
8
|
-
readonly office_id : OfficeID
|
|
9
|
-
readonly state_id : StateID
|
|
10
|
-
readonly district? : number
|
|
11
|
-
readonly election_id : ElectionID
|
|
12
|
-
readonly party_id? : string
|
|
13
|
-
readonly report_date : string
|
|
14
|
-
|
|
15
|
-
constructor(fec_file : any) {
|
|
16
|
-
if (!FECF2File.is(fec_file)) {
|
|
17
|
-
throw Error("Invalid input.")
|
|
18
|
-
}
|
|
19
|
-
super(fec_file)
|
|
20
|
-
this.candidate_id = fec_file.candidate_id
|
|
21
|
-
this.fec_name = fec_file.fec_name
|
|
22
|
-
this.office_id = fec_file.office_id
|
|
23
|
-
this.state_id = fec_file.state_id
|
|
24
|
-
this.district = fec_file.district
|
|
25
|
-
this.election_id = fec_file.election_id
|
|
26
|
-
this.party_id = fec_file.party_id
|
|
27
|
-
this.report_date = fec_file.report_date
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static is(fec_file : any) : fec_file is FECF2File {
|
|
31
|
-
return (
|
|
32
|
-
FECFile.is(fec_file) &&
|
|
33
|
-
fec_file.form_type_id === "F2" &&
|
|
34
|
-
typeof fec_file.candidate_id === "string" &&
|
|
35
|
-
typeof fec_file.fec_name === "string" &&
|
|
36
|
-
is_office_id(fec_file.office_id) &&
|
|
37
|
-
is_state_id(fec_file.state_id) &&
|
|
38
|
-
(fec_file.district === undefined || typeof fec_file.district === "number") &&
|
|
39
|
-
is_election_id(fec_file.election_id) &&
|
|
40
|
-
(fec_file.party_id === undefined || typeof fec_file.party_id === "string") &&
|
|
41
|
-
typeof fec_file.report_date === "string"
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
}
|
package/src/types/FECF3File.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { FECFile } from "./FECFile"
|
|
2
|
-
|
|
3
|
-
export class FECF3File extends FECFile {
|
|
4
|
-
readonly committee_id : string
|
|
5
|
-
readonly period_id : string
|
|
6
|
-
readonly period_start_date : string
|
|
7
|
-
readonly period_end_date : string
|
|
8
|
-
readonly report_date : string
|
|
9
|
-
readonly cash_on_hand : number
|
|
10
|
-
readonly cumulative_receipts : number
|
|
11
|
-
readonly new_receipts : number
|
|
12
|
-
|
|
13
|
-
constructor(fec_file : any) {
|
|
14
|
-
if (!FECF3File.is(fec_file)) {
|
|
15
|
-
throw Error("Invalid input.")
|
|
16
|
-
}
|
|
17
|
-
super(fec_file)
|
|
18
|
-
this.committee_id = fec_file.committee_id
|
|
19
|
-
this.period_id = fec_file.period_id
|
|
20
|
-
this.period_start_date = fec_file.period_start_date
|
|
21
|
-
this.period_end_date = fec_file.period_end_date
|
|
22
|
-
this.report_date = fec_file.report_date
|
|
23
|
-
this.cash_on_hand = fec_file.cash_on_hand
|
|
24
|
-
this.cumulative_receipts = fec_file.cumulative_receipts
|
|
25
|
-
this.new_receipts = fec_file.new_receipts
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static is(fec_file : any) : fec_file is FECF3File {
|
|
29
|
-
return (
|
|
30
|
-
FECFile.is(fec_file) &&
|
|
31
|
-
fec_file.form_type_id === "F3" &&
|
|
32
|
-
typeof fec_file.committee_id === "string" &&
|
|
33
|
-
typeof fec_file.period_id === "string" &&
|
|
34
|
-
typeof fec_file.period_start_date === "string" &&
|
|
35
|
-
typeof fec_file.period_end_date === "string" &&
|
|
36
|
-
typeof fec_file.report_date === "string" &&
|
|
37
|
-
typeof fec_file.cash_on_hand === "number" &&
|
|
38
|
-
typeof fec_file.cumulative_receipts === "number" &&
|
|
39
|
-
typeof fec_file.new_receipts === "number"
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
}
|
package/src/types/FECFile.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { AmendmentTypeID, FormTypeID, is_amendment_type_id, is_form_type_id, is_long_form_type_id, LongFormTypeID } from "./FormTypeID"
|
|
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
|
-
|
|
11
|
-
export class FECFile {
|
|
12
|
-
readonly fec_file_id : number
|
|
13
|
-
readonly form_version_id : FormVersionID
|
|
14
|
-
readonly form_type_id : FormTypeID
|
|
15
|
-
readonly amendment_type_id : AmendmentTypeID
|
|
16
|
-
readonly long_form_type_id : LongFormTypeID
|
|
17
|
-
readonly s3_filename : string
|
|
18
|
-
[x : string] : any
|
|
19
|
-
|
|
20
|
-
constructor(fec_file : any) {
|
|
21
|
-
if (!FECFile.is(fec_file)) {
|
|
22
|
-
throw Error("Invalid input.")
|
|
23
|
-
}
|
|
24
|
-
this.fec_file_id = fec_file.fec_file_id
|
|
25
|
-
this.form_version_id = fec_file.form_version_id
|
|
26
|
-
this.form_type_id = fec_file.form_type_id
|
|
27
|
-
this.amendment_type_id = fec_file.amendment_type_id
|
|
28
|
-
this.long_form_type_id = fec_file.long_form_type_id
|
|
29
|
-
this.s3_filename = fec_file.s3_filename
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
static is(fec_file : any) : fec_file is FECFile {
|
|
33
|
-
return (
|
|
34
|
-
fec_file !== undefined &&
|
|
35
|
-
typeof fec_file.fec_file_id === "number" &&
|
|
36
|
-
is_form_version_id(fec_file.form_version_id) &&
|
|
37
|
-
is_form_type_id(fec_file.form_type_id) &&
|
|
38
|
-
is_amendment_type_id(fec_file.amendment_type_id) &&
|
|
39
|
-
is_long_form_type_id(fec_file.long_form_type_id) &&
|
|
40
|
-
(fec_file.s3_filename === undefined || typeof fec_file.s3_filename === "string")
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
}
|