triangle-types 1.0.134 → 1.0.136
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/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/types/federal_congress/FederalCongress.d.ts +7 -0
- package/dist/src/types/federal_congress/FederalCongress.js +17 -0
- package/dist/src/types/federal_elections/FederalElection.d.ts +3 -1
- package/dist/src/types/federal_elections/FederalElection.js +9 -3
- package/dist/src/types/prism/TenantVoterTarget.d.ts +1 -2
- package/dist/src/types/prism/TenantVoterTarget.js +3 -4
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/types/federal_congress/FederalCongress.ts +23 -0
- package/src/types/federal_congress/FederalCongressDistrict.ts +1 -1
- package/src/types/federal_elections/FederalElection.ts +9 -3
- package/src/types/prism/TenantVoterTarget.ts +3 -3
package/dist/src/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export * from "./types/federal_lobby/FederalLobbyClient.js";
|
|
|
26
26
|
export * from "./types/federal_lobby/FederalLobbyLobbyist.js";
|
|
27
27
|
export * from "./types/federal_lobby/FederalLobbyDocument.js";
|
|
28
28
|
export * from "./types/federal_lobby/FederalLobbyDocumentInterest.js";
|
|
29
|
+
export * from "./types/federal_congress/FederalCongress.js";
|
|
29
30
|
export * from "./types/federal_congress/FederalCongressBill.js";
|
|
30
31
|
export * from "./types/federal_congress/FederalCongressBillAction.js";
|
|
31
32
|
export * from "./types/federal_congress/FederalCongressBillDocument.js";
|
package/dist/src/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export * from "./types/federal_lobby/FederalLobbyClient.js";
|
|
|
26
26
|
export * from "./types/federal_lobby/FederalLobbyLobbyist.js";
|
|
27
27
|
export * from "./types/federal_lobby/FederalLobbyDocument.js";
|
|
28
28
|
export * from "./types/federal_lobby/FederalLobbyDocumentInterest.js";
|
|
29
|
+
export * from "./types/federal_congress/FederalCongress.js";
|
|
29
30
|
export * from "./types/federal_congress/FederalCongressBill.js";
|
|
30
31
|
export * from "./types/federal_congress/FederalCongressBillAction.js";
|
|
31
32
|
export * from "./types/federal_congress/FederalCongressBillDocument.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StateID } from "../regions/State.js";
|
|
2
|
+
export declare class FederalCongress {
|
|
3
|
+
readonly federal_congress_id: number;
|
|
4
|
+
readonly redistrict_state_ids: StateID;
|
|
5
|
+
constructor(federal_congress: any);
|
|
6
|
+
static is(federal_congress: any): federal_congress is FederalCongress;
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { is_state_id } from "../regions/State.js";
|
|
2
|
+
export class FederalCongress {
|
|
3
|
+
federal_congress_id;
|
|
4
|
+
redistrict_state_ids;
|
|
5
|
+
constructor(federal_congress) {
|
|
6
|
+
if (!FederalCongress.is(federal_congress)) {
|
|
7
|
+
throw Error("Invalid input.");
|
|
8
|
+
}
|
|
9
|
+
this.federal_congress_id = federal_congress.federal_congress_id;
|
|
10
|
+
this.redistrict_state_ids = federal_congress.redistrict_state_ids;
|
|
11
|
+
}
|
|
12
|
+
static is(federal_congress) {
|
|
13
|
+
return (federal_congress !== undefined &&
|
|
14
|
+
typeof federal_congress.federal_congress_id === "number" &&
|
|
15
|
+
Array.isArray(federal_congress.redistrict_state_ids) && federal_congress.redistrict_state_ids.every(is_state_id));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -10,10 +10,12 @@ export type FederalElectionID = string;
|
|
|
10
10
|
export declare function is_federal_election_id(federal_election_id: any): federal_election_id is FederalElectionID;
|
|
11
11
|
export declare class FederalElection {
|
|
12
12
|
readonly federal_election_id: FederalElectionID;
|
|
13
|
+
readonly year: number;
|
|
13
14
|
readonly name: string;
|
|
15
|
+
readonly federal_congress_id?: number;
|
|
14
16
|
readonly federal_election_office_id: FederalElectionOfficeID;
|
|
15
17
|
readonly state_id?: StateID;
|
|
16
|
-
readonly
|
|
18
|
+
readonly federal_congress_district_id?: string;
|
|
17
19
|
readonly [x: string]: any;
|
|
18
20
|
constructor(federal_election: FederalElection);
|
|
19
21
|
static is(federal_election: any): federal_election is FederalElection;
|
|
@@ -38,27 +38,33 @@ export function is_federal_election_id(federal_election_id) {
|
|
|
38
38
|
}
|
|
39
39
|
export class FederalElection {
|
|
40
40
|
federal_election_id;
|
|
41
|
+
year;
|
|
41
42
|
name;
|
|
43
|
+
federal_congress_id;
|
|
42
44
|
federal_election_office_id;
|
|
43
45
|
state_id;
|
|
44
|
-
|
|
46
|
+
federal_congress_district_id;
|
|
45
47
|
constructor(federal_election) {
|
|
46
48
|
if (!FederalElection.is(federal_election)) {
|
|
47
49
|
throw Error("Invalid input.");
|
|
48
50
|
}
|
|
49
51
|
this.federal_election_id = federal_election.federal_election_id;
|
|
52
|
+
this.year = federal_election.year;
|
|
50
53
|
this.name = federal_election.name;
|
|
54
|
+
this.federal_congress_id = federal_election.federal_congress_id;
|
|
51
55
|
this.federal_election_office_id = federal_election.federal_election_office_id;
|
|
52
56
|
this.state_id = federal_election.state_id;
|
|
53
|
-
this.
|
|
57
|
+
this.federal_congress_district_id = federal_election.federal_congress_district_id;
|
|
54
58
|
}
|
|
55
59
|
static is(federal_election) {
|
|
56
60
|
return (federal_election !== undefined &&
|
|
57
61
|
is_federal_election_id(federal_election.federal_election_id) &&
|
|
62
|
+
typeof federal_election.year === "number" &&
|
|
58
63
|
typeof federal_election.name === "string" &&
|
|
64
|
+
(federal_election.federal_congress_id === undefined || typeof federal_election.federal_congress_id === "number") &&
|
|
59
65
|
is_federal_election_office_id(federal_election.federal_election_office_id) &&
|
|
60
66
|
(federal_election.state_id === undefined || is_state_id(federal_election.state_id)) &&
|
|
61
|
-
(federal_election.
|
|
67
|
+
(federal_election.federal_congress_district_id === undefined || typeof federal_election.federal_congress_district_id === "string"));
|
|
62
68
|
}
|
|
63
69
|
}
|
|
64
70
|
export class FederalElectionAux extends FederalElection {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { StateID } from "../regions/State.js";
|
|
2
1
|
export declare class TenantVoterTarget {
|
|
3
2
|
readonly tenant_voter_target_id: string;
|
|
4
3
|
readonly tenant_id: string;
|
|
5
4
|
readonly voter_id: string;
|
|
6
5
|
readonly target_id: string;
|
|
7
6
|
readonly value: number;
|
|
8
|
-
readonly
|
|
7
|
+
readonly user_id: string;
|
|
9
8
|
constructor(tenant_voter_target: any);
|
|
10
9
|
static is(tenant_voter_target: any): tenant_voter_target is TenantVoterTarget;
|
|
11
10
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { is_state_id } from "../regions/State.js";
|
|
2
1
|
export class TenantVoterTarget {
|
|
3
2
|
tenant_voter_target_id;
|
|
4
3
|
tenant_id;
|
|
5
4
|
voter_id;
|
|
6
5
|
target_id;
|
|
7
6
|
value;
|
|
8
|
-
|
|
7
|
+
user_id;
|
|
9
8
|
// readonly federal_congress_district_id? : string
|
|
10
9
|
// readonly state_legislature_house_district_id? : string
|
|
11
10
|
// readonly state_legislature_senate_district_id? : string
|
|
@@ -21,7 +20,7 @@ export class TenantVoterTarget {
|
|
|
21
20
|
this.voter_id = tenant_voter_target.voter_id;
|
|
22
21
|
this.target_id = tenant_voter_target.target_id;
|
|
23
22
|
this.value = tenant_voter_target.value;
|
|
24
|
-
this.
|
|
23
|
+
this.user_id = tenant_voter_target.user_id;
|
|
25
24
|
// this.federal_congress_district_id = tenant_voter_target.federal_congress_district_id
|
|
26
25
|
// this.state_legislature_house_district_id = tenant_voter_target.state_legislature_house_district_id
|
|
27
26
|
// this.state_legislature_senate_district_id = tenant_voter_target.state_legislature_senate_district_id
|
|
@@ -36,7 +35,7 @@ export class TenantVoterTarget {
|
|
|
36
35
|
typeof tenant_voter_target.voter_id === "string" &&
|
|
37
36
|
typeof tenant_voter_target.target_id === "string" &&
|
|
38
37
|
typeof tenant_voter_target.value === "number" &&
|
|
39
|
-
|
|
38
|
+
typeof tenant_voter_target.user_id === "string" // &&
|
|
40
39
|
// (tenant_voter_target.federal_congress_district_id === undefined || typeof tenant_voter_target.federal_congress_district_id === "string") &&
|
|
41
40
|
// (tenant_voter_target.state_legislature_house_district_id === undefined || typeof tenant_voter_target.state_legislature_house_district_id === "string") &&
|
|
42
41
|
// (tenant_voter_target.state_legislature_senate_district_id === undefined || typeof tenant_voter_target.state_legislature_senate_district_id === "string") &&
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -31,6 +31,7 @@ export * from "./types/federal_lobby/FederalLobbyLobbyist"
|
|
|
31
31
|
export * from "./types/federal_lobby/FederalLobbyDocument"
|
|
32
32
|
export * from "./types/federal_lobby/FederalLobbyDocumentInterest"
|
|
33
33
|
|
|
34
|
+
export * from "./types/federal_congress/FederalCongress"
|
|
34
35
|
export * from "./types/federal_congress/FederalCongressBill"
|
|
35
36
|
export * from "./types/federal_congress/FederalCongressBillAction"
|
|
36
37
|
export * from "./types/federal_congress/FederalCongressBillDocument"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { is_state_id, StateID } from "../regions/State"
|
|
2
|
+
|
|
3
|
+
export class FederalCongress {
|
|
4
|
+
readonly federal_congress_id : number
|
|
5
|
+
readonly redistrict_state_ids : StateID
|
|
6
|
+
|
|
7
|
+
constructor(federal_congress : any) {
|
|
8
|
+
if (!FederalCongress.is(federal_congress)) {
|
|
9
|
+
throw Error("Invalid input.")
|
|
10
|
+
}
|
|
11
|
+
this.federal_congress_id = federal_congress.federal_congress_id
|
|
12
|
+
this.redistrict_state_ids = federal_congress.redistrict_state_ids
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static is(federal_congress : any) : federal_congress is FederalCongress {
|
|
16
|
+
return (
|
|
17
|
+
federal_congress !== undefined &&
|
|
18
|
+
typeof federal_congress.federal_congress_id === "number" &&
|
|
19
|
+
Array.isArray(federal_congress.redistrict_state_ids) && federal_congress.redistrict_state_ids.every(is_state_id)
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
@@ -47,10 +47,12 @@ export function is_federal_election_id(federal_election_id : any) : federal_elec
|
|
|
47
47
|
|
|
48
48
|
export class FederalElection {
|
|
49
49
|
readonly federal_election_id : FederalElectionID
|
|
50
|
+
readonly year : number
|
|
50
51
|
readonly name : string
|
|
52
|
+
readonly federal_congress_id? : number
|
|
51
53
|
readonly federal_election_office_id : FederalElectionOfficeID
|
|
52
54
|
readonly state_id? : StateID
|
|
53
|
-
readonly
|
|
55
|
+
readonly federal_congress_district_id? : string
|
|
54
56
|
readonly [x : string] : any
|
|
55
57
|
|
|
56
58
|
constructor(federal_election : FederalElection) {
|
|
@@ -58,20 +60,24 @@ export class FederalElection {
|
|
|
58
60
|
throw Error("Invalid input.")
|
|
59
61
|
}
|
|
60
62
|
this.federal_election_id = federal_election.federal_election_id
|
|
63
|
+
this.year = federal_election.year
|
|
61
64
|
this.name = federal_election.name
|
|
65
|
+
this.federal_congress_id = federal_election.federal_congress_id
|
|
62
66
|
this.federal_election_office_id = federal_election.federal_election_office_id
|
|
63
67
|
this.state_id = federal_election.state_id
|
|
64
|
-
this.
|
|
68
|
+
this.federal_congress_district_id = federal_election.federal_congress_district_id
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
static is(federal_election : any) : federal_election is FederalElection {
|
|
68
72
|
return (
|
|
69
73
|
federal_election !== undefined &&
|
|
70
74
|
is_federal_election_id(federal_election.federal_election_id) &&
|
|
75
|
+
typeof federal_election.year === "number" &&
|
|
71
76
|
typeof federal_election.name === "string" &&
|
|
77
|
+
(federal_election.federal_congress_id === undefined || typeof federal_election.federal_congress_id === "number") &&
|
|
72
78
|
is_federal_election_office_id(federal_election.federal_election_office_id) &&
|
|
73
79
|
(federal_election.state_id === undefined || is_state_id(federal_election.state_id)) &&
|
|
74
|
-
(federal_election.
|
|
80
|
+
(federal_election.federal_congress_district_id === undefined || typeof federal_election.federal_congress_district_id === "string")
|
|
75
81
|
)
|
|
76
82
|
}
|
|
77
83
|
}
|
|
@@ -6,7 +6,7 @@ export class TenantVoterTarget {
|
|
|
6
6
|
readonly voter_id : string
|
|
7
7
|
readonly target_id : string
|
|
8
8
|
readonly value : number
|
|
9
|
-
readonly
|
|
9
|
+
readonly user_id : string
|
|
10
10
|
// readonly federal_congress_district_id? : string
|
|
11
11
|
// readonly state_legislature_house_district_id? : string
|
|
12
12
|
// readonly state_legislature_senate_district_id? : string
|
|
@@ -23,7 +23,7 @@ export class TenantVoterTarget {
|
|
|
23
23
|
this.voter_id = tenant_voter_target.voter_id
|
|
24
24
|
this.target_id = tenant_voter_target.target_id
|
|
25
25
|
this.value = tenant_voter_target.value
|
|
26
|
-
this.
|
|
26
|
+
this.user_id = tenant_voter_target.user_id
|
|
27
27
|
// this.federal_congress_district_id = tenant_voter_target.federal_congress_district_id
|
|
28
28
|
// this.state_legislature_house_district_id = tenant_voter_target.state_legislature_house_district_id
|
|
29
29
|
// this.state_legislature_senate_district_id = tenant_voter_target.state_legislature_senate_district_id
|
|
@@ -40,7 +40,7 @@ export class TenantVoterTarget {
|
|
|
40
40
|
typeof tenant_voter_target.voter_id === "string" &&
|
|
41
41
|
typeof tenant_voter_target.target_id === "string" &&
|
|
42
42
|
typeof tenant_voter_target.value === "number" &&
|
|
43
|
-
|
|
43
|
+
typeof tenant_voter_target.user_id === "string"// &&
|
|
44
44
|
// (tenant_voter_target.federal_congress_district_id === undefined || typeof tenant_voter_target.federal_congress_district_id === "string") &&
|
|
45
45
|
// (tenant_voter_target.state_legislature_house_district_id === undefined || typeof tenant_voter_target.state_legislature_house_district_id === "string") &&
|
|
46
46
|
// (tenant_voter_target.state_legislature_senate_district_id === undefined || typeof tenant_voter_target.state_legislature_senate_district_id === "string") &&
|