triangle-types 1.0.121 → 1.0.122
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.
- package/dist/src/types/federal_congress/FederalCongressMember.d.ts +1 -1
- package/dist/src/types/federal_congress/FederalCongressMember.js +3 -3
- package/dist/src/types/federal_elections/FederalElection.d.ts +1 -1
- package/dist/src/types/federal_elections/FederalElection.js +5 -5
- package/dist/src/types/federal_elections/FederalElectionCandidate.d.ts +1 -16
- package/dist/src/types/federal_elections/FederalElectionCandidate.js +25 -47
- package/dist/src/types/federal_elections/FederalElectionF24File.d.ts +1 -1
- package/dist/src/types/federal_elections/FederalElectionF24File.js +3 -3
- package/dist/src/types/federal_elections/FederalElectionF2File.d.ts +1 -1
- package/dist/src/types/federal_elections/FederalElectionF2File.js +3 -3
- package/dist/src/types/press/PressArticleTag.d.ts +1 -0
- package/dist/src/types/press/PressArticleTag.js +3 -0
- package/dist/src/types/scout/Scout.d.ts +0 -16
- package/dist/src/types/scout/Scout.js +35 -31
- package/package.json +1 -1
- package/src/types/federal_congress/FederalCongressMember.ts +3 -3
- package/src/types/federal_elections/FederalElection.ts +5 -5
- package/src/types/federal_elections/FederalElectionCandidate.ts +25 -51
- package/src/types/federal_elections/FederalElectionF24File.ts +3 -3
- package/src/types/federal_elections/FederalElectionF2File.ts +3 -3
- package/src/types/press/PressArticleTag.ts +3 -0
- package/src/types/scout/Scout.ts +35 -35
|
@@ -9,7 +9,7 @@ export declare class FederalCongressMember {
|
|
|
9
9
|
readonly birth_year: number;
|
|
10
10
|
readonly chamber_id: string;
|
|
11
11
|
readonly state_id: StateID;
|
|
12
|
-
readonly
|
|
12
|
+
readonly district_id?: number;
|
|
13
13
|
readonly is_incumbent: boolean;
|
|
14
14
|
readonly url?: string;
|
|
15
15
|
readonly url_image?: string;
|
|
@@ -9,7 +9,7 @@ export class FederalCongressMember {
|
|
|
9
9
|
birth_year;
|
|
10
10
|
chamber_id;
|
|
11
11
|
state_id;
|
|
12
|
-
|
|
12
|
+
district_id;
|
|
13
13
|
is_incumbent;
|
|
14
14
|
url;
|
|
15
15
|
url_image;
|
|
@@ -28,7 +28,7 @@ export class FederalCongressMember {
|
|
|
28
28
|
this.chamber_id = federal_congress_member.chamber_id;
|
|
29
29
|
this.state_id = federal_congress_member.state_id;
|
|
30
30
|
this.is_incumbent = federal_congress_member.is_incumbent;
|
|
31
|
-
this.
|
|
31
|
+
this.district_id = federal_congress_member.district_id;
|
|
32
32
|
this.url = federal_congress_member.url;
|
|
33
33
|
this.url_image = federal_congress_member.url_image;
|
|
34
34
|
this.federal_senate_member_id = federal_congress_member.federal_senate_member_id;
|
|
@@ -44,7 +44,7 @@ export class FederalCongressMember {
|
|
|
44
44
|
typeof federal_congress_member.birth_year === "number" && !isNaN(federal_congress_member.birth_year) &&
|
|
45
45
|
is_state_id(federal_congress_member.state_id) &&
|
|
46
46
|
typeof federal_congress_member.chamber_id === "string" &&
|
|
47
|
-
(federal_congress_member.
|
|
47
|
+
(federal_congress_member.district_id === undefined || typeof federal_congress_member.district_id === "number") &&
|
|
48
48
|
typeof federal_congress_member.is_incumbent === "boolean" &&
|
|
49
49
|
(federal_congress_member.url === undefined || typeof federal_congress_member.url === "string") &&
|
|
50
50
|
(federal_congress_member.url_image === undefined || typeof federal_congress_member.url_image === "string") &&
|
|
@@ -12,7 +12,7 @@ export declare class FederalElection {
|
|
|
12
12
|
readonly name: string;
|
|
13
13
|
readonly federal_election_office_id: FederalElectionOfficeID;
|
|
14
14
|
readonly state_id?: StateID;
|
|
15
|
-
readonly
|
|
15
|
+
readonly district_id?: number;
|
|
16
16
|
readonly [x: string]: any;
|
|
17
17
|
constructor(federal_election: FederalElection);
|
|
18
18
|
static is(federal_election: any): federal_election is FederalElection;
|
|
@@ -12,7 +12,7 @@ export function is_federal_election_id(federal_election_id) {
|
|
|
12
12
|
const year = Number(parts[0]);
|
|
13
13
|
const federal_election_office_id = parts[1];
|
|
14
14
|
const state_id = parts[2];
|
|
15
|
-
const
|
|
15
|
+
const district_id = Number(parts[3]);
|
|
16
16
|
if (!(Number.isInteger(year) && year > 1700 && year < 3000 && is_federal_election_office_id(federal_election_office_id))) {
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
@@ -31,7 +31,7 @@ export function is_federal_election_id(federal_election_id) {
|
|
|
31
31
|
if (!(state_ids_without_district.includes(state_id) && parts.length === 3 || parts.length === 4)) {
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
|
-
if (!Number.isInteger(
|
|
34
|
+
if (!Number.isInteger(district_id) && district_id < 100) {
|
|
35
35
|
return false;
|
|
36
36
|
}
|
|
37
37
|
return true;
|
|
@@ -41,7 +41,7 @@ export class FederalElection {
|
|
|
41
41
|
name;
|
|
42
42
|
federal_election_office_id;
|
|
43
43
|
state_id;
|
|
44
|
-
|
|
44
|
+
district_id;
|
|
45
45
|
constructor(federal_election) {
|
|
46
46
|
if (!FederalElection.is(federal_election)) {
|
|
47
47
|
throw Error("Invalid input.");
|
|
@@ -50,7 +50,7 @@ export class FederalElection {
|
|
|
50
50
|
this.name = federal_election.name;
|
|
51
51
|
this.federal_election_office_id = federal_election.federal_election_office_id;
|
|
52
52
|
this.state_id = federal_election.state_id;
|
|
53
|
-
this.
|
|
53
|
+
this.district_id = federal_election.district_id;
|
|
54
54
|
}
|
|
55
55
|
static is(federal_election) {
|
|
56
56
|
return (federal_election !== undefined &&
|
|
@@ -58,7 +58,7 @@ export class FederalElection {
|
|
|
58
58
|
typeof federal_election.name === "string" &&
|
|
59
59
|
is_federal_election_office_id(federal_election.federal_election_office_id) &&
|
|
60
60
|
(federal_election.state_id === undefined || is_state_id(federal_election.state_id)) &&
|
|
61
|
-
(federal_election.
|
|
61
|
+
(federal_election.district_id === undefined || typeof federal_election.district_id === "number"));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
export class FederalElectionAux extends FederalElection {
|
|
@@ -3,30 +3,15 @@ import { FederalElectionID, FederalElectionOfficeID } from "./FederalElection.js
|
|
|
3
3
|
import { FederalElectionFileExpenditureAux } from "./FederalElectionFileExpenditure.js";
|
|
4
4
|
import { FederalElectionF3File } from "./FederalElectionF3File.js";
|
|
5
5
|
import { StateID } from "../regions/State.js";
|
|
6
|
-
export declare class ActivityIndex {
|
|
7
|
-
readonly news_index: number;
|
|
8
|
-
readonly twitter_index: number;
|
|
9
|
-
readonly total_index: number;
|
|
10
|
-
constructor(activity_index: any);
|
|
11
|
-
static is(activity_index: any): activity_index is ActivityIndex;
|
|
12
|
-
}
|
|
13
6
|
export declare class FederalElectionCandidate {
|
|
14
7
|
readonly federal_election_candidate_id: string;
|
|
15
8
|
readonly name: string;
|
|
16
9
|
readonly federal_election_office_id: FederalElectionOfficeID;
|
|
17
10
|
readonly state_id: StateID;
|
|
18
|
-
readonly
|
|
11
|
+
readonly district_id?: number;
|
|
19
12
|
readonly federal_election_id: FederalElectionID;
|
|
20
13
|
readonly party_id?: string;
|
|
21
|
-
readonly is_active?: boolean;
|
|
22
|
-
readonly status?: string;
|
|
23
14
|
readonly federal_election_file_id?: number;
|
|
24
|
-
readonly ballotpedia_name?: string;
|
|
25
|
-
readonly ballotpedia_url?: string;
|
|
26
|
-
readonly ballotpedia_data?: Record<string, any>;
|
|
27
|
-
readonly activity_index?: ActivityIndex;
|
|
28
|
-
readonly is_veteran?: string;
|
|
29
|
-
readonly url_veteran?: string;
|
|
30
15
|
[x: string]: any;
|
|
31
16
|
constructor(federal_election_candidate: FederalElectionCandidate);
|
|
32
17
|
static is(federal_election_candidate: any): federal_election_candidate is FederalElectionCandidate;
|
|
@@ -3,42 +3,36 @@ import { is_federal_election_id, is_federal_election_office_id } from "./Federal
|
|
|
3
3
|
import { FederalElectionFileExpenditureAux } from "./FederalElectionFileExpenditure.js";
|
|
4
4
|
import { FederalElectionF3File } from "./FederalElectionF3File.js";
|
|
5
5
|
import { is_state_id } from "../regions/State.js";
|
|
6
|
-
export class ActivityIndex {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
// export class ActivityIndex {
|
|
7
|
+
// readonly news_index : number
|
|
8
|
+
// readonly twitter_index : number
|
|
9
|
+
// readonly total_index : number
|
|
10
|
+
// constructor(activity_index : any) {
|
|
11
|
+
// if (!ActivityIndex.is(activity_index)) {
|
|
12
|
+
// throw Error("Invalid input.")
|
|
13
|
+
// }
|
|
14
|
+
// this.news_index = activity_index.news_index
|
|
15
|
+
// this.twitter_index = activity_index.twitter_index
|
|
16
|
+
// this.total_index = activity_index.total_index
|
|
17
|
+
// }
|
|
18
|
+
// static is(activity_index : any) : activity_index is ActivityIndex {
|
|
19
|
+
// return (
|
|
20
|
+
// activity_index !== undefined &&
|
|
21
|
+
// typeof activity_index.news_index === "number" &&
|
|
22
|
+
// typeof activity_index.twitter_index === "number" &&
|
|
23
|
+
// typeof activity_index.total_index === "number"
|
|
24
|
+
// )
|
|
25
|
+
// }
|
|
26
|
+
// }
|
|
25
27
|
export class FederalElectionCandidate {
|
|
26
28
|
federal_election_candidate_id;
|
|
27
29
|
name;
|
|
28
30
|
federal_election_office_id;
|
|
29
31
|
state_id;
|
|
30
|
-
|
|
32
|
+
district_id;
|
|
31
33
|
federal_election_id;
|
|
32
34
|
party_id;
|
|
33
|
-
is_active;
|
|
34
|
-
status;
|
|
35
35
|
federal_election_file_id;
|
|
36
|
-
ballotpedia_name;
|
|
37
|
-
ballotpedia_url;
|
|
38
|
-
ballotpedia_data;
|
|
39
|
-
activity_index;
|
|
40
|
-
is_veteran;
|
|
41
|
-
url_veteran;
|
|
42
36
|
constructor(federal_election_candidate) {
|
|
43
37
|
if (!FederalElectionCandidate.is(federal_election_candidate)) {
|
|
44
38
|
throw Error("Invalid input.");
|
|
@@ -47,18 +41,10 @@ export class FederalElectionCandidate {
|
|
|
47
41
|
this.name = federal_election_candidate.name;
|
|
48
42
|
this.federal_election_office_id = federal_election_candidate.federal_election_office_id;
|
|
49
43
|
this.state_id = federal_election_candidate.state_id;
|
|
50
|
-
this.
|
|
44
|
+
this.district_id = federal_election_candidate.district_id;
|
|
51
45
|
this.federal_election_id = federal_election_candidate.federal_election_id;
|
|
52
46
|
this.party_id = federal_election_candidate.party_id;
|
|
53
|
-
this.is_active = federal_election_candidate.is_active;
|
|
54
|
-
this.status = federal_election_candidate.status;
|
|
55
47
|
this.federal_election_file_id = federal_election_candidate.federal_election_file_id;
|
|
56
|
-
this.ballotpedia_name = federal_election_candidate.ballotpedia_name;
|
|
57
|
-
this.ballotpedia_url = federal_election_candidate.ballotpedia_url;
|
|
58
|
-
this.ballotpedia_data = federal_election_candidate.ballotpedia_data;
|
|
59
|
-
this.activity_index = federal_election_candidate.activity_index;
|
|
60
|
-
this.is_veteran = federal_election_candidate.is_veteran;
|
|
61
|
-
this.url_veteran = federal_election_candidate.url_veteran;
|
|
62
48
|
}
|
|
63
49
|
static is(federal_election_candidate) {
|
|
64
50
|
return (federal_election_candidate !== undefined &&
|
|
@@ -66,18 +52,10 @@ export class FederalElectionCandidate {
|
|
|
66
52
|
typeof federal_election_candidate.name === "string" &&
|
|
67
53
|
is_federal_election_office_id(federal_election_candidate.federal_election_office_id) &&
|
|
68
54
|
is_state_id(federal_election_candidate.state_id) &&
|
|
69
|
-
(federal_election_candidate.
|
|
55
|
+
(federal_election_candidate.district_id === undefined || typeof federal_election_candidate.district_id === "number") &&
|
|
70
56
|
is_federal_election_id(federal_election_candidate.federal_election_id) &&
|
|
71
57
|
(federal_election_candidate.party_id === undefined || typeof federal_election_candidate.party_id === "string") &&
|
|
72
|
-
(federal_election_candidate.
|
|
73
|
-
(federal_election_candidate.status === undefined || typeof federal_election_candidate.status === "string") &&
|
|
74
|
-
(federal_election_candidate.federal_election_file_id === undefined || typeof federal_election_candidate.federal_election_file_id === "number" && !isNaN(federal_election_candidate.federal_election_file_id)) &&
|
|
75
|
-
(federal_election_candidate.ballotpedia_name === undefined || typeof federal_election_candidate.ballotpedia_name === "string") &&
|
|
76
|
-
(federal_election_candidate.ballotpedia_url === undefined || typeof federal_election_candidate.ballotpedia_url === "string") &&
|
|
77
|
-
(federal_election_candidate.ballotpedia_data === undefined || typeof federal_election_candidate.ballotpedia_data === "object" && Object.keys(federal_election_candidate.ballotpedia_data).map((key) => typeof key === "string")) &&
|
|
78
|
-
(federal_election_candidate.activity_index === undefined || ActivityIndex.is(federal_election_candidate.activity_index)) &&
|
|
79
|
-
(federal_election_candidate.is_veteran === undefined || typeof federal_election_candidate.is_veteran === "string") &&
|
|
80
|
-
(federal_election_candidate.url_veteran === undefined || typeof federal_election_candidate.url_veteran === "string"));
|
|
58
|
+
(federal_election_candidate.federal_election_file_id === undefined || typeof federal_election_candidate.federal_election_file_id === "number" && !isNaN(federal_election_candidate.federal_election_file_id)));
|
|
81
59
|
}
|
|
82
60
|
}
|
|
83
61
|
export class FederalElectionCandidateAux extends FederalElectionCandidate {
|
|
@@ -3,7 +3,7 @@ import { FederalElectionFile } from "./FederalElectionFile.js";
|
|
|
3
3
|
export declare class FederalElectionF24File extends FederalElectionFile {
|
|
4
4
|
readonly federal_election_committee_id: string;
|
|
5
5
|
readonly first_federal_election_file_id: number;
|
|
6
|
-
readonly
|
|
6
|
+
readonly f24_report_type_id: string;
|
|
7
7
|
readonly first_report_date: string;
|
|
8
8
|
readonly report_date: string;
|
|
9
9
|
readonly expenditures: FederalElectionFileExpenditure[];
|
|
@@ -3,7 +3,7 @@ import { FederalElectionFile } from "./FederalElectionFile.js";
|
|
|
3
3
|
export class FederalElectionF24File extends FederalElectionFile {
|
|
4
4
|
federal_election_committee_id;
|
|
5
5
|
first_federal_election_file_id;
|
|
6
|
-
|
|
6
|
+
f24_report_type_id;
|
|
7
7
|
first_report_date;
|
|
8
8
|
report_date;
|
|
9
9
|
expenditures;
|
|
@@ -14,7 +14,7 @@ export class FederalElectionF24File extends FederalElectionFile {
|
|
|
14
14
|
super(federal_election_file);
|
|
15
15
|
this.federal_election_committee_id = federal_election_file.federal_election_committee_id;
|
|
16
16
|
this.first_federal_election_file_id = federal_election_file.first_federal_election_file_id;
|
|
17
|
-
this.
|
|
17
|
+
this.f24_report_type_id = federal_election_file.f24_report_type_id;
|
|
18
18
|
this.first_report_date = federal_election_file.first_report_date;
|
|
19
19
|
this.report_date = federal_election_file.report_date;
|
|
20
20
|
this.expenditures = federal_election_file.expenditures;
|
|
@@ -24,7 +24,7 @@ export class FederalElectionF24File extends FederalElectionFile {
|
|
|
24
24
|
federal_election_file.form_type_id === "F24" &&
|
|
25
25
|
typeof federal_election_file.federal_election_committee_id === "string" &&
|
|
26
26
|
typeof federal_election_file.first_federal_election_file_id === "number" &&
|
|
27
|
-
typeof federal_election_file.
|
|
27
|
+
typeof federal_election_file.f24_report_type_id === "string" &&
|
|
28
28
|
typeof federal_election_file.first_report_date === "string" &&
|
|
29
29
|
typeof federal_election_file.report_date === "string" &&
|
|
30
30
|
Array.isArray(federal_election_file.expenditures) && federal_election_file.expenditures.every(FederalElectionFileExpenditure.is));
|
|
@@ -6,7 +6,7 @@ export declare class FederalElectionF2File extends FederalElectionFile {
|
|
|
6
6
|
readonly name: string;
|
|
7
7
|
readonly federal_election_office_id: FederalElectionOfficeID;
|
|
8
8
|
readonly state_id: StateID;
|
|
9
|
-
readonly
|
|
9
|
+
readonly district_id?: number;
|
|
10
10
|
readonly federal_election_id: FederalElectionID;
|
|
11
11
|
readonly party_id?: string;
|
|
12
12
|
readonly report_date: string;
|
|
@@ -6,7 +6,7 @@ export class FederalElectionF2File extends FederalElectionFile {
|
|
|
6
6
|
name;
|
|
7
7
|
federal_election_office_id;
|
|
8
8
|
state_id;
|
|
9
|
-
|
|
9
|
+
district_id;
|
|
10
10
|
federal_election_id;
|
|
11
11
|
party_id;
|
|
12
12
|
report_date;
|
|
@@ -19,7 +19,7 @@ export class FederalElectionF2File extends FederalElectionFile {
|
|
|
19
19
|
this.name = federal_election_file.name;
|
|
20
20
|
this.federal_election_office_id = federal_election_file.federal_election_office_id;
|
|
21
21
|
this.state_id = federal_election_file.state_id;
|
|
22
|
-
this.
|
|
22
|
+
this.district_id = federal_election_file.district_id;
|
|
23
23
|
this.federal_election_id = federal_election_file.federal_election_id;
|
|
24
24
|
this.party_id = federal_election_file.party_id;
|
|
25
25
|
this.report_date = federal_election_file.report_date;
|
|
@@ -31,7 +31,7 @@ export class FederalElectionF2File extends FederalElectionFile {
|
|
|
31
31
|
typeof federal_election_file.name === "string" &&
|
|
32
32
|
is_federal_election_office_id(federal_election_file.federal_election_office_id) &&
|
|
33
33
|
is_state_id(federal_election_file.state_id) &&
|
|
34
|
-
(federal_election_file.
|
|
34
|
+
(federal_election_file.district_id === undefined || typeof federal_election_file.district_id === "number") &&
|
|
35
35
|
is_federal_election_id(federal_election_file.federal_election_id) &&
|
|
36
36
|
(federal_election_file.party_id === undefined || typeof federal_election_file.party_id === "string") &&
|
|
37
37
|
typeof federal_election_file.report_date === "string");
|
|
@@ -3,6 +3,7 @@ export class PressArticleTag {
|
|
|
3
3
|
press_article_id;
|
|
4
4
|
tag_id;
|
|
5
5
|
publish_date;
|
|
6
|
+
url;
|
|
6
7
|
relevance;
|
|
7
8
|
sentiment;
|
|
8
9
|
constructor(press_article_tag) {
|
|
@@ -12,6 +13,7 @@ export class PressArticleTag {
|
|
|
12
13
|
this.press_article_id = press_article_tag.press_article_id;
|
|
13
14
|
this.tag_id = press_article_tag.tag_id;
|
|
14
15
|
this.publish_date = press_article_tag.publish_date;
|
|
16
|
+
this.url = press_article_tag.url;
|
|
15
17
|
this.relevance = press_article_tag.relevance;
|
|
16
18
|
this.sentiment = press_article_tag.sentiment;
|
|
17
19
|
}
|
|
@@ -20,6 +22,7 @@ export class PressArticleTag {
|
|
|
20
22
|
typeof press_article_tag.press_article_id === "string" &&
|
|
21
23
|
typeof press_article_tag.tag_id === "string" &&
|
|
22
24
|
typeof press_article_tag.publish_date === "string" &&
|
|
25
|
+
typeof press_article_tag.url === "string" &&
|
|
23
26
|
(press_article_tag.relevance === undefined || typeof press_article_tag.relevance === "string") &&
|
|
24
27
|
(press_article_tag.sentiment === undefined || typeof press_article_tag.sentiment === "string"));
|
|
25
28
|
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { DocumentTypeID } from "../fragments/Fragment.js";
|
|
2
|
-
import { StateID } from "../regions/State.js";
|
|
3
|
-
declare const scout_type_ids: readonly ["I", "O"];
|
|
4
|
-
export type ScoutTypeID = typeof scout_type_ids[number];
|
|
5
|
-
export declare function is_scout_type_id(scout_type_id: any): scout_type_id is ScoutTypeID;
|
|
6
2
|
export declare class Scout {
|
|
7
3
|
readonly scout_id: string;
|
|
8
|
-
readonly scout_type_id: ScoutTypeID;
|
|
9
4
|
readonly name: string;
|
|
10
5
|
readonly s3_id_img?: string;
|
|
11
6
|
readonly document_type_ids: DocumentTypeID[];
|
|
@@ -19,14 +14,3 @@ export declare class ScoutAux extends Scout {
|
|
|
19
14
|
constructor(scout: any);
|
|
20
15
|
static is(scout: any): scout is ScoutAux;
|
|
21
16
|
}
|
|
22
|
-
declare const scout_office_ids: readonly ["USP", "USH", "USS", "STG", "STH", "STS"];
|
|
23
|
-
export type ScoutOfficeID = typeof scout_office_ids[number];
|
|
24
|
-
export declare function is_scout_office_id(scout_office_id: any): scout_office_id is ScoutOfficeID;
|
|
25
|
-
export declare class IndividualScout extends Scout {
|
|
26
|
-
readonly office_id: ScoutOfficeID;
|
|
27
|
-
readonly state_id?: StateID;
|
|
28
|
-
readonly district?: number;
|
|
29
|
-
constructor(scout: any);
|
|
30
|
-
static is(scout: any): scout is IndividualScout;
|
|
31
|
-
}
|
|
32
|
-
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { is_document_type_id } from "../fragments/Fragment.js";
|
|
2
|
-
const scout_type_ids = ["I", "O"]
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
// const scout_type_ids = ["I", "O"] as const
|
|
3
|
+
// export type ScoutTypeID = typeof scout_type_ids[number]
|
|
4
|
+
// export function is_scout_type_id(scout_type_id : any) : scout_type_id is ScoutTypeID {
|
|
5
|
+
// return scout_type_ids.includes(scout_type_id)
|
|
6
|
+
// }
|
|
6
7
|
export class Scout {
|
|
7
8
|
scout_id;
|
|
8
|
-
scout_type_id
|
|
9
|
+
// readonly scout_type_id : ScoutTypeID
|
|
9
10
|
name;
|
|
10
11
|
s3_id_img;
|
|
11
12
|
document_type_ids;
|
|
@@ -14,7 +15,7 @@ export class Scout {
|
|
|
14
15
|
throw Error("Invalid input.");
|
|
15
16
|
}
|
|
16
17
|
this.scout_id = scout.scout_id;
|
|
17
|
-
this.scout_type_id = scout.scout_type_id
|
|
18
|
+
// this.scout_type_id = scout.scout_type_id
|
|
18
19
|
this.name = scout.name;
|
|
19
20
|
this.s3_id_img = scout.s3_id_img;
|
|
20
21
|
this.document_type_ids = scout.document_type_ids;
|
|
@@ -22,7 +23,7 @@ export class Scout {
|
|
|
22
23
|
static is(scout) {
|
|
23
24
|
return (scout !== undefined &&
|
|
24
25
|
typeof scout.scout_id === "string" &&
|
|
25
|
-
is_scout_type_id(scout.scout_type_id) &&
|
|
26
|
+
// is_scout_type_id(scout.scout_type_id) &&
|
|
26
27
|
typeof scout.name === "string" &&
|
|
27
28
|
(scout.s3_id_img === undefined || typeof scout.s3_id_img === "string") &&
|
|
28
29
|
Array.isArray(scout.document_type_ids) && scout.document_type_ids.every(is_document_type_id));
|
|
@@ -45,27 +46,30 @@ export class ScoutAux extends Scout {
|
|
|
45
46
|
(scout.s3_url_img === undefined || typeof scout.s3_url_img === "string"));
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
const scout_office_ids = ["USP", "USH", "USS", "STG", "STH", "STS"]
|
|
49
|
-
export
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
49
|
+
// const scout_office_ids = ["USP", "USH", "USS", "STG", "STH", "STS"] as const
|
|
50
|
+
// export type ScoutOfficeID = typeof scout_office_ids[number]
|
|
51
|
+
// export function is_scout_office_id(scout_office_id : any) : scout_office_id is ScoutOfficeID {
|
|
52
|
+
// return scout_office_ids.includes(scout_office_id)
|
|
53
|
+
// }
|
|
54
|
+
// export class IndividualScout extends Scout {
|
|
55
|
+
// readonly office_id : ScoutOfficeID
|
|
56
|
+
// readonly state_id? : StateID
|
|
57
|
+
// readonly district? : number
|
|
58
|
+
// constructor(scout : any) {
|
|
59
|
+
// if (!IndividualScout.is(scout)) {
|
|
60
|
+
// throw Error("Invalid input.")
|
|
61
|
+
// }
|
|
62
|
+
// super(scout)
|
|
63
|
+
// this.office_id = scout.office_id
|
|
64
|
+
// this.state_id = scout.state_id
|
|
65
|
+
// this.district = scout.district
|
|
66
|
+
// }
|
|
67
|
+
// static is(scout : any) : scout is IndividualScout {
|
|
68
|
+
// return (
|
|
69
|
+
// Scout.is(scout) &&
|
|
70
|
+
// is_scout_office_id(scout.office_id) &&
|
|
71
|
+
// (scout.state_id === undefined || typeof scout.state_id === "string") &&
|
|
72
|
+
// (scout.district === undefined || typeof scout.district === "number")
|
|
73
|
+
// )
|
|
74
|
+
// }
|
|
75
|
+
// }
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ export class FederalCongressMember {
|
|
|
10
10
|
readonly birth_year : number
|
|
11
11
|
readonly chamber_id : string
|
|
12
12
|
readonly state_id : StateID
|
|
13
|
-
readonly
|
|
13
|
+
readonly district_id? : number
|
|
14
14
|
readonly is_incumbent : boolean
|
|
15
15
|
readonly url? : string
|
|
16
16
|
readonly url_image? : string
|
|
@@ -31,7 +31,7 @@ export class FederalCongressMember {
|
|
|
31
31
|
this.chamber_id = federal_congress_member.chamber_id
|
|
32
32
|
this.state_id = federal_congress_member.state_id
|
|
33
33
|
this.is_incumbent = federal_congress_member.is_incumbent
|
|
34
|
-
this.
|
|
34
|
+
this.district_id = federal_congress_member.district_id
|
|
35
35
|
this.url = federal_congress_member.url
|
|
36
36
|
this.url_image = federal_congress_member.url_image
|
|
37
37
|
this.federal_senate_member_id = federal_congress_member.federal_senate_member_id
|
|
@@ -49,7 +49,7 @@ export class FederalCongressMember {
|
|
|
49
49
|
typeof federal_congress_member.birth_year === "number" && !isNaN(federal_congress_member.birth_year) &&
|
|
50
50
|
is_state_id(federal_congress_member.state_id) &&
|
|
51
51
|
typeof federal_congress_member.chamber_id === "string" &&
|
|
52
|
-
(federal_congress_member.
|
|
52
|
+
(federal_congress_member.district_id === undefined || typeof federal_congress_member.district_id === "number") &&
|
|
53
53
|
typeof federal_congress_member.is_incumbent === "boolean" &&
|
|
54
54
|
(federal_congress_member.url === undefined || typeof federal_congress_member.url === "string") &&
|
|
55
55
|
(federal_congress_member.url_image === undefined || typeof federal_congress_member.url_image === "string") &&
|
|
@@ -20,7 +20,7 @@ export function is_federal_election_id(federal_election_id : any) : federal_elec
|
|
|
20
20
|
const year = Number(parts[0])
|
|
21
21
|
const federal_election_office_id = parts[1]
|
|
22
22
|
const state_id = parts[2]
|
|
23
|
-
const
|
|
23
|
+
const district_id = Number(parts[3])
|
|
24
24
|
if (!(Number.isInteger(year) && year > 1700 && year < 3000 && is_federal_election_office_id(federal_election_office_id))) {
|
|
25
25
|
return false
|
|
26
26
|
}
|
|
@@ -39,7 +39,7 @@ export function is_federal_election_id(federal_election_id : any) : federal_elec
|
|
|
39
39
|
if (!(state_ids_without_district.includes(state_id) && parts.length === 3 || parts.length === 4)) {
|
|
40
40
|
return false
|
|
41
41
|
}
|
|
42
|
-
if (!Number.isInteger(
|
|
42
|
+
if (!Number.isInteger(district_id) && district_id < 100) {
|
|
43
43
|
return false
|
|
44
44
|
}
|
|
45
45
|
return true
|
|
@@ -50,7 +50,7 @@ export class FederalElection {
|
|
|
50
50
|
readonly name : string
|
|
51
51
|
readonly federal_election_office_id : FederalElectionOfficeID
|
|
52
52
|
readonly state_id? : StateID
|
|
53
|
-
readonly
|
|
53
|
+
readonly district_id? : number
|
|
54
54
|
readonly [x : string] : any
|
|
55
55
|
|
|
56
56
|
constructor(federal_election : FederalElection) {
|
|
@@ -61,7 +61,7 @@ export class FederalElection {
|
|
|
61
61
|
this.name = federal_election.name
|
|
62
62
|
this.federal_election_office_id = federal_election.federal_election_office_id
|
|
63
63
|
this.state_id = federal_election.state_id
|
|
64
|
-
this.
|
|
64
|
+
this.district_id = federal_election.district_id
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
static is(federal_election : any) : federal_election is FederalElection {
|
|
@@ -71,7 +71,7 @@ export class FederalElection {
|
|
|
71
71
|
typeof federal_election.name === "string" &&
|
|
72
72
|
is_federal_election_office_id(federal_election.federal_election_office_id) &&
|
|
73
73
|
(federal_election.state_id === undefined || is_state_id(federal_election.state_id)) &&
|
|
74
|
-
(federal_election.
|
|
74
|
+
(federal_election.district_id === undefined || typeof federal_election.district_id === "number")
|
|
75
75
|
)
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -4,49 +4,39 @@ import { FederalElectionFileExpenditureAux } from "./FederalElectionFileExpendit
|
|
|
4
4
|
import { FederalElectionF3File } from "./FederalElectionF3File"
|
|
5
5
|
import { is_state_id, StateID } from "../regions/State"
|
|
6
6
|
|
|
7
|
-
export class ActivityIndex {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
// export class ActivityIndex {
|
|
8
|
+
// readonly news_index : number
|
|
9
|
+
// readonly twitter_index : number
|
|
10
|
+
// readonly total_index : number
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
// constructor(activity_index : any) {
|
|
13
|
+
// if (!ActivityIndex.is(activity_index)) {
|
|
14
|
+
// throw Error("Invalid input.")
|
|
15
|
+
// }
|
|
16
|
+
// this.news_index = activity_index.news_index
|
|
17
|
+
// this.twitter_index = activity_index.twitter_index
|
|
18
|
+
// this.total_index = activity_index.total_index
|
|
19
|
+
// }
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
21
|
+
// static is(activity_index : any) : activity_index is ActivityIndex {
|
|
22
|
+
// return (
|
|
23
|
+
// activity_index !== undefined &&
|
|
24
|
+
// typeof activity_index.news_index === "number" &&
|
|
25
|
+
// typeof activity_index.twitter_index === "number" &&
|
|
26
|
+
// typeof activity_index.total_index === "number"
|
|
27
|
+
// )
|
|
28
|
+
// }
|
|
29
|
+
// }
|
|
30
30
|
|
|
31
31
|
export class FederalElectionCandidate {
|
|
32
32
|
readonly federal_election_candidate_id : string
|
|
33
33
|
readonly name : string
|
|
34
34
|
readonly federal_election_office_id : FederalElectionOfficeID
|
|
35
35
|
readonly state_id : StateID
|
|
36
|
-
readonly
|
|
36
|
+
readonly district_id? : number
|
|
37
37
|
readonly federal_election_id : FederalElectionID
|
|
38
38
|
readonly party_id? : string
|
|
39
|
-
readonly is_active? : boolean
|
|
40
|
-
readonly status? : string
|
|
41
39
|
readonly federal_election_file_id? : number
|
|
42
|
-
readonly ballotpedia_name? : string
|
|
43
|
-
readonly ballotpedia_url? : string
|
|
44
|
-
readonly ballotpedia_data? : Record<string, any>
|
|
45
|
-
readonly activity_index? : ActivityIndex
|
|
46
|
-
readonly is_veteran? : string
|
|
47
|
-
readonly url_veteran? : string
|
|
48
|
-
// readonly urls? : string[]
|
|
49
|
-
// readonly previews? : string[]
|
|
50
40
|
[x : string] : any
|
|
51
41
|
|
|
52
42
|
|
|
@@ -58,18 +48,10 @@ export class FederalElectionCandidate {
|
|
|
58
48
|
this.name = federal_election_candidate.name
|
|
59
49
|
this.federal_election_office_id = federal_election_candidate.federal_election_office_id
|
|
60
50
|
this.state_id = federal_election_candidate.state_id
|
|
61
|
-
this.
|
|
51
|
+
this.district_id = federal_election_candidate.district_id
|
|
62
52
|
this.federal_election_id = federal_election_candidate.federal_election_id
|
|
63
53
|
this.party_id = federal_election_candidate.party_id
|
|
64
|
-
this.is_active = federal_election_candidate.is_active
|
|
65
|
-
this.status = federal_election_candidate.status
|
|
66
54
|
this.federal_election_file_id = federal_election_candidate.federal_election_file_id
|
|
67
|
-
this.ballotpedia_name = federal_election_candidate.ballotpedia_name
|
|
68
|
-
this.ballotpedia_url = federal_election_candidate.ballotpedia_url
|
|
69
|
-
this.ballotpedia_data = federal_election_candidate.ballotpedia_data
|
|
70
|
-
this.activity_index = federal_election_candidate.activity_index
|
|
71
|
-
this.is_veteran = federal_election_candidate.is_veteran
|
|
72
|
-
this.url_veteran = federal_election_candidate.url_veteran
|
|
73
55
|
}
|
|
74
56
|
|
|
75
57
|
static is(federal_election_candidate : any) : federal_election_candidate is FederalElectionCandidate {
|
|
@@ -79,18 +61,10 @@ export class FederalElectionCandidate {
|
|
|
79
61
|
typeof federal_election_candidate.name === "string" &&
|
|
80
62
|
is_federal_election_office_id(federal_election_candidate.federal_election_office_id) &&
|
|
81
63
|
is_state_id(federal_election_candidate.state_id) &&
|
|
82
|
-
(federal_election_candidate.
|
|
64
|
+
(federal_election_candidate.district_id === undefined || typeof federal_election_candidate.district_id === "number") &&
|
|
83
65
|
is_federal_election_id(federal_election_candidate.federal_election_id) &&
|
|
84
66
|
(federal_election_candidate.party_id === undefined || typeof federal_election_candidate.party_id === "string") &&
|
|
85
|
-
(federal_election_candidate.
|
|
86
|
-
(federal_election_candidate.status === undefined || typeof federal_election_candidate.status === "string") &&
|
|
87
|
-
(federal_election_candidate.federal_election_file_id === undefined || typeof federal_election_candidate.federal_election_file_id === "number" && !isNaN(federal_election_candidate.federal_election_file_id)) &&
|
|
88
|
-
(federal_election_candidate.ballotpedia_name === undefined || typeof federal_election_candidate.ballotpedia_name === "string") &&
|
|
89
|
-
(federal_election_candidate.ballotpedia_url === undefined || typeof federal_election_candidate.ballotpedia_url === "string") &&
|
|
90
|
-
(federal_election_candidate.ballotpedia_data === undefined || typeof federal_election_candidate.ballotpedia_data === "object" && Object.keys(federal_election_candidate.ballotpedia_data).map((key : any) => typeof key === "string")) &&
|
|
91
|
-
(federal_election_candidate.activity_index === undefined || ActivityIndex.is(federal_election_candidate.activity_index)) &&
|
|
92
|
-
(federal_election_candidate.is_veteran === undefined || typeof federal_election_candidate.is_veteran === "string") &&
|
|
93
|
-
(federal_election_candidate.url_veteran === undefined || typeof federal_election_candidate.url_veteran === "string")
|
|
67
|
+
(federal_election_candidate.federal_election_file_id === undefined || typeof federal_election_candidate.federal_election_file_id === "number" && !isNaN(federal_election_candidate.federal_election_file_id))
|
|
94
68
|
)
|
|
95
69
|
}
|
|
96
70
|
}
|
|
@@ -4,7 +4,7 @@ import { FederalElectionFile } from "./FederalElectionFile"
|
|
|
4
4
|
export class FederalElectionF24File extends FederalElectionFile {
|
|
5
5
|
readonly federal_election_committee_id : string
|
|
6
6
|
readonly first_federal_election_file_id : number
|
|
7
|
-
readonly
|
|
7
|
+
readonly f24_report_type_id : string
|
|
8
8
|
readonly first_report_date : string
|
|
9
9
|
readonly report_date : string
|
|
10
10
|
readonly expenditures : FederalElectionFileExpenditure[]
|
|
@@ -16,7 +16,7 @@ export class FederalElectionF24File extends FederalElectionFile {
|
|
|
16
16
|
super(federal_election_file)
|
|
17
17
|
this.federal_election_committee_id = federal_election_file.federal_election_committee_id
|
|
18
18
|
this.first_federal_election_file_id = federal_election_file.first_federal_election_file_id
|
|
19
|
-
this.
|
|
19
|
+
this.f24_report_type_id = federal_election_file.f24_report_type_id
|
|
20
20
|
this.first_report_date = federal_election_file.first_report_date
|
|
21
21
|
this.report_date = federal_election_file.report_date
|
|
22
22
|
this.expenditures = federal_election_file.expenditures
|
|
@@ -28,7 +28,7 @@ export class FederalElectionF24File extends FederalElectionFile {
|
|
|
28
28
|
federal_election_file.form_type_id === "F24" &&
|
|
29
29
|
typeof federal_election_file.federal_election_committee_id === "string" &&
|
|
30
30
|
typeof federal_election_file.first_federal_election_file_id === "number" &&
|
|
31
|
-
typeof federal_election_file.
|
|
31
|
+
typeof federal_election_file.f24_report_type_id === "string" &&
|
|
32
32
|
typeof federal_election_file.first_report_date === "string" &&
|
|
33
33
|
typeof federal_election_file.report_date === "string" &&
|
|
34
34
|
Array.isArray(federal_election_file.expenditures) && federal_election_file.expenditures.every(FederalElectionFileExpenditure.is)
|
|
@@ -7,7 +7,7 @@ export class FederalElectionF2File extends FederalElectionFile {
|
|
|
7
7
|
readonly name : string
|
|
8
8
|
readonly federal_election_office_id : FederalElectionOfficeID
|
|
9
9
|
readonly state_id : StateID
|
|
10
|
-
readonly
|
|
10
|
+
readonly district_id? : number
|
|
11
11
|
readonly federal_election_id : FederalElectionID
|
|
12
12
|
readonly party_id? : string
|
|
13
13
|
readonly report_date : string
|
|
@@ -21,7 +21,7 @@ export class FederalElectionF2File extends FederalElectionFile {
|
|
|
21
21
|
this.name = federal_election_file.name
|
|
22
22
|
this.federal_election_office_id = federal_election_file.federal_election_office_id
|
|
23
23
|
this.state_id = federal_election_file.state_id
|
|
24
|
-
this.
|
|
24
|
+
this.district_id = federal_election_file.district_id
|
|
25
25
|
this.federal_election_id = federal_election_file.federal_election_id
|
|
26
26
|
this.party_id = federal_election_file.party_id
|
|
27
27
|
this.report_date = federal_election_file.report_date
|
|
@@ -35,7 +35,7 @@ export class FederalElectionF2File extends FederalElectionFile {
|
|
|
35
35
|
typeof federal_election_file.name === "string" &&
|
|
36
36
|
is_federal_election_office_id(federal_election_file.federal_election_office_id) &&
|
|
37
37
|
is_state_id(federal_election_file.state_id) &&
|
|
38
|
-
(federal_election_file.
|
|
38
|
+
(federal_election_file.district_id === undefined || typeof federal_election_file.district_id === "number") &&
|
|
39
39
|
is_federal_election_id(federal_election_file.federal_election_id) &&
|
|
40
40
|
(federal_election_file.party_id === undefined || typeof federal_election_file.party_id === "string") &&
|
|
41
41
|
typeof federal_election_file.report_date === "string"
|
|
@@ -4,6 +4,7 @@ export class PressArticleTag {
|
|
|
4
4
|
readonly press_article_id : string
|
|
5
5
|
readonly tag_id : string
|
|
6
6
|
readonly publish_date : string
|
|
7
|
+
readonly url : string
|
|
7
8
|
readonly relevance? : string
|
|
8
9
|
readonly sentiment? : string
|
|
9
10
|
readonly [x : string] : any
|
|
@@ -15,6 +16,7 @@ export class PressArticleTag {
|
|
|
15
16
|
this.press_article_id = press_article_tag.press_article_id
|
|
16
17
|
this.tag_id = press_article_tag.tag_id
|
|
17
18
|
this.publish_date = press_article_tag.publish_date
|
|
19
|
+
this.url = press_article_tag.url
|
|
18
20
|
this.relevance = press_article_tag.relevance
|
|
19
21
|
this.sentiment = press_article_tag.sentiment
|
|
20
22
|
}
|
|
@@ -25,6 +27,7 @@ export class PressArticleTag {
|
|
|
25
27
|
typeof press_article_tag.press_article_id === "string" &&
|
|
26
28
|
typeof press_article_tag.tag_id === "string" &&
|
|
27
29
|
typeof press_article_tag.publish_date === "string" &&
|
|
30
|
+
typeof press_article_tag.url === "string" &&
|
|
28
31
|
(press_article_tag.relevance === undefined || typeof press_article_tag.relevance === "string") &&
|
|
29
32
|
(press_article_tag.sentiment === undefined || typeof press_article_tag.sentiment === "string")
|
|
30
33
|
)
|
package/src/types/scout/Scout.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { DocumentTypeID, is_document_type_id } from "../fragments/Fragment"
|
|
2
2
|
import { StateID } from "../regions/State"
|
|
3
3
|
|
|
4
|
-
const scout_type_ids = ["I", "O"] as const
|
|
4
|
+
// const scout_type_ids = ["I", "O"] as const
|
|
5
5
|
|
|
6
|
-
export type ScoutTypeID = typeof scout_type_ids[number]
|
|
6
|
+
// export type ScoutTypeID = typeof scout_type_ids[number]
|
|
7
7
|
|
|
8
|
-
export function is_scout_type_id(scout_type_id : any) : scout_type_id is ScoutTypeID {
|
|
9
|
-
|
|
10
|
-
}
|
|
8
|
+
// export function is_scout_type_id(scout_type_id : any) : scout_type_id is ScoutTypeID {
|
|
9
|
+
// return scout_type_ids.includes(scout_type_id)
|
|
10
|
+
// }
|
|
11
11
|
|
|
12
12
|
export class Scout {
|
|
13
13
|
readonly scout_id : string
|
|
14
|
-
readonly scout_type_id : ScoutTypeID
|
|
14
|
+
// readonly scout_type_id : ScoutTypeID
|
|
15
15
|
readonly name : string
|
|
16
16
|
readonly s3_id_img? : string
|
|
17
17
|
readonly document_type_ids : DocumentTypeID[]
|
|
@@ -22,7 +22,7 @@ export class Scout {
|
|
|
22
22
|
throw Error("Invalid input.")
|
|
23
23
|
}
|
|
24
24
|
this.scout_id = scout.scout_id
|
|
25
|
-
this.scout_type_id = scout.scout_type_id
|
|
25
|
+
// this.scout_type_id = scout.scout_type_id
|
|
26
26
|
this.name = scout.name
|
|
27
27
|
this.s3_id_img = scout.s3_id_img
|
|
28
28
|
this.document_type_ids = scout.document_type_ids
|
|
@@ -32,7 +32,7 @@ export class Scout {
|
|
|
32
32
|
return (
|
|
33
33
|
scout !== undefined &&
|
|
34
34
|
typeof scout.scout_id === "string" &&
|
|
35
|
-
is_scout_type_id(scout.scout_type_id) &&
|
|
35
|
+
// is_scout_type_id(scout.scout_type_id) &&
|
|
36
36
|
typeof scout.name === "string" &&
|
|
37
37
|
(scout.s3_id_img === undefined || typeof scout.s3_id_img === "string") &&
|
|
38
38
|
Array.isArray(scout.document_type_ids) && scout.document_type_ids.every(is_document_type_id)
|
|
@@ -62,35 +62,35 @@ export class ScoutAux extends Scout {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const scout_office_ids = ["USP", "USH", "USS", "STG", "STH", "STS"] as const
|
|
65
|
+
// const scout_office_ids = ["USP", "USH", "USS", "STG", "STH", "STS"] as const
|
|
66
66
|
|
|
67
|
-
export type ScoutOfficeID = typeof scout_office_ids[number]
|
|
67
|
+
// export type ScoutOfficeID = typeof scout_office_ids[number]
|
|
68
68
|
|
|
69
|
-
export function is_scout_office_id(scout_office_id : any) : scout_office_id is ScoutOfficeID {
|
|
70
|
-
|
|
71
|
-
}
|
|
69
|
+
// export function is_scout_office_id(scout_office_id : any) : scout_office_id is ScoutOfficeID {
|
|
70
|
+
// return scout_office_ids.includes(scout_office_id)
|
|
71
|
+
// }
|
|
72
72
|
|
|
73
|
-
export class IndividualScout extends Scout {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
// export class IndividualScout extends Scout {
|
|
74
|
+
// readonly office_id : ScoutOfficeID
|
|
75
|
+
// readonly state_id? : StateID
|
|
76
|
+
// readonly district? : number
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
// constructor(scout : any) {
|
|
79
|
+
// if (!IndividualScout.is(scout)) {
|
|
80
|
+
// throw Error("Invalid input.")
|
|
81
|
+
// }
|
|
82
|
+
// super(scout)
|
|
83
|
+
// this.office_id = scout.office_id
|
|
84
|
+
// this.state_id = scout.state_id
|
|
85
|
+
// this.district = scout.district
|
|
86
|
+
// }
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
88
|
+
// static is(scout : any) : scout is IndividualScout {
|
|
89
|
+
// return (
|
|
90
|
+
// Scout.is(scout) &&
|
|
91
|
+
// is_scout_office_id(scout.office_id) &&
|
|
92
|
+
// (scout.state_id === undefined || typeof scout.state_id === "string") &&
|
|
93
|
+
// (scout.district === undefined || typeof scout.district === "number")
|
|
94
|
+
// )
|
|
95
|
+
// }
|
|
96
|
+
// }
|