triangle-types 1.0.248 → 1.0.249

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,5 +1,8 @@
1
1
  export * from "./types/errors/TriangleAPIError.js";
2
2
  export * from "./types/application/ApplicationStage.js";
3
+ export * from "./types/ballotpedia/BallotpediaJurisdiction.js";
4
+ export * from "./types/ballotpedia/BallotpediaOffice.js";
5
+ export * from "./types/ballotpedia/BallotpediaPerson.js";
3
6
  export * from "./types/twitter/TwitterTweet.js";
4
7
  export * from "./types/twitter/TwitterUser.js";
5
8
  export * from "./types/twitter/TwitterUserTag.js";
package/dist/src/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  export * from "./types/errors/TriangleAPIError.js";
2
2
  export * from "./types/application/ApplicationStage.js";
3
+ export * from "./types/ballotpedia/BallotpediaJurisdiction.js";
4
+ export * from "./types/ballotpedia/BallotpediaOffice.js";
5
+ export * from "./types/ballotpedia/BallotpediaPerson.js";
3
6
  export * from "./types/twitter/TwitterTweet.js";
4
7
  export * from "./types/twitter/TwitterUser.js";
5
8
  export * from "./types/twitter/TwitterUserTag.js";
@@ -0,0 +1,9 @@
1
+ export declare class BallotpediaJurisdiction {
2
+ readonly ballotpedia_jurisdiction_id: number;
3
+ readonly name: string;
4
+ readonly jurisdiction_type_id: string;
5
+ readonly geo_id?: string;
6
+ readonly [x: string]: any;
7
+ constructor(ballotpedia_jurisdiction: any);
8
+ static is(ballotpedia_jurisdiction: any): ballotpedia_jurisdiction is BallotpediaJurisdiction;
9
+ }
@@ -0,0 +1,27 @@
1
+ // const ballotpedia_jurisdiction_type_ids = ["federal_congress_district", "municipality", "country", "county", "sub_county", "ju"] as const
2
+ // export type BallotpediaJurisdictionTypeID = typeof ballotpedia_jurisdiction_type_ids[number]
3
+ // export function is_ballotpedia_jurisdiction_type_id(ballotpedia_jurisdiction_type_id : any) : ballotpedia_jurisdiction_type_id is BallotpediaJurisdictionTypeID {
4
+ // return ballotpedia_jurisdiction_type_ids.includes(ballotpedia_jurisdiction_type_id)
5
+ // }
6
+ export class BallotpediaJurisdiction {
7
+ ballotpedia_jurisdiction_id;
8
+ name;
9
+ jurisdiction_type_id;
10
+ geo_id;
11
+ constructor(ballotpedia_jurisdiction) {
12
+ if (!BallotpediaJurisdiction.is(ballotpedia_jurisdiction)) {
13
+ throw Error("Invalid input.");
14
+ }
15
+ this.ballotpedia_jurisdiction_id = ballotpedia_jurisdiction.ballotpedia_jurisdiction_id;
16
+ this.name = ballotpedia_jurisdiction.name;
17
+ this.jurisdiction_type_id = ballotpedia_jurisdiction.jurisdiction_type_id;
18
+ this.jurisdiction_type_id = ballotpedia_jurisdiction.jurisdiction_type_id;
19
+ }
20
+ static is(ballotpedia_jurisdiction) {
21
+ return (ballotpedia_jurisdiction !== undefined &&
22
+ typeof ballotpedia_jurisdiction.ballotpedia_jurisdiction_id === "number" && !isNaN(ballotpedia_jurisdiction.ballotpedia_jurisdiction_id) &&
23
+ typeof ballotpedia_jurisdiction.name === "string" &&
24
+ typeof ballotpedia_jurisdiction.jurisdiction_type_id === "string" &&
25
+ (ballotpedia_jurisdiction.geo_id === undefined || typeof ballotpedia_jurisdiction.geo_id === "string"));
26
+ }
27
+ }
@@ -0,0 +1,15 @@
1
+ import { StateID } from "../regions/State.js";
2
+ declare const ballotpedia_office_type_ids: readonly ["F", "S", "L"];
3
+ export type BallotpediaOfficeTypeID = typeof ballotpedia_office_type_ids[number];
4
+ export declare function is_ballotpedia_office_type_id(ballotpedia_office_type_id: any): ballotpedia_office_type_id is BallotpediaOfficeTypeID;
5
+ export declare class BallotpediaOffice {
6
+ readonly ballotpedia_office_id: number;
7
+ readonly ballotpedia_jurisdiction_id: number;
8
+ readonly name: string;
9
+ readonly state_id?: StateID;
10
+ readonly office_type_id: BallotpediaOfficeTypeID;
11
+ readonly [x: string]: any;
12
+ constructor(ballotpedia_office: any);
13
+ static is(ballotpedia_office: any): ballotpedia_office is BallotpediaOffice;
14
+ }
15
+ export {};
@@ -0,0 +1,30 @@
1
+ import { is_state_id } from "../regions/State.js";
2
+ const ballotpedia_office_type_ids = ["F", "S", "L"];
3
+ export function is_ballotpedia_office_type_id(ballotpedia_office_type_id) {
4
+ return ballotpedia_office_type_ids.includes(ballotpedia_office_type_id);
5
+ }
6
+ export class BallotpediaOffice {
7
+ ballotpedia_office_id;
8
+ ballotpedia_jurisdiction_id;
9
+ name;
10
+ state_id;
11
+ office_type_id;
12
+ constructor(ballotpedia_office) {
13
+ if (!BallotpediaOffice.is(ballotpedia_office)) {
14
+ throw Error("Invalid input.");
15
+ }
16
+ this.ballotpedia_office_id = ballotpedia_office.ballotpedia_office_id;
17
+ this.ballotpedia_jurisdiction_id = ballotpedia_office.ballotpedia_jurisdiction_id;
18
+ this.name = ballotpedia_office.name;
19
+ this.state_id = ballotpedia_office.state_id;
20
+ this.office_type_id = ballotpedia_office.office_type_id;
21
+ }
22
+ static is(ballotpedia_office) {
23
+ return (ballotpedia_office !== undefined &&
24
+ typeof ballotpedia_office.ballotpedia_office_id === "number" && !isNaN(ballotpedia_office.ballotpedia_office_id) &&
25
+ typeof ballotpedia_office.ballotpedia_jurisdiction_id === "number" && !isNaN(ballotpedia_office.ballotpedia_jurisdiction_id) &&
26
+ typeof ballotpedia_office.name === "string" &&
27
+ (ballotpedia_office.state_id === undefined || is_state_id(ballotpedia_office.state_id)) &&
28
+ is_ballotpedia_office_type_id(ballotpedia_office.office_type_id));
29
+ }
30
+ }
@@ -0,0 +1,22 @@
1
+ export declare class BallotpediaPerson {
2
+ readonly ballotpedia_person_id: number;
3
+ readonly url: string;
4
+ readonly name: string;
5
+ readonly name_first: string;
6
+ readonly name_last: string;
7
+ readonly name_nick?: string;
8
+ readonly is_alive?: boolean;
9
+ readonly gender_id?: string;
10
+ readonly birth_date?: string;
11
+ readonly birth_city?: string;
12
+ readonly religion_id: string;
13
+ readonly profession_id?: string;
14
+ readonly contacts_json: string;
15
+ readonly campaigns_json: string;
16
+ readonly terms_json: string;
17
+ readonly education_json: string;
18
+ readonly military_json: string;
19
+ readonly [x: string]: any;
20
+ constructor(ballotpedia_person: any);
21
+ static is(ballotpedia_person: any): ballotpedia_person is BallotpediaPerson;
22
+ }
@@ -0,0 +1,60 @@
1
+ export class BallotpediaPerson {
2
+ ballotpedia_person_id;
3
+ url;
4
+ name;
5
+ name_first;
6
+ name_last;
7
+ name_nick;
8
+ is_alive;
9
+ gender_id;
10
+ birth_date;
11
+ birth_city;
12
+ religion_id;
13
+ profession_id;
14
+ contacts_json;
15
+ campaigns_json;
16
+ terms_json;
17
+ education_json;
18
+ military_json;
19
+ constructor(ballotpedia_person) {
20
+ if (!BallotpediaPerson.is(ballotpedia_person)) {
21
+ throw Error("Invalid input.");
22
+ }
23
+ this.ballotpedia_person_id = ballotpedia_person.ballotpedia_person_id;
24
+ this.url = ballotpedia_person.url;
25
+ this.name = ballotpedia_person.name;
26
+ this.name_first = ballotpedia_person.name_first;
27
+ this.name_last = ballotpedia_person.name_last;
28
+ this.name_nick = ballotpedia_person.name_nick;
29
+ this.is_alive = ballotpedia_person.is_alive;
30
+ this.gender_id = ballotpedia_person.gender_id;
31
+ this.birth_date = ballotpedia_person.birth_date;
32
+ this.birth_city = ballotpedia_person.birth_city;
33
+ this.religion_id = ballotpedia_person.religion_id;
34
+ this.profession_id = ballotpedia_person.profession_id;
35
+ this.contacts_json = ballotpedia_person.contacts_json;
36
+ this.campaigns_json = ballotpedia_person.campaigns_json;
37
+ this.terms_json = ballotpedia_person.terms_json;
38
+ this.education_json = ballotpedia_person.education_json;
39
+ this.military_json = ballotpedia_person.military_json;
40
+ }
41
+ static is(ballotpedia_person) {
42
+ return (ballotpedia_person !== undefined &&
43
+ typeof ballotpedia_person.ballotpedia_person_id === "number" && !isNaN(ballotpedia_person.ballotpedia_person_id) &&
44
+ typeof ballotpedia_person.url === "string" &&
45
+ typeof ballotpedia_person.name === "string" &&
46
+ typeof ballotpedia_person.name_first === "string" &&
47
+ typeof ballotpedia_person.name_last === "string" &&
48
+ (ballotpedia_person.name_nick === undefined || typeof ballotpedia_person.name_nick === "string") &&
49
+ (ballotpedia_person.is_alive === undefined || typeof ballotpedia_person.is_alive === "boolean") &&
50
+ (ballotpedia_person.gender_id === undefined || typeof ballotpedia_person.gender_id === "string") &&
51
+ (ballotpedia_person.birth_date === undefined || typeof ballotpedia_person.birth_date === "string") &&
52
+ (ballotpedia_person.birth_city === undefined || typeof ballotpedia_person.birth_city === "string") &&
53
+ (ballotpedia_person.religion_id === undefined || typeof ballotpedia_person.religion_id === "string") &&
54
+ (ballotpedia_person.profession_id === undefined || typeof ballotpedia_person.profession_id === "string") &&
55
+ typeof ballotpedia_person.contacts_json === "string" &&
56
+ typeof ballotpedia_person.terms_json === "string" &&
57
+ typeof ballotpedia_person.education_json === "string" &&
58
+ typeof ballotpedia_person.military_json === "string");
59
+ }
60
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.248",
3
+ "version": "1.0.249",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
@@ -26,7 +26,7 @@ export class BallotpediaJurisdiction {
26
26
  static is(ballotpedia_jurisdiction : any) : ballotpedia_jurisdiction is BallotpediaJurisdiction {
27
27
  return (
28
28
  ballotpedia_jurisdiction !== undefined &&
29
- typeof ballotpedia_jurisdiction.ballotpedia_jurisdiction_id === "number" &&
29
+ typeof ballotpedia_jurisdiction.ballotpedia_jurisdiction_id === "number" && !isNaN(ballotpedia_jurisdiction.ballotpedia_jurisdiction_id) &&
30
30
  typeof ballotpedia_jurisdiction.name === "string" &&
31
31
  typeof ballotpedia_jurisdiction.jurisdiction_type_id === "string" &&
32
32
  (ballotpedia_jurisdiction.geo_id === undefined || typeof ballotpedia_jurisdiction.geo_id === "string")
@@ -31,8 +31,8 @@ export class BallotpediaOffice {
31
31
  static is(ballotpedia_office : any) : ballotpedia_office is BallotpediaOffice {
32
32
  return (
33
33
  ballotpedia_office !== undefined &&
34
- typeof ballotpedia_office.ballotpedia_office_id === "number" &&
35
- typeof ballotpedia_office.ballotpedia_jurisdiction_id === "number" &&
34
+ typeof ballotpedia_office.ballotpedia_office_id === "number" && !isNaN(ballotpedia_office.ballotpedia_office_id) &&
35
+ typeof ballotpedia_office.ballotpedia_jurisdiction_id === "number" && !isNaN(ballotpedia_office.ballotpedia_jurisdiction_id) &&
36
36
  typeof ballotpedia_office.name === "string" &&
37
37
  (ballotpedia_office.state_id === undefined || is_state_id(ballotpedia_office.state_id)) &&
38
38
  is_ballotpedia_office_type_id(ballotpedia_office.office_type_id)
@@ -44,7 +44,7 @@ export class BallotpediaPerson {
44
44
  static is(ballotpedia_person : any) : ballotpedia_person is BallotpediaPerson {
45
45
  return (
46
46
  ballotpedia_person !== undefined &&
47
- typeof ballotpedia_person.ballotpedia_person_id === "number" &&
47
+ typeof ballotpedia_person.ballotpedia_person_id === "number" && !isNaN(ballotpedia_person.ballotpedia_person_id) &&
48
48
  typeof ballotpedia_person.url === "string" &&
49
49
  typeof ballotpedia_person.name === "string" &&
50
50
  typeof ballotpedia_person.name_first === "string" &&