elections-types 1.0.70 → 1.0.72

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
1
  import { CommitteeAux } from "./Committee.js";
2
2
  import { ElectionID, OfficeID } from "./Election.js";
3
+ import { Expenditure } from "./FECF24File.js";
4
+ import { FECF3File } from "./FECF3File.js";
3
5
  import { StateID } from "./State.js";
4
6
  export declare class ActivityIndex {
5
7
  readonly news_index: number;
@@ -29,6 +31,8 @@ export declare class Candidate {
29
31
  }
30
32
  export declare class CandidateAux extends Candidate {
31
33
  readonly committees: CommitteeAux[];
34
+ readonly fec_f3_files: FECF3File[];
35
+ readonly expenditures: Expenditure[];
32
36
  constructor(candidate: any);
33
37
  static is(candidate: any): candidate is CandidateAux;
34
38
  }
@@ -1,5 +1,7 @@
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";
4
+ import { FECF3File } from "./FECF3File.js";
3
5
  import { is_state_id } from "./State.js";
4
6
  export class ActivityIndex {
5
7
  news_index;
@@ -74,18 +76,24 @@ export class Candidate {
74
76
  }
75
77
  export class CandidateAux extends Candidate {
76
78
  committees;
77
- // readonly fec_f3_files : FECF3File[]
79
+ fec_f3_files;
80
+ expenditures;
78
81
  constructor(candidate) {
79
82
  if (!CandidateAux.is(candidate)) {
80
83
  throw Error("Invalid input.");
81
84
  }
82
85
  super(candidate);
83
86
  this.committees = candidate.committees;
84
- // 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));
88
+ this.expenditures = candidate.expenditures.map(expenditure => new Expenditure(expenditure));
85
89
  }
86
90
  static is(candidate) {
87
91
  return (Candidate.is(candidate) &&
88
92
  Array.isArray(candidate.committees) &&
89
- candidate.committees.every(CommitteeAux.is));
93
+ candidate.committees.every(CommitteeAux.is) &&
94
+ Array.isArray(candidate.fec_f3_files) &&
95
+ candidate.fec_f3_files.every(FECF3File.is) &&
96
+ Array.isArray(candidate.expenditures) &&
97
+ candidate.expenditures.every(Expenditure.is));
90
98
  }
91
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
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"
@@ -92,7 +92,8 @@ export class Candidate {
92
92
 
93
93
  export class CandidateAux extends Candidate {
94
94
  readonly committees : CommitteeAux[]
95
- // readonly fec_f3_files : FECF3File[]
95
+ readonly fec_f3_files : FECF3File[]
96
+ readonly expenditures : Expenditure[]
96
97
 
97
98
  constructor(candidate : any) {
98
99
  if (!CandidateAux.is(candidate)) {
@@ -100,14 +101,19 @@ export class CandidateAux extends Candidate {
100
101
  }
101
102
  super(candidate)
102
103
  this.committees = candidate.committees
103
- // this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
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 {
107
109
  return (
108
110
  Candidate.is(candidate) &&
109
111
  Array.isArray(candidate.committees) &&
110
- candidate.committees.every(CommitteeAux.is)
112
+ candidate.committees.every(CommitteeAux.is) &&
113
+ Array.isArray(candidate.fec_f3_files) &&
114
+ candidate.fec_f3_files.every(FECF3File.is) &&
115
+ Array.isArray(candidate.expenditures) &&
116
+ candidate.expenditures.every(Expenditure.is)
111
117
  )
112
118
  }
113
119
  }