elections-types 1.0.71 → 1.0.73

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,6 @@
1
1
  import { CommitteeAux } from "./Committee.js";
2
2
  import { ElectionID, OfficeID } from "./Election.js";
3
+ import { Expenditure } from "./FECF24File.js";
3
4
  import { FECF3File } from "./FECF3File.js";
4
5
  import { StateID } from "./State.js";
5
6
  export declare class ActivityIndex {
@@ -31,6 +32,7 @@ export declare class Candidate {
31
32
  export declare class CandidateAux extends Candidate {
32
33
  readonly committees: CommitteeAux[];
33
34
  readonly fec_f3_files: FECF3File[];
35
+ readonly expenditures: Expenditure[];
34
36
  constructor(candidate: any);
35
37
  static is(candidate: any): candidate is CandidateAux;
36
38
  }
@@ -1,5 +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 "./FECF24File.js";
3
4
  import { FECF3File } from "./FECF3File.js";
4
5
  import { is_state_id } from "./State.js";
5
6
  export class ActivityIndex {
@@ -76,6 +77,7 @@ export class Candidate {
76
77
  export class CandidateAux extends Candidate {
77
78
  committees;
78
79
  fec_f3_files;
80
+ expenditures;
79
81
  constructor(candidate) {
80
82
  if (!CandidateAux.is(candidate)) {
81
83
  throw Error("Invalid input.");
@@ -83,12 +85,15 @@ export class CandidateAux extends Candidate {
83
85
  super(candidate);
84
86
  this.committees = candidate.committees;
85
87
  this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file));
88
+ this.expenditures = candidate.expenditures.map(expenditure => new Expenditure(expenditure));
86
89
  }
87
90
  static is(candidate) {
88
91
  return (Candidate.is(candidate) &&
89
92
  Array.isArray(candidate.committees) &&
90
93
  candidate.committees.every(CommitteeAux.is) &&
91
94
  Array.isArray(candidate.fec_f3_files) &&
92
- candidate.fec_f3_files.every(FECF3File.is));
95
+ candidate.fec_f3_files.every(FECF3File.is) &&
96
+ Array.isArray(candidate.expenditures) &&
97
+ candidate.expenditures.every(Expenditure.is));
93
98
  }
94
99
  }
@@ -1,5 +1,6 @@
1
1
  import { CandidateAux } from "./Candidate.js";
2
2
  import { CommitteeAux } from "./Committee.js";
3
+ import { Expenditure } from "./FECF24File.js";
3
4
  import { StateID } from "./State.js";
4
5
  declare const office_ids: readonly ["H", "S"];
5
6
  export type OfficeID = typeof office_ids[number];
@@ -19,6 +20,7 @@ export declare class Election {
19
20
  export declare class ElectionAux extends Election {
20
21
  readonly candidates: CandidateAux[];
21
22
  readonly committees: CommitteeAux[];
23
+ readonly expenditures: Expenditure[];
22
24
  constructor(election: any);
23
25
  static is(election: any): election is ElectionAux;
24
26
  }
@@ -1,5 +1,6 @@
1
1
  import { CandidateAux } from "./Candidate.js";
2
2
  import { CommitteeAux } from "./Committee.js";
3
+ import { Expenditure } from "./FECF24File.js";
3
4
  import { is_state_id } from "./State.js";
4
5
  const office_ids = ["H", "S"];
5
6
  export function is_office_id(office_id) {
@@ -47,6 +48,7 @@ export class Election {
47
48
  export class ElectionAux extends Election {
48
49
  candidates;
49
50
  committees;
51
+ expenditures;
50
52
  constructor(election) {
51
53
  if (!ElectionAux.is(election)) {
52
54
  throw Error("Invalid input.");
@@ -54,12 +56,15 @@ export class ElectionAux extends Election {
54
56
  super(election);
55
57
  this.candidates = election.candidates;
56
58
  this.committees = election.committees;
59
+ this.expenditures = election.expenditures;
57
60
  }
58
61
  static is(election) {
59
62
  return (Election.is(election) &&
60
63
  Array.isArray(election.candidates) &&
61
64
  election.candidates.every(CandidateAux.is) &&
62
65
  Array.isArray(election.committees) &&
63
- election.committees.every(CommitteeAux.is));
66
+ election.committees.every(CommitteeAux.is) &&
67
+ Array.isArray(election.expenditures) &&
68
+ election.expenditures.every(Expenditure.is));
64
69
  }
65
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.0.71",
3
+ "version": "1.0.73",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -1,6 +1,6 @@
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"
3
+ import { Expenditure, FECF24File } from "./FECF24File"
4
4
  import { FECF3File } from "./FECF3File"
5
5
  import { FECReport } from "./FECReport"
6
6
  import { is_state_id, StateID } from "./State"
@@ -93,6 +93,7 @@ export class Candidate {
93
93
  export class CandidateAux extends Candidate {
94
94
  readonly committees : CommitteeAux[]
95
95
  readonly fec_f3_files : FECF3File[]
96
+ readonly expenditures : Expenditure[]
96
97
 
97
98
  constructor(candidate : any) {
98
99
  if (!CandidateAux.is(candidate)) {
@@ -101,6 +102,7 @@ export class CandidateAux extends Candidate {
101
102
  super(candidate)
102
103
  this.committees = candidate.committees
103
104
  this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
105
+ this.expenditures = candidate.expenditures.map(expenditure => new Expenditure(expenditure))
104
106
  }
105
107
 
106
108
  static is(candidate : any) : candidate is CandidateAux {
@@ -109,7 +111,9 @@ export class CandidateAux extends Candidate {
109
111
  Array.isArray(candidate.committees) &&
110
112
  candidate.committees.every(CommitteeAux.is) &&
111
113
  Array.isArray(candidate.fec_f3_files) &&
112
- candidate.fec_f3_files.every(FECF3File.is)
114
+ candidate.fec_f3_files.every(FECF3File.is) &&
115
+ Array.isArray(candidate.expenditures) &&
116
+ candidate.expenditures.every(Expenditure.is)
113
117
  )
114
118
  }
115
119
  }
@@ -1,5 +1,6 @@
1
1
  import { Candidate, CandidateAux } from "./Candidate"
2
2
  import { Committee, CommitteeAux } from "./Committee"
3
+ import { Expenditure } from "./FECF24File"
3
4
  import { is_state_id, state_ids, StateID } from "./State"
4
5
 
5
6
  const office_ids = ["H", "S"] as const
@@ -64,6 +65,7 @@ export class Election {
64
65
  export class ElectionAux extends Election {
65
66
  readonly candidates : CandidateAux[]
66
67
  readonly committees : CommitteeAux[]
68
+ readonly expenditures : Expenditure[]
67
69
 
68
70
  constructor(election : any) {
69
71
  if (!ElectionAux.is(election)) {
@@ -72,6 +74,7 @@ export class ElectionAux extends Election {
72
74
  super(election)
73
75
  this.candidates = election.candidates
74
76
  this.committees = election.committees
77
+ this.expenditures = election.expenditures
75
78
  }
76
79
 
77
80
  static is(election : any) : election is ElectionAux {
@@ -80,7 +83,9 @@ export class ElectionAux extends Election {
80
83
  Array.isArray(election.candidates) &&
81
84
  election.candidates.every(CandidateAux.is) &&
82
85
  Array.isArray(election.committees) &&
83
- election.committees.every(CommitteeAux.is)
86
+ election.committees.every(CommitteeAux.is) &&
87
+ Array.isArray(election.expenditures) &&
88
+ election.expenditures.every(Expenditure.is)
84
89
  )
85
90
  }
86
91
  }