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.
Files changed (60) hide show
  1. package/dist/src/index.d.ts +14 -0
  2. package/dist/src/index.js +14 -0
  3. package/dist/src/types/APIError.d.ts +4 -0
  4. package/dist/src/types/APIError.js +19 -0
  5. package/dist/src/types/Bill.d.ts +19 -0
  6. package/dist/src/types/Bill.js +47 -0
  7. package/dist/src/types/Bot.d.ts +28 -0
  8. package/dist/src/types/Bot.js +72 -0
  9. package/dist/src/types/BotDocument.d.ts +14 -0
  10. package/dist/src/types/BotDocument.js +38 -0
  11. package/dist/src/types/Conversation.d.ts +16 -0
  12. package/dist/src/types/Conversation.js +41 -0
  13. package/dist/src/types/DoersAPIError.d.ts +4 -0
  14. package/dist/src/types/DoersAPIError.js +19 -0
  15. package/dist/src/types/DoersIQConfig.d.ts +27 -0
  16. package/dist/src/types/DoersIQConfig.js +1 -0
  17. package/dist/src/types/Jurisdiction.d.ts +24 -0
  18. package/dist/src/types/Jurisdiction.js +57 -0
  19. package/dist/src/types/JurisdictionDocument.d.ts +15 -0
  20. package/dist/src/types/JurisdictionDocument.js +44 -0
  21. package/dist/src/types/Message.d.ts +23 -0
  22. package/dist/src/types/Message.js +63 -0
  23. package/dist/src/types/OfficeClass.d.ts +17 -0
  24. package/dist/src/types/OfficeClass.js +132 -0
  25. package/dist/src/types/Party.d.ts +10 -0
  26. package/dist/src/types/Party.js +26 -0
  27. package/dist/src/types/Scout.d.ts +28 -0
  28. package/dist/src/types/Scout.js +72 -0
  29. package/dist/src/types/ScoutConfig.d.ts +27 -0
  30. package/dist/src/types/ScoutConfig.js +1 -0
  31. package/dist/src/types/ScoutDocument.d.ts +14 -0
  32. package/dist/src/types/ScoutDocument.js +38 -0
  33. package/dist/src/types/Sources.d.ts +50 -0
  34. package/dist/src/types/Sources.js +138 -0
  35. package/dist/src/types/State.d.ts +11 -0
  36. package/dist/src/types/State.js +306 -0
  37. package/dist/src/types/Tweet.d.ts +12 -0
  38. package/dist/src/types/Tweet.js +34 -0
  39. package/dist/src/types/User.d.ts +16 -0
  40. package/dist/src/types/User.js +42 -0
  41. package/eslint.config.ts +13 -0
  42. package/jest.config.js +20 -0
  43. package/package.json +31 -0
  44. package/src/index.ts +14 -0
  45. package/src/types/APIError.ts +21 -0
  46. package/src/types/Bill.ts +57 -0
  47. package/src/types/Conversation.ts +52 -0
  48. package/src/types/Jurisdiction.ts +62 -0
  49. package/src/types/JurisdictionDocument.ts +48 -0
  50. package/src/types/Message.ts +73 -0
  51. package/src/types/OfficeClass.ts +150 -0
  52. package/src/types/Party.ts +36 -0
  53. package/src/types/Scout.ts +83 -0
  54. package/src/types/ScoutConfig.ts +28 -0
  55. package/src/types/ScoutDocument.ts +43 -0
  56. package/src/types/Sources.ts +163 -0
  57. package/src/types/State.ts +317 -0
  58. package/src/types/Tweet.ts +38 -0
  59. package/src/types/User.ts +53 -0
  60. package/tsconfig.json +34 -0
@@ -0,0 +1,317 @@
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"] as const
2
+
3
+ export type StateID = typeof state_ids[number]
4
+
5
+ export function is_state_id(state_id : any) : state_id is StateID {
6
+ return state_ids.includes(state_id)
7
+ }
8
+
9
+ export interface State {
10
+ state_id : StateID,
11
+ name : string,
12
+ jurisdiction_id : number,
13
+ schools_jurisdiction_id : number
14
+ }
15
+
16
+ export const states_by_state_id : Record<StateID, State> = {
17
+ AL : {
18
+ state_id : "AL",
19
+ name : "Alabama",
20
+ jurisdiction_id : 2280,
21
+ schools_jurisdiction_id : 13586
22
+ },
23
+ AK : {
24
+ state_id : "AK",
25
+ name : "Alaska",
26
+ jurisdiction_id : 2281,
27
+ schools_jurisdiction_id : 12910
28
+ },
29
+ AZ : {
30
+ state_id : "AZ",
31
+ name : "Arizona",
32
+ jurisdiction_id : 2148,
33
+ schools_jurisdiction_id : 12978
34
+ },
35
+ AR : {
36
+ state_id : "AR",
37
+ name : "Arkansas",
38
+ jurisdiction_id : 2282,
39
+ schools_jurisdiction_id : 12971
40
+ },
41
+ CA : {
42
+ state_id : "CA",
43
+ name : "California",
44
+ jurisdiction_id : 2283,
45
+ schools_jurisdiction_id : 12992
46
+ },
47
+ CO : {
48
+ state_id : "CO",
49
+ name : "Colorado",
50
+ jurisdiction_id : 2284,
51
+ schools_jurisdiction_id : 12897
52
+ },
53
+ CT : {
54
+ state_id : "CT",
55
+ name : "Connecticut",
56
+ jurisdiction_id : 2314,
57
+ schools_jurisdiction_id : 12998
58
+ },
59
+ DE : {
60
+ state_id : "DE",
61
+ name : "Delaware",
62
+ jurisdiction_id : 2315,
63
+ schools_jurisdiction_id : 13105
64
+ },
65
+ FL : {
66
+ state_id : "FL",
67
+ name : "Florida",
68
+ jurisdiction_id : 2316,
69
+ schools_jurisdiction_id : 13111
70
+ },
71
+ GA : {
72
+ state_id : "GA",
73
+ name : "Georgia",
74
+ jurisdiction_id : 2317,
75
+ schools_jurisdiction_id : 13119
76
+ },
77
+ HI : {
78
+ state_id : "HI",
79
+ name : "Hawaii",
80
+ jurisdiction_id : 2156,
81
+ schools_jurisdiction_id : 13127
82
+ },
83
+ ID : {
84
+ state_id : "ID",
85
+ name : "Idaho",
86
+ jurisdiction_id : 2318,
87
+ schools_jurisdiction_id : 13014
88
+ },
89
+ IL : {
90
+ state_id : "IL",
91
+ name : "Illinois",
92
+ jurisdiction_id : 2319,
93
+ schools_jurisdiction_id : 13065
94
+ },
95
+ IN : {
96
+ state_id : "IN",
97
+ name : "Indiana",
98
+ jurisdiction_id : 2159,
99
+ schools_jurisdiction_id : 13068
100
+ },
101
+ IA : {
102
+ state_id : "IA",
103
+ name : "Iowa",
104
+ jurisdiction_id : 2320,
105
+ schools_jurisdiction_id : 12917
106
+ },
107
+ KS : {
108
+ state_id : "KS",
109
+ name : "Kansas",
110
+ jurisdiction_id : 2161,
111
+ schools_jurisdiction_id : 13088
112
+ },
113
+ KY : {
114
+ state_id : "KY",
115
+ name : "Kentucky",
116
+ jurisdiction_id : 2162,
117
+ schools_jurisdiction_id : 13094
118
+ },
119
+ LA : {
120
+ state_id : "LA",
121
+ name : "Louisiana",
122
+ jurisdiction_id : 2163,
123
+ schools_jurisdiction_id : 13130
124
+ },
125
+ ME : {
126
+ state_id : "ME",
127
+ name : "Maine",
128
+ jurisdiction_id : 2164,
129
+ schools_jurisdiction_id : 38491
130
+ },
131
+ MD : {
132
+ state_id : "MD",
133
+ name : "Maryland",
134
+ jurisdiction_id : 2165,
135
+ schools_jurisdiction_id : 14199
136
+ },
137
+ MA : {
138
+ state_id : "MA",
139
+ name : "Massachusetts",
140
+ jurisdiction_id : 2166,
141
+ schools_jurisdiction_id : 13135
142
+ },
143
+ MI : {
144
+ state_id : "MI",
145
+ name : "Michigan",
146
+ jurisdiction_id : 2167,
147
+ schools_jurisdiction_id : 13448
148
+ },
149
+ MN : {
150
+ state_id : "MN",
151
+ name : "Minnesota",
152
+ jurisdiction_id : 2286,
153
+ schools_jurisdiction_id : 13233
154
+ },
155
+ MS : {
156
+ state_id : "MS",
157
+ name : "Mississippi",
158
+ jurisdiction_id : 2287,
159
+ schools_jurisdiction_id : 12965
160
+ },
161
+ MO : {
162
+ state_id : "MO",
163
+ name : "Missouri",
164
+ jurisdiction_id : 2288,
165
+ schools_jurisdiction_id : 12955
166
+ },
167
+ MT : {
168
+ state_id : "MT",
169
+ name : "Montana",
170
+ jurisdiction_id : 2289,
171
+ schools_jurisdiction_id : 38286
172
+ },
173
+ NE : {
174
+ state_id : "NE",
175
+ name : "Nebraska",
176
+ jurisdiction_id : 2290,
177
+ schools_jurisdiction_id : 13050
178
+ },
179
+ NV : {
180
+ state_id : "NV",
181
+ name : "Nevada",
182
+ jurisdiction_id : 2291,
183
+ schools_jurisdiction_id : 13425
184
+ },
185
+ NH : {
186
+ state_id : "NH",
187
+ name : "New Hampshire",
188
+ jurisdiction_id : 2292,
189
+ schools_jurisdiction_id : 13062
190
+ },
191
+ NJ : {
192
+ state_id : "NJ",
193
+ name : "New Jersey",
194
+ jurisdiction_id : 2293,
195
+ schools_jurisdiction_id : 13244
196
+ },
197
+ NM : {
198
+ state_id : "NM",
199
+ name : "New Mexico",
200
+ jurisdiction_id : 2294,
201
+ schools_jurisdiction_id : 13251
202
+ },
203
+ NY : {
204
+ state_id : "NY",
205
+ name : "New York",
206
+ jurisdiction_id : 2295,
207
+ schools_jurisdiction_id : 13429
208
+ },
209
+ NC : {
210
+ state_id : "NC",
211
+ name : "North Carolina",
212
+ jurisdiction_id : 2296,
213
+ schools_jurisdiction_id : 13009
214
+ },
215
+ ND : {
216
+ state_id : "ND",
217
+ name : "North Dakota",
218
+ jurisdiction_id : 2297,
219
+ schools_jurisdiction_id : 13042
220
+ },
221
+ OH : {
222
+ state_id : "OH",
223
+ name : "Ohio",
224
+ jurisdiction_id : 2298,
225
+ schools_jurisdiction_id : 13224
226
+ },
227
+ OK : {
228
+ state_id : "OK",
229
+ name : "Oklahoma",
230
+ jurisdiction_id : 2299,
231
+ schools_jurisdiction_id : 13223
232
+ },
233
+ OR : {
234
+ state_id : "OR",
235
+ name : "Oregon",
236
+ jurisdiction_id : 2300,
237
+ schools_jurisdiction_id : 13221
238
+ },
239
+ PA : {
240
+ state_id : "PA",
241
+ name : "Pennsylvania",
242
+ jurisdiction_id : 2301,
243
+ schools_jurisdiction_id : 12918
244
+ },
245
+ RI : {
246
+ state_id : "RI",
247
+ name : "Rhode Island",
248
+ jurisdiction_id : 2302,
249
+ schools_jurisdiction_id : 12926
250
+ },
251
+ SC : {
252
+ state_id : "SC",
253
+ name : "South Carolina",
254
+ jurisdiction_id : 2303,
255
+ schools_jurisdiction_id : 12929
256
+ },
257
+ SD : {
258
+ state_id : "SD",
259
+ name : "South Dakota",
260
+ jurisdiction_id : 2304,
261
+ schools_jurisdiction_id : 12938
262
+ },
263
+ TN : {
264
+ state_id : "TN",
265
+ name : "Tennessee",
266
+ jurisdiction_id : 2305,
267
+ schools_jurisdiction_id : 12942
268
+ },
269
+ TX : {
270
+ state_id : "TX",
271
+ name : "Texas",
272
+ jurisdiction_id : 2306,
273
+ schools_jurisdiction_id : 12949
274
+ },
275
+ UT : {
276
+ state_id : "UT",
277
+ name : "Utah",
278
+ jurisdiction_id : 2307,
279
+ schools_jurisdiction_id : 65780
280
+ },
281
+ VT : {
282
+ state_id : "VT",
283
+ name : "Vermont",
284
+ jurisdiction_id : 2308,
285
+ schools_jurisdiction_id : 47348
286
+ },
287
+ VA : {
288
+ state_id : "VA",
289
+ name : "Virginia",
290
+ jurisdiction_id : 2309,
291
+ schools_jurisdiction_id : 13026
292
+ },
293
+ WA : {
294
+ state_id : "WA",
295
+ name : "Washington",
296
+ jurisdiction_id : 2310,
297
+ schools_jurisdiction_id : 13032
298
+ },
299
+ WV : {
300
+ state_id : "WV",
301
+ name : "West Virginia",
302
+ jurisdiction_id : 2311,
303
+ schools_jurisdiction_id : 13056
304
+ },
305
+ WI : {
306
+ state_id : "WI",
307
+ name : "Wisconsin",
308
+ jurisdiction_id : 2312,
309
+ schools_jurisdiction_id : 13044
310
+ },
311
+ WY : {
312
+ state_id : "WY",
313
+ name : "Wyoming",
314
+ jurisdiction_id : 2313,
315
+ schools_jurisdiction_id : 13148
316
+ }
317
+ }
@@ -0,0 +1,38 @@
1
+ export 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
+
11
+ constructor(tweet : any) {
12
+ if (!Tweet.is(tweet)) {
13
+ throw Error("Invalid input.")
14
+ }
15
+ this.tweet_id = tweet.tweet_id
16
+ this.username = tweet.username
17
+ this.url = tweet.url
18
+ this.tweet_time = tweet.tweet_time
19
+ this.tweet_content = tweet.tweet_content
20
+ this.quote = tweet.quote
21
+ this.html = tweet.html
22
+ this.text = tweet.text
23
+ }
24
+
25
+ static is(tweet : any) : tweet is Tweet {
26
+ return (
27
+ tweet !== undefined &&
28
+ typeof tweet.tweet_id === "string" &&
29
+ typeof tweet.username === "string" &&
30
+ typeof tweet.url === "string" &&
31
+ typeof tweet.tweet_time === "string" &&
32
+ typeof tweet.tweet_content === "string" &&
33
+ (tweet.quote === undefined || typeof tweet.quote === "string") &&
34
+ (typeof tweet.html === "string") &&
35
+ (typeof tweet.text === "string")
36
+ )
37
+ }
38
+ }
@@ -0,0 +1,53 @@
1
+ import { ScoutAux } from "./Scout"
2
+
3
+ export class User {
4
+ readonly user_id : string
5
+ readonly admin : boolean
6
+ readonly active : boolean
7
+ readonly scout_ids : string[]
8
+ readonly email : string
9
+ readonly [x : string] : any
10
+
11
+ constructor(user : any) {
12
+ if (!User.is(user)) {
13
+ throw Error("Invalid Input.")
14
+ }
15
+ this.user_id = user.user_id
16
+ this.admin = user.admin
17
+ this.active = user.active
18
+ this.scout_ids = user.scout_ids
19
+ this.email = user.email
20
+ }
21
+
22
+ static is(user : any) : user is User {
23
+ return (
24
+ user !== undefined &&
25
+ typeof user.user_id === "string" &&
26
+ typeof user.admin === "boolean" &&
27
+ typeof user.active === "boolean" &&
28
+ typeof user.email === "string" &&
29
+ Array.isArray(user.scout_ids) &&
30
+ user.scout_ids.every((scout_id : any) => typeof scout_id === "string")
31
+ )
32
+ }
33
+ }
34
+
35
+ export class UserAux extends User {
36
+ readonly scouts : ScoutAux[]
37
+
38
+ constructor(user : any) {
39
+ if (!UserAux.is(user)) {
40
+ throw Error("Invalid Input.")
41
+ }
42
+ super(user)
43
+ this.scouts = user.scouts
44
+ }
45
+
46
+ static is(user : any) : user is UserAux {
47
+ return (
48
+ User.is(user) &&
49
+ Array.isArray(user.scouts) &&
50
+ user.scouts.every(ScoutAux.is)
51
+ )
52
+ }
53
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "./dist",
4
+
5
+ // Treat files as modules even if it doesn't use import/export
6
+ "moduleDetection": "force",
7
+
8
+ // Ignore module structure
9
+ "module" : "esnext",
10
+ "target" : "es2022",
11
+ "noImplicitAny" : true,
12
+ "noImplicitReturns" : true,
13
+ "moduleResolution": "bundler",
14
+ "declaration": true,
15
+ // Allow JS files to be imported from TS and vice versa
16
+ "allowJs": true,
17
+ "strict" : true,
18
+ // Use correct ESM import behavior
19
+ "esModuleInterop": true,
20
+ "resolveJsonModule": true,
21
+ // Disallow features that require cross-file awareness
22
+ "isolatedModules": true,
23
+ "lib": ["es2022"],
24
+ "rootDir": "./",
25
+ "skipLibCheck": true,
26
+ "maxNodeModuleJsDepth": 0,
27
+ "types": ["jest", "node"]
28
+ },
29
+ "tsc-alias": {
30
+ "resolveFullPaths": true,
31
+ "verbose": false
32
+ },
33
+ "include" : ["src/**/*", "test/**/*"]
34
+ }