elections-types 1.1.28 → 1.1.30

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,6 +1,7 @@
1
1
  export declare class TwitterTweet {
2
2
  readonly twitter_tweet_id: string;
3
3
  readonly twitter_user_id: string;
4
+ readonly publish_time: string;
4
5
  readonly supreme_twitter_tweet_id: string;
5
6
  readonly draft_twitter_tweet_ids: string[];
6
7
  readonly community_id?: string;
@@ -1,6 +1,7 @@
1
1
  export class TwitterTweet {
2
2
  twitter_tweet_id;
3
3
  twitter_user_id;
4
+ publish_time;
4
5
  supreme_twitter_tweet_id;
5
6
  draft_twitter_tweet_ids;
6
7
  community_id;
@@ -21,6 +22,7 @@ export class TwitterTweet {
21
22
  }
22
23
  this.twitter_tweet_id = twitter_tweet.twitter_tweet_id;
23
24
  this.twitter_user_id = twitter_tweet.twitter_user_id;
25
+ this.publish_time = twitter_tweet.publish_time;
24
26
  this.supreme_twitter_tweet_id = twitter_tweet.supreme_twitter_tweet_id;
25
27
  this.draft_twitter_tweet_ids = twitter_tweet.draft_twitter_tweet_ids;
26
28
  this.community_id = twitter_tweet.community_id;
@@ -40,6 +42,7 @@ export class TwitterTweet {
40
42
  return (twitter_tweet !== undefined &&
41
43
  typeof twitter_tweet.twitter_tweet_id === "string" &&
42
44
  typeof twitter_tweet.twitter_user_id === "string" &&
45
+ typeof twitter_tweet.publish_time === "string" &&
43
46
  typeof twitter_tweet.supreme_twitter_tweet_id === "string" &&
44
47
  Array.isArray(twitter_tweet.draft_twitter_tweet_ids) && twitter_tweet.draft_twitter_tweet_ids.every((draft_twitter_tweet_id) => typeof draft_twitter_tweet_id === "string") &&
45
48
  (twitter_tweet.community_id === undefined || typeof twitter_tweet.community_id === "string") &&
@@ -1,10 +1,7 @@
1
- import { LongFormTypeID } from "./FormTypeID.js";
2
1
  export declare class User {
3
2
  readonly user_id: string;
4
- readonly admin: boolean;
5
- readonly premium: boolean;
6
3
  readonly email: string;
7
- readonly email_settings: Record<LongFormTypeID | "NEWS", number>;
4
+ readonly is_admin_elections: boolean;
8
5
  constructor(user: User);
9
6
  static is(user: any): user is User;
10
7
  }
@@ -1,28 +1,20 @@
1
- import { is_long_form_type_id } from "./FormTypeID.js";
2
1
  export class User {
3
2
  user_id;
4
- admin;
5
- premium;
6
3
  email;
7
- email_settings;
4
+ is_admin_elections;
8
5
  // readonly [x : string] : any
9
6
  constructor(user) {
10
7
  if (!User.is(user)) {
11
8
  throw Error("Invalid Input.");
12
9
  }
13
10
  this.user_id = user.user_id;
14
- this.admin = user.admin;
15
- this.premium = user.premium;
16
11
  this.email = user.email;
17
- this.email_settings = user.email_settings;
12
+ this.is_admin_elections = user.is_admin_elections;
18
13
  }
19
14
  static is(user) {
20
15
  return (user !== undefined &&
21
16
  typeof user.user_id === "string" &&
22
- typeof user.admin === "boolean" &&
23
- typeof user.premium === "boolean" &&
24
17
  typeof user.email === "string" &&
25
- typeof user.email_settings === "object" &&
26
- Object.entries(user.email_settings).every(([key, value]) => (is_long_form_type_id(key) || key === "NEWS") && typeof value === "number"));
18
+ typeof user.is_admin_elections === "boolean");
27
19
  }
28
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -1,6 +1,7 @@
1
1
  export class TwitterTweet {
2
2
  readonly twitter_tweet_id : string
3
3
  readonly twitter_user_id : string
4
+ readonly publish_time : string
4
5
  readonly supreme_twitter_tweet_id : string
5
6
  readonly draft_twitter_tweet_ids : string[]
6
7
  readonly community_id? : string
@@ -22,6 +23,7 @@ export class TwitterTweet {
22
23
  }
23
24
  this.twitter_tweet_id = twitter_tweet.twitter_tweet_id
24
25
  this.twitter_user_id = twitter_tweet.twitter_user_id
26
+ this.publish_time = twitter_tweet.publish_time
25
27
  this.supreme_twitter_tweet_id = twitter_tweet.supreme_twitter_tweet_id
26
28
  this.draft_twitter_tweet_ids = twitter_tweet.draft_twitter_tweet_ids
27
29
  this.community_id = twitter_tweet.community_id
@@ -43,6 +45,7 @@ export class TwitterTweet {
43
45
  twitter_tweet !== undefined &&
44
46
  typeof twitter_tweet.twitter_tweet_id === "string" &&
45
47
  typeof twitter_tweet.twitter_user_id === "string" &&
48
+ typeof twitter_tweet.publish_time === "string" &&
46
49
  typeof twitter_tweet.supreme_twitter_tweet_id === "string" &&
47
50
  Array.isArray(twitter_tweet.draft_twitter_tweet_ids) && twitter_tweet.draft_twitter_tweet_ids.every((draft_twitter_tweet_id : any) => typeof draft_twitter_tweet_id === "string") &&
48
51
  (twitter_tweet.community_id === undefined || typeof twitter_tweet.community_id === "string") &&
package/src/types/User.ts CHANGED
@@ -2,10 +2,8 @@ import { is_long_form_type_id, LongFormTypeID } from "./FormTypeID"
2
2
 
3
3
  export class User {
4
4
  readonly user_id : string
5
- readonly admin : boolean
6
- readonly premium : boolean
7
5
  readonly email : string
8
- readonly email_settings : Record<LongFormTypeID | "NEWS", number>
6
+ readonly is_admin_elections : boolean
9
7
  // readonly [x : string] : any
10
8
 
11
9
  constructor(user : User) {
@@ -13,21 +11,16 @@ export class User {
13
11
  throw Error("Invalid Input.")
14
12
  }
15
13
  this.user_id = user.user_id
16
- this.admin = user.admin
17
- this.premium = user.premium
18
14
  this.email = user.email
19
- this.email_settings = user.email_settings
15
+ this.is_admin_elections = user.is_admin_elections
20
16
  }
21
17
 
22
18
  static is(user : any) : user is User {
23
19
  return (
24
20
  user !== undefined &&
25
21
  typeof user.user_id === "string" &&
26
- typeof user.admin === "boolean" &&
27
- typeof user.premium === "boolean" &&
28
22
  typeof user.email === "string" &&
29
- typeof user.email_settings === "object" &&
30
- Object.entries(user.email_settings).every(([key, value]) => (is_long_form_type_id(key) || key === "NEWS") && typeof value === "number")
23
+ typeof user.is_admin_elections === "boolean"
31
24
  )
32
25
  }
33
26
  }