elections-types 1.0.64 → 1.0.66
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 +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/types/CandidateCommittee.d.ts +7 -0
- package/dist/src/types/CandidateCommittee.js +32 -0
- package/dist/src/types/ElectionsConfig.d.ts +1 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/types/CandidateCommittee.ts +42 -0
- package/src/types/ElectionsConfig.ts +1 -0
package/dist/src/index.d.ts
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";
|
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";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class CandidateCommittee {
|
|
2
|
+
readonly candidate_id: string;
|
|
3
|
+
readonly committee_id: string;
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
constructor(candidate_committee: CandidateCommittee);
|
|
6
|
+
static is(candidate_committee: any): candidate_committee is CandidateCommittee;
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export class CandidateCommittee {
|
|
2
|
+
candidate_id;
|
|
3
|
+
committee_id;
|
|
4
|
+
constructor(candidate_committee) {
|
|
5
|
+
if (!CandidateCommittee.is(candidate_committee)) {
|
|
6
|
+
throw Error("Invalid input.");
|
|
7
|
+
}
|
|
8
|
+
this.candidate_id = candidate_committee.candidate_id;
|
|
9
|
+
this.committee_id = candidate_committee.committee_id;
|
|
10
|
+
}
|
|
11
|
+
static is(candidate_committee) {
|
|
12
|
+
return (candidate_committee !== undefined &&
|
|
13
|
+
typeof candidate_committee.candidate_id === "string" &&
|
|
14
|
+
typeof candidate_committee.committee_id === "string");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
// export class CandidateCommitteeAux extends CandidateCommittee {
|
|
18
|
+
// readonly committee : CommitteeAux
|
|
19
|
+
// constructor(candidate_committee : any) {
|
|
20
|
+
// if (!CandidateCommitteeAux.is(candidate_committee)) {
|
|
21
|
+
// throw Error("Invalid input.")
|
|
22
|
+
// }
|
|
23
|
+
// super(candidate_committee)
|
|
24
|
+
// this.committee = candidate_committee.committee
|
|
25
|
+
// }
|
|
26
|
+
// static is(candidate_committee : any) : candidate_committee is CandidateCommitteeAux {
|
|
27
|
+
// return (
|
|
28
|
+
// CandidateCommittee.is(candidate_committee) &&
|
|
29
|
+
// CommitteeAux.is(candidate_committee.committee)
|
|
30
|
+
// )
|
|
31
|
+
// }
|
|
32
|
+
// }
|
|
@@ -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
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"
|
|
@@ -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,
|