elections-types 1.0.69 → 1.0.71

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 { FECF3File } from "./FECF3File.js";
3
4
  import { StateID } from "./State.js";
4
5
  export declare class ActivityIndex {
5
6
  readonly news_index: number;
@@ -19,7 +20,6 @@ export declare class Candidate {
19
20
  readonly active?: boolean;
20
21
  readonly status?: string;
21
22
  readonly fec_file_id?: number;
22
- readonly committee_ids?: string[];
23
23
  readonly ballotpedia_name?: string;
24
24
  readonly ballotpedia_url?: string;
25
25
  readonly ballotpedia_data?: Record<string, any>;
@@ -30,6 +30,7 @@ export declare class Candidate {
30
30
  }
31
31
  export declare class CandidateAux extends Candidate {
32
32
  readonly committees: CommitteeAux[];
33
+ readonly fec_f3_files: FECF3File[];
33
34
  constructor(candidate: any);
34
35
  static is(candidate: any): candidate is CandidateAux;
35
36
  }
@@ -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 { FECF3File } from "./FECF3File.js";
3
4
  import { is_state_id } from "./State.js";
4
5
  export class ActivityIndex {
5
6
  news_index;
@@ -31,7 +32,6 @@ export class Candidate {
31
32
  active;
32
33
  status;
33
34
  fec_file_id;
34
- committee_ids;
35
35
  ballotpedia_name;
36
36
  ballotpedia_url;
37
37
  ballotpedia_data;
@@ -50,7 +50,6 @@ export class Candidate {
50
50
  this.active = candidate.active;
51
51
  this.status = candidate.status;
52
52
  this.fec_file_id = candidate.fec_file_id;
53
- this.committee_ids = candidate.committee_ids;
54
53
  this.ballotpedia_name = candidate.ballotpedia_name;
55
54
  this.ballotpedia_url = candidate.ballotpedia_url;
56
55
  this.ballotpedia_data = candidate.ballotpedia_data;
@@ -68,7 +67,6 @@ export class Candidate {
68
67
  (candidate.active === undefined || typeof candidate.active === "boolean") &&
69
68
  (candidate.status === undefined || typeof candidate.status === "string") &&
70
69
  (candidate.fec_file_id === undefined || typeof candidate.fec_file_id === "number" && !isNaN(candidate.fec_file_id)) &&
71
- (candidate.committee_ids === undefined || Array.isArray(candidate.committee_ids) && candidate.committee_ids.map((committee_id) => typeof committee_id === "string")) &&
72
70
  (candidate.ballotpedia_name === undefined || typeof candidate.ballotpedia_name === "string") &&
73
71
  (candidate.ballotpedia_url === undefined || typeof candidate.ballotpedia_url === "string") &&
74
72
  (candidate.ballotpedia_data === undefined || typeof candidate.ballotpedia_data === "object" && Object.keys(candidate.ballotpedia_data).map((key) => typeof key === "string")) &&
@@ -77,18 +75,20 @@ export class Candidate {
77
75
  }
78
76
  export class CandidateAux extends Candidate {
79
77
  committees;
80
- // readonly fec_f3_files : FECF3File[]
78
+ fec_f3_files;
81
79
  constructor(candidate) {
82
80
  if (!CandidateAux.is(candidate)) {
83
81
  throw Error("Invalid input.");
84
82
  }
85
83
  super(candidate);
86
84
  this.committees = candidate.committees;
87
- // this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
85
+ this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file));
88
86
  }
89
87
  static is(candidate) {
90
88
  return (Candidate.is(candidate) &&
91
89
  Array.isArray(candidate.committees) &&
92
- candidate.committees.every(CommitteeAux.is));
90
+ candidate.committees.every(CommitteeAux.is) &&
91
+ Array.isArray(candidate.fec_f3_files) &&
92
+ candidate.fec_f3_files.every(FECF3File.is));
93
93
  }
94
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.0.69",
3
+ "version": "1.0.71",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -40,7 +40,6 @@ export class Candidate {
40
40
  readonly active? : boolean
41
41
  readonly status? : string
42
42
  readonly fec_file_id? : number
43
- readonly committee_ids? : string[]
44
43
  readonly ballotpedia_name? : string
45
44
  readonly ballotpedia_url? : string
46
45
  readonly ballotpedia_data? : Record<string, any>
@@ -64,7 +63,6 @@ export class Candidate {
64
63
  this.active = candidate.active
65
64
  this.status = candidate.status
66
65
  this.fec_file_id = candidate.fec_file_id
67
- this.committee_ids = candidate.committee_ids
68
66
  this.ballotpedia_name = candidate.ballotpedia_name
69
67
  this.ballotpedia_url = candidate.ballotpedia_url
70
68
  this.ballotpedia_data = candidate.ballotpedia_data
@@ -84,7 +82,6 @@ export class Candidate {
84
82
  (candidate.active === undefined || typeof candidate.active === "boolean") &&
85
83
  (candidate.status === undefined || typeof candidate.status === "string") &&
86
84
  (candidate.fec_file_id === undefined || typeof candidate.fec_file_id === "number" && !isNaN(candidate.fec_file_id)) &&
87
- (candidate.committee_ids === undefined || Array.isArray(candidate.committee_ids) && candidate.committee_ids.map((committee_id : any) => typeof committee_id === "string")) &&
88
85
  (candidate.ballotpedia_name === undefined || typeof candidate.ballotpedia_name === "string") &&
89
86
  (candidate.ballotpedia_url === undefined || typeof candidate.ballotpedia_url === "string") &&
90
87
  (candidate.ballotpedia_data === undefined || typeof candidate.ballotpedia_data === "object" && Object.keys(candidate.ballotpedia_data).map((key : any) => typeof key === "string")) &&
@@ -95,7 +92,7 @@ export class Candidate {
95
92
 
96
93
  export class CandidateAux extends Candidate {
97
94
  readonly committees : CommitteeAux[]
98
- // readonly fec_f3_files : FECF3File[]
95
+ readonly fec_f3_files : FECF3File[]
99
96
 
100
97
  constructor(candidate : any) {
101
98
  if (!CandidateAux.is(candidate)) {
@@ -103,14 +100,16 @@ export class CandidateAux extends Candidate {
103
100
  }
104
101
  super(candidate)
105
102
  this.committees = candidate.committees
106
- // this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
103
+ this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
107
104
  }
108
105
 
109
106
  static is(candidate : any) : candidate is CandidateAux {
110
107
  return (
111
108
  Candidate.is(candidate) &&
112
109
  Array.isArray(candidate.committees) &&
113
- candidate.committees.every(CommitteeAux.is)
110
+ candidate.committees.every(CommitteeAux.is) &&
111
+ Array.isArray(candidate.fec_f3_files) &&
112
+ candidate.fec_f3_files.every(FECF3File.is)
114
113
  )
115
114
  }
116
115
  }