elections-types 1.0.42 → 1.0.44

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,4 +1,4 @@
1
- import { Committee } from "./Committee.js";
1
+ import { CommitteeAux } from "./Committee.js";
2
2
  import { ElectionID, OfficeID } from "./Election.js";
3
3
  import { FECReport } from "./FECReport.js";
4
4
  import { StateID } from "./State.js";
@@ -33,7 +33,7 @@ export declare class Candidate {
33
33
  static is(candidate: any): candidate is Candidate;
34
34
  }
35
35
  export declare class CandidateAux extends Candidate {
36
- readonly committees: Committee[];
36
+ readonly committees: CommitteeAux[];
37
37
  readonly fec_reports: FECReport[];
38
38
  constructor(candidate: any);
39
39
  static is(candidate: any): candidate is CandidateAux;
@@ -1,4 +1,4 @@
1
- import { Committee } from "./Committee.js";
1
+ import { CommitteeAux } from "./Committee.js";
2
2
  import { is_election_id, is_office_id } from "./Election.js";
3
3
  import { FECReport } from "./FECReport.js";
4
4
  import { is_state_id } from "./State.js";
@@ -99,7 +99,7 @@ export class CandidateAux extends Candidate {
99
99
  static is(candidate) {
100
100
  return (Candidate.is(candidate) &&
101
101
  Array.isArray(candidate.committees) &&
102
- candidate.committees.every(Committee.is) &&
102
+ candidate.committees.every(CommitteeAux.is) &&
103
103
  Array.isArray(candidate.fec_reports) &&
104
104
  candidate.fec_reports.every(FECReport.is));
105
105
  }
@@ -1,3 +1,4 @@
1
+ import { Article } from "./Article.js";
1
2
  export declare class CandidateArticle {
2
3
  readonly candidate_id: string;
3
4
  readonly article_id: string;
@@ -5,6 +6,12 @@ export declare class CandidateArticle {
5
6
  readonly fetch_time: string;
6
7
  readonly relevance_text?: string;
7
8
  readonly sentiment?: string;
9
+ [x: string]: any;
8
10
  constructor(candidate_article: any);
9
11
  static is(candidate_article: any): candidate_article is CandidateArticle;
10
12
  }
13
+ export declare class CandidateArticleAux extends CandidateArticle {
14
+ readonly article: Article;
15
+ constructor(candidate_article: any);
16
+ static is(candidate_article: any): candidate_article is CandidateArticleAux;
17
+ }
@@ -1,3 +1,4 @@
1
+ import { Article } from "./Article.js";
1
2
  export class CandidateArticle {
2
3
  candidate_id;
3
4
  article_id;
@@ -26,3 +27,17 @@ export class CandidateArticle {
26
27
  (candidate_article.sentiment === undefined || typeof candidate_article.sentiment === "string"));
27
28
  }
28
29
  }
30
+ export class CandidateArticleAux extends CandidateArticle {
31
+ article;
32
+ constructor(candidate_article) {
33
+ if (!CandidateArticleAux.is(candidate_article)) {
34
+ throw Error("Invalid input.");
35
+ }
36
+ super(candidate_article);
37
+ this.article = candidate_article.article;
38
+ }
39
+ static is(candidate_article) {
40
+ return (CandidateArticle.is(candidate_article) &&
41
+ Article.is(candidate_article.article));
42
+ }
43
+ }
@@ -1,3 +1,4 @@
1
+ import { Tweet } from "./Tweet.js";
1
2
  export declare class CandidateTweet {
2
3
  readonly candidate_id: string;
3
4
  readonly tweet_id: string;
@@ -5,6 +6,12 @@ export declare class CandidateTweet {
5
6
  readonly fetch_time: string;
6
7
  readonly relevance?: string;
7
8
  readonly sentiment?: string;
9
+ readonly [x: string]: any;
8
10
  constructor(candidate_tweet: any);
9
11
  static is(candidate_tweet: any): candidate_tweet is CandidateTweet;
10
12
  }
13
+ export declare class CandidateTweetAux extends CandidateTweet {
14
+ readonly tweet: Tweet;
15
+ constructor(candidate_tweet: any);
16
+ static is(candidate_tweet: any): candidate_tweet is CandidateTweetAux;
17
+ }
@@ -1,3 +1,4 @@
1
+ import { Tweet } from "./Tweet.js";
1
2
  export class CandidateTweet {
2
3
  candidate_id;
3
4
  tweet_id;
@@ -26,3 +27,17 @@ export class CandidateTweet {
26
27
  (candidate_tweet.sentiment === undefined || typeof candidate_tweet.sentiment === "string"));
27
28
  }
28
29
  }
30
+ export class CandidateTweetAux extends CandidateTweet {
31
+ tweet;
32
+ constructor(candidate_tweet) {
33
+ if (!CandidateTweetAux.is(candidate_tweet)) {
34
+ throw Error("Invalid input.");
35
+ }
36
+ super(candidate_tweet);
37
+ this.tweet = candidate_tweet.tweet;
38
+ }
39
+ static is(candidate_tweet) {
40
+ return (CandidateTweet.is(candidate_tweet) &&
41
+ Tweet.is(candidate_tweet.tweet));
42
+ }
43
+ }
@@ -1,9 +1,16 @@
1
+ import { Video } from "./Video.js";
1
2
  export declare class CandidateVideo {
2
3
  readonly candidate_id: string;
3
4
  readonly video_id: string;
4
5
  readonly title: string;
5
6
  readonly fetch_time: string;
6
7
  readonly relevance?: string;
8
+ readonly [x: string]: any;
7
9
  constructor(candidate_video: any);
8
10
  static is(candidate_video: any): candidate_video is CandidateVideo;
9
11
  }
12
+ export declare class CandidateVideoAux extends CandidateVideo {
13
+ readonly video: Video;
14
+ constructor(candidate_video: any);
15
+ static is(candidate_video: any): candidate_video is CandidateVideoAux;
16
+ }
@@ -1,3 +1,4 @@
1
+ import { Video } from "./Video.js";
1
2
  export class CandidateVideo {
2
3
  candidate_id;
3
4
  video_id;
@@ -23,3 +24,17 @@ export class CandidateVideo {
23
24
  (candidate_video.relevance === undefined || typeof candidate_video.relevance === "string"));
24
25
  }
25
26
  }
27
+ export class CandidateVideoAux extends CandidateVideo {
28
+ video;
29
+ constructor(candidate_video) {
30
+ if (!CandidateVideoAux.is(candidate_video)) {
31
+ throw Error("Invalid input.");
32
+ }
33
+ super(candidate_video);
34
+ this.video = candidate_video.video;
35
+ }
36
+ static is(candidate_video) {
37
+ return (CandidateVideo.is(candidate_video) &&
38
+ Video.is(candidate_video.video));
39
+ }
40
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -1,4 +1,4 @@
1
- import { Committee } from "./Committee"
1
+ import { Committee, CommitteeAux } from "./Committee"
2
2
  import { ElectionID, is_election_id, is_office_id, OfficeID } from "./Election"
3
3
  import { FECReport } from "./FECReport"
4
4
  import { is_state_id, StateID } from "./State"
@@ -101,7 +101,7 @@ export class Candidate {
101
101
  }
102
102
 
103
103
  export class CandidateAux extends Candidate {
104
- readonly committees : Committee[]
104
+ readonly committees : CommitteeAux[]
105
105
  readonly fec_reports : FECReport[]
106
106
 
107
107
  constructor(candidate : any) {
@@ -117,7 +117,7 @@ export class CandidateAux extends Candidate {
117
117
  return (
118
118
  Candidate.is(candidate) &&
119
119
  Array.isArray(candidate.committees) &&
120
- candidate.committees.every(Committee.is) &&
120
+ candidate.committees.every(CommitteeAux.is) &&
121
121
  Array.isArray(candidate.fec_reports) &&
122
122
  candidate.fec_reports.every(FECReport.is)
123
123
  )
@@ -1,3 +1,5 @@
1
+ import { Article } from "./Article"
2
+
1
3
  export class CandidateArticle {
2
4
  readonly candidate_id : string
3
5
  readonly article_id : string
@@ -5,6 +7,7 @@ export class CandidateArticle {
5
7
  readonly fetch_time : string
6
8
  readonly relevance_text? : string
7
9
  readonly sentiment? : string
10
+ [x : string] : any
8
11
 
9
12
  constructor(candidate_article : any) {
10
13
  if (!CandidateArticle.is(candidate_article)) {
@@ -29,4 +32,23 @@ export class CandidateArticle {
29
32
  (candidate_article.sentiment === undefined || typeof candidate_article.sentiment === "string")
30
33
  )
31
34
  }
35
+ }
36
+
37
+ export class CandidateArticleAux extends CandidateArticle {
38
+ readonly article : Article
39
+
40
+ constructor(candidate_article : any) {
41
+ if (!CandidateArticleAux.is(candidate_article)) {
42
+ throw Error("Invalid input.")
43
+ }
44
+ super(candidate_article)
45
+ this.article = candidate_article.article
46
+ }
47
+
48
+ static is(candidate_article : any) : candidate_article is CandidateArticleAux {
49
+ return (
50
+ CandidateArticle.is(candidate_article) &&
51
+ Article.is(candidate_article.article)
52
+ )
53
+ }
32
54
  }
@@ -1,3 +1,5 @@
1
+ import { Tweet } from "./Tweet"
2
+
1
3
  export class CandidateTweet {
2
4
  readonly candidate_id : string
3
5
  readonly tweet_id : string
@@ -5,6 +7,7 @@ export class CandidateTweet {
5
7
  readonly fetch_time : string
6
8
  readonly relevance? : string
7
9
  readonly sentiment? : string
10
+ readonly [x : string] : any
8
11
 
9
12
  constructor(candidate_tweet : any) {
10
13
  if (!CandidateTweet.is(candidate_tweet)) {
@@ -29,4 +32,23 @@ export class CandidateTweet {
29
32
  (candidate_tweet.sentiment === undefined || typeof candidate_tweet.sentiment === "string")
30
33
  )
31
34
  }
35
+ }
36
+
37
+ export class CandidateTweetAux extends CandidateTweet {
38
+ readonly tweet : Tweet
39
+
40
+ constructor(candidate_tweet : any) {
41
+ if (!CandidateTweetAux.is(candidate_tweet)) {
42
+ throw Error("Invalid input.")
43
+ }
44
+ super(candidate_tweet)
45
+ this.tweet = candidate_tweet.tweet
46
+ }
47
+
48
+ static is(candidate_tweet : any) : candidate_tweet is CandidateTweetAux {
49
+ return (
50
+ CandidateTweet.is(candidate_tweet) &&
51
+ Tweet.is(candidate_tweet.tweet)
52
+ )
53
+ }
32
54
  }
@@ -1,9 +1,12 @@
1
+ import { Video } from "./Video"
2
+
1
3
  export class CandidateVideo {
2
4
  readonly candidate_id : string
3
5
  readonly video_id : string
4
6
  readonly title : string
5
7
  readonly fetch_time : string
6
8
  readonly relevance? : string
9
+ readonly [x : string] : any
7
10
 
8
11
  constructor(candidate_video : any) {
9
12
  if (!CandidateVideo.is(candidate_video)) {
@@ -26,4 +29,23 @@ export class CandidateVideo {
26
29
  (candidate_video.relevance === undefined || typeof candidate_video.relevance === "string")
27
30
  )
28
31
  }
32
+ }
33
+
34
+ export class CandidateVideoAux extends CandidateVideo {
35
+ readonly video : Video
36
+
37
+ constructor(candidate_video : any) {
38
+ if (!CandidateVideoAux.is(candidate_video)) {
39
+ throw Error("Invalid input.")
40
+ }
41
+ super(candidate_video)
42
+ this.video = candidate_video.video
43
+ }
44
+
45
+ static is(candidate_video : any) : candidate_video is CandidateVideoAux {
46
+ return (
47
+ CandidateVideo.is(candidate_video) &&
48
+ Video.is(candidate_video.video)
49
+ )
50
+ }
29
51
  }