elections-types 1.0.64 → 1.0.65

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.
@@ -2,6 +2,7 @@ export * from "./types/APIError.js";
2
2
  export * from "./types/Article.js";
3
3
  export * from "./types/Candidate.js";
4
4
  export * from "./types/CandidateArticle.js";
5
+ export * from "./types/CandidateCommittee.js";
5
6
  export * from "./types/CandidateTweet.js";
6
7
  export * from "./types/CandidateVideo.js";
7
8
  export * from "./types/Committee.js";
package/dist/src/index.js CHANGED
@@ -2,6 +2,7 @@ export * from "./types/APIError.js";
2
2
  export * from "./types/Article.js";
3
3
  export * from "./types/Candidate.js";
4
4
  export * from "./types/CandidateArticle.js";
5
+ export * from "./types/CandidateCommittee.js";
5
6
  export * from "./types/CandidateTweet.js";
6
7
  export * from "./types/CandidateVideo.js";
7
8
  export * from "./types/Committee.js";
@@ -1,4 +1,4 @@
1
- import { CommitteeAux } from "./Committee.js";
1
+ import { CandidateCommitteeAux } from "./CandidateCommittee.js";
2
2
  import { ElectionID, OfficeID } from "./Election.js";
3
3
  import { FECF3File } from "./FECF3File.js";
4
4
  import { StateID } from "./State.js";
@@ -30,7 +30,7 @@ export declare class Candidate {
30
30
  static is(candidate: any): candidate is Candidate;
31
31
  }
32
32
  export declare class CandidateAux extends Candidate {
33
- readonly committees: CommitteeAux[];
33
+ readonly candidate_committees: CandidateCommitteeAux[];
34
34
  readonly fec_f3_files: FECF3File[];
35
35
  constructor(candidate: any);
36
36
  static is(candidate: any): candidate is CandidateAux;
@@ -1,4 +1,4 @@
1
- import { CommitteeAux } from "./Committee.js";
1
+ import { CandidateCommitteeAux } from "./CandidateCommittee.js";
2
2
  import { is_election_id, is_office_id } from "./Election.js";
3
3
  import { FECF3File } from "./FECF3File.js";
4
4
  import { is_state_id } from "./State.js";
@@ -77,20 +77,20 @@ export class Candidate {
77
77
  }
78
78
  }
79
79
  export class CandidateAux extends Candidate {
80
- committees;
80
+ candidate_committees;
81
81
  fec_f3_files;
82
82
  constructor(candidate) {
83
83
  if (!CandidateAux.is(candidate)) {
84
84
  throw Error("Invalid input.");
85
85
  }
86
86
  super(candidate);
87
- this.committees = candidate.committees;
87
+ this.candidate_committees = candidate.candidate_committees;
88
88
  this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file));
89
89
  }
90
90
  static is(candidate) {
91
91
  return (Candidate.is(candidate) &&
92
- Array.isArray(candidate.committees) &&
93
- candidate.committees.every(CommitteeAux.is) &&
92
+ Array.isArray(candidate.candidate_committees) &&
93
+ candidate.candidate_committees.every(CandidateCommitteeAux.is) &&
94
94
  Array.isArray(candidate.fec_f3_files) &&
95
95
  candidate.fec_f3_files.every(FECF3File.is));
96
96
  }
@@ -0,0 +1,13 @@
1
+ import { CommitteeAux } from "./Committee.js";
2
+ export declare class CandidateCommittee {
3
+ readonly candidate_id: string;
4
+ readonly committee_id: string;
5
+ [x: string]: any;
6
+ constructor(candidate_committee: CandidateCommittee);
7
+ static is(candidate_committee: any): candidate_committee is CandidateCommittee;
8
+ }
9
+ export declare class CandidateCommitteeAux extends CandidateCommittee {
10
+ readonly committee: CommitteeAux;
11
+ constructor(candidate_committee: any);
12
+ static is(candidate_committee: any): candidate_committee is CandidateCommitteeAux;
13
+ }
@@ -0,0 +1,31 @@
1
+ import { CommitteeAux } from "./Committee.js";
2
+ export class CandidateCommittee {
3
+ candidate_id;
4
+ committee_id;
5
+ constructor(candidate_committee) {
6
+ if (!CandidateCommittee.is(candidate_committee)) {
7
+ throw Error("Invalid input.");
8
+ }
9
+ this.candidate_id = candidate_committee.candidate_id;
10
+ this.committee_id = candidate_committee.committee_id;
11
+ }
12
+ static is(candidate_committee) {
13
+ return (candidate_committee !== undefined &&
14
+ typeof candidate_committee.candidate_id === "string" &&
15
+ typeof candidate_committee.committee_id === "string");
16
+ }
17
+ }
18
+ export class CandidateCommitteeAux extends CandidateCommittee {
19
+ committee;
20
+ constructor(candidate_committee) {
21
+ if (!CandidateCommitteeAux.is(candidate_committee)) {
22
+ throw Error("Invalid input.");
23
+ }
24
+ super(candidate_committee);
25
+ this.committee = candidate_committee.committee;
26
+ }
27
+ static is(candidate_committee) {
28
+ return (CandidateCommittee.is(candidate_committee) &&
29
+ CommitteeAux.is(candidate_committee.committee));
30
+ }
31
+ }
@@ -20,6 +20,7 @@ export interface ElectionsConfig extends ElectionsUtilsConfig {
20
20
  dynamodb_elections: string;
21
21
  dynamodb_candidates: string;
22
22
  dynamodb_committees: string;
23
+ dynamodb_candidate_committees: string;
23
24
  dynamodb_expenditures: string;
24
25
  dynamodb_users: string;
25
26
  dynamodb_user_elections: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.0.64",
3
+ "version": "1.0.65",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./types/APIError"
2
2
  export * from "./types/Article"
3
3
  export * from "./types/Candidate"
4
4
  export * from "./types/CandidateArticle"
5
+ export * from "./types/CandidateCommittee"
5
6
  export * from "./types/CandidateTweet"
6
7
  export * from "./types/CandidateVideo"
7
8
  export * from "./types/Committee"
@@ -1,3 +1,4 @@
1
+ import { CandidateCommitteeAux } from "./CandidateCommittee"
1
2
  import { Committee, CommitteeAux } from "./Committee"
2
3
  import { ElectionID, is_election_id, is_office_id, OfficeID } from "./Election"
3
4
  import { FECF24File } from "./FECF24File"
@@ -94,7 +95,7 @@ export class Candidate {
94
95
  }
95
96
 
96
97
  export class CandidateAux extends Candidate {
97
- readonly committees : CommitteeAux[]
98
+ readonly candidate_committees : CandidateCommitteeAux[]
98
99
  readonly fec_f3_files : FECF3File[]
99
100
 
100
101
  constructor(candidate : any) {
@@ -102,15 +103,15 @@ export class CandidateAux extends Candidate {
102
103
  throw Error("Invalid input.")
103
104
  }
104
105
  super(candidate)
105
- this.committees = candidate.committees
106
+ this.candidate_committees = candidate.candidate_committees
106
107
  this.fec_f3_files = candidate.fec_f3_files.map(fec_f3_file => new FECF3File(fec_f3_file))
107
108
  }
108
109
 
109
110
  static is(candidate : any) : candidate is CandidateAux {
110
111
  return (
111
112
  Candidate.is(candidate) &&
112
- Array.isArray(candidate.committees) &&
113
- candidate.committees.every(CommitteeAux.is) &&
113
+ Array.isArray(candidate.candidate_committees) &&
114
+ candidate.candidate_committees.every(CandidateCommitteeAux.is) &&
114
115
  Array.isArray(candidate.fec_f3_files) &&
115
116
  candidate.fec_f3_files.every(FECF3File.is)
116
117
  )
@@ -0,0 +1,42 @@
1
+ import { Committee, CommitteeAux } from "./Committee"
2
+
3
+ export class CandidateCommittee {
4
+ readonly candidate_id : string
5
+ readonly committee_id : string
6
+ [x : string] : any
7
+
8
+ constructor(candidate_committee : CandidateCommittee) {
9
+ if (!CandidateCommittee.is(candidate_committee)) {
10
+ throw Error("Invalid input.")
11
+ }
12
+ this.candidate_id = candidate_committee.candidate_id
13
+ this.committee_id = candidate_committee.committee_id
14
+ }
15
+
16
+ static is(candidate_committee : any) : candidate_committee is CandidateCommittee {
17
+ return (
18
+ candidate_committee !== undefined &&
19
+ typeof candidate_committee.candidate_id === "string" &&
20
+ typeof candidate_committee.committee_id === "string"
21
+ )
22
+ }
23
+ }
24
+
25
+ export class CandidateCommitteeAux extends CandidateCommittee {
26
+ readonly committee : CommitteeAux
27
+
28
+ constructor(candidate_committee : any) {
29
+ if (!CandidateCommitteeAux.is(candidate_committee)) {
30
+ throw Error("Invalid input.")
31
+ }
32
+ super(candidate_committee)
33
+ this.committee = candidate_committee.committee
34
+ }
35
+
36
+ static is(candidate_committee : any) : candidate_committee is CandidateCommitteeAux {
37
+ return (
38
+ CandidateCommittee.is(candidate_committee) &&
39
+ CommitteeAux.is(candidate_committee.committee)
40
+ )
41
+ }
42
+ }
@@ -22,6 +22,7 @@ export interface ElectionsConfig extends ElectionsUtilsConfig {
22
22
  dynamodb_elections : string,
23
23
  dynamodb_candidates : string,
24
24
  dynamodb_committees : string,
25
+ dynamodb_candidate_committees : string,
25
26
  dynamodb_expenditures : string,
26
27
  dynamodb_users : string,
27
28
  dynamodb_user_elections : string,