elections-types 1.1.8 → 1.1.10
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/FederalElectionCandidate.d.ts +1 -0
- package/dist/src/types/FederalElectionCandidate.js +4 -1
- package/dist/src/types/TwitterTweet.d.ts +10 -0
- package/dist/src/types/TwitterTweet.js +27 -0
- package/dist/src/types/YoutubeVideo.d.ts +14 -0
- package/dist/src/types/YoutubeVideo.js +40 -0
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/types/FederalElectionCandidate.ts +4 -1
- package/src/types/YoutubeVideo.ts +44 -0
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export declare class FederalElectionCandidate {
|
|
|
26
26
|
readonly ballotpedia_data?: Record<string, any>;
|
|
27
27
|
readonly activity_index?: ActivityIndex;
|
|
28
28
|
readonly is_veteran?: string;
|
|
29
|
+
readonly url_veteran?: string;
|
|
29
30
|
[x: string]: any;
|
|
30
31
|
constructor(federal_election_candidate: FederalElectionCandidate);
|
|
31
32
|
static is(federal_election_candidate: any): federal_election_candidate is FederalElectionCandidate;
|
|
@@ -38,6 +38,7 @@ export class FederalElectionCandidate {
|
|
|
38
38
|
ballotpedia_data;
|
|
39
39
|
activity_index;
|
|
40
40
|
is_veteran;
|
|
41
|
+
url_veteran;
|
|
41
42
|
constructor(federal_election_candidate) {
|
|
42
43
|
if (!FederalElectionCandidate.is(federal_election_candidate)) {
|
|
43
44
|
throw Error("Invalid input.");
|
|
@@ -57,6 +58,7 @@ export class FederalElectionCandidate {
|
|
|
57
58
|
this.ballotpedia_data = federal_election_candidate.ballotpedia_data;
|
|
58
59
|
this.activity_index = federal_election_candidate.activity_index;
|
|
59
60
|
this.is_veteran = federal_election_candidate.is_veteran;
|
|
61
|
+
this.url_veteran = federal_election_candidate.url_veteran;
|
|
60
62
|
}
|
|
61
63
|
static is(federal_election_candidate) {
|
|
62
64
|
return (federal_election_candidate !== undefined &&
|
|
@@ -74,7 +76,8 @@ export class FederalElectionCandidate {
|
|
|
74
76
|
(federal_election_candidate.ballotpedia_url === undefined || typeof federal_election_candidate.ballotpedia_url === "string") &&
|
|
75
77
|
(federal_election_candidate.ballotpedia_data === undefined || typeof federal_election_candidate.ballotpedia_data === "object" && Object.keys(federal_election_candidate.ballotpedia_data).map((key) => typeof key === "string")) &&
|
|
76
78
|
(federal_election_candidate.activity_index === undefined || ActivityIndex.is(federal_election_candidate.activity_index)) &&
|
|
77
|
-
(federal_election_candidate.is_veteran === undefined || typeof federal_election_candidate.is_veteran === "string")
|
|
79
|
+
(federal_election_candidate.is_veteran === undefined || typeof federal_election_candidate.is_veteran === "string") &&
|
|
80
|
+
(federal_election_candidate.url_veteran === undefined || typeof federal_election_candidate.url_veteran === "string"));
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
83
|
export class FederalElectionCandidateAux extends FederalElectionCandidate {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class TwitterTweet {
|
|
2
|
+
readonly twitter_tweet_id: string;
|
|
3
|
+
readonly username: string;
|
|
4
|
+
readonly url: string;
|
|
5
|
+
readonly twitter_tweet_time: string;
|
|
6
|
+
readonly twitter_tweet_content?: string;
|
|
7
|
+
readonly html: string;
|
|
8
|
+
constructor(twitter_tweet: TwitterTweet);
|
|
9
|
+
static is(twitter_tweet: any): twitter_tweet is TwitterTweet;
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export class TwitterTweet {
|
|
2
|
+
twitter_tweet_id;
|
|
3
|
+
username;
|
|
4
|
+
url;
|
|
5
|
+
twitter_tweet_time;
|
|
6
|
+
twitter_tweet_content;
|
|
7
|
+
html;
|
|
8
|
+
constructor(twitter_tweet) {
|
|
9
|
+
if (!TwitterTweet.is(twitter_tweet)) {
|
|
10
|
+
throw Error("Invalid input.");
|
|
11
|
+
}
|
|
12
|
+
this.twitter_tweet_id = twitter_tweet.twitter_tweet_id;
|
|
13
|
+
this.username = twitter_tweet.username;
|
|
14
|
+
this.url = twitter_tweet.url;
|
|
15
|
+
this.twitter_tweet_time = twitter_tweet.twitter_tweet_time;
|
|
16
|
+
this.twitter_tweet_content = twitter_tweet.twitter_tweet_content;
|
|
17
|
+
this.html = twitter_tweet.html;
|
|
18
|
+
}
|
|
19
|
+
static is(twitter_tweet) {
|
|
20
|
+
return (twitter_tweet !== undefined &&
|
|
21
|
+
typeof twitter_tweet.twitter_tweet_id === "string" &&
|
|
22
|
+
typeof twitter_tweet.username === "string" &&
|
|
23
|
+
typeof twitter_tweet.url === "string" &&
|
|
24
|
+
typeof twitter_tweet.twitter_tweet_time === "string" &&
|
|
25
|
+
typeof twitter_tweet.html === "string");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class YoutubeVideo {
|
|
2
|
+
readonly youtube_video_id: string;
|
|
3
|
+
readonly publish_time: string;
|
|
4
|
+
readonly channel_id: string;
|
|
5
|
+
readonly channel_name: string;
|
|
6
|
+
readonly title: string;
|
|
7
|
+
readonly description: string;
|
|
8
|
+
readonly tags?: string[];
|
|
9
|
+
readonly duration?: number;
|
|
10
|
+
readonly fetch_time: string;
|
|
11
|
+
readonly s3_id?: string;
|
|
12
|
+
constructor(youtube_video: YoutubeVideo);
|
|
13
|
+
static is(youtube_video: any): youtube_video is YoutubeVideo;
|
|
14
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export class YoutubeVideo {
|
|
2
|
+
youtube_video_id;
|
|
3
|
+
publish_time;
|
|
4
|
+
channel_id;
|
|
5
|
+
channel_name;
|
|
6
|
+
title;
|
|
7
|
+
description;
|
|
8
|
+
tags;
|
|
9
|
+
duration;
|
|
10
|
+
fetch_time;
|
|
11
|
+
s3_id;
|
|
12
|
+
constructor(youtube_video) {
|
|
13
|
+
if (!YoutubeVideo.is(youtube_video)) {
|
|
14
|
+
throw Error("Invalid input.");
|
|
15
|
+
}
|
|
16
|
+
this.youtube_video_id = youtube_video.youtube_video_id;
|
|
17
|
+
this.publish_time = youtube_video.publish_time;
|
|
18
|
+
this.channel_id = youtube_video.channel_id;
|
|
19
|
+
this.channel_name = youtube_video.channel_name;
|
|
20
|
+
this.title = youtube_video.title;
|
|
21
|
+
this.description = youtube_video.description;
|
|
22
|
+
this.tags = youtube_video.tags;
|
|
23
|
+
this.duration = youtube_video.duration;
|
|
24
|
+
this.fetch_time = youtube_video.fetch_time;
|
|
25
|
+
this.s3_id = youtube_video.s3_id;
|
|
26
|
+
}
|
|
27
|
+
static is(youtube_video) {
|
|
28
|
+
return (youtube_video !== undefined &&
|
|
29
|
+
typeof youtube_video.youtube_video_id === "string" &&
|
|
30
|
+
typeof youtube_video.publish_time === "string" &&
|
|
31
|
+
typeof youtube_video.channel_id === "string" &&
|
|
32
|
+
typeof youtube_video.channel_name === "string" &&
|
|
33
|
+
typeof youtube_video.title === "string" &&
|
|
34
|
+
typeof youtube_video.description === "string" &&
|
|
35
|
+
(youtube_video.tags === undefined || Array.isArray(youtube_video.tags) && youtube_video.tags.map((tag) => typeof tag === "string")) &&
|
|
36
|
+
(youtube_video.duration === undefined || typeof youtube_video.duration === "number" && !isNaN(youtube_video.duration)) &&
|
|
37
|
+
typeof youtube_video.fetch_time === "string" &&
|
|
38
|
+
(youtube_video.s3_id === undefined || typeof youtube_video.s3_id === "string"));
|
|
39
|
+
}
|
|
40
|
+
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -44,6 +44,7 @@ export class FederalElectionCandidate {
|
|
|
44
44
|
readonly ballotpedia_data? : Record<string, any>
|
|
45
45
|
readonly activity_index? : ActivityIndex
|
|
46
46
|
readonly is_veteran? : string
|
|
47
|
+
readonly url_veteran? : string
|
|
47
48
|
// readonly urls? : string[]
|
|
48
49
|
// readonly previews? : string[]
|
|
49
50
|
[x : string] : any
|
|
@@ -68,6 +69,7 @@ export class FederalElectionCandidate {
|
|
|
68
69
|
this.ballotpedia_data = federal_election_candidate.ballotpedia_data
|
|
69
70
|
this.activity_index = federal_election_candidate.activity_index
|
|
70
71
|
this.is_veteran = federal_election_candidate.is_veteran
|
|
72
|
+
this.url_veteran = federal_election_candidate.url_veteran
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
static is(federal_election_candidate : any) : federal_election_candidate is FederalElectionCandidate {
|
|
@@ -87,7 +89,8 @@ export class FederalElectionCandidate {
|
|
|
87
89
|
(federal_election_candidate.ballotpedia_url === undefined || typeof federal_election_candidate.ballotpedia_url === "string") &&
|
|
88
90
|
(federal_election_candidate.ballotpedia_data === undefined || typeof federal_election_candidate.ballotpedia_data === "object" && Object.keys(federal_election_candidate.ballotpedia_data).map((key : any) => typeof key === "string")) &&
|
|
89
91
|
(federal_election_candidate.activity_index === undefined || ActivityIndex.is(federal_election_candidate.activity_index)) &&
|
|
90
|
-
(federal_election_candidate.is_veteran === undefined || typeof federal_election_candidate.is_veteran === "string")
|
|
92
|
+
(federal_election_candidate.is_veteran === undefined || typeof federal_election_candidate.is_veteran === "string") &&
|
|
93
|
+
(federal_election_candidate.url_veteran === undefined || typeof federal_election_candidate.url_veteran === "string")
|
|
91
94
|
)
|
|
92
95
|
}
|
|
93
96
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export class YoutubeVideo {
|
|
2
|
+
readonly youtube_video_id : string
|
|
3
|
+
readonly publish_time : string
|
|
4
|
+
readonly channel_id : string
|
|
5
|
+
readonly channel_name : string
|
|
6
|
+
readonly title : string
|
|
7
|
+
readonly description : string
|
|
8
|
+
readonly tags? : string[]
|
|
9
|
+
readonly duration? : number
|
|
10
|
+
readonly fetch_time : string
|
|
11
|
+
readonly s3_id? : string
|
|
12
|
+
|
|
13
|
+
constructor(youtube_video : YoutubeVideo) {
|
|
14
|
+
if (!YoutubeVideo.is(youtube_video)) {
|
|
15
|
+
throw Error("Invalid input.")
|
|
16
|
+
}
|
|
17
|
+
this.youtube_video_id = youtube_video.youtube_video_id
|
|
18
|
+
this.publish_time = youtube_video.publish_time
|
|
19
|
+
this.channel_id = youtube_video.channel_id
|
|
20
|
+
this.channel_name = youtube_video.channel_name
|
|
21
|
+
this.title = youtube_video.title
|
|
22
|
+
this.description = youtube_video.description
|
|
23
|
+
this.tags = youtube_video.tags
|
|
24
|
+
this.duration = youtube_video.duration
|
|
25
|
+
this.fetch_time = youtube_video.fetch_time
|
|
26
|
+
this.s3_id = youtube_video.s3_id
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static is(youtube_video : any) : youtube_video is YoutubeVideo {
|
|
30
|
+
return (
|
|
31
|
+
youtube_video !== undefined &&
|
|
32
|
+
typeof youtube_video.youtube_video_id === "string" &&
|
|
33
|
+
typeof youtube_video.publish_time === "string" &&
|
|
34
|
+
typeof youtube_video.channel_id === "string" &&
|
|
35
|
+
typeof youtube_video.channel_name === "string" &&
|
|
36
|
+
typeof youtube_video.title === "string" &&
|
|
37
|
+
typeof youtube_video.description === "string" &&
|
|
38
|
+
(youtube_video.tags === undefined || Array.isArray(youtube_video.tags) && youtube_video.tags.map((tag : any) => typeof tag === "string")) &&
|
|
39
|
+
(youtube_video.duration === undefined || typeof youtube_video.duration === "number" && !isNaN(youtube_video.duration)) &&
|
|
40
|
+
typeof youtube_video.fetch_time === "string" &&
|
|
41
|
+
(youtube_video.s3_id === undefined || typeof youtube_video.s3_id === "string")
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}
|