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.
- package/dist/src/Bot.d.ts +28 -0
- package/dist/src/Bot.js +73 -0
- package/dist/src/BotDocument.d.ts +14 -0
- package/dist/src/BotDocument.js +38 -0
- package/dist/src/Conversation.d.ts +16 -0
- package/dist/src/Conversation.js +42 -0
- package/dist/src/DoersAPIError.d.ts +4 -0
- package/dist/src/DoersAPIError.js +18 -0
- package/dist/src/Jurisdiction.d.ts +22 -0
- package/dist/src/Jurisdiction.js +53 -0
- package/dist/src/JurisdictionDocument.d.ts +15 -0
- package/dist/src/JurisdictionDocument.js +44 -0
- package/dist/src/Message.d.ts +29 -0
- package/dist/src/Message.js +79 -0
- package/dist/src/OfficeClass.d.ts +17 -0
- package/dist/src/OfficeClass.js +131 -0
- package/dist/src/Party.d.ts +10 -0
- package/dist/src/Party.js +26 -0
- package/dist/src/Sources.d.ts +38 -0
- package/dist/src/Sources.js +105 -0
- package/dist/src/State.d.ts +10 -0
- package/dist/src/State.js +256 -0
- package/dist/src/Tweet.d.ts +11 -0
- package/dist/src/Tweet.js +32 -0
- package/dist/src/User.d.ts +15 -0
- package/dist/src/User.js +39 -0
- package/dist/src/index.d.ts +13 -0
- package/dist/src/index.js +13 -0
- package/dist/src/types/Bot.d.ts +29 -0
- package/dist/src/types/Bot.js +76 -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 +18 -0
- package/dist/src/types/Conversation.js +48 -0
- package/dist/src/types/DoersAPIError.d.ts +4 -0
- package/dist/src/types/DoersAPIError.js +19 -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 +31 -0
- package/dist/src/types/Message.js +85 -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/Sources.d.ts +38 -0
- package/dist/src/types/Sources.js +105 -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 +13 -0
- package/src/types/Bot.ts +87 -0
- package/src/types/BotDocument.ts +43 -0
- package/src/types/Conversation.ts +59 -0
- package/src/types/DoersAPIError.ts +21 -0
- package/src/types/Jurisdiction.ts +62 -0
- package/src/types/JurisdictionDocument.ts +48 -0
- package/src/types/Message.ts +100 -0
- package/src/types/OfficeClass.ts +150 -0
- package/src/types/Party.ts +36 -0
- package/src/types/Sources.ts +125 -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,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,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 {};
|
|
@@ -0,0 +1,306 @@
|
|
|
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
|
+
schools_jurisdiction_id: 13586
|
|
11
|
+
},
|
|
12
|
+
AK: {
|
|
13
|
+
state_id: "AK",
|
|
14
|
+
name: "Alaska",
|
|
15
|
+
jurisdiction_id: 2281,
|
|
16
|
+
schools_jurisdiction_id: 12910
|
|
17
|
+
},
|
|
18
|
+
AZ: {
|
|
19
|
+
state_id: "AZ",
|
|
20
|
+
name: "Arizona",
|
|
21
|
+
jurisdiction_id: 2148,
|
|
22
|
+
schools_jurisdiction_id: 12978
|
|
23
|
+
},
|
|
24
|
+
AR: {
|
|
25
|
+
state_id: "AR",
|
|
26
|
+
name: "Arkansas",
|
|
27
|
+
jurisdiction_id: 2282,
|
|
28
|
+
schools_jurisdiction_id: 12971
|
|
29
|
+
},
|
|
30
|
+
CA: {
|
|
31
|
+
state_id: "CA",
|
|
32
|
+
name: "California",
|
|
33
|
+
jurisdiction_id: 2283,
|
|
34
|
+
schools_jurisdiction_id: 12992
|
|
35
|
+
},
|
|
36
|
+
CO: {
|
|
37
|
+
state_id: "CO",
|
|
38
|
+
name: "Colorado",
|
|
39
|
+
jurisdiction_id: 2284,
|
|
40
|
+
schools_jurisdiction_id: 12897
|
|
41
|
+
},
|
|
42
|
+
CT: {
|
|
43
|
+
state_id: "CT",
|
|
44
|
+
name: "Connecticut",
|
|
45
|
+
jurisdiction_id: 2314,
|
|
46
|
+
schools_jurisdiction_id: 12998
|
|
47
|
+
},
|
|
48
|
+
DE: {
|
|
49
|
+
state_id: "DE",
|
|
50
|
+
name: "Delaware",
|
|
51
|
+
jurisdiction_id: 2315,
|
|
52
|
+
schools_jurisdiction_id: 13105
|
|
53
|
+
},
|
|
54
|
+
FL: {
|
|
55
|
+
state_id: "FL",
|
|
56
|
+
name: "Florida",
|
|
57
|
+
jurisdiction_id: 2316,
|
|
58
|
+
schools_jurisdiction_id: 13111
|
|
59
|
+
},
|
|
60
|
+
GA: {
|
|
61
|
+
state_id: "GA",
|
|
62
|
+
name: "Georgia",
|
|
63
|
+
jurisdiction_id: 2317,
|
|
64
|
+
schools_jurisdiction_id: 13119
|
|
65
|
+
},
|
|
66
|
+
HI: {
|
|
67
|
+
state_id: "HI",
|
|
68
|
+
name: "Hawaii",
|
|
69
|
+
jurisdiction_id: 2156,
|
|
70
|
+
schools_jurisdiction_id: 13127
|
|
71
|
+
},
|
|
72
|
+
ID: {
|
|
73
|
+
state_id: "ID",
|
|
74
|
+
name: "Idaho",
|
|
75
|
+
jurisdiction_id: 2318,
|
|
76
|
+
schools_jurisdiction_id: 13014
|
|
77
|
+
},
|
|
78
|
+
IL: {
|
|
79
|
+
state_id: "IL",
|
|
80
|
+
name: "Illinois",
|
|
81
|
+
jurisdiction_id: 2319,
|
|
82
|
+
schools_jurisdiction_id: 13065
|
|
83
|
+
},
|
|
84
|
+
IN: {
|
|
85
|
+
state_id: "IN",
|
|
86
|
+
name: "Indiana",
|
|
87
|
+
jurisdiction_id: 2159,
|
|
88
|
+
schools_jurisdiction_id: 13068
|
|
89
|
+
},
|
|
90
|
+
IA: {
|
|
91
|
+
state_id: "IA",
|
|
92
|
+
name: "Iowa",
|
|
93
|
+
jurisdiction_id: 2320,
|
|
94
|
+
schools_jurisdiction_id: 12917
|
|
95
|
+
},
|
|
96
|
+
KS: {
|
|
97
|
+
state_id: "KS",
|
|
98
|
+
name: "Kansas",
|
|
99
|
+
jurisdiction_id: 2161,
|
|
100
|
+
schools_jurisdiction_id: 13088
|
|
101
|
+
},
|
|
102
|
+
KY: {
|
|
103
|
+
state_id: "KY",
|
|
104
|
+
name: "Kentucky",
|
|
105
|
+
jurisdiction_id: 2162,
|
|
106
|
+
schools_jurisdiction_id: 13094
|
|
107
|
+
},
|
|
108
|
+
LA: {
|
|
109
|
+
state_id: "LA",
|
|
110
|
+
name: "Louisiana",
|
|
111
|
+
jurisdiction_id: 2163,
|
|
112
|
+
schools_jurisdiction_id: 13130
|
|
113
|
+
},
|
|
114
|
+
ME: {
|
|
115
|
+
state_id: "ME",
|
|
116
|
+
name: "Maine",
|
|
117
|
+
jurisdiction_id: 2164,
|
|
118
|
+
schools_jurisdiction_id: 38491
|
|
119
|
+
},
|
|
120
|
+
MD: {
|
|
121
|
+
state_id: "MD",
|
|
122
|
+
name: "Maryland",
|
|
123
|
+
jurisdiction_id: 2165,
|
|
124
|
+
schools_jurisdiction_id: 14199
|
|
125
|
+
},
|
|
126
|
+
MA: {
|
|
127
|
+
state_id: "MA",
|
|
128
|
+
name: "Massachusetts",
|
|
129
|
+
jurisdiction_id: 2166,
|
|
130
|
+
schools_jurisdiction_id: 13135
|
|
131
|
+
},
|
|
132
|
+
MI: {
|
|
133
|
+
state_id: "MI",
|
|
134
|
+
name: "Michigan",
|
|
135
|
+
jurisdiction_id: 2167,
|
|
136
|
+
schools_jurisdiction_id: 13448
|
|
137
|
+
},
|
|
138
|
+
MN: {
|
|
139
|
+
state_id: "MN",
|
|
140
|
+
name: "Minnesota",
|
|
141
|
+
jurisdiction_id: 2286,
|
|
142
|
+
schools_jurisdiction_id: 13233
|
|
143
|
+
},
|
|
144
|
+
MS: {
|
|
145
|
+
state_id: "MS",
|
|
146
|
+
name: "Mississippi",
|
|
147
|
+
jurisdiction_id: 2287,
|
|
148
|
+
schools_jurisdiction_id: 12965
|
|
149
|
+
},
|
|
150
|
+
MO: {
|
|
151
|
+
state_id: "MO",
|
|
152
|
+
name: "Missouri",
|
|
153
|
+
jurisdiction_id: 2288,
|
|
154
|
+
schools_jurisdiction_id: 12955
|
|
155
|
+
},
|
|
156
|
+
MT: {
|
|
157
|
+
state_id: "MT",
|
|
158
|
+
name: "Montana",
|
|
159
|
+
jurisdiction_id: 2289,
|
|
160
|
+
schools_jurisdiction_id: 38286
|
|
161
|
+
},
|
|
162
|
+
NE: {
|
|
163
|
+
state_id: "NE",
|
|
164
|
+
name: "Nebraska",
|
|
165
|
+
jurisdiction_id: 2290,
|
|
166
|
+
schools_jurisdiction_id: 13050
|
|
167
|
+
},
|
|
168
|
+
NV: {
|
|
169
|
+
state_id: "NV",
|
|
170
|
+
name: "Nevada",
|
|
171
|
+
jurisdiction_id: 2291,
|
|
172
|
+
schools_jurisdiction_id: 13425
|
|
173
|
+
},
|
|
174
|
+
NH: {
|
|
175
|
+
state_id: "NH",
|
|
176
|
+
name: "New Hampshire",
|
|
177
|
+
jurisdiction_id: 2292,
|
|
178
|
+
schools_jurisdiction_id: 13062
|
|
179
|
+
},
|
|
180
|
+
NJ: {
|
|
181
|
+
state_id: "NJ",
|
|
182
|
+
name: "New Jersey",
|
|
183
|
+
jurisdiction_id: 2293,
|
|
184
|
+
schools_jurisdiction_id: 13244
|
|
185
|
+
},
|
|
186
|
+
NM: {
|
|
187
|
+
state_id: "NM",
|
|
188
|
+
name: "New Mexico",
|
|
189
|
+
jurisdiction_id: 2294,
|
|
190
|
+
schools_jurisdiction_id: 13251
|
|
191
|
+
},
|
|
192
|
+
NY: {
|
|
193
|
+
state_id: "NY",
|
|
194
|
+
name: "New York",
|
|
195
|
+
jurisdiction_id: 2295,
|
|
196
|
+
schools_jurisdiction_id: 13429
|
|
197
|
+
},
|
|
198
|
+
NC: {
|
|
199
|
+
state_id: "NC",
|
|
200
|
+
name: "North Carolina",
|
|
201
|
+
jurisdiction_id: 2296,
|
|
202
|
+
schools_jurisdiction_id: 13009
|
|
203
|
+
},
|
|
204
|
+
ND: {
|
|
205
|
+
state_id: "ND",
|
|
206
|
+
name: "North Dakota",
|
|
207
|
+
jurisdiction_id: 2297,
|
|
208
|
+
schools_jurisdiction_id: 13042
|
|
209
|
+
},
|
|
210
|
+
OH: {
|
|
211
|
+
state_id: "OH",
|
|
212
|
+
name: "Ohio",
|
|
213
|
+
jurisdiction_id: 2298,
|
|
214
|
+
schools_jurisdiction_id: 13224
|
|
215
|
+
},
|
|
216
|
+
OK: {
|
|
217
|
+
state_id: "OK",
|
|
218
|
+
name: "Oklahoma",
|
|
219
|
+
jurisdiction_id: 2299,
|
|
220
|
+
schools_jurisdiction_id: 13223
|
|
221
|
+
},
|
|
222
|
+
OR: {
|
|
223
|
+
state_id: "OR",
|
|
224
|
+
name: "Oregon",
|
|
225
|
+
jurisdiction_id: 2300,
|
|
226
|
+
schools_jurisdiction_id: 13221
|
|
227
|
+
},
|
|
228
|
+
PA: {
|
|
229
|
+
state_id: "PA",
|
|
230
|
+
name: "Pennsylvania",
|
|
231
|
+
jurisdiction_id: 2301,
|
|
232
|
+
schools_jurisdiction_id: 12918
|
|
233
|
+
},
|
|
234
|
+
RI: {
|
|
235
|
+
state_id: "RI",
|
|
236
|
+
name: "Rhode Island",
|
|
237
|
+
jurisdiction_id: 2302,
|
|
238
|
+
schools_jurisdiction_id: 12926
|
|
239
|
+
},
|
|
240
|
+
SC: {
|
|
241
|
+
state_id: "SC",
|
|
242
|
+
name: "South Carolina",
|
|
243
|
+
jurisdiction_id: 2303,
|
|
244
|
+
schools_jurisdiction_id: 12929
|
|
245
|
+
},
|
|
246
|
+
SD: {
|
|
247
|
+
state_id: "SD",
|
|
248
|
+
name: "South Dakota",
|
|
249
|
+
jurisdiction_id: 2304,
|
|
250
|
+
schools_jurisdiction_id: 12938
|
|
251
|
+
},
|
|
252
|
+
TN: {
|
|
253
|
+
state_id: "TN",
|
|
254
|
+
name: "Tennessee",
|
|
255
|
+
jurisdiction_id: 2305,
|
|
256
|
+
schools_jurisdiction_id: 12942
|
|
257
|
+
},
|
|
258
|
+
TX: {
|
|
259
|
+
state_id: "TX",
|
|
260
|
+
name: "Texas",
|
|
261
|
+
jurisdiction_id: 2306,
|
|
262
|
+
schools_jurisdiction_id: 12949
|
|
263
|
+
},
|
|
264
|
+
UT: {
|
|
265
|
+
state_id: "UT",
|
|
266
|
+
name: "Utah",
|
|
267
|
+
jurisdiction_id: 2307,
|
|
268
|
+
schools_jurisdiction_id: 65780
|
|
269
|
+
},
|
|
270
|
+
VT: {
|
|
271
|
+
state_id: "VT",
|
|
272
|
+
name: "Vermont",
|
|
273
|
+
jurisdiction_id: 2308,
|
|
274
|
+
schools_jurisdiction_id: 47348
|
|
275
|
+
},
|
|
276
|
+
VA: {
|
|
277
|
+
state_id: "VA",
|
|
278
|
+
name: "Virginia",
|
|
279
|
+
jurisdiction_id: 2309,
|
|
280
|
+
schools_jurisdiction_id: 13026
|
|
281
|
+
},
|
|
282
|
+
WA: {
|
|
283
|
+
state_id: "WA",
|
|
284
|
+
name: "Washington",
|
|
285
|
+
jurisdiction_id: 2310,
|
|
286
|
+
schools_jurisdiction_id: 13032
|
|
287
|
+
},
|
|
288
|
+
WV: {
|
|
289
|
+
state_id: "WV",
|
|
290
|
+
name: "West Virginia",
|
|
291
|
+
jurisdiction_id: 2311,
|
|
292
|
+
schools_jurisdiction_id: 13056
|
|
293
|
+
},
|
|
294
|
+
WI: {
|
|
295
|
+
state_id: "WI",
|
|
296
|
+
name: "Wisconsin",
|
|
297
|
+
jurisdiction_id: 2312,
|
|
298
|
+
schools_jurisdiction_id: 13044
|
|
299
|
+
},
|
|
300
|
+
WY: {
|
|
301
|
+
state_id: "WY",
|
|
302
|
+
name: "Wyoming",
|
|
303
|
+
jurisdiction_id: 2313,
|
|
304
|
+
schools_jurisdiction_id: 13148
|
|
305
|
+
}
|
|
306
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
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 quote?: string;
|
|
8
|
+
readonly html: string;
|
|
9
|
+
readonly text: string;
|
|
10
|
+
constructor(tweet: any);
|
|
11
|
+
static is(tweet: any): tweet is Tweet;
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export class Tweet {
|
|
2
|
+
tweet_id;
|
|
3
|
+
username;
|
|
4
|
+
url;
|
|
5
|
+
tweet_time;
|
|
6
|
+
tweet_content;
|
|
7
|
+
quote;
|
|
8
|
+
html;
|
|
9
|
+
text;
|
|
10
|
+
constructor(tweet) {
|
|
11
|
+
if (!Tweet.is(tweet)) {
|
|
12
|
+
throw Error("Invalid input.");
|
|
13
|
+
}
|
|
14
|
+
this.tweet_id = tweet.tweet_id;
|
|
15
|
+
this.username = tweet.username;
|
|
16
|
+
this.url = tweet.url;
|
|
17
|
+
this.tweet_time = tweet.tweet_time;
|
|
18
|
+
this.tweet_content = tweet.tweet_content;
|
|
19
|
+
this.quote = tweet.quote;
|
|
20
|
+
this.html = tweet.html;
|
|
21
|
+
this.text = tweet.text;
|
|
22
|
+
}
|
|
23
|
+
static is(tweet) {
|
|
24
|
+
return (tweet !== undefined &&
|
|
25
|
+
typeof tweet.tweet_id === "string" &&
|
|
26
|
+
typeof tweet.username === "string" &&
|
|
27
|
+
typeof tweet.url === "string" &&
|
|
28
|
+
typeof tweet.tweet_time === "string" &&
|
|
29
|
+
typeof tweet.tweet_content === "string" &&
|
|
30
|
+
(tweet.quote === undefined || typeof tweet.quote === "string") &&
|
|
31
|
+
(typeof tweet.html === "string") &&
|
|
32
|
+
(typeof tweet.text === "string"));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BotAux } from "./Bot.js";
|
|
2
|
+
export declare class User {
|
|
3
|
+
readonly user_id: string;
|
|
4
|
+
readonly admin: boolean;
|
|
5
|
+
readonly active: boolean;
|
|
6
|
+
readonly bot_ids: string[];
|
|
7
|
+
readonly email: string;
|
|
8
|
+
readonly [x: string]: any;
|
|
9
|
+
constructor(user: any);
|
|
10
|
+
static is(user: any): user is User;
|
|
11
|
+
}
|
|
12
|
+
export declare class UserAux extends User {
|
|
13
|
+
readonly bots: BotAux[];
|
|
14
|
+
constructor(user: any);
|
|
15
|
+
static is(user: any): user is UserAux;
|
|
16
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BotAux } from "./Bot.js";
|
|
2
|
+
export class User {
|
|
3
|
+
user_id;
|
|
4
|
+
admin;
|
|
5
|
+
active;
|
|
6
|
+
bot_ids;
|
|
7
|
+
email;
|
|
8
|
+
constructor(user) {
|
|
9
|
+
if (!User.is(user)) {
|
|
10
|
+
throw Error("Invalid Input.");
|
|
11
|
+
}
|
|
12
|
+
this.user_id = user.user_id;
|
|
13
|
+
this.admin = user.admin;
|
|
14
|
+
this.active = user.active;
|
|
15
|
+
this.bot_ids = user.bot_ids;
|
|
16
|
+
this.email = user.email;
|
|
17
|
+
}
|
|
18
|
+
static is(user) {
|
|
19
|
+
return (user !== undefined &&
|
|
20
|
+
typeof user.user_id === "string" &&
|
|
21
|
+
typeof user.admin === "boolean" &&
|
|
22
|
+
typeof user.active === "boolean" &&
|
|
23
|
+
typeof user.email === "string" &&
|
|
24
|
+
Array.isArray(user.bot_ids) &&
|
|
25
|
+
user.bot_ids.every((bot_id) => typeof bot_id === "string"));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export class UserAux extends User {
|
|
29
|
+
bots;
|
|
30
|
+
constructor(user) {
|
|
31
|
+
if (!UserAux.is(user)) {
|
|
32
|
+
throw Error("Invalid Input.");
|
|
33
|
+
}
|
|
34
|
+
super(user);
|
|
35
|
+
this.bots = user.bots;
|
|
36
|
+
}
|
|
37
|
+
static is(user) {
|
|
38
|
+
return (User.is(user) &&
|
|
39
|
+
Array.isArray(user.bots) &&
|
|
40
|
+
user.bots.every(BotAux.is));
|
|
41
|
+
}
|
|
42
|
+
}
|
package/eslint.config.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
import tseslint from "typescript-eslint";
|
|
4
|
+
import { defineConfig } from "eslint/config";
|
|
5
|
+
|
|
6
|
+
export default defineConfig([
|
|
7
|
+
{ files: ["**/*.{js,mjs,cjs,ts,mts,cts}"], plugins: { js }, extends: ["js/recommended"], languageOptions: { globals: globals.browser } },
|
|
8
|
+
{
|
|
9
|
+
rules: {
|
|
10
|
+
"@typescript-eslint/explicit-function-return-type": "error"
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
]);
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createDefaultPreset } from "ts-jest"
|
|
2
|
+
|
|
3
|
+
const tsJestTransformCfg = createDefaultPreset().transform;
|
|
4
|
+
|
|
5
|
+
/** @type {import("jest").Config} **/
|
|
6
|
+
export default {
|
|
7
|
+
testEnvironment: "node",
|
|
8
|
+
transform: {
|
|
9
|
+
...tsJestTransformCfg,
|
|
10
|
+
},
|
|
11
|
+
transformIgnorePatterns: ["/node_modules/(?!@smithy|@aws-sdk).+\\.js$"],
|
|
12
|
+
globals : {
|
|
13
|
+
"ts-jest" : {
|
|
14
|
+
useESM : true
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
extensionsToTreatAsEsm : [".ts"],
|
|
18
|
+
testTimeout : 30000,
|
|
19
|
+
testPathIgnorePatterns: ['dist/']
|
|
20
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "doersiq-types",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"main": "dist/src/index.js",
|
|
5
|
+
"types": "dist/src/index.d.ts",
|
|
6
|
+
"directories": {
|
|
7
|
+
"test": "test"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
11
|
+
"build": "tsc && tsc-alias"
|
|
12
|
+
},
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"description": "",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"dependencies": {},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@eslint/js": "^9.39.2",
|
|
20
|
+
"@types/jest": "^30.0.0",
|
|
21
|
+
"eslint": "^9.39.2",
|
|
22
|
+
"globals": "^17.3.0",
|
|
23
|
+
"jest": "^30.2.0",
|
|
24
|
+
"jiti": "^2.6.1",
|
|
25
|
+
"ts-jest": "^29.4.6",
|
|
26
|
+
"tsc-alias": "^1.8.16",
|
|
27
|
+
"tsx": "^4.21.0",
|
|
28
|
+
"typescript": "^5.9.3",
|
|
29
|
+
"typescript-eslint": "^8.55.0"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./types/Bot"
|
|
2
|
+
export * from "./types/BotDocument"
|
|
3
|
+
export * from "./types/Conversation"
|
|
4
|
+
export * from "./types/DoersAPIError"
|
|
5
|
+
export * from "./types/Jurisdiction"
|
|
6
|
+
export * from "./types/JurisdictionDocument"
|
|
7
|
+
export * from "./types/Message"
|
|
8
|
+
export * from "./types/OfficeClass"
|
|
9
|
+
export * from "./types/Party"
|
|
10
|
+
export * from "./types/Sources"
|
|
11
|
+
export * from "./types/State"
|
|
12
|
+
export * from "./types/Tweet"
|
|
13
|
+
export * from "./types/User"
|