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