triangle-types 1.0.8 → 1.0.10
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/FederalCongressMember.d.ts +16 -0
- package/dist/src/types/federal_congress/FederalCongressMember.js +44 -0
- package/dist/src/types/scout/Scout.d.ts +9 -0
- package/dist/src/types/scout/Scout.js +22 -0
- package/dist/src/types/scout/ScoutDocument.d.ts +1 -0
- package/dist/src/types/scout/ScoutDocument.js +1 -0
- package/dist/src/types/scout/UserScout.d.ts +8 -0
- package/dist/src/types/scout/UserScout.js +19 -0
- package/dist/src/types/scout/UserScoutConversation.d.ts +10 -0
- package/dist/src/types/scout/UserScoutConversation.js +25 -0
- package/dist/src/types/scout/UserScoutConversationMessage.d.ts +15 -0
- package/dist/src/types/scout/UserScoutConversationMessage.js +43 -0
- package/dist/src/types/voters/Voter.d.ts +2 -0
- package/dist/src/types/voters/Voter.js +5 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/types/federal_congress/FederalCongressMember.ts +51 -0
- package/src/types/scout/Scout.ts +27 -0
- package/src/types/scout/ScoutDocument.ts +0 -0
- package/src/types/scout/UserScout.ts +24 -0
- package/src/types/scout/UserScoutConversation.ts +30 -0
- package/src/types/scout/UserScoutConversationMessage.ts +47 -0
- package/src/types/voters/Voter.ts +5 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export * from "./types/federal_lobby/FederalLobbyDocument.js";
|
|
|
29
29
|
export * from "./types/federal_lobby/FederalLobbyDocumentInterest.js";
|
|
30
30
|
export * from "./types/federal_congress/FederalCongressBill.js";
|
|
31
31
|
export * from "./types/federal_congress/FederalCongressBillDocument.js";
|
|
32
|
+
export * from "./types/federal_congress/FederalCongressMember.js";
|
|
32
33
|
export * from "./types/federal_register/FederalRegisterAgency.js";
|
|
33
34
|
export * from "./types/federal_register/FederalRegisterDocument.js";
|
|
34
35
|
export * from "./types/federal_dockets/FederalDocketAgency.js";
|
package/dist/src/index.js
CHANGED
|
@@ -29,6 +29,7 @@ export * from "./types/federal_lobby/FederalLobbyDocument.js";
|
|
|
29
29
|
export * from "./types/federal_lobby/FederalLobbyDocumentInterest.js";
|
|
30
30
|
export * from "./types/federal_congress/FederalCongressBill.js";
|
|
31
31
|
export * from "./types/federal_congress/FederalCongressBillDocument.js";
|
|
32
|
+
export * from "./types/federal_congress/FederalCongressMember.js";
|
|
32
33
|
export * from "./types/federal_register/FederalRegisterAgency.js";
|
|
33
34
|
export * from "./types/federal_register/FederalRegisterDocument.js";
|
|
34
35
|
export * from "./types/federal_dockets/FederalDocketAgency.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StateID } from "../State.js";
|
|
2
|
+
export declare class FederalCongressMember {
|
|
3
|
+
readonly federal_congress_member_id: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly name_reverse: string;
|
|
6
|
+
readonly name_prefix?: string;
|
|
7
|
+
readonly name_first: string;
|
|
8
|
+
readonly name_last: string;
|
|
9
|
+
readonly birth_year: number;
|
|
10
|
+
readonly state_id: StateID;
|
|
11
|
+
readonly district?: number;
|
|
12
|
+
readonly is_incumbent: boolean;
|
|
13
|
+
readonly url?: string;
|
|
14
|
+
constructor(federal_congress_member: any);
|
|
15
|
+
static is(federal_congress_member: any): federal_congress_member is FederalCongressMember;
|
|
16
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { is_state_id } from "../State.js";
|
|
2
|
+
export class FederalCongressMember {
|
|
3
|
+
federal_congress_member_id;
|
|
4
|
+
name;
|
|
5
|
+
name_reverse;
|
|
6
|
+
name_prefix;
|
|
7
|
+
name_first;
|
|
8
|
+
name_last;
|
|
9
|
+
birth_year;
|
|
10
|
+
state_id;
|
|
11
|
+
district;
|
|
12
|
+
is_incumbent;
|
|
13
|
+
url;
|
|
14
|
+
constructor(federal_congress_member) {
|
|
15
|
+
if (!FederalCongressMember.is(federal_congress_member)) {
|
|
16
|
+
throw Error("Invalid input.");
|
|
17
|
+
}
|
|
18
|
+
this.federal_congress_member_id = federal_congress_member.federal_congress_member_id;
|
|
19
|
+
this.name = federal_congress_member.name;
|
|
20
|
+
this.name_reverse = federal_congress_member.name_reverse;
|
|
21
|
+
this.name_prefix = federal_congress_member.name_prefix;
|
|
22
|
+
this.name_first = federal_congress_member.name_first;
|
|
23
|
+
this.name_last = federal_congress_member.name_last;
|
|
24
|
+
this.birth_year = federal_congress_member.birth_year;
|
|
25
|
+
this.state_id = federal_congress_member.state_id;
|
|
26
|
+
this.district = federal_congress_member.district;
|
|
27
|
+
this.url = federal_congress_member.url;
|
|
28
|
+
this.is_incumbent = federal_congress_member.is_incumbent;
|
|
29
|
+
}
|
|
30
|
+
static is(federal_congress_member) {
|
|
31
|
+
return (federal_congress_member !== undefined &&
|
|
32
|
+
typeof federal_congress_member.federal_congress_member_id === "string" &&
|
|
33
|
+
typeof federal_congress_member.name === "string" &&
|
|
34
|
+
typeof federal_congress_member.name_reverse === "string" &&
|
|
35
|
+
(federal_congress_member.name_prefix === undefined || typeof federal_congress_member.name_prefix === "string") &&
|
|
36
|
+
typeof federal_congress_member.name_first === "string" &&
|
|
37
|
+
typeof federal_congress_member.name_last === "string" &&
|
|
38
|
+
typeof federal_congress_member.birth_year === "number" && !isNaN(federal_congress_member.birth_year) &&
|
|
39
|
+
is_state_id(federal_congress_member.state_id) &&
|
|
40
|
+
(federal_congress_member.district === undefined || typeof federal_congress_member.district === "number") &&
|
|
41
|
+
(federal_congress_member.url === undefined || typeof federal_congress_member.url === "string") &&
|
|
42
|
+
typeof federal_congress_member.is_incumbent === "boolean");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class Scout {
|
|
2
|
+
scout_id;
|
|
3
|
+
office_id;
|
|
4
|
+
number;
|
|
5
|
+
name;
|
|
6
|
+
constructor(scout) {
|
|
7
|
+
if (!Scout.is(scout)) {
|
|
8
|
+
throw Error("Invalid input.");
|
|
9
|
+
}
|
|
10
|
+
this.office_id = scout.office_id;
|
|
11
|
+
this.number = scout.number;
|
|
12
|
+
this.scout_id = scout.scout_id;
|
|
13
|
+
this.name = scout.name;
|
|
14
|
+
}
|
|
15
|
+
static is(scout) {
|
|
16
|
+
return (scout !== undefined &&
|
|
17
|
+
typeof scout.office_id === "string" &&
|
|
18
|
+
typeof scout.number === "string" &&
|
|
19
|
+
typeof scout.scout_id === "string" &&
|
|
20
|
+
typeof scout.name === "string");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class UserScout {
|
|
2
|
+
user_scout_id;
|
|
3
|
+
user_id;
|
|
4
|
+
scout_id;
|
|
5
|
+
constructor(user_scout) {
|
|
6
|
+
if (!UserScout.is(user_scout)) {
|
|
7
|
+
throw Error("Invalid input.");
|
|
8
|
+
}
|
|
9
|
+
this.user_scout_id = user_scout.user_scout_id;
|
|
10
|
+
this.user_id = user_scout.user_id;
|
|
11
|
+
this.scout_id = user_scout.scout_id;
|
|
12
|
+
}
|
|
13
|
+
static is(user_scout) {
|
|
14
|
+
return (user_scout !== undefined &&
|
|
15
|
+
typeof user_scout.user_scout_id === "string" &&
|
|
16
|
+
typeof user_scout.user_id === "string" &&
|
|
17
|
+
typeof user_scout.scout_id === "string");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class UserScoutConversation {
|
|
2
|
+
readonly user_scout_conversation_id: string;
|
|
3
|
+
readonly user_id: string;
|
|
4
|
+
readonly scout_id: string;
|
|
5
|
+
readonly conversation_id: string;
|
|
6
|
+
readonly user_scout_id: string;
|
|
7
|
+
readonly [x: string]: any;
|
|
8
|
+
constructor(user_scout_conversation: any);
|
|
9
|
+
static is(user_scout_conversation: any): user_scout_conversation is UserScoutConversation;
|
|
10
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class UserScoutConversation {
|
|
2
|
+
user_scout_conversation_id;
|
|
3
|
+
user_id;
|
|
4
|
+
scout_id;
|
|
5
|
+
conversation_id;
|
|
6
|
+
user_scout_id;
|
|
7
|
+
constructor(user_scout_conversation) {
|
|
8
|
+
if (!UserScoutConversation.is(user_scout_conversation)) {
|
|
9
|
+
throw Error("Invalid input.");
|
|
10
|
+
}
|
|
11
|
+
this.user_scout_conversation_id = user_scout_conversation.user_scout_conversation_id;
|
|
12
|
+
this.user_id = user_scout_conversation.user_id;
|
|
13
|
+
this.scout_id = user_scout_conversation.scout_id;
|
|
14
|
+
this.conversation_id = user_scout_conversation.conversation_id;
|
|
15
|
+
this.user_scout_id = user_scout_conversation.user_scout_id;
|
|
16
|
+
}
|
|
17
|
+
static is(user_scout_conversation) {
|
|
18
|
+
return (user_scout_conversation !== undefined &&
|
|
19
|
+
typeof user_scout_conversation.user_scout_conversation_id === "string" &&
|
|
20
|
+
typeof user_scout_conversation.user_id === "string" &&
|
|
21
|
+
typeof user_scout_conversation.scout_id === "string" &&
|
|
22
|
+
typeof user_scout_conversation.conversation_id === "string" &&
|
|
23
|
+
typeof user_scout_conversation.user_scout_id === "string");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class UserScoutConversationMessage {
|
|
2
|
+
readonly user_scout_conversation_message_id: string;
|
|
3
|
+
readonly user_id: string;
|
|
4
|
+
readonly scout_id: string;
|
|
5
|
+
readonly conversation_id: string;
|
|
6
|
+
readonly message_id: string;
|
|
7
|
+
readonly user_scout_id: string;
|
|
8
|
+
readonly user_scout_conversation_id: string;
|
|
9
|
+
readonly time: string;
|
|
10
|
+
readonly role: "USER" | "SCOUT";
|
|
11
|
+
readonly system_prompt?: string;
|
|
12
|
+
readonly text: string;
|
|
13
|
+
constructor(user_scout_conversation_message: any);
|
|
14
|
+
static is(user_scout_conversation_message: any): user_scout_conversation_message is UserScoutConversationMessage;
|
|
15
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export class UserScoutConversationMessage {
|
|
2
|
+
user_scout_conversation_message_id;
|
|
3
|
+
user_id;
|
|
4
|
+
scout_id;
|
|
5
|
+
conversation_id;
|
|
6
|
+
message_id;
|
|
7
|
+
user_scout_id;
|
|
8
|
+
user_scout_conversation_id;
|
|
9
|
+
time;
|
|
10
|
+
role;
|
|
11
|
+
system_prompt;
|
|
12
|
+
text;
|
|
13
|
+
constructor(user_scout_conversation_message) {
|
|
14
|
+
if (!UserScoutConversationMessage.is(user_scout_conversation_message)) {
|
|
15
|
+
throw Error("Invalid input.");
|
|
16
|
+
}
|
|
17
|
+
this.user_scout_conversation_message_id = user_scout_conversation_message.user_scout_conversation_message_id;
|
|
18
|
+
this.user_id = user_scout_conversation_message.user_id;
|
|
19
|
+
this.scout_id = user_scout_conversation_message.scout_id;
|
|
20
|
+
this.conversation_id = user_scout_conversation_message.conversation_id;
|
|
21
|
+
this.message_id = user_scout_conversation_message.message_id;
|
|
22
|
+
this.user_scout_id = user_scout_conversation_message.user_scout_id;
|
|
23
|
+
this.user_scout_conversation_id = user_scout_conversation_message.user_scout_conversation_id;
|
|
24
|
+
this.time = user_scout_conversation_message.time;
|
|
25
|
+
this.role = user_scout_conversation_message.role;
|
|
26
|
+
this.system_prompt = user_scout_conversation_message.system_prompt;
|
|
27
|
+
this.text = user_scout_conversation_message.text;
|
|
28
|
+
}
|
|
29
|
+
static is(user_scout_conversation_message) {
|
|
30
|
+
return (user_scout_conversation_message !== undefined &&
|
|
31
|
+
typeof user_scout_conversation_message.user_scout_conversation_message_id === "string" &&
|
|
32
|
+
typeof user_scout_conversation_message.user_id === "string" &&
|
|
33
|
+
typeof user_scout_conversation_message.scout_id === "string" &&
|
|
34
|
+
typeof user_scout_conversation_message.conversation_id === "string" &&
|
|
35
|
+
typeof user_scout_conversation_message.message_id === "string" &&
|
|
36
|
+
typeof user_scout_conversation_message.user_scout_id === "string" &&
|
|
37
|
+
typeof user_scout_conversation_message.user_scout_conversation_id === "string" &&
|
|
38
|
+
typeof user_scout_conversation_message.time === "string" &&
|
|
39
|
+
["USER", "SCOUT"].includes(user_scout_conversation_message.role) &&
|
|
40
|
+
(user_scout_conversation_message.system_prompt === undefined || typeof user_scout_conversation_message.system_prompt === "string") &&
|
|
41
|
+
typeof user_scout_conversation_message.text === "string");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VoterScore } from "./VoterScore.js";
|
|
2
|
+
import { VoterTurnout } from "./VoterTurnout.js";
|
|
2
3
|
export declare class Voter {
|
|
3
4
|
readonly voter_id: string;
|
|
4
5
|
readonly state_id: string;
|
|
@@ -39,6 +40,7 @@ export declare class Voter {
|
|
|
39
40
|
}
|
|
40
41
|
export declare class VoterAux extends Voter {
|
|
41
42
|
readonly scores: VoterScore[];
|
|
43
|
+
readonly turnouts: VoterTurnout[];
|
|
42
44
|
constructor(voter: any);
|
|
43
45
|
static is(voter: any): voter is Voter;
|
|
44
46
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VoterScore } from "./VoterScore.js";
|
|
2
|
+
import { VoterTurnout } from "./VoterTurnout.js";
|
|
2
3
|
export class Voter {
|
|
3
4
|
voter_id;
|
|
4
5
|
state_id;
|
|
@@ -110,15 +111,18 @@ export class Voter {
|
|
|
110
111
|
}
|
|
111
112
|
export class VoterAux extends Voter {
|
|
112
113
|
scores;
|
|
114
|
+
turnouts;
|
|
113
115
|
constructor(voter) {
|
|
114
116
|
if (!VoterAux.is(voter)) {
|
|
115
117
|
throw Error("Invalid input.");
|
|
116
118
|
}
|
|
117
119
|
super(voter);
|
|
118
120
|
this.scores = voter.scores;
|
|
121
|
+
this.turnouts = voter.turnouts;
|
|
119
122
|
}
|
|
120
123
|
static is(voter) {
|
|
121
124
|
return (Voter.is(voter) &&
|
|
122
|
-
Array.isArray(voter.scores) && voter.scores.every(VoterScore.is)
|
|
125
|
+
Array.isArray(voter.scores) && voter.scores.every(VoterScore.is) &&
|
|
126
|
+
Array.isArray(voter.turnouts) && voter.turnouts.every(VoterTurnout.is));
|
|
123
127
|
}
|
|
124
128
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -33,6 +33,7 @@ export * from "./types/federal_lobby/FederalLobbyDocumentInterest"
|
|
|
33
33
|
|
|
34
34
|
export * from "./types/federal_congress/FederalCongressBill"
|
|
35
35
|
export * from "./types/federal_congress/FederalCongressBillDocument"
|
|
36
|
+
export * from "./types/federal_congress/FederalCongressMember"
|
|
36
37
|
|
|
37
38
|
export * from "./types/federal_register/FederalRegisterAgency"
|
|
38
39
|
export * from "./types/federal_register/FederalRegisterDocument"
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { is_state_id, StateID } from "../State"
|
|
2
|
+
|
|
3
|
+
export class FederalCongressMember {
|
|
4
|
+
readonly federal_congress_member_id : string
|
|
5
|
+
readonly name : string
|
|
6
|
+
readonly name_reverse : string
|
|
7
|
+
readonly name_prefix? : string
|
|
8
|
+
readonly name_first : string
|
|
9
|
+
readonly name_last : string
|
|
10
|
+
readonly birth_year : number
|
|
11
|
+
readonly state_id : StateID
|
|
12
|
+
readonly district? : number
|
|
13
|
+
readonly is_incumbent : boolean
|
|
14
|
+
readonly url? : string
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
constructor(federal_congress_member : any) {
|
|
18
|
+
if (!FederalCongressMember.is(federal_congress_member)) {
|
|
19
|
+
throw Error("Invalid input.")
|
|
20
|
+
}
|
|
21
|
+
this.federal_congress_member_id = federal_congress_member.federal_congress_member_id
|
|
22
|
+
this.name = federal_congress_member.name
|
|
23
|
+
this.name_reverse = federal_congress_member.name_reverse
|
|
24
|
+
this.name_prefix = federal_congress_member.name_prefix
|
|
25
|
+
this.name_first = federal_congress_member.name_first
|
|
26
|
+
this.name_last = federal_congress_member.name_last
|
|
27
|
+
this.birth_year = federal_congress_member.birth_year
|
|
28
|
+
this.state_id = federal_congress_member.state_id
|
|
29
|
+
this.district = federal_congress_member.district
|
|
30
|
+
this.url = federal_congress_member.url
|
|
31
|
+
this.is_incumbent = federal_congress_member.is_incumbent
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static is(federal_congress_member : any) : federal_congress_member is FederalCongressMember {
|
|
35
|
+
return (
|
|
36
|
+
federal_congress_member !== undefined &&
|
|
37
|
+
typeof federal_congress_member.federal_congress_member_id === "string" &&
|
|
38
|
+
typeof federal_congress_member.name === "string" &&
|
|
39
|
+
typeof federal_congress_member.name_reverse === "string" &&
|
|
40
|
+
(federal_congress_member.name_prefix === undefined || typeof federal_congress_member.name_prefix === "string") &&
|
|
41
|
+
typeof federal_congress_member.name_first === "string" &&
|
|
42
|
+
typeof federal_congress_member.name_last === "string" &&
|
|
43
|
+
typeof federal_congress_member.birth_year === "number" && !isNaN(federal_congress_member.birth_year) &&
|
|
44
|
+
is_state_id(federal_congress_member.state_id) &&
|
|
45
|
+
(federal_congress_member.district === undefined || typeof federal_congress_member.district === "number") &&
|
|
46
|
+
(federal_congress_member.url === undefined || typeof federal_congress_member.url === "string") &&
|
|
47
|
+
typeof federal_congress_member.is_incumbent === "boolean"
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export class Scout {
|
|
2
|
+
readonly scout_id : string
|
|
3
|
+
readonly office_id : string
|
|
4
|
+
readonly number : string
|
|
5
|
+
readonly name : string
|
|
6
|
+
readonly [x : string] : any
|
|
7
|
+
|
|
8
|
+
constructor(scout : any) {
|
|
9
|
+
if (!Scout.is(scout)) {
|
|
10
|
+
throw Error("Invalid input.")
|
|
11
|
+
}
|
|
12
|
+
this.office_id = scout.office_id
|
|
13
|
+
this.number = scout.number
|
|
14
|
+
this.scout_id = scout.scout_id
|
|
15
|
+
this.name = scout.name
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static is(scout : any) : scout is Scout {
|
|
19
|
+
return (
|
|
20
|
+
scout !== undefined &&
|
|
21
|
+
typeof scout.office_id === "string" &&
|
|
22
|
+
typeof scout.number === "string" &&
|
|
23
|
+
typeof scout.scout_id === "string" &&
|
|
24
|
+
typeof scout.name === "string"
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export class UserScout {
|
|
2
|
+
readonly user_scout_id : string
|
|
3
|
+
readonly user_id : string
|
|
4
|
+
readonly scout_id : string
|
|
5
|
+
readonly [x : string] : any
|
|
6
|
+
|
|
7
|
+
constructor(user_scout : any) {
|
|
8
|
+
if (!UserScout.is(user_scout)) {
|
|
9
|
+
throw Error("Invalid input.")
|
|
10
|
+
}
|
|
11
|
+
this.user_scout_id = user_scout.user_scout_id
|
|
12
|
+
this.user_id = user_scout.user_id
|
|
13
|
+
this.scout_id = user_scout.scout_id
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static is(user_scout : any) : user_scout is UserScout {
|
|
17
|
+
return (
|
|
18
|
+
user_scout !== undefined &&
|
|
19
|
+
typeof user_scout.user_scout_id === "string" &&
|
|
20
|
+
typeof user_scout.user_id === "string" &&
|
|
21
|
+
typeof user_scout.scout_id === "string"
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class UserScoutConversation {
|
|
2
|
+
readonly user_scout_conversation_id : string
|
|
3
|
+
readonly user_id : string
|
|
4
|
+
readonly scout_id : string
|
|
5
|
+
readonly conversation_id : string
|
|
6
|
+
readonly user_scout_id : string
|
|
7
|
+
readonly [x : string] : any
|
|
8
|
+
|
|
9
|
+
constructor(user_scout_conversation : any) {
|
|
10
|
+
if (!UserScoutConversation.is(user_scout_conversation)) {
|
|
11
|
+
throw Error("Invalid input.")
|
|
12
|
+
}
|
|
13
|
+
this.user_scout_conversation_id = user_scout_conversation.user_scout_conversation_id
|
|
14
|
+
this.user_id = user_scout_conversation.user_id
|
|
15
|
+
this.scout_id = user_scout_conversation.scout_id
|
|
16
|
+
this.conversation_id = user_scout_conversation.conversation_id
|
|
17
|
+
this.user_scout_id = user_scout_conversation.user_scout_id
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static is(user_scout_conversation : any) : user_scout_conversation is UserScoutConversation {
|
|
21
|
+
return (
|
|
22
|
+
user_scout_conversation !== undefined &&
|
|
23
|
+
typeof user_scout_conversation.user_scout_conversation_id === "string" &&
|
|
24
|
+
typeof user_scout_conversation.user_id === "string" &&
|
|
25
|
+
typeof user_scout_conversation.scout_id === "string" &&
|
|
26
|
+
typeof user_scout_conversation.conversation_id === "string" &&
|
|
27
|
+
typeof user_scout_conversation.user_scout_id === "string"
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export class UserScoutConversationMessage {
|
|
2
|
+
readonly user_scout_conversation_message_id : string
|
|
3
|
+
readonly user_id : string
|
|
4
|
+
readonly scout_id : string
|
|
5
|
+
readonly conversation_id : string
|
|
6
|
+
readonly message_id : string
|
|
7
|
+
readonly user_scout_id : string
|
|
8
|
+
readonly user_scout_conversation_id : string
|
|
9
|
+
readonly time : string
|
|
10
|
+
readonly role : "USER" | "SCOUT"
|
|
11
|
+
readonly system_prompt? : string
|
|
12
|
+
readonly text : string
|
|
13
|
+
|
|
14
|
+
constructor(user_scout_conversation_message : any) {
|
|
15
|
+
if (!UserScoutConversationMessage.is(user_scout_conversation_message)) {
|
|
16
|
+
throw Error("Invalid input.")
|
|
17
|
+
}
|
|
18
|
+
this.user_scout_conversation_message_id = user_scout_conversation_message.user_scout_conversation_message_id
|
|
19
|
+
this.user_id = user_scout_conversation_message.user_id
|
|
20
|
+
this.scout_id = user_scout_conversation_message.scout_id
|
|
21
|
+
this.conversation_id = user_scout_conversation_message.conversation_id
|
|
22
|
+
this.message_id = user_scout_conversation_message.message_id
|
|
23
|
+
this.user_scout_id = user_scout_conversation_message.user_scout_id
|
|
24
|
+
this.user_scout_conversation_id = user_scout_conversation_message.user_scout_conversation_id
|
|
25
|
+
this.time = user_scout_conversation_message.time
|
|
26
|
+
this.role = user_scout_conversation_message.role
|
|
27
|
+
this.system_prompt = user_scout_conversation_message.system_prompt
|
|
28
|
+
this.text = user_scout_conversation_message.text
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static is(user_scout_conversation_message : any) : user_scout_conversation_message is UserScoutConversationMessage {
|
|
32
|
+
return (
|
|
33
|
+
user_scout_conversation_message !== undefined &&
|
|
34
|
+
typeof user_scout_conversation_message.user_scout_conversation_message_id === "string" &&
|
|
35
|
+
typeof user_scout_conversation_message.user_id === "string" &&
|
|
36
|
+
typeof user_scout_conversation_message.scout_id === "string" &&
|
|
37
|
+
typeof user_scout_conversation_message.conversation_id === "string" &&
|
|
38
|
+
typeof user_scout_conversation_message.message_id === "string" &&
|
|
39
|
+
typeof user_scout_conversation_message.user_scout_id === "string" &&
|
|
40
|
+
typeof user_scout_conversation_message.user_scout_conversation_id === "string" &&
|
|
41
|
+
typeof user_scout_conversation_message.time === "string" &&
|
|
42
|
+
["USER", "SCOUT"].includes(user_scout_conversation_message.role) &&
|
|
43
|
+
(user_scout_conversation_message.system_prompt === undefined || typeof user_scout_conversation_message.system_prompt === "string") &&
|
|
44
|
+
typeof user_scout_conversation_message.text === "string"
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VoterScore } from "./VoterScore"
|
|
2
|
+
import { VoterTurnout } from "./VoterTurnout"
|
|
2
3
|
|
|
3
4
|
export class Voter {
|
|
4
5
|
readonly voter_id : string
|
|
@@ -117,6 +118,7 @@ export class Voter {
|
|
|
117
118
|
|
|
118
119
|
export class VoterAux extends Voter {
|
|
119
120
|
readonly scores : VoterScore[]
|
|
121
|
+
readonly turnouts : VoterTurnout[]
|
|
120
122
|
|
|
121
123
|
constructor(voter : any) {
|
|
122
124
|
if (!VoterAux.is(voter)) {
|
|
@@ -124,12 +126,14 @@ export class VoterAux extends Voter {
|
|
|
124
126
|
}
|
|
125
127
|
super(voter)
|
|
126
128
|
this.scores = voter.scores
|
|
129
|
+
this.turnouts = voter.turnouts
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
static is(voter : any) : voter is Voter {
|
|
130
133
|
return (
|
|
131
134
|
Voter.is(voter) &&
|
|
132
|
-
Array.isArray(voter.scores) && voter.scores.every(VoterScore.is)
|
|
135
|
+
Array.isArray(voter.scores) && voter.scores.every(VoterScore.is) &&
|
|
136
|
+
Array.isArray(voter.turnouts) && voter.turnouts.every(VoterTurnout.is)
|
|
133
137
|
)
|
|
134
138
|
}
|
|
135
139
|
}
|