doersiq-types 2.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.
Files changed (72) hide show
  1. package/dist/src/Bot.d.ts +28 -0
  2. package/dist/src/Bot.js +73 -0
  3. package/dist/src/BotDocument.d.ts +14 -0
  4. package/dist/src/BotDocument.js +38 -0
  5. package/dist/src/Conversation.d.ts +16 -0
  6. package/dist/src/Conversation.js +42 -0
  7. package/dist/src/DoersAPIError.d.ts +4 -0
  8. package/dist/src/DoersAPIError.js +18 -0
  9. package/dist/src/Jurisdiction.d.ts +22 -0
  10. package/dist/src/Jurisdiction.js +53 -0
  11. package/dist/src/JurisdictionDocument.d.ts +15 -0
  12. package/dist/src/JurisdictionDocument.js +44 -0
  13. package/dist/src/Message.d.ts +29 -0
  14. package/dist/src/Message.js +79 -0
  15. package/dist/src/OfficeClass.d.ts +17 -0
  16. package/dist/src/OfficeClass.js +131 -0
  17. package/dist/src/Party.d.ts +10 -0
  18. package/dist/src/Party.js +26 -0
  19. package/dist/src/Sources.d.ts +38 -0
  20. package/dist/src/Sources.js +105 -0
  21. package/dist/src/State.d.ts +10 -0
  22. package/dist/src/State.js +256 -0
  23. package/dist/src/Tweet.d.ts +11 -0
  24. package/dist/src/Tweet.js +32 -0
  25. package/dist/src/User.d.ts +15 -0
  26. package/dist/src/User.js +39 -0
  27. package/dist/src/index.d.ts +13 -0
  28. package/dist/src/index.js +13 -0
  29. package/dist/src/types/Bot.d.ts +29 -0
  30. package/dist/src/types/Bot.js +76 -0
  31. package/dist/src/types/BotDocument.d.ts +14 -0
  32. package/dist/src/types/BotDocument.js +38 -0
  33. package/dist/src/types/Conversation.d.ts +18 -0
  34. package/dist/src/types/Conversation.js +48 -0
  35. package/dist/src/types/DoersAPIError.d.ts +4 -0
  36. package/dist/src/types/DoersAPIError.js +19 -0
  37. package/dist/src/types/Jurisdiction.d.ts +24 -0
  38. package/dist/src/types/Jurisdiction.js +57 -0
  39. package/dist/src/types/JurisdictionDocument.d.ts +15 -0
  40. package/dist/src/types/JurisdictionDocument.js +44 -0
  41. package/dist/src/types/Message.d.ts +31 -0
  42. package/dist/src/types/Message.js +85 -0
  43. package/dist/src/types/OfficeClass.d.ts +17 -0
  44. package/dist/src/types/OfficeClass.js +132 -0
  45. package/dist/src/types/Party.d.ts +10 -0
  46. package/dist/src/types/Party.js +26 -0
  47. package/dist/src/types/Sources.d.ts +38 -0
  48. package/dist/src/types/Sources.js +105 -0
  49. package/dist/src/types/State.d.ts +11 -0
  50. package/dist/src/types/State.js +306 -0
  51. package/dist/src/types/Tweet.d.ts +12 -0
  52. package/dist/src/types/Tweet.js +34 -0
  53. package/dist/src/types/User.d.ts +16 -0
  54. package/dist/src/types/User.js +42 -0
  55. package/eslint.config.ts +13 -0
  56. package/jest.config.js +20 -0
  57. package/package.json +31 -0
  58. package/src/index.ts +13 -0
  59. package/src/types/Bot.ts +87 -0
  60. package/src/types/BotDocument.ts +43 -0
  61. package/src/types/Conversation.ts +59 -0
  62. package/src/types/DoersAPIError.ts +21 -0
  63. package/src/types/Jurisdiction.ts +62 -0
  64. package/src/types/JurisdictionDocument.ts +48 -0
  65. package/src/types/Message.ts +100 -0
  66. package/src/types/OfficeClass.ts +150 -0
  67. package/src/types/Party.ts +36 -0
  68. package/src/types/Sources.ts +125 -0
  69. package/src/types/State.ts +317 -0
  70. package/src/types/Tweet.ts +38 -0
  71. package/src/types/User.ts +53 -0
  72. package/tsconfig.json +34 -0
@@ -0,0 +1,38 @@
1
+ import { BotDocument } from "./BotDocument.js";
2
+ import { JurisdictionDocument } from "./JurisdictionDocument.js";
3
+ export declare class BotDocumentSource {
4
+ readonly chunk_text: string;
5
+ readonly description: string;
6
+ readonly label: string;
7
+ readonly type: string;
8
+ readonly vector_key: string;
9
+ readonly document: BotDocument;
10
+ constructor(bot_document_source: any);
11
+ static is(bot_document_source: any): bot_document_source is BotDocumentSource;
12
+ }
13
+ export declare class JurisdictionDocumentSource {
14
+ readonly chunk_text: string;
15
+ readonly description: string;
16
+ readonly label: string;
17
+ readonly type: string;
18
+ readonly vector_key: string;
19
+ readonly document: JurisdictionDocument;
20
+ constructor(jurisdiction_document_source: any);
21
+ static is(jurisdiction_document_source: any): jurisdiction_document_source is JurisdictionDocumentSource;
22
+ }
23
+ export declare class GrokSource {
24
+ readonly title: string;
25
+ readonly url: string;
26
+ readonly start_index: number;
27
+ readonly end_index: number;
28
+ readonly type: string;
29
+ constructor(grok_source: any);
30
+ static is(grok_source: any): grok_source is GrokSource;
31
+ }
32
+ export declare class Sources {
33
+ readonly B: BotDocumentSource[];
34
+ readonly J: JurisdictionDocumentSource[];
35
+ readonly G: GrokSource[];
36
+ constructor(sources: any);
37
+ static is(sources: any): sources is Sources;
38
+ }
@@ -0,0 +1,105 @@
1
+ import { BotDocument } from "./BotDocument.js";
2
+ import { JurisdictionDocument } from "./JurisdictionDocument.js";
3
+ export class BotDocumentSource {
4
+ chunk_text;
5
+ description;
6
+ label;
7
+ type;
8
+ vector_key;
9
+ document;
10
+ constructor(bot_document_source) {
11
+ if (!BotDocumentSource.is(bot_document_source)) {
12
+ throw Error("Invalid input.");
13
+ }
14
+ this.chunk_text = bot_document_source.chunk_text;
15
+ this.description = bot_document_source.description;
16
+ this.label = bot_document_source.label;
17
+ this.type = bot_document_source.type;
18
+ this.vector_key = bot_document_source.vector_key;
19
+ this.document = bot_document_source.document;
20
+ }
21
+ static is(bot_document_source) {
22
+ return (bot_document_source !== undefined &&
23
+ typeof bot_document_source.chunk_text === "string" &&
24
+ typeof bot_document_source.description === "string" &&
25
+ typeof bot_document_source.label === "string" &&
26
+ typeof bot_document_source.type === "string" &&
27
+ typeof bot_document_source.vector_key === "string" &&
28
+ BotDocument.is(bot_document_source.document));
29
+ }
30
+ }
31
+ export class JurisdictionDocumentSource {
32
+ chunk_text;
33
+ description;
34
+ label;
35
+ type;
36
+ vector_key;
37
+ document;
38
+ constructor(jurisdiction_document_source) {
39
+ if (!JurisdictionDocumentSource.is(jurisdiction_document_source)) {
40
+ throw Error("Invalid input.");
41
+ }
42
+ this.chunk_text = jurisdiction_document_source.chunk_text;
43
+ this.description = jurisdiction_document_source.description;
44
+ this.label = jurisdiction_document_source.label;
45
+ this.type = jurisdiction_document_source.type;
46
+ this.vector_key = jurisdiction_document_source.vector_key;
47
+ this.document = jurisdiction_document_source.document;
48
+ }
49
+ static is(jurisdiction_document_source) {
50
+ return (jurisdiction_document_source !== undefined &&
51
+ typeof jurisdiction_document_source.chunk_text === "string" &&
52
+ typeof jurisdiction_document_source.description === "string" &&
53
+ typeof jurisdiction_document_source.label === "string" &&
54
+ typeof jurisdiction_document_source.type === "string" &&
55
+ typeof jurisdiction_document_source.vector_key === "string" &&
56
+ JurisdictionDocument.is(jurisdiction_document_source.document));
57
+ }
58
+ }
59
+ export class GrokSource {
60
+ title;
61
+ url;
62
+ start_index;
63
+ end_index;
64
+ type;
65
+ constructor(grok_source) {
66
+ if (!GrokSource.is(grok_source)) {
67
+ throw Error("Invalid input.");
68
+ }
69
+ this.title = grok_source.title;
70
+ this.url = grok_source.url;
71
+ this.start_index = grok_source.start_index;
72
+ this.end_index = grok_source.end_index;
73
+ this.type = grok_source.type;
74
+ }
75
+ static is(grok_source) {
76
+ return (grok_source !== undefined &&
77
+ typeof grok_source.title === "string" &&
78
+ typeof grok_source.url === "string" &&
79
+ typeof grok_source.start_index === "number" &&
80
+ typeof grok_source.end_index === "number" &&
81
+ typeof grok_source.type === "string");
82
+ }
83
+ }
84
+ export class Sources {
85
+ B;
86
+ J;
87
+ G;
88
+ constructor(sources) {
89
+ if (!Sources.is(sources)) {
90
+ throw Error("Invalid input.");
91
+ }
92
+ this.B = sources.B;
93
+ this.J = sources.J;
94
+ this.G = sources.G;
95
+ }
96
+ static is(sources) {
97
+ return (sources !== undefined &&
98
+ Array.isArray(sources.B) &&
99
+ sources.B.every(BotDocumentSource.is) &&
100
+ Array.isArray(sources.J) &&
101
+ sources.J.every(JurisdictionDocumentSource.is) &&
102
+ Array.isArray(sources.G) &&
103
+ sources.G.every(GrokSource.is));
104
+ }
105
+ }
@@ -0,0 +1,10 @@
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
+ }
9
+ export declare const states_by_state_id: Record<StateID, State>;
10
+ export {};
@@ -0,0 +1,256 @@
1
+ const state_ids = ["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 function is_state_id(state_id) {
3
+ return state_ids.includes(state_id);
4
+ }
5
+ export const states_by_state_id = {
6
+ AL: {
7
+ state_id: "AL",
8
+ name: "Alabama",
9
+ jurisdiction_id: 2280
10
+ },
11
+ AK: {
12
+ state_id: "AK",
13
+ name: "Alaska",
14
+ jurisdiction_id: 2281
15
+ },
16
+ AZ: {
17
+ state_id: "AZ",
18
+ name: "Arizona",
19
+ jurisdiction_id: 2148
20
+ },
21
+ AR: {
22
+ state_id: "AR",
23
+ name: "Arkansas",
24
+ jurisdiction_id: 2282
25
+ },
26
+ CA: {
27
+ state_id: "CA",
28
+ name: "California",
29
+ jurisdiction_id: 2283
30
+ },
31
+ CO: {
32
+ state_id: "CO",
33
+ name: "Colorado",
34
+ jurisdiction_id: 2284
35
+ },
36
+ CT: {
37
+ state_id: "CT",
38
+ name: "Connecticut",
39
+ jurisdiction_id: 2314
40
+ },
41
+ DE: {
42
+ state_id: "DE",
43
+ name: "Delaware",
44
+ jurisdiction_id: 2315
45
+ },
46
+ FL: {
47
+ state_id: "FL",
48
+ name: "Florida",
49
+ jurisdiction_id: 2316
50
+ },
51
+ GA: {
52
+ state_id: "GA",
53
+ name: "Georgia",
54
+ jurisdiction_id: 2317
55
+ },
56
+ HI: {
57
+ state_id: "HI",
58
+ name: "Hawaii",
59
+ jurisdiction_id: 2156
60
+ },
61
+ ID: {
62
+ state_id: "ID",
63
+ name: "Idaho",
64
+ jurisdiction_id: 2318
65
+ },
66
+ IL: {
67
+ state_id: "IL",
68
+ name: "Illinois",
69
+ jurisdiction_id: 2319
70
+ },
71
+ IN: {
72
+ state_id: "IN",
73
+ name: "Indiana",
74
+ jurisdiction_id: 2159
75
+ },
76
+ IA: {
77
+ state_id: "IA",
78
+ name: "Iowa",
79
+ jurisdiction_id: 2320
80
+ },
81
+ KS: {
82
+ state_id: "KS",
83
+ name: "Kansas",
84
+ jurisdiction_id: 2161
85
+ },
86
+ KY: {
87
+ state_id: "KY",
88
+ name: "Kentucky",
89
+ jurisdiction_id: 2162
90
+ },
91
+ LA: {
92
+ state_id: "LA",
93
+ name: "Louisiana",
94
+ jurisdiction_id: 2163
95
+ },
96
+ ME: {
97
+ state_id: "ME",
98
+ name: "Maine",
99
+ jurisdiction_id: 2164
100
+ },
101
+ MD: {
102
+ state_id: "MD",
103
+ name: "Maryland",
104
+ jurisdiction_id: 2165
105
+ },
106
+ MA: {
107
+ state_id: "MA",
108
+ name: "Massachusetts",
109
+ jurisdiction_id: 2166
110
+ },
111
+ MI: {
112
+ state_id: "MI",
113
+ name: "Michigan",
114
+ jurisdiction_id: 2167
115
+ },
116
+ MN: {
117
+ state_id: "MN",
118
+ name: "Minnesota",
119
+ jurisdiction_id: 2286
120
+ },
121
+ MS: {
122
+ state_id: "MS",
123
+ name: "Mississippi",
124
+ jurisdiction_id: 2287
125
+ },
126
+ MO: {
127
+ state_id: "MO",
128
+ name: "Missouri",
129
+ jurisdiction_id: 2288
130
+ },
131
+ MT: {
132
+ state_id: "MT",
133
+ name: "Montana",
134
+ jurisdiction_id: 2289
135
+ },
136
+ NE: {
137
+ state_id: "NE",
138
+ name: "Nebraska",
139
+ jurisdiction_id: 2290
140
+ },
141
+ NV: {
142
+ state_id: "NV",
143
+ name: "Nevada",
144
+ jurisdiction_id: 2291
145
+ },
146
+ NH: {
147
+ state_id: "NH",
148
+ name: "New Hampshire",
149
+ jurisdiction_id: 2292
150
+ },
151
+ NJ: {
152
+ state_id: "NJ",
153
+ name: "New Jersey",
154
+ jurisdiction_id: 2293
155
+ },
156
+ NM: {
157
+ state_id: "NM",
158
+ name: "New Mexico",
159
+ jurisdiction_id: 2294
160
+ },
161
+ NY: {
162
+ state_id: "NY",
163
+ name: "New York",
164
+ jurisdiction_id: 2295
165
+ },
166
+ NC: {
167
+ state_id: "NC",
168
+ name: "North Carolina",
169
+ jurisdiction_id: 2296
170
+ },
171
+ ND: {
172
+ state_id: "ND",
173
+ name: "North Dakota",
174
+ jurisdiction_id: 2297
175
+ },
176
+ OH: {
177
+ state_id: "OH",
178
+ name: "Ohio",
179
+ jurisdiction_id: 2298
180
+ },
181
+ OK: {
182
+ state_id: "OK",
183
+ name: "Oklahoma",
184
+ jurisdiction_id: 2299
185
+ },
186
+ OR: {
187
+ state_id: "OR",
188
+ name: "Oregon",
189
+ jurisdiction_id: 2300
190
+ },
191
+ PA: {
192
+ state_id: "PA",
193
+ name: "Pennsylvania",
194
+ jurisdiction_id: 2301
195
+ },
196
+ RI: {
197
+ state_id: "RI",
198
+ name: "Rhode Island",
199
+ jurisdiction_id: 2302
200
+ },
201
+ SC: {
202
+ state_id: "SC",
203
+ name: "South Carolina",
204
+ jurisdiction_id: 2303
205
+ },
206
+ SD: {
207
+ state_id: "SD",
208
+ name: "South Dakota",
209
+ jurisdiction_id: 2304
210
+ },
211
+ TN: {
212
+ state_id: "TN",
213
+ name: "Tennessee",
214
+ jurisdiction_id: 2305
215
+ },
216
+ TX: {
217
+ state_id: "TX",
218
+ name: "Texas",
219
+ jurisdiction_id: 2306
220
+ },
221
+ UT: {
222
+ state_id: "UT",
223
+ name: "Utah",
224
+ jurisdiction_id: 2307
225
+ },
226
+ VT: {
227
+ state_id: "VT",
228
+ name: "Vermont",
229
+ jurisdiction_id: 2308
230
+ },
231
+ VA: {
232
+ state_id: "VA",
233
+ name: "Virginia",
234
+ jurisdiction_id: 2309
235
+ },
236
+ WA: {
237
+ state_id: "WA",
238
+ name: "Washington",
239
+ jurisdiction_id: 2310
240
+ },
241
+ WV: {
242
+ state_id: "WV",
243
+ name: "West Virginia",
244
+ jurisdiction_id: 2311
245
+ },
246
+ WI: {
247
+ state_id: "WI",
248
+ name: "Wisconsin",
249
+ jurisdiction_id: 2312
250
+ },
251
+ WY: {
252
+ state_id: "WY",
253
+ name: "Wyoming",
254
+ jurisdiction_id: 2313
255
+ }
256
+ };
@@ -0,0 +1,11 @@
1
+ export declare class Tweet {
2
+ readonly tweet_id: string;
3
+ readonly username: string;
4
+ readonly url: string;
5
+ readonly tweet_time: string;
6
+ readonly tweet_content: string;
7
+ readonly replying_to: string[];
8
+ readonly quote?: string;
9
+ constructor(tweet: any);
10
+ static is(tweet: any): tweet is Tweet;
11
+ }
@@ -0,0 +1,32 @@
1
+ export class Tweet {
2
+ tweet_id;
3
+ username;
4
+ url;
5
+ tweet_time;
6
+ tweet_content;
7
+ replying_to;
8
+ quote;
9
+ constructor(tweet) {
10
+ if (!Tweet.is(tweet)) {
11
+ throw Error("Invalid input.");
12
+ }
13
+ this.tweet_id = tweet.tweet_id;
14
+ this.username = tweet.username;
15
+ this.url = tweet.url;
16
+ this.tweet_time = tweet.tweet_time;
17
+ this.tweet_content = tweet.tweet_content;
18
+ this.replying_to = tweet.replying_to;
19
+ this.quote = tweet.quote;
20
+ }
21
+ static is(tweet) {
22
+ return (tweet !== undefined &&
23
+ typeof tweet.tweet_id === "string" &&
24
+ typeof tweet.username === "string" &&
25
+ typeof tweet.url === "string" &&
26
+ typeof tweet.tweet_time === "string" &&
27
+ typeof tweet.tweet_content === "string" &&
28
+ Array.isArray(tweet.replying_to) &&
29
+ tweet.replying_to.every((username) => typeof username === "string") &&
30
+ (tweet.quote === undefined || typeof tweet.quote === "string"));
31
+ }
32
+ }
@@ -0,0 +1,15 @@
1
+ import { BotAux } from "./Bot.js";
2
+ export declare class User {
3
+ readonly user_id: string;
4
+ readonly admin: boolean;
5
+ readonly bot_ids: string[];
6
+ readonly email: string;
7
+ readonly [x: string]: any;
8
+ constructor(user: any);
9
+ static is(user: any): user is User;
10
+ }
11
+ export declare class UserAux extends User {
12
+ readonly bots: BotAux[];
13
+ constructor(user: any);
14
+ static is(user: any): user is UserAux;
15
+ }
@@ -0,0 +1,39 @@
1
+ import { BotAux } from "./Bot.js";
2
+ export class User {
3
+ user_id;
4
+ admin;
5
+ bot_ids;
6
+ email;
7
+ constructor(user) {
8
+ if (!User.is(user)) {
9
+ throw Error("Invalid Input.");
10
+ }
11
+ this.user_id = user.user_id;
12
+ this.admin = user.admin;
13
+ this.bot_ids = user.bot_ids;
14
+ this.email = user.email;
15
+ }
16
+ static is(user) {
17
+ return (user !== undefined &&
18
+ typeof user.user_id === "string" &&
19
+ typeof user.admin === "boolean" &&
20
+ typeof user.email === "string" &&
21
+ Array.isArray(user.bot_ids) &&
22
+ user.bot_ids.every((bot_id) => typeof bot_id === "string"));
23
+ }
24
+ }
25
+ export class UserAux extends User {
26
+ bots;
27
+ constructor(user) {
28
+ if (!UserAux.is(user)) {
29
+ throw Error("Invalid Input.");
30
+ }
31
+ super(user);
32
+ this.bots = user.bots;
33
+ }
34
+ static is(user) {
35
+ return (User.is(user) &&
36
+ Array.isArray(user.bots) &&
37
+ user.bots.every(BotAux.is));
38
+ }
39
+ }
@@ -0,0 +1,13 @@
1
+ export * from "./types/Bot.js";
2
+ export * from "./types/BotDocument.js";
3
+ export * from "./types/Conversation.js";
4
+ export * from "./types/DoersAPIError.js";
5
+ export * from "./types/Jurisdiction.js";
6
+ export * from "./types/JurisdictionDocument.js";
7
+ export * from "./types/Message.js";
8
+ export * from "./types/OfficeClass.js";
9
+ export * from "./types/Party.js";
10
+ export * from "./types/Sources.js";
11
+ export * from "./types/State.js";
12
+ export * from "./types/Tweet.js";
13
+ export * from "./types/User.js";
@@ -0,0 +1,13 @@
1
+ export * from "./types/Bot.js";
2
+ export * from "./types/BotDocument.js";
3
+ export * from "./types/Conversation.js";
4
+ export * from "./types/DoersAPIError.js";
5
+ export * from "./types/Jurisdiction.js";
6
+ export * from "./types/JurisdictionDocument.js";
7
+ export * from "./types/Message.js";
8
+ export * from "./types/OfficeClass.js";
9
+ export * from "./types/Party.js";
10
+ export * from "./types/Sources.js";
11
+ export * from "./types/State.js";
12
+ export * from "./types/Tweet.js";
13
+ export * from "./types/User.js";
@@ -0,0 +1,29 @@
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 topics: string[];
16
+ readonly jurisdiction_ids: number[];
17
+ readonly office_class_id: OfficeClassID;
18
+ readonly office_name?: string;
19
+ readonly [x: string]: any;
20
+ constructor(bot: any);
21
+ static is(bot: any): bot is Bot;
22
+ }
23
+ export declare class BotAux extends Bot {
24
+ readonly jurisdictions: Jurisdiction[];
25
+ readonly photo_download_url?: string;
26
+ readonly tone_description?: string;
27
+ constructor(bot: any);
28
+ static is(bot: any): bot is BotAux;
29
+ }
@@ -0,0 +1,76 @@
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
+ topics;
16
+ jurisdiction_ids;
17
+ office_class_id;
18
+ office_name;
19
+ constructor(bot) {
20
+ if (!Bot.is(bot)) {
21
+ throw Error("Invalid input.");
22
+ }
23
+ this.office_id = bot.office_id;
24
+ this.number = bot.number;
25
+ this.bot_id = bot.bot_id;
26
+ this.name = bot.name;
27
+ this.active = bot.active;
28
+ this.state_id = bot.state_id;
29
+ this.district = bot.district;
30
+ this.party_id = bot.party_id;
31
+ this.tone_description_refresh = bot.tone_description_refresh;
32
+ this.topics = bot.topics;
33
+ this.jurisdiction_ids = bot.jurisdiction_ids;
34
+ this.office_class_id = bot.office_class_id;
35
+ this.office_name = bot.office_name;
36
+ }
37
+ static is(bot) {
38
+ return (bot !== undefined &&
39
+ typeof bot.office_id === "string" &&
40
+ typeof bot.number === "string" &&
41
+ typeof bot.bot_id === "string" &&
42
+ typeof bot.name === "string" &&
43
+ typeof bot.active === "boolean" &&
44
+ is_state_id(bot.state_id) &&
45
+ (bot.district === undefined || typeof bot.district === "number") &&
46
+ is_party_id(bot.party_id) &&
47
+ typeof bot.tone_description_refresh === "boolean" &&
48
+ Array.isArray(bot.topics) &&
49
+ bot.topics.every((topic) => typeof topic === "string") &&
50
+ Array.isArray(bot.jurisdiction_ids) &&
51
+ bot.jurisdiction_ids.every((jurisdiction_id) => typeof jurisdiction_id === "number") &&
52
+ is_office_class_id(bot.office_class_id) &&
53
+ (bot.office_name === undefined || typeof bot.office_name === "string"));
54
+ }
55
+ }
56
+ export class BotAux extends Bot {
57
+ jurisdictions;
58
+ photo_download_url;
59
+ tone_description;
60
+ constructor(bot) {
61
+ if (!BotAux.is(bot)) {
62
+ throw Error("Invalid input.");
63
+ }
64
+ super(bot);
65
+ this.jurisdictions = bot.jurisdictions;
66
+ this.photo_download_url = bot.photo_download_url;
67
+ this.tone_description = bot.tone_description;
68
+ }
69
+ static is(bot) {
70
+ return (Bot.is(bot) &&
71
+ Array.isArray(bot.jurisdictions) &&
72
+ bot.jurisdictions.every(Jurisdiction.is) &&
73
+ (bot.photo_download_url === undefined || typeof bot.photo_download_url === "string") &&
74
+ (bot.tone_description === undefined || typeof bot.tone_description === "string"));
75
+ }
76
+ }
@@ -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
+ }