triangle-types 1.0.249 → 1.0.251
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,9 @@
|
|
|
1
|
+
import { BallotpediaPerson } from "../ballotpedia/BallotpediaPerson.js";
|
|
1
2
|
import { FederalCongressMember } from "../federal_congress/FederalCongressMember.js";
|
|
2
3
|
import { FederalElectionCandidate } from "../federal_elections/FederalElectionCandidate.js";
|
|
3
4
|
export declare class Scout {
|
|
4
5
|
readonly scout_id: string;
|
|
5
|
-
readonly
|
|
6
|
-
readonly ballotpedia_article_id?: string;
|
|
7
|
-
readonly wikipedia_article_id?: string;
|
|
6
|
+
readonly ballotpedia_person_id: number;
|
|
8
7
|
readonly s3_id_img?: string;
|
|
9
8
|
readonly [x: string]: any;
|
|
10
9
|
constructor(scout: any);
|
|
@@ -13,6 +12,7 @@ export declare class Scout {
|
|
|
13
12
|
export declare class ScoutAux extends Scout {
|
|
14
13
|
readonly federal_election_candidates: FederalElectionCandidate[];
|
|
15
14
|
readonly federal_congress_member?: FederalCongressMember;
|
|
15
|
+
readonly ballotpedia_person: BallotpediaPerson;
|
|
16
16
|
constructor(scout: any);
|
|
17
17
|
static is(scout: any): scout is ScoutAux;
|
|
18
18
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BallotpediaPerson } from "../ballotpedia/BallotpediaPerson.js";
|
|
1
2
|
import { FederalCongressMember } from "../federal_congress/FederalCongressMember.js";
|
|
2
3
|
import { FederalElectionCandidate } from "../federal_elections/FederalElectionCandidate.js";
|
|
3
4
|
// const scout_type_ids = ["I", "O"] as const
|
|
@@ -8,9 +9,9 @@ import { FederalElectionCandidate } from "../federal_elections/FederalElectionCa
|
|
|
8
9
|
export class Scout {
|
|
9
10
|
scout_id;
|
|
10
11
|
// readonly scout_type_id : ScoutTypeID
|
|
11
|
-
name
|
|
12
|
-
|
|
13
|
-
wikipedia_article_id
|
|
12
|
+
// readonly name? : string
|
|
13
|
+
ballotpedia_person_id;
|
|
14
|
+
// readonly wikipedia_article_id? : string
|
|
14
15
|
s3_id_img;
|
|
15
16
|
constructor(scout) {
|
|
16
17
|
if (!Scout.is(scout)) {
|
|
@@ -18,24 +19,25 @@ export class Scout {
|
|
|
18
19
|
}
|
|
19
20
|
this.scout_id = scout.scout_id;
|
|
20
21
|
// this.scout_type_id = scout.scout_type_id
|
|
21
|
-
this.name = scout.name
|
|
22
|
-
this.
|
|
23
|
-
this.wikipedia_article_id = scout.wikipedia_article_id
|
|
22
|
+
// this.name = scout.name
|
|
23
|
+
this.ballotpedia_person_id = scout.ballotpedia_person_id;
|
|
24
|
+
// this.wikipedia_article_id = scout.wikipedia_article_id
|
|
24
25
|
this.s3_id_img = scout.s3_id_img;
|
|
25
26
|
}
|
|
26
27
|
static is(scout) {
|
|
27
28
|
return (scout !== undefined &&
|
|
28
29
|
typeof scout.scout_id === "string" &&
|
|
29
30
|
// is_scout_type_id(scout.scout_type_id) &&
|
|
30
|
-
(scout.name === undefined || typeof scout.name === "string") &&
|
|
31
|
-
|
|
32
|
-
(scout.wikipedia_article_id === undefined || typeof scout.wikipedia_article_id === "string") &&
|
|
31
|
+
// (scout.name === undefined || typeof scout.name === "string") &&
|
|
32
|
+
typeof scout.ballotpedia_person_id === "string" &&
|
|
33
|
+
// (scout.wikipedia_article_id === undefined || typeof scout.wikipedia_article_id === "string") &&
|
|
33
34
|
(scout.s3_id_img === undefined || typeof scout.s3_id_img === "string"));
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
export class ScoutAux extends Scout {
|
|
37
38
|
federal_election_candidates;
|
|
38
39
|
federal_congress_member;
|
|
40
|
+
ballotpedia_person;
|
|
39
41
|
constructor(scout) {
|
|
40
42
|
if (!ScoutAux.is(scout)) {
|
|
41
43
|
throw Error("Invalid input.");
|
|
@@ -43,11 +45,13 @@ export class ScoutAux extends Scout {
|
|
|
43
45
|
super(scout);
|
|
44
46
|
this.federal_election_candidates = scout.federal_election_candidates;
|
|
45
47
|
this.federal_congress_member = scout.federal_congress_member;
|
|
48
|
+
this.ballotpedia_person = scout.ballotpedia_person;
|
|
46
49
|
}
|
|
47
50
|
static is(scout) {
|
|
48
51
|
return (Scout.is(scout) &&
|
|
49
52
|
Array.isArray(scout.federal_election_candidates) && scout.federal_election_candidates.every(FederalElectionCandidate.is) &&
|
|
50
|
-
(scout.federal_congress_member === undefined || FederalCongressMember.is(scout.federal_congress_member))
|
|
53
|
+
(scout.federal_congress_member === undefined || FederalCongressMember.is(scout.federal_congress_member)) &&
|
|
54
|
+
BallotpediaPerson.is(scout.ballotpedia_person));
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
// const scout_office_ids = ["USP", "USH", "USS", "STG", "STH", "STS"] as const
|
package/package.json
CHANGED
package/src/types/scout/Scout.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BallotpediaPerson } from "../ballotpedia/BallotpediaPerson"
|
|
1
2
|
import { FederalCongressMember } from "../federal_congress/FederalCongressMember"
|
|
2
3
|
import { FederalElectionCandidate } from "../federal_elections/FederalElectionCandidate"
|
|
3
4
|
import { DocumentTypeID, is_document_type_id } from "../fragments/Fragment"
|
|
@@ -14,9 +15,9 @@ import { StateID } from "../regions/State"
|
|
|
14
15
|
export class Scout {
|
|
15
16
|
readonly scout_id : string
|
|
16
17
|
// readonly scout_type_id : ScoutTypeID
|
|
17
|
-
readonly name? : string
|
|
18
|
-
readonly
|
|
19
|
-
readonly wikipedia_article_id? : string
|
|
18
|
+
// readonly name? : string
|
|
19
|
+
readonly ballotpedia_person_id : number
|
|
20
|
+
// readonly wikipedia_article_id? : string
|
|
20
21
|
readonly s3_id_img? : string
|
|
21
22
|
readonly [x : string] : any
|
|
22
23
|
|
|
@@ -26,9 +27,9 @@ export class Scout {
|
|
|
26
27
|
}
|
|
27
28
|
this.scout_id = scout.scout_id
|
|
28
29
|
// this.scout_type_id = scout.scout_type_id
|
|
29
|
-
this.name = scout.name
|
|
30
|
-
this.
|
|
31
|
-
this.wikipedia_article_id = scout.wikipedia_article_id
|
|
30
|
+
// this.name = scout.name
|
|
31
|
+
this.ballotpedia_person_id = scout.ballotpedia_person_id
|
|
32
|
+
// this.wikipedia_article_id = scout.wikipedia_article_id
|
|
32
33
|
this.s3_id_img = scout.s3_id_img
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -37,9 +38,9 @@ export class Scout {
|
|
|
37
38
|
scout !== undefined &&
|
|
38
39
|
typeof scout.scout_id === "string" &&
|
|
39
40
|
// is_scout_type_id(scout.scout_type_id) &&
|
|
40
|
-
(scout.name === undefined || typeof scout.name === "string") &&
|
|
41
|
-
|
|
42
|
-
(scout.wikipedia_article_id === undefined || typeof scout.wikipedia_article_id === "string") &&
|
|
41
|
+
// (scout.name === undefined || typeof scout.name === "string") &&
|
|
42
|
+
typeof scout.ballotpedia_person_id === "string" &&
|
|
43
|
+
// (scout.wikipedia_article_id === undefined || typeof scout.wikipedia_article_id === "string") &&
|
|
43
44
|
(scout.s3_id_img === undefined || typeof scout.s3_id_img === "string")
|
|
44
45
|
)
|
|
45
46
|
}
|
|
@@ -48,6 +49,7 @@ export class Scout {
|
|
|
48
49
|
export class ScoutAux extends Scout {
|
|
49
50
|
readonly federal_election_candidates : FederalElectionCandidate[]
|
|
50
51
|
readonly federal_congress_member? : FederalCongressMember
|
|
52
|
+
readonly ballotpedia_person : BallotpediaPerson
|
|
51
53
|
|
|
52
54
|
constructor(scout : any) {
|
|
53
55
|
if (!ScoutAux.is(scout)) {
|
|
@@ -56,13 +58,15 @@ export class ScoutAux extends Scout {
|
|
|
56
58
|
super(scout)
|
|
57
59
|
this.federal_election_candidates = scout.federal_election_candidates
|
|
58
60
|
this.federal_congress_member = scout.federal_congress_member
|
|
61
|
+
this.ballotpedia_person = scout.ballotpedia_person
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
static is(scout : any) : scout is ScoutAux {
|
|
62
65
|
return (
|
|
63
66
|
Scout.is(scout) &&
|
|
64
67
|
Array.isArray(scout.federal_election_candidates) && scout.federal_election_candidates.every(FederalElectionCandidate.is) &&
|
|
65
|
-
(scout.federal_congress_member === undefined || FederalCongressMember.is(scout.federal_congress_member))
|
|
68
|
+
(scout.federal_congress_member === undefined || FederalCongressMember.is(scout.federal_congress_member)) &&
|
|
69
|
+
BallotpediaPerson.is(scout.ballotpedia_person)
|
|
66
70
|
)
|
|
67
71
|
}
|
|
68
72
|
}
|