scout-types 1.0.0
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 +14 -0
- package/dist/src/index.js +14 -0
- package/dist/src/types/APIError.d.ts +4 -0
- package/dist/src/types/APIError.js +19 -0
- package/dist/src/types/Bill.d.ts +19 -0
- package/dist/src/types/Bill.js +47 -0
- package/dist/src/types/Bot.d.ts +28 -0
- package/dist/src/types/Bot.js +72 -0
- package/dist/src/types/BotDocument.d.ts +14 -0
- package/dist/src/types/BotDocument.js +38 -0
- package/dist/src/types/Conversation.d.ts +16 -0
- package/dist/src/types/Conversation.js +41 -0
- package/dist/src/types/DoersAPIError.d.ts +4 -0
- package/dist/src/types/DoersAPIError.js +19 -0
- package/dist/src/types/DoersIQConfig.d.ts +27 -0
- package/dist/src/types/DoersIQConfig.js +1 -0
- package/dist/src/types/Jurisdiction.d.ts +24 -0
- package/dist/src/types/Jurisdiction.js +57 -0
- package/dist/src/types/JurisdictionDocument.d.ts +15 -0
- package/dist/src/types/JurisdictionDocument.js +44 -0
- package/dist/src/types/Message.d.ts +23 -0
- package/dist/src/types/Message.js +63 -0
- package/dist/src/types/OfficeClass.d.ts +17 -0
- package/dist/src/types/OfficeClass.js +132 -0
- package/dist/src/types/Party.d.ts +10 -0
- package/dist/src/types/Party.js +26 -0
- package/dist/src/types/Scout.d.ts +28 -0
- package/dist/src/types/Scout.js +72 -0
- package/dist/src/types/ScoutConfig.d.ts +27 -0
- package/dist/src/types/ScoutConfig.js +1 -0
- package/dist/src/types/ScoutDocument.d.ts +14 -0
- package/dist/src/types/ScoutDocument.js +38 -0
- package/dist/src/types/Sources.d.ts +50 -0
- package/dist/src/types/Sources.js +138 -0
- package/dist/src/types/State.d.ts +11 -0
- package/dist/src/types/State.js +306 -0
- package/dist/src/types/Tweet.d.ts +12 -0
- package/dist/src/types/Tweet.js +34 -0
- package/dist/src/types/User.d.ts +16 -0
- package/dist/src/types/User.js +42 -0
- package/eslint.config.ts +13 -0
- package/jest.config.js +20 -0
- package/package.json +31 -0
- package/src/index.ts +14 -0
- package/src/types/APIError.ts +21 -0
- package/src/types/Bill.ts +57 -0
- package/src/types/Conversation.ts +52 -0
- package/src/types/Jurisdiction.ts +62 -0
- package/src/types/JurisdictionDocument.ts +48 -0
- package/src/types/Message.ts +73 -0
- package/src/types/OfficeClass.ts +150 -0
- package/src/types/Party.ts +36 -0
- package/src/types/Scout.ts +83 -0
- package/src/types/ScoutConfig.ts +28 -0
- package/src/types/ScoutDocument.ts +43 -0
- package/src/types/Sources.ts +163 -0
- package/src/types/State.ts +317 -0
- package/src/types/Tweet.ts +38 -0
- package/src/types/User.ts +53 -0
- package/tsconfig.json +34 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./types/Scout.js";
|
|
2
|
+
export * from "./types/ScoutDocument.js";
|
|
3
|
+
export * from "./types/Conversation.js";
|
|
4
|
+
export * from "./types/APIError.js";
|
|
5
|
+
export * from "./types/ScoutConfig.js";
|
|
6
|
+
export * from "./types/Jurisdiction.js";
|
|
7
|
+
export * from "./types/JurisdictionDocument.js";
|
|
8
|
+
export * from "./types/Message.js";
|
|
9
|
+
export * from "./types/OfficeClass.js";
|
|
10
|
+
export * from "./types/Party.js";
|
|
11
|
+
export * from "./types/Sources.js";
|
|
12
|
+
export * from "./types/State.js";
|
|
13
|
+
export * from "./types/Tweet.js";
|
|
14
|
+
export * from "./types/User.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./types/Scout.js";
|
|
2
|
+
export * from "./types/ScoutDocument.js";
|
|
3
|
+
export * from "./types/Conversation.js";
|
|
4
|
+
export * from "./types/APIError.js";
|
|
5
|
+
export * from "./types/ScoutConfig.js";
|
|
6
|
+
export * from "./types/Jurisdiction.js";
|
|
7
|
+
export * from "./types/JurisdictionDocument.js";
|
|
8
|
+
export * from "./types/Message.js";
|
|
9
|
+
export * from "./types/OfficeClass.js";
|
|
10
|
+
export * from "./types/Party.js";
|
|
11
|
+
export * from "./types/Sources.js";
|
|
12
|
+
export * from "./types/State.js";
|
|
13
|
+
export * from "./types/Tweet.js";
|
|
14
|
+
export * from "./types/User.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const default_messages_by_status = {
|
|
2
|
+
400: "Bad Request",
|
|
3
|
+
401: "Unauthorized",
|
|
4
|
+
403: "Forbidden",
|
|
5
|
+
404: "Not Found",
|
|
6
|
+
405: "Method Not Allowed",
|
|
7
|
+
500: "Internal Server Error",
|
|
8
|
+
504: "Gateway Timeout",
|
|
9
|
+
600: "Failed to Parse Output"
|
|
10
|
+
};
|
|
11
|
+
export class APIError extends Error {
|
|
12
|
+
status;
|
|
13
|
+
constructor(status, message) {
|
|
14
|
+
const default_message = default_messages_by_status[status];
|
|
15
|
+
super(message !== undefined ? message : default_message !== undefined ? default_message : "Error");
|
|
16
|
+
this.name = "APIError";
|
|
17
|
+
this.status = status;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const bill_types: readonly ["HR", "S", "HJRES", "SJRES", "HCONRES", "SCONRES", "HRES", "SRES"];
|
|
2
|
+
export type BillType = typeof bill_types[number];
|
|
3
|
+
export declare function is_bill_type(bill_type: any): bill_type is BillType;
|
|
4
|
+
export declare class Bill {
|
|
5
|
+
readonly congress_id: number;
|
|
6
|
+
readonly bill_id: string;
|
|
7
|
+
readonly type: string;
|
|
8
|
+
readonly number: number;
|
|
9
|
+
readonly title: string;
|
|
10
|
+
readonly intro_date?: string;
|
|
11
|
+
readonly policy_area_name?: string;
|
|
12
|
+
readonly committee_ids?: string[];
|
|
13
|
+
readonly xml_url?: string;
|
|
14
|
+
readonly s3_filename?: string;
|
|
15
|
+
readonly vector_keys?: string[];
|
|
16
|
+
constructor(bill: any);
|
|
17
|
+
static is(bill: any): bill is Bill;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const bill_types = ["HR", "S", "HJRES", "SJRES", "HCONRES", "SCONRES", "HRES", "SRES"];
|
|
2
|
+
export function is_bill_type(bill_type) {
|
|
3
|
+
return bill_types.includes(bill_type);
|
|
4
|
+
}
|
|
5
|
+
export class Bill {
|
|
6
|
+
congress_id;
|
|
7
|
+
bill_id;
|
|
8
|
+
type;
|
|
9
|
+
number;
|
|
10
|
+
title;
|
|
11
|
+
intro_date;
|
|
12
|
+
policy_area_name;
|
|
13
|
+
committee_ids;
|
|
14
|
+
xml_url;
|
|
15
|
+
s3_filename;
|
|
16
|
+
vector_keys;
|
|
17
|
+
constructor(bill) {
|
|
18
|
+
if (!Bill.is(bill)) {
|
|
19
|
+
throw Error("Invalid input.");
|
|
20
|
+
}
|
|
21
|
+
this.congress_id = bill.congress_id;
|
|
22
|
+
this.bill_id = bill.bill_id;
|
|
23
|
+
this.type = bill.type;
|
|
24
|
+
this.number = bill.number;
|
|
25
|
+
this.title = bill.title;
|
|
26
|
+
this.intro_date = bill.intro_date;
|
|
27
|
+
this.policy_area_name = bill.policy_area_name;
|
|
28
|
+
this.committee_ids = bill.committee_ids;
|
|
29
|
+
this.xml_url = bill.xml_url;
|
|
30
|
+
this.s3_filename = bill.s3_filename;
|
|
31
|
+
this.vector_keys = bill.vector_keys;
|
|
32
|
+
}
|
|
33
|
+
static is(bill) {
|
|
34
|
+
return (bill !== undefined &&
|
|
35
|
+
typeof bill.congress_id === "number" &&
|
|
36
|
+
typeof bill.bill_id === "string" &&
|
|
37
|
+
typeof bill.type === "string" &&
|
|
38
|
+
typeof bill.number === "number" &&
|
|
39
|
+
typeof bill.title === "string" &&
|
|
40
|
+
(bill.intro_date === undefined || typeof bill.intro_date === "string") &&
|
|
41
|
+
(bill.policy_area_name === undefined || typeof bill.policy_area_name === "string") &&
|
|
42
|
+
(bill.committee_ids === undefined || Array.isArray(bill.committee_ids) && bill.committee_ids.every((committee_id) => typeof committee_id === "string")) &&
|
|
43
|
+
(bill.xml_url === undefined || typeof bill.xml_url === "string") &&
|
|
44
|
+
(bill.s3_filename === undefined || typeof bill.s3_filename === "string") &&
|
|
45
|
+
(bill.vector_keys === undefined || Array.isArray(bill.vector_keys) && bill.vector_keys.every((vector_key) => typeof vector_key === "string")));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { OfficeClassID } from "./OfficeClass.js";
|
|
2
|
+
import { Jurisdiction } from "./Jurisdiction.js";
|
|
3
|
+
import { StateID } from "./State.js";
|
|
4
|
+
import { PartyID } from "./Party.js";
|
|
5
|
+
export declare class Bot {
|
|
6
|
+
readonly office_id: string;
|
|
7
|
+
readonly number: string;
|
|
8
|
+
readonly bot_id: string;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly active: boolean;
|
|
11
|
+
readonly state_id: StateID;
|
|
12
|
+
readonly district?: number;
|
|
13
|
+
readonly party_id: PartyID;
|
|
14
|
+
readonly tone_description_refresh: boolean;
|
|
15
|
+
readonly jurisdiction_ids: number[];
|
|
16
|
+
readonly office_class_id: OfficeClassID;
|
|
17
|
+
readonly office_name?: string;
|
|
18
|
+
readonly [x: string]: any;
|
|
19
|
+
constructor(bot: any);
|
|
20
|
+
static is(bot: any): bot is Bot;
|
|
21
|
+
}
|
|
22
|
+
export declare class BotAux extends Bot {
|
|
23
|
+
readonly jurisdictions: Jurisdiction[];
|
|
24
|
+
readonly photo_download_url?: string;
|
|
25
|
+
readonly tone_description?: string;
|
|
26
|
+
constructor(bot: any);
|
|
27
|
+
static is(bot: any): bot is BotAux;
|
|
28
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { is_office_class_id } from "./OfficeClass.js";
|
|
2
|
+
import { Jurisdiction } from "./Jurisdiction.js";
|
|
3
|
+
import { is_state_id } from "./State.js";
|
|
4
|
+
import { is_party_id } from "./Party.js";
|
|
5
|
+
export class Bot {
|
|
6
|
+
office_id;
|
|
7
|
+
number;
|
|
8
|
+
bot_id;
|
|
9
|
+
name;
|
|
10
|
+
active;
|
|
11
|
+
state_id;
|
|
12
|
+
district;
|
|
13
|
+
party_id;
|
|
14
|
+
tone_description_refresh;
|
|
15
|
+
jurisdiction_ids;
|
|
16
|
+
office_class_id;
|
|
17
|
+
office_name;
|
|
18
|
+
constructor(bot) {
|
|
19
|
+
if (!Bot.is(bot)) {
|
|
20
|
+
throw Error("Invalid input.");
|
|
21
|
+
}
|
|
22
|
+
this.office_id = bot.office_id;
|
|
23
|
+
this.number = bot.number;
|
|
24
|
+
this.bot_id = bot.bot_id;
|
|
25
|
+
this.name = bot.name;
|
|
26
|
+
this.active = bot.active;
|
|
27
|
+
this.state_id = bot.state_id;
|
|
28
|
+
this.district = bot.district;
|
|
29
|
+
this.party_id = bot.party_id;
|
|
30
|
+
this.tone_description_refresh = bot.tone_description_refresh;
|
|
31
|
+
this.jurisdiction_ids = bot.jurisdiction_ids;
|
|
32
|
+
this.office_class_id = bot.office_class_id;
|
|
33
|
+
this.office_name = bot.office_name;
|
|
34
|
+
}
|
|
35
|
+
static is(bot) {
|
|
36
|
+
return (bot !== undefined &&
|
|
37
|
+
typeof bot.office_id === "string" &&
|
|
38
|
+
typeof bot.number === "string" &&
|
|
39
|
+
typeof bot.bot_id === "string" &&
|
|
40
|
+
typeof bot.name === "string" &&
|
|
41
|
+
typeof bot.active === "boolean" &&
|
|
42
|
+
is_state_id(bot.state_id) &&
|
|
43
|
+
(bot.district === undefined || typeof bot.district === "number") &&
|
|
44
|
+
is_party_id(bot.party_id) &&
|
|
45
|
+
typeof bot.tone_description_refresh === "boolean" &&
|
|
46
|
+
Array.isArray(bot.jurisdiction_ids) &&
|
|
47
|
+
bot.jurisdiction_ids.every((jurisdiction_id) => typeof jurisdiction_id === "number") &&
|
|
48
|
+
is_office_class_id(bot.office_class_id) &&
|
|
49
|
+
(bot.office_name === undefined || typeof bot.office_name === "string"));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export class BotAux extends Bot {
|
|
53
|
+
jurisdictions;
|
|
54
|
+
photo_download_url;
|
|
55
|
+
tone_description;
|
|
56
|
+
constructor(bot) {
|
|
57
|
+
if (!BotAux.is(bot)) {
|
|
58
|
+
throw Error("Invalid input.");
|
|
59
|
+
}
|
|
60
|
+
super(bot);
|
|
61
|
+
this.jurisdictions = bot.jurisdictions;
|
|
62
|
+
this.photo_download_url = bot.photo_download_url;
|
|
63
|
+
this.tone_description = bot.tone_description;
|
|
64
|
+
}
|
|
65
|
+
static is(bot) {
|
|
66
|
+
return (Bot.is(bot) &&
|
|
67
|
+
Array.isArray(bot.jurisdictions) &&
|
|
68
|
+
bot.jurisdictions.every(Jurisdiction.is) &&
|
|
69
|
+
(bot.photo_download_url === undefined || typeof bot.photo_download_url === "string") &&
|
|
70
|
+
(bot.tone_description === undefined || typeof bot.tone_description === "string"));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Tweet } from "./Tweet.js";
|
|
2
|
+
export declare class BotDocument {
|
|
3
|
+
readonly bot_id: string;
|
|
4
|
+
readonly document_id: string;
|
|
5
|
+
readonly type: "URL" | "TWEET" | "TWITTER";
|
|
6
|
+
readonly s3_filename?: string;
|
|
7
|
+
readonly url?: string;
|
|
8
|
+
readonly username?: string;
|
|
9
|
+
readonly vector_keys?: string[];
|
|
10
|
+
readonly tweet?: Tweet;
|
|
11
|
+
readonly text?: string;
|
|
12
|
+
constructor(bot_document: any);
|
|
13
|
+
static is(bot_document: any): bot_document is BotDocument;
|
|
14
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Tweet } from "./Tweet.js";
|
|
2
|
+
export class BotDocument {
|
|
3
|
+
bot_id;
|
|
4
|
+
document_id;
|
|
5
|
+
type;
|
|
6
|
+
s3_filename;
|
|
7
|
+
url;
|
|
8
|
+
username;
|
|
9
|
+
vector_keys;
|
|
10
|
+
tweet;
|
|
11
|
+
text;
|
|
12
|
+
constructor(bot_document) {
|
|
13
|
+
if (!BotDocument.is(bot_document)) {
|
|
14
|
+
throw Error("Invalid input.");
|
|
15
|
+
}
|
|
16
|
+
this.bot_id = bot_document.bot_id;
|
|
17
|
+
this.document_id = bot_document.document_id;
|
|
18
|
+
this.type = bot_document.type;
|
|
19
|
+
this.s3_filename = bot_document.s3_filename;
|
|
20
|
+
this.url = bot_document.url;
|
|
21
|
+
this.username = bot_document.username;
|
|
22
|
+
this.vector_keys = bot_document.vector_keys;
|
|
23
|
+
this.tweet = bot_document.tweet;
|
|
24
|
+
this.text = bot_document.text;
|
|
25
|
+
}
|
|
26
|
+
static is(bot_document) {
|
|
27
|
+
return (bot_document !== undefined &&
|
|
28
|
+
typeof bot_document.bot_id === "string" &&
|
|
29
|
+
typeof bot_document.document_id === "string" &&
|
|
30
|
+
typeof bot_document.type === "string" &&
|
|
31
|
+
(bot_document.s3_filename === undefined || typeof bot_document.s3_filename === "string") &&
|
|
32
|
+
(bot_document.url === undefined || typeof bot_document.url === "string") &&
|
|
33
|
+
(bot_document.username === undefined || typeof bot_document.username === "string") &&
|
|
34
|
+
(bot_document.vector_keys === undefined || Array.isArray(bot_document.vector_keys) && bot_document.vector_keys.every((vector_key) => typeof vector_key === "string")) &&
|
|
35
|
+
(bot_document.tweet === undefined || Tweet.is(bot_document.tweet)) &&
|
|
36
|
+
(bot_document.text === undefined || typeof bot_document.text === "string"));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Message } from "./Message.js";
|
|
2
|
+
export declare class Conversation {
|
|
3
|
+
readonly user_id: string;
|
|
4
|
+
readonly conversation_id: string;
|
|
5
|
+
readonly scout_id: string;
|
|
6
|
+
readonly time: string;
|
|
7
|
+
readonly [x: string]: any;
|
|
8
|
+
constructor(conversation: any);
|
|
9
|
+
static is(conversation: any): conversation is Conversation;
|
|
10
|
+
}
|
|
11
|
+
export declare class ConversationAux extends Conversation {
|
|
12
|
+
readonly messages: Message[];
|
|
13
|
+
readonly max_action_time: string;
|
|
14
|
+
constructor(conversation: any);
|
|
15
|
+
static is(conversation: any): conversation is ConversationAux;
|
|
16
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Message } from "./Message.js";
|
|
2
|
+
export class Conversation {
|
|
3
|
+
user_id;
|
|
4
|
+
conversation_id;
|
|
5
|
+
scout_id;
|
|
6
|
+
time;
|
|
7
|
+
constructor(conversation) {
|
|
8
|
+
if (!Conversation.is(conversation)) {
|
|
9
|
+
throw Error("Invalid input.");
|
|
10
|
+
}
|
|
11
|
+
this.user_id = conversation.user_id;
|
|
12
|
+
this.conversation_id = conversation.conversation_id;
|
|
13
|
+
this.scout_id = conversation.scout_id;
|
|
14
|
+
this.time = conversation.time;
|
|
15
|
+
}
|
|
16
|
+
static is(conversation) {
|
|
17
|
+
return (conversation !== undefined &&
|
|
18
|
+
typeof conversation.user_id === "string" &&
|
|
19
|
+
typeof conversation.conversation_id === "string" &&
|
|
20
|
+
typeof conversation.scout_id === "string" &&
|
|
21
|
+
typeof conversation.time === "string");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class ConversationAux extends Conversation {
|
|
25
|
+
messages;
|
|
26
|
+
max_action_time;
|
|
27
|
+
constructor(conversation) {
|
|
28
|
+
if (!ConversationAux.is(conversation)) {
|
|
29
|
+
throw Error("Invalid input.");
|
|
30
|
+
}
|
|
31
|
+
super(conversation);
|
|
32
|
+
this.messages = conversation.messages;
|
|
33
|
+
this.max_action_time = conversation.max_action_time;
|
|
34
|
+
}
|
|
35
|
+
static is(conversation) {
|
|
36
|
+
return (Conversation.is(conversation) &&
|
|
37
|
+
Array.isArray(conversation.messages) &&
|
|
38
|
+
conversation.messages.every(Message.is) &&
|
|
39
|
+
typeof conversation.max_action_time === "string");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const default_messages_by_status = {
|
|
2
|
+
400: "Bad Request",
|
|
3
|
+
401: "Unauthorized",
|
|
4
|
+
403: "Forbidden",
|
|
5
|
+
404: "Not Found",
|
|
6
|
+
405: "Method Not Allowed",
|
|
7
|
+
500: "Internal Server Error",
|
|
8
|
+
504: "Gateway Timeout",
|
|
9
|
+
600: "Failed to Parse Output"
|
|
10
|
+
};
|
|
11
|
+
export class DoersAPIError extends Error {
|
|
12
|
+
status;
|
|
13
|
+
constructor(status, message) {
|
|
14
|
+
const default_message = default_messages_by_status[status];
|
|
15
|
+
super(message !== undefined ? message : default_message !== undefined ? default_message : "Error");
|
|
16
|
+
this.name = "DoersAPIError";
|
|
17
|
+
this.status = status;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface DoersIQUtilsConfig {
|
|
2
|
+
region: string;
|
|
3
|
+
scraping_bee_api_key?: string;
|
|
4
|
+
xai_api_key?: string;
|
|
5
|
+
citizenportal_api_key?: string;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
export interface DoersIQConfig extends DoersIQUtilsConfig {
|
|
9
|
+
port: number;
|
|
10
|
+
api_url: string;
|
|
11
|
+
client_url: string;
|
|
12
|
+
auth_url: string;
|
|
13
|
+
cognito_user_pool_id: string;
|
|
14
|
+
cognito_client_id: string;
|
|
15
|
+
cognito_client_secret: string;
|
|
16
|
+
secret_key: string;
|
|
17
|
+
admin_key: string;
|
|
18
|
+
dynamodb_bots: string;
|
|
19
|
+
dynamodb_bot_documents: string;
|
|
20
|
+
dynamodb_conversations: string;
|
|
21
|
+
dynamodb_jurisdictions: string;
|
|
22
|
+
dynamodb_jurisdiction_documents: string;
|
|
23
|
+
dynamodb_messages: string;
|
|
24
|
+
dynamodb_users: string;
|
|
25
|
+
s3_bucket: string;
|
|
26
|
+
s3vectors_bucket: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare enum JurisdictionLevel {
|
|
2
|
+
OTHER = 0,
|
|
3
|
+
NATION = 1,
|
|
4
|
+
STATE = 2,
|
|
5
|
+
COUNTY = 3,
|
|
6
|
+
CITY = 4,
|
|
7
|
+
SCHOOL = 5
|
|
8
|
+
}
|
|
9
|
+
export declare function is_jurisdiction_level(jurisdiction_level: any): jurisdiction_level is JurisdictionLevel;
|
|
10
|
+
export declare class Jurisdiction {
|
|
11
|
+
readonly jurisdiction_id: number;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly path: number[];
|
|
14
|
+
readonly sub_jurisdiction_ids: number[];
|
|
15
|
+
readonly super_jurisdiction_id?: number;
|
|
16
|
+
readonly level: JurisdictionLevel;
|
|
17
|
+
readonly state_jurisdiction_id?: number;
|
|
18
|
+
readonly county_jurisdiction_id?: number;
|
|
19
|
+
readonly city_jurisdiction_id?: number;
|
|
20
|
+
readonly school_jurisdiction_id?: number;
|
|
21
|
+
readonly geographic: boolean;
|
|
22
|
+
constructor(jurisdiction: any);
|
|
23
|
+
static is(jurisdiction: any): jurisdiction is Jurisdiction;
|
|
24
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export var JurisdictionLevel;
|
|
2
|
+
(function (JurisdictionLevel) {
|
|
3
|
+
JurisdictionLevel[JurisdictionLevel["OTHER"] = 0] = "OTHER";
|
|
4
|
+
JurisdictionLevel[JurisdictionLevel["NATION"] = 1] = "NATION";
|
|
5
|
+
JurisdictionLevel[JurisdictionLevel["STATE"] = 2] = "STATE";
|
|
6
|
+
JurisdictionLevel[JurisdictionLevel["COUNTY"] = 3] = "COUNTY";
|
|
7
|
+
JurisdictionLevel[JurisdictionLevel["CITY"] = 4] = "CITY";
|
|
8
|
+
JurisdictionLevel[JurisdictionLevel["SCHOOL"] = 5] = "SCHOOL";
|
|
9
|
+
})(JurisdictionLevel || (JurisdictionLevel = {}));
|
|
10
|
+
export function is_jurisdiction_level(jurisdiction_level) {
|
|
11
|
+
return [0, 1, 2, 3, 4, 5].includes(jurisdiction_level);
|
|
12
|
+
}
|
|
13
|
+
export class Jurisdiction {
|
|
14
|
+
jurisdiction_id;
|
|
15
|
+
name;
|
|
16
|
+
path;
|
|
17
|
+
sub_jurisdiction_ids;
|
|
18
|
+
super_jurisdiction_id;
|
|
19
|
+
level;
|
|
20
|
+
state_jurisdiction_id;
|
|
21
|
+
county_jurisdiction_id;
|
|
22
|
+
city_jurisdiction_id;
|
|
23
|
+
school_jurisdiction_id;
|
|
24
|
+
geographic;
|
|
25
|
+
constructor(jurisdiction) {
|
|
26
|
+
if (!Jurisdiction.is(jurisdiction)) {
|
|
27
|
+
throw Error("Invalid input.");
|
|
28
|
+
}
|
|
29
|
+
this.jurisdiction_id = jurisdiction.jurisdiction_id;
|
|
30
|
+
this.name = jurisdiction.name;
|
|
31
|
+
this.path = jurisdiction.path;
|
|
32
|
+
this.sub_jurisdiction_ids = jurisdiction.sub_jurisdiction_ids;
|
|
33
|
+
this.super_jurisdiction_id = jurisdiction.super_jurisdiction_id;
|
|
34
|
+
this.level = jurisdiction.level;
|
|
35
|
+
this.state_jurisdiction_id = jurisdiction.state_jurisdiction_id;
|
|
36
|
+
this.county_jurisdiction_id = jurisdiction.county_jurisdiction_id;
|
|
37
|
+
this.city_jurisdiction_id = jurisdiction.city_jurisdiction_id;
|
|
38
|
+
this.school_jurisdiction_id = jurisdiction.school_jurisdiction_id;
|
|
39
|
+
this.geographic = jurisdiction.geographic;
|
|
40
|
+
}
|
|
41
|
+
static is(jurisdiction) {
|
|
42
|
+
return (jurisdiction !== undefined &&
|
|
43
|
+
typeof jurisdiction.jurisdiction_id === "number" &&
|
|
44
|
+
typeof jurisdiction.name === "string" &&
|
|
45
|
+
Array.isArray(jurisdiction.path) &&
|
|
46
|
+
jurisdiction.path.every((jurisdiction_id) => typeof jurisdiction_id === "number") &&
|
|
47
|
+
Array.isArray(jurisdiction.sub_jurisdiction_ids) &&
|
|
48
|
+
jurisdiction.sub_jurisdiction_ids.every((jurisdiction_id) => typeof jurisdiction_id === "number") &&
|
|
49
|
+
is_jurisdiction_level(jurisdiction.level) &&
|
|
50
|
+
typeof jurisdiction.geographic === "boolean" &&
|
|
51
|
+
(jurisdiction.super_jurisdiction_id === undefined || typeof jurisdiction.super_jurisdiction_id === "number") &&
|
|
52
|
+
(jurisdiction.state_jurisdiction_id === undefined || typeof jurisdiction.state_jurisdiction_id === "number") &&
|
|
53
|
+
(jurisdiction.county_jurisdiction_id === undefined || typeof jurisdiction.county_jurisdiction_id === "number") &&
|
|
54
|
+
(jurisdiction.city_jurisdiction_id === undefined || typeof jurisdiction.city_jurisdiction_id === "number") &&
|
|
55
|
+
(jurisdiction.school_jurisdiction_id === undefined || typeof jurisdiction.school_jurisdiction_id === "number"));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class JurisdictionDocument {
|
|
2
|
+
readonly jurisdiction_id: number;
|
|
3
|
+
readonly document_id: string;
|
|
4
|
+
readonly media_id: string;
|
|
5
|
+
readonly origin: string;
|
|
6
|
+
readonly s3_filename?: string;
|
|
7
|
+
readonly time?: string;
|
|
8
|
+
readonly title: string;
|
|
9
|
+
readonly type: string;
|
|
10
|
+
readonly url: string;
|
|
11
|
+
readonly vector_keys?: string[];
|
|
12
|
+
readonly location?: string;
|
|
13
|
+
constructor(jurisdiction_document: any);
|
|
14
|
+
static is(jurisdiction_document: any): jurisdiction_document is JurisdictionDocument;
|
|
15
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export class JurisdictionDocument {
|
|
2
|
+
jurisdiction_id;
|
|
3
|
+
document_id;
|
|
4
|
+
media_id;
|
|
5
|
+
origin;
|
|
6
|
+
s3_filename;
|
|
7
|
+
time;
|
|
8
|
+
title;
|
|
9
|
+
type;
|
|
10
|
+
url;
|
|
11
|
+
vector_keys;
|
|
12
|
+
location;
|
|
13
|
+
constructor(jurisdiction_document) {
|
|
14
|
+
if (!JurisdictionDocument.is(jurisdiction_document)) {
|
|
15
|
+
throw Error("Invalid input.");
|
|
16
|
+
}
|
|
17
|
+
this.jurisdiction_id = jurisdiction_document.jurisdiction_id;
|
|
18
|
+
this.document_id = jurisdiction_document.document_id;
|
|
19
|
+
this.media_id = jurisdiction_document.media_id;
|
|
20
|
+
this.origin = jurisdiction_document.origin;
|
|
21
|
+
this.s3_filename = jurisdiction_document.s3_filename;
|
|
22
|
+
this.time = jurisdiction_document.time;
|
|
23
|
+
this.title = jurisdiction_document.title;
|
|
24
|
+
this.type = jurisdiction_document.type;
|
|
25
|
+
this.url = jurisdiction_document.url;
|
|
26
|
+
this.vector_keys = jurisdiction_document.vector_keys;
|
|
27
|
+
this.location = jurisdiction_document.location;
|
|
28
|
+
}
|
|
29
|
+
static is(jurisdiction_document) {
|
|
30
|
+
return (jurisdiction_document !== undefined &&
|
|
31
|
+
typeof jurisdiction_document.jurisdiction_id === "number" &&
|
|
32
|
+
typeof jurisdiction_document.document_id === "string" &&
|
|
33
|
+
typeof jurisdiction_document.media_id === "string" &&
|
|
34
|
+
typeof jurisdiction_document.origin === "string" &&
|
|
35
|
+
(jurisdiction_document.s3_filename === undefined || typeof jurisdiction_document.s3_filename === "string") &&
|
|
36
|
+
(jurisdiction_document.time === undefined || typeof jurisdiction_document.time === "string") &&
|
|
37
|
+
typeof jurisdiction_document.title === "string" &&
|
|
38
|
+
typeof jurisdiction_document.type === "string" &&
|
|
39
|
+
typeof jurisdiction_document.url === "string" &&
|
|
40
|
+
(jurisdiction_document.vector_keys === undefined || Array.isArray(jurisdiction_document.vector_keys) &&
|
|
41
|
+
jurisdiction_document.vector_keys.every((vector_key) => typeof vector_key === "string")) &&
|
|
42
|
+
(jurisdiction_document.location === undefined || typeof jurisdiction_document.location === "string"));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Sources } from "./Sources.js";
|
|
2
|
+
export declare class Fragment {
|
|
3
|
+
readonly text: string;
|
|
4
|
+
readonly sources: Sources;
|
|
5
|
+
constructor(fragment: any);
|
|
6
|
+
static is(fragment: any): fragment is Fragment;
|
|
7
|
+
}
|
|
8
|
+
export declare class Message {
|
|
9
|
+
readonly user_id: string;
|
|
10
|
+
readonly message_id: string;
|
|
11
|
+
readonly scout_id: string;
|
|
12
|
+
readonly conversation_id: string;
|
|
13
|
+
readonly time: string;
|
|
14
|
+
readonly mode: "chat" | "write";
|
|
15
|
+
readonly role: "user" | "scout";
|
|
16
|
+
readonly system_prompt?: string;
|
|
17
|
+
readonly grok_text?: string;
|
|
18
|
+
readonly fragments?: Fragment[];
|
|
19
|
+
readonly sources?: Sources;
|
|
20
|
+
readonly text: string;
|
|
21
|
+
constructor(message: any);
|
|
22
|
+
static is(message: any): message is Message;
|
|
23
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Sources } from "./Sources.js";
|
|
2
|
+
export class Fragment {
|
|
3
|
+
text;
|
|
4
|
+
sources;
|
|
5
|
+
constructor(fragment) {
|
|
6
|
+
if (!Fragment.is(fragment)) {
|
|
7
|
+
throw Error("Invalid input.");
|
|
8
|
+
}
|
|
9
|
+
this.text = fragment.text;
|
|
10
|
+
this.sources = fragment.sources;
|
|
11
|
+
}
|
|
12
|
+
static is(fragment) {
|
|
13
|
+
return (fragment !== undefined &&
|
|
14
|
+
typeof fragment.text === "string" &&
|
|
15
|
+
Sources.is(fragment.sources));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class Message {
|
|
19
|
+
user_id;
|
|
20
|
+
message_id;
|
|
21
|
+
scout_id;
|
|
22
|
+
conversation_id;
|
|
23
|
+
time;
|
|
24
|
+
mode;
|
|
25
|
+
role;
|
|
26
|
+
system_prompt;
|
|
27
|
+
grok_text;
|
|
28
|
+
fragments;
|
|
29
|
+
sources;
|
|
30
|
+
text;
|
|
31
|
+
constructor(message) {
|
|
32
|
+
if (!Message.is(message)) {
|
|
33
|
+
throw Error("Invalid input.");
|
|
34
|
+
}
|
|
35
|
+
this.user_id = message.user_id;
|
|
36
|
+
this.message_id = message.message_id;
|
|
37
|
+
this.scout_id = message.scout_id;
|
|
38
|
+
this.conversation_id = message.conversation_id;
|
|
39
|
+
this.time = message.time;
|
|
40
|
+
this.mode = message.mode;
|
|
41
|
+
this.role = message.role;
|
|
42
|
+
this.system_prompt = message.system_prompt;
|
|
43
|
+
this.grok_text = message.grok_text;
|
|
44
|
+
this.fragments = message.fragments;
|
|
45
|
+
this.sources = message.sources;
|
|
46
|
+
this.text = message.text;
|
|
47
|
+
}
|
|
48
|
+
static is(message) {
|
|
49
|
+
return (message !== undefined &&
|
|
50
|
+
typeof message.user_id === "string" &&
|
|
51
|
+
typeof message.message_id === "string" &&
|
|
52
|
+
typeof message.scout_id === "string" &&
|
|
53
|
+
typeof message.conversation_id === "string" &&
|
|
54
|
+
typeof message.time === "string" &&
|
|
55
|
+
["chat", "write"].includes(message.mode) &&
|
|
56
|
+
["user", "scout"].includes(message.role) &&
|
|
57
|
+
(message.system_prompt === undefined || typeof message.system_prompt === "string") &&
|
|
58
|
+
(message.grok_text === undefined || typeof message.grok_text === "string") &&
|
|
59
|
+
(message.fragments === undefined || Array.isArray(message.fragments) && message.fragments.every(Fragment.is)) &&
|
|
60
|
+
(message.sources === undefined || Sources.is(message.sources)) &&
|
|
61
|
+
typeof message.text === "string");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { JurisdictionLevel } from "./Jurisdiction.js";
|
|
2
|
+
declare const office_class_ids: readonly ["ORG", "USH", "USS", "STG", "STH", "STS", "STB", "COG", "CIG", "LOB"];
|
|
3
|
+
export type OfficeClassID = typeof office_class_ids[number];
|
|
4
|
+
export declare function is_office_class_id(office_class_id: any): office_class_id is OfficeClassID;
|
|
5
|
+
export interface OfficeClass {
|
|
6
|
+
office_class_id: OfficeClassID;
|
|
7
|
+
name: string;
|
|
8
|
+
type: "candidate" | "organization";
|
|
9
|
+
office_id_template: string;
|
|
10
|
+
jurisdiction_level?: JurisdictionLevel;
|
|
11
|
+
jurisdictions_mutable: Boolean;
|
|
12
|
+
require_district: Boolean;
|
|
13
|
+
require_initial_jurisdiction: Boolean;
|
|
14
|
+
office_names?: string[];
|
|
15
|
+
}
|
|
16
|
+
export declare const office_classes_by_office_class_id: Record<OfficeClassID, OfficeClass>;
|
|
17
|
+
export {};
|