elections-types 1.1.29 → 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,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.29",
3
+ "version": "1.1.30",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
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
  }