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,132 @@
|
|
|
1
|
+
import { JurisdictionLevel } from "./Jurisdiction.js";
|
|
2
|
+
const office_class_ids = ["ORG", "USH", "USS", "STG", "STH", "STS", "STB", "COG", "CIG", "LOB"];
|
|
3
|
+
export function is_office_class_id(office_class_id) {
|
|
4
|
+
return office_class_ids.includes(office_class_id);
|
|
5
|
+
}
|
|
6
|
+
export const office_classes_by_office_class_id = {
|
|
7
|
+
"ORG": {
|
|
8
|
+
office_class_id: "ORG",
|
|
9
|
+
name: "Organization",
|
|
10
|
+
type: "organization",
|
|
11
|
+
office_id_template: "O-[state_id]",
|
|
12
|
+
jurisdictions_mutable: true,
|
|
13
|
+
require_district: false,
|
|
14
|
+
require_initial_jurisdiction: false
|
|
15
|
+
},
|
|
16
|
+
"USH": {
|
|
17
|
+
office_class_id: "USH",
|
|
18
|
+
name: "U.S. House",
|
|
19
|
+
type: "candidate",
|
|
20
|
+
office_id_template: "H-[state_id]",
|
|
21
|
+
jurisdictions_mutable: true,
|
|
22
|
+
require_district: true,
|
|
23
|
+
require_initial_jurisdiction: false
|
|
24
|
+
},
|
|
25
|
+
"USS": {
|
|
26
|
+
office_class_id: "USS",
|
|
27
|
+
name: "U.S. Senate",
|
|
28
|
+
type: "candidate",
|
|
29
|
+
office_id_template: "S-[state_id]",
|
|
30
|
+
jurisdiction_level: JurisdictionLevel.STATE,
|
|
31
|
+
jurisdictions_mutable: false,
|
|
32
|
+
require_district: false,
|
|
33
|
+
require_initial_jurisdiction: false
|
|
34
|
+
},
|
|
35
|
+
"STG": {
|
|
36
|
+
office_class_id: "STG",
|
|
37
|
+
name: "State (Executive) Government",
|
|
38
|
+
type: "candidate",
|
|
39
|
+
office_id_template: "[state_id]-G",
|
|
40
|
+
jurisdiction_level: JurisdictionLevel.STATE,
|
|
41
|
+
jurisdictions_mutable: false,
|
|
42
|
+
require_district: false,
|
|
43
|
+
require_initial_jurisdiction: false,
|
|
44
|
+
office_names: [
|
|
45
|
+
"Governor",
|
|
46
|
+
"Lieutenant Governor",
|
|
47
|
+
"Secretary of State",
|
|
48
|
+
"Treasurer",
|
|
49
|
+
"Auditor",
|
|
50
|
+
"Attorney General"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"STH": {
|
|
54
|
+
office_class_id: "STH",
|
|
55
|
+
name: "State House",
|
|
56
|
+
type: "candidate",
|
|
57
|
+
office_id_template: "[state_id]-H",
|
|
58
|
+
jurisdictions_mutable: true,
|
|
59
|
+
require_district: true,
|
|
60
|
+
require_initial_jurisdiction: false
|
|
61
|
+
},
|
|
62
|
+
"STS": {
|
|
63
|
+
office_class_id: "STS",
|
|
64
|
+
name: "State Senate",
|
|
65
|
+
type: "candidate",
|
|
66
|
+
office_id_template: "[state_id]-S",
|
|
67
|
+
jurisdictions_mutable: true,
|
|
68
|
+
require_district: true,
|
|
69
|
+
require_initial_jurisdiction: false
|
|
70
|
+
},
|
|
71
|
+
"STB": {
|
|
72
|
+
office_class_id: "STB",
|
|
73
|
+
name: "State School Board",
|
|
74
|
+
type: "candidate",
|
|
75
|
+
office_id_template: "[state_id]-B",
|
|
76
|
+
jurisdiction_level: JurisdictionLevel.SCHOOL,
|
|
77
|
+
jurisdictions_mutable: true,
|
|
78
|
+
require_district: true,
|
|
79
|
+
require_initial_jurisdiction: true,
|
|
80
|
+
office_names: [
|
|
81
|
+
"Board Member"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"COG": {
|
|
85
|
+
office_class_id: "COG",
|
|
86
|
+
name: "County Government",
|
|
87
|
+
type: "candidate",
|
|
88
|
+
office_id_template: "[state_id]-C",
|
|
89
|
+
jurisdiction_level: JurisdictionLevel.COUNTY,
|
|
90
|
+
jurisdictions_mutable: true,
|
|
91
|
+
require_district: false,
|
|
92
|
+
require_initial_jurisdiction: true,
|
|
93
|
+
office_names: [
|
|
94
|
+
"Mayor",
|
|
95
|
+
"Councillor",
|
|
96
|
+
"Commissioner",
|
|
97
|
+
"Clerk",
|
|
98
|
+
"Recorder",
|
|
99
|
+
"Auditor",
|
|
100
|
+
"Surveyor",
|
|
101
|
+
"District Attorney",
|
|
102
|
+
"Sheriff"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
"CIG": {
|
|
106
|
+
office_class_id: "CIG",
|
|
107
|
+
name: "City Government",
|
|
108
|
+
type: "candidate",
|
|
109
|
+
office_id_template: "[state_id]-M",
|
|
110
|
+
jurisdiction_level: JurisdictionLevel.CITY,
|
|
111
|
+
jurisdictions_mutable: true,
|
|
112
|
+
require_district: false,
|
|
113
|
+
require_initial_jurisdiction: true,
|
|
114
|
+
office_names: [
|
|
115
|
+
"Mayor",
|
|
116
|
+
"Councillor"
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
"LOB": {
|
|
120
|
+
office_class_id: "LOB",
|
|
121
|
+
name: "Local School Board",
|
|
122
|
+
type: "candidate",
|
|
123
|
+
office_id_template: "[state_id]-E",
|
|
124
|
+
jurisdiction_level: JurisdictionLevel.SCHOOL,
|
|
125
|
+
jurisdictions_mutable: true,
|
|
126
|
+
require_district: false,
|
|
127
|
+
require_initial_jurisdiction: true,
|
|
128
|
+
office_names: [
|
|
129
|
+
"Board Member"
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const party_ids: readonly ["DEM", "REP", "NON", "ETC"];
|
|
2
|
+
export type PartyID = typeof party_ids[number];
|
|
3
|
+
export declare function is_party_id(party_id: any): party_id is PartyID;
|
|
4
|
+
export interface Party {
|
|
5
|
+
party_id: PartyID;
|
|
6
|
+
name: string;
|
|
7
|
+
adjective: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const parties_by_party_id: Record<PartyID, Party>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const party_ids = ["DEM", "REP", "NON", "ETC"];
|
|
2
|
+
export function is_party_id(party_id) {
|
|
3
|
+
return party_ids.includes(party_id);
|
|
4
|
+
}
|
|
5
|
+
export const parties_by_party_id = {
|
|
6
|
+
DEM: {
|
|
7
|
+
party_id: "DEM",
|
|
8
|
+
name: "Democratic Party",
|
|
9
|
+
adjective: "Democratic"
|
|
10
|
+
},
|
|
11
|
+
REP: {
|
|
12
|
+
party_id: "REP",
|
|
13
|
+
name: "Republican Party",
|
|
14
|
+
adjective: "Republican"
|
|
15
|
+
},
|
|
16
|
+
ETC: {
|
|
17
|
+
party_id: "ETC",
|
|
18
|
+
name: "Other Party",
|
|
19
|
+
adjective: "Third-Party"
|
|
20
|
+
},
|
|
21
|
+
NON: {
|
|
22
|
+
party_id: "NON",
|
|
23
|
+
name: "Nonpartisan",
|
|
24
|
+
adjective: "Nonpartisan"
|
|
25
|
+
}
|
|
26
|
+
};
|
|
@@ -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 Scout {
|
|
6
|
+
readonly office_id: string;
|
|
7
|
+
readonly number: string;
|
|
8
|
+
readonly scout_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(scout: any);
|
|
20
|
+
static is(scout: any): scout is Scout;
|
|
21
|
+
}
|
|
22
|
+
export declare class ScoutAux extends Scout {
|
|
23
|
+
readonly jurisdictions: Jurisdiction[];
|
|
24
|
+
readonly photo_download_url?: string;
|
|
25
|
+
readonly tone_description?: string;
|
|
26
|
+
constructor(scout: any);
|
|
27
|
+
static is(scout: any): scout is ScoutAux;
|
|
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 Scout {
|
|
6
|
+
office_id;
|
|
7
|
+
number;
|
|
8
|
+
scout_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(scout) {
|
|
19
|
+
if (!Scout.is(scout)) {
|
|
20
|
+
throw Error("Invalid input.");
|
|
21
|
+
}
|
|
22
|
+
this.office_id = scout.office_id;
|
|
23
|
+
this.number = scout.number;
|
|
24
|
+
this.scout_id = scout.scout_id;
|
|
25
|
+
this.name = scout.name;
|
|
26
|
+
this.active = scout.active;
|
|
27
|
+
this.state_id = scout.state_id;
|
|
28
|
+
this.district = scout.district;
|
|
29
|
+
this.party_id = scout.party_id;
|
|
30
|
+
this.tone_description_refresh = scout.tone_description_refresh;
|
|
31
|
+
this.jurisdiction_ids = scout.jurisdiction_ids;
|
|
32
|
+
this.office_class_id = scout.office_class_id;
|
|
33
|
+
this.office_name = scout.office_name;
|
|
34
|
+
}
|
|
35
|
+
static is(scout) {
|
|
36
|
+
return (scout !== undefined &&
|
|
37
|
+
typeof scout.office_id === "string" &&
|
|
38
|
+
typeof scout.number === "string" &&
|
|
39
|
+
typeof scout.scout_id === "string" &&
|
|
40
|
+
typeof scout.name === "string" &&
|
|
41
|
+
typeof scout.active === "boolean" &&
|
|
42
|
+
is_state_id(scout.state_id) &&
|
|
43
|
+
(scout.district === undefined || typeof scout.district === "number") &&
|
|
44
|
+
is_party_id(scout.party_id) &&
|
|
45
|
+
typeof scout.tone_description_refresh === "boolean" &&
|
|
46
|
+
Array.isArray(scout.jurisdiction_ids) &&
|
|
47
|
+
scout.jurisdiction_ids.every((jurisdiction_id) => typeof jurisdiction_id === "number") &&
|
|
48
|
+
is_office_class_id(scout.office_class_id) &&
|
|
49
|
+
(scout.office_name === undefined || typeof scout.office_name === "string"));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export class ScoutAux extends Scout {
|
|
53
|
+
jurisdictions;
|
|
54
|
+
photo_download_url;
|
|
55
|
+
tone_description;
|
|
56
|
+
constructor(scout) {
|
|
57
|
+
if (!ScoutAux.is(scout)) {
|
|
58
|
+
throw Error("Invalid input.");
|
|
59
|
+
}
|
|
60
|
+
super(scout);
|
|
61
|
+
this.jurisdictions = scout.jurisdictions;
|
|
62
|
+
this.photo_download_url = scout.photo_download_url;
|
|
63
|
+
this.tone_description = scout.tone_description;
|
|
64
|
+
}
|
|
65
|
+
static is(scout) {
|
|
66
|
+
return (Scout.is(scout) &&
|
|
67
|
+
Array.isArray(scout.jurisdictions) &&
|
|
68
|
+
scout.jurisdictions.every(Jurisdiction.is) &&
|
|
69
|
+
(scout.photo_download_url === undefined || typeof scout.photo_download_url === "string") &&
|
|
70
|
+
(scout.tone_description === undefined || typeof scout.tone_description === "string"));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ScoutUtilsConfig {
|
|
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 ScoutConfig extends ScoutUtilsConfig {
|
|
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_scouts: string;
|
|
19
|
+
dynamodb_scout_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,14 @@
|
|
|
1
|
+
import { Tweet } from "./Tweet.js";
|
|
2
|
+
export declare class ScoutDocument {
|
|
3
|
+
readonly scout_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(scout_document: any);
|
|
13
|
+
static is(scout_document: any): scout_document is ScoutDocument;
|
|
14
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Tweet } from "./Tweet.js";
|
|
2
|
+
export class ScoutDocument {
|
|
3
|
+
scout_id;
|
|
4
|
+
document_id;
|
|
5
|
+
type;
|
|
6
|
+
s3_filename;
|
|
7
|
+
url;
|
|
8
|
+
username;
|
|
9
|
+
vector_keys;
|
|
10
|
+
tweet;
|
|
11
|
+
text;
|
|
12
|
+
constructor(scout_document) {
|
|
13
|
+
if (!ScoutDocument.is(scout_document)) {
|
|
14
|
+
throw Error("Invalid input.");
|
|
15
|
+
}
|
|
16
|
+
this.scout_id = scout_document.scout_id;
|
|
17
|
+
this.document_id = scout_document.document_id;
|
|
18
|
+
this.type = scout_document.type;
|
|
19
|
+
this.s3_filename = scout_document.s3_filename;
|
|
20
|
+
this.url = scout_document.url;
|
|
21
|
+
this.username = scout_document.username;
|
|
22
|
+
this.vector_keys = scout_document.vector_keys;
|
|
23
|
+
this.tweet = scout_document.tweet;
|
|
24
|
+
this.text = scout_document.text;
|
|
25
|
+
}
|
|
26
|
+
static is(scout_document) {
|
|
27
|
+
return (scout_document !== undefined &&
|
|
28
|
+
typeof scout_document.scout_id === "string" &&
|
|
29
|
+
typeof scout_document.document_id === "string" &&
|
|
30
|
+
typeof scout_document.type === "string" &&
|
|
31
|
+
(scout_document.s3_filename === undefined || typeof scout_document.s3_filename === "string") &&
|
|
32
|
+
(scout_document.url === undefined || typeof scout_document.url === "string") &&
|
|
33
|
+
(scout_document.username === undefined || typeof scout_document.username === "string") &&
|
|
34
|
+
(scout_document.vector_keys === undefined || Array.isArray(scout_document.vector_keys) && scout_document.vector_keys.every((vector_key) => typeof vector_key === "string")) &&
|
|
35
|
+
(scout_document.tweet === undefined || Tweet.is(scout_document.tweet)) &&
|
|
36
|
+
(scout_document.text === undefined || typeof scout_document.text === "string"));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ScoutDocument } from "./ScoutDocument.js";
|
|
2
|
+
import { JurisdictionDocument } from "./JurisdictionDocument.js";
|
|
3
|
+
import { Bill } from "./Bill.js";
|
|
4
|
+
export declare class ScoutDocumentSource {
|
|
5
|
+
readonly chunk_text: string;
|
|
6
|
+
readonly description: string;
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly type: string;
|
|
9
|
+
readonly vector_key: string;
|
|
10
|
+
readonly document: ScoutDocument;
|
|
11
|
+
constructor(scout_document_source: any);
|
|
12
|
+
static is(scout_document_source: any): scout_document_source is ScoutDocumentSource;
|
|
13
|
+
}
|
|
14
|
+
export declare class JurisdictionDocumentSource {
|
|
15
|
+
readonly chunk_text: string;
|
|
16
|
+
readonly description: string;
|
|
17
|
+
readonly label: string;
|
|
18
|
+
readonly type: string;
|
|
19
|
+
readonly vector_key: string;
|
|
20
|
+
readonly document: JurisdictionDocument;
|
|
21
|
+
constructor(jurisdiction_document_source: any);
|
|
22
|
+
static is(jurisdiction_document_source: any): jurisdiction_document_source is JurisdictionDocumentSource;
|
|
23
|
+
}
|
|
24
|
+
export declare class BillDocumentSource {
|
|
25
|
+
readonly chunk_text: string;
|
|
26
|
+
readonly description: string;
|
|
27
|
+
readonly label: string;
|
|
28
|
+
readonly type: string;
|
|
29
|
+
readonly vector_key: string;
|
|
30
|
+
readonly bill: Bill;
|
|
31
|
+
constructor(bill_document_source: any);
|
|
32
|
+
static is(bill_document_source: any): bill_document_source is BillDocumentSource;
|
|
33
|
+
}
|
|
34
|
+
export declare class GrokSource {
|
|
35
|
+
readonly title: string;
|
|
36
|
+
readonly url: string;
|
|
37
|
+
readonly start_index: number;
|
|
38
|
+
readonly end_index: number;
|
|
39
|
+
readonly type: string;
|
|
40
|
+
constructor(grok_source: any);
|
|
41
|
+
static is(grok_source: any): grok_source is GrokSource;
|
|
42
|
+
}
|
|
43
|
+
export declare class Sources {
|
|
44
|
+
readonly B: BillDocumentSource[];
|
|
45
|
+
readonly S: ScoutDocumentSource[];
|
|
46
|
+
readonly J: JurisdictionDocumentSource[];
|
|
47
|
+
readonly G: GrokSource[];
|
|
48
|
+
constructor(sources: any);
|
|
49
|
+
static is(sources: any): sources is Sources;
|
|
50
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { ScoutDocument } from "./ScoutDocument.js";
|
|
2
|
+
import { JurisdictionDocument } from "./JurisdictionDocument.js";
|
|
3
|
+
import { Bill } from "./Bill.js";
|
|
4
|
+
export class ScoutDocumentSource {
|
|
5
|
+
chunk_text;
|
|
6
|
+
description;
|
|
7
|
+
label;
|
|
8
|
+
type;
|
|
9
|
+
vector_key;
|
|
10
|
+
document;
|
|
11
|
+
constructor(scout_document_source) {
|
|
12
|
+
if (!ScoutDocumentSource.is(scout_document_source)) {
|
|
13
|
+
throw Error("Invalid input.");
|
|
14
|
+
}
|
|
15
|
+
this.chunk_text = scout_document_source.chunk_text;
|
|
16
|
+
this.description = scout_document_source.description;
|
|
17
|
+
this.label = scout_document_source.label;
|
|
18
|
+
this.type = scout_document_source.type;
|
|
19
|
+
this.vector_key = scout_document_source.vector_key;
|
|
20
|
+
this.document = scout_document_source.document;
|
|
21
|
+
}
|
|
22
|
+
static is(scout_document_source) {
|
|
23
|
+
return (scout_document_source !== undefined &&
|
|
24
|
+
typeof scout_document_source.chunk_text === "string" &&
|
|
25
|
+
typeof scout_document_source.description === "string" &&
|
|
26
|
+
typeof scout_document_source.label === "string" &&
|
|
27
|
+
typeof scout_document_source.type === "string" &&
|
|
28
|
+
typeof scout_document_source.vector_key === "string" &&
|
|
29
|
+
ScoutDocument.is(scout_document_source.document));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export class JurisdictionDocumentSource {
|
|
33
|
+
chunk_text;
|
|
34
|
+
description;
|
|
35
|
+
label;
|
|
36
|
+
type;
|
|
37
|
+
vector_key;
|
|
38
|
+
document;
|
|
39
|
+
constructor(jurisdiction_document_source) {
|
|
40
|
+
if (!JurisdictionDocumentSource.is(jurisdiction_document_source)) {
|
|
41
|
+
throw Error("Invalid input.");
|
|
42
|
+
}
|
|
43
|
+
this.chunk_text = jurisdiction_document_source.chunk_text;
|
|
44
|
+
this.description = jurisdiction_document_source.description;
|
|
45
|
+
this.label = jurisdiction_document_source.label;
|
|
46
|
+
this.type = jurisdiction_document_source.type;
|
|
47
|
+
this.vector_key = jurisdiction_document_source.vector_key;
|
|
48
|
+
this.document = jurisdiction_document_source.document;
|
|
49
|
+
}
|
|
50
|
+
static is(jurisdiction_document_source) {
|
|
51
|
+
return (jurisdiction_document_source !== undefined &&
|
|
52
|
+
typeof jurisdiction_document_source.chunk_text === "string" &&
|
|
53
|
+
typeof jurisdiction_document_source.description === "string" &&
|
|
54
|
+
typeof jurisdiction_document_source.label === "string" &&
|
|
55
|
+
typeof jurisdiction_document_source.type === "string" &&
|
|
56
|
+
typeof jurisdiction_document_source.vector_key === "string" &&
|
|
57
|
+
JurisdictionDocument.is(jurisdiction_document_source.document));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export class BillDocumentSource {
|
|
61
|
+
chunk_text;
|
|
62
|
+
description;
|
|
63
|
+
label;
|
|
64
|
+
type;
|
|
65
|
+
vector_key;
|
|
66
|
+
bill;
|
|
67
|
+
constructor(bill_document_source) {
|
|
68
|
+
if (!BillDocumentSource.is(bill_document_source)) {
|
|
69
|
+
throw Error("Invalid input.");
|
|
70
|
+
}
|
|
71
|
+
this.chunk_text = bill_document_source.chunk_text;
|
|
72
|
+
this.description = bill_document_source.description;
|
|
73
|
+
this.label = bill_document_source.label;
|
|
74
|
+
this.type = bill_document_source.type;
|
|
75
|
+
this.vector_key = bill_document_source.vector_key;
|
|
76
|
+
this.bill = bill_document_source.bill;
|
|
77
|
+
}
|
|
78
|
+
static is(bill_document_source) {
|
|
79
|
+
return (bill_document_source !== undefined &&
|
|
80
|
+
typeof bill_document_source.chunk_text === "string" &&
|
|
81
|
+
typeof bill_document_source.description === "string" &&
|
|
82
|
+
typeof bill_document_source.label === "string" &&
|
|
83
|
+
typeof bill_document_source.type === "string" &&
|
|
84
|
+
typeof bill_document_source.vector_key === "string" &&
|
|
85
|
+
Bill.is(bill_document_source.bill));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export class GrokSource {
|
|
89
|
+
title;
|
|
90
|
+
url;
|
|
91
|
+
start_index;
|
|
92
|
+
end_index;
|
|
93
|
+
type;
|
|
94
|
+
constructor(grok_source) {
|
|
95
|
+
if (!GrokSource.is(grok_source)) {
|
|
96
|
+
throw Error("Invalid input.");
|
|
97
|
+
}
|
|
98
|
+
this.title = grok_source.title;
|
|
99
|
+
this.url = grok_source.url;
|
|
100
|
+
this.start_index = grok_source.start_index;
|
|
101
|
+
this.end_index = grok_source.end_index;
|
|
102
|
+
this.type = grok_source.type;
|
|
103
|
+
}
|
|
104
|
+
static is(grok_source) {
|
|
105
|
+
return (grok_source !== undefined &&
|
|
106
|
+
typeof grok_source.title === "string" &&
|
|
107
|
+
typeof grok_source.url === "string" &&
|
|
108
|
+
typeof grok_source.start_index === "number" &&
|
|
109
|
+
typeof grok_source.end_index === "number" &&
|
|
110
|
+
typeof grok_source.type === "string");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export class Sources {
|
|
114
|
+
B;
|
|
115
|
+
S;
|
|
116
|
+
J;
|
|
117
|
+
G;
|
|
118
|
+
constructor(sources) {
|
|
119
|
+
if (!Sources.is(sources)) {
|
|
120
|
+
throw Error("Invalid input.");
|
|
121
|
+
}
|
|
122
|
+
this.B = sources.B;
|
|
123
|
+
this.S = sources.S;
|
|
124
|
+
this.J = sources.J;
|
|
125
|
+
this.G = sources.G;
|
|
126
|
+
}
|
|
127
|
+
static is(sources) {
|
|
128
|
+
return (sources !== undefined &&
|
|
129
|
+
Array.isArray(sources.B) &&
|
|
130
|
+
sources.B.every(BillDocumentSource.is) &&
|
|
131
|
+
Array.isArray(sources.S) &&
|
|
132
|
+
sources.S.every(ScoutDocumentSource.is) &&
|
|
133
|
+
Array.isArray(sources.J) &&
|
|
134
|
+
sources.J.every(JurisdictionDocumentSource.is) &&
|
|
135
|
+
Array.isArray(sources.G) &&
|
|
136
|
+
sources.G.every(GrokSource.is));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const state_ids: readonly ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"];
|
|
2
|
+
export type StateID = typeof state_ids[number];
|
|
3
|
+
export declare function is_state_id(state_id: any): state_id is StateID;
|
|
4
|
+
export interface State {
|
|
5
|
+
state_id: StateID;
|
|
6
|
+
name: string;
|
|
7
|
+
jurisdiction_id: number;
|
|
8
|
+
schools_jurisdiction_id: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const states_by_state_id: Record<StateID, State>;
|
|
11
|
+
export {};
|