legiscan-ts 3.0.0 → 3.0.1
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/README.md +25 -8
- package/dist/cli.mjs +71 -104
- package/dist/index.cjs +96 -105
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1059 -1391
- package/dist/index.d.ts +1059 -1391
- package/dist/index.js +72 -105
- package/dist/index.js.map +1 -1
- package/package.json +9 -8
package/dist/index.cjs
CHANGED
|
@@ -137,7 +137,7 @@ const BillType = {
|
|
|
137
137
|
Remonstration: 22,
|
|
138
138
|
CommitteeBill: 23
|
|
139
139
|
};
|
|
140
|
-
const
|
|
140
|
+
const VoteType = {
|
|
141
141
|
Yea: 1,
|
|
142
142
|
Nay: 2,
|
|
143
143
|
Abstain: 3,
|
|
@@ -217,9 +217,8 @@ function zNames(haystack) {
|
|
|
217
217
|
function zNumbers(haystack) {
|
|
218
218
|
return zod.z.union(Object.values(haystack).map((n) => zod.z.literal(n)));
|
|
219
219
|
}
|
|
220
|
-
// src/
|
|
221
|
-
|
|
222
|
-
const _zSession = zod.z.object({
|
|
220
|
+
// src/types.ts
|
|
221
|
+
const SessionSchema = zod.z.object({
|
|
223
222
|
session_id: zod.z.number().describe("Internal session id"),
|
|
224
223
|
session_name: zod.z.string().describe("State specific session name"),
|
|
225
224
|
session_title: zod.z.string().describe("Normalized session title with year(s) and Regular/Nth Special Session"),
|
|
@@ -233,13 +232,11 @@ const _zSession = zod.z.object({
|
|
|
233
232
|
prior: zod.z.boolean().describe("Flag for session being archived"),
|
|
234
233
|
sine_die: zod.z.boolean().describe("Flag for session being adjourned sine die")
|
|
235
234
|
});
|
|
236
|
-
|
|
237
|
-
const zGetSessionList = zod.z.array(_zSession.extend({
|
|
235
|
+
const SessionListSchema = zod.z.array(SessionSchema.extend({
|
|
238
236
|
session_hash: zod.z.hash("md5").nullable().describe("Hash of session data, used for caching"),
|
|
239
237
|
dataset_hash: zod.z.hash("md5").nullable().describe("Hash of entire dataset, used for caching")
|
|
240
238
|
}));
|
|
241
|
-
|
|
242
|
-
const _zBillText = zod.z.object({
|
|
239
|
+
const BillTextSchema = zod.z.object({
|
|
243
240
|
doc_id: zod.z.number().describe("Internal document id"),
|
|
244
241
|
bill_id: zod.z.number().optional().describe("Internal bill id"),
|
|
245
242
|
type: zNames(TextType).describe("Type of draft text"),
|
|
@@ -259,38 +256,30 @@ const _zBillText = zod.z.object({
|
|
|
259
256
|
alt_mime_raw: zod.z.string().nullable().describe("Raw MIME type of the alternate document, e.g. 'application/pdf'"),
|
|
260
257
|
alt_state_link: zod.z.url().nullable().describe("URL of alternate document on state website"),
|
|
261
258
|
alt_text_size: zod.z.number().nullable().describe("Size in bytes of the decoded BASE64 alternate document (add 33% for base64)"),
|
|
262
|
-
alt_text_hash: zod.z.hash("md5").nullable().describe("MD5 hash of the decoded BASE64 alternate document")
|
|
259
|
+
alt_text_hash: zod.z.hash("md5").nullable().describe("MD5 hash of the decoded BASE64 alternate document"),
|
|
260
|
+
doc: zod.z.base64().describe("BASE64 encoded document").nullish(),
|
|
261
|
+
alt_doc: zod.z.base64().describe("BASE64 encoded alternate document").nullish()
|
|
263
262
|
});
|
|
264
|
-
|
|
265
|
-
const zGetBillText = _zBillText.extend({
|
|
266
|
-
doc: zod.z.base64().describe("BASE64 encoded document"),
|
|
267
|
-
alt_doc: zod.z.unknown()
|
|
268
|
-
});
|
|
269
|
-
/** @public */
|
|
270
|
-
const _zCommittee = zod.z.object({
|
|
263
|
+
const CommitteeSchema = zod.z.object({
|
|
271
264
|
committee_id: zod.z.number().describe("Internal committee id"),
|
|
272
265
|
chamber_raw: zod.z.string().describe("Internal chamber name, e.g. 'S' or 'H'"),
|
|
273
266
|
chamber_id: zod.z.number().describe("Internal chamber id"),
|
|
274
267
|
name: zod.z.string().describe("Committee name")
|
|
275
268
|
});
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
/** @public */
|
|
279
|
-
const _zBillProgress = zod.z.object({
|
|
269
|
+
const CommitteeReferralSchema = zod.z.intersection(CommitteeSchema, zod.z.object({ date: zod.z.iso.date().describe("Date of referral") }));
|
|
270
|
+
const BillProgressSchema = zod.z.object({
|
|
280
271
|
date: zod.z.iso.date().describe("Date of progress event"),
|
|
281
272
|
event: zNames(Progress).describe("Normalized progress event"),
|
|
282
273
|
event_id: zNumbers(Progress).describe("Internal progress event id")
|
|
283
274
|
});
|
|
284
|
-
|
|
285
|
-
const _zBillHistory = zod.z.object({
|
|
275
|
+
const BillHistorySchema = zod.z.object({
|
|
286
276
|
date: zod.z.iso.date().describe("Date of action"),
|
|
287
277
|
action: zod.z.string().describe("Description of action taken"),
|
|
288
278
|
chamber_raw: zod.z.string().nullable().describe("Internal chamber name"),
|
|
289
279
|
chamber_id: zod.z.number().nullable().describe("Internal chamber id"),
|
|
290
280
|
importance: zod.z.boolean().describe("Flag for major steps (i.e. those included in progress list)")
|
|
291
281
|
});
|
|
292
|
-
|
|
293
|
-
const _zPerson = zod.z.object({
|
|
282
|
+
const PersonSchema = zod.z.object({
|
|
294
283
|
people_id: zod.z.number().describe("Internal person id"),
|
|
295
284
|
person_hash: zod.z.string().describe("Hash of the person's details, used for caching"),
|
|
296
285
|
party: zNames(Party).describe("Normalized party, e.g. 'Democrat' or 'Republican'"),
|
|
@@ -319,23 +308,18 @@ const _zPerson = zod.z.object({
|
|
|
319
308
|
state_federal: zod.z.unknown(),
|
|
320
309
|
bio: zod.z.unknown()
|
|
321
310
|
});
|
|
322
|
-
|
|
323
|
-
const zGetPerson = _zPerson.extend({});
|
|
324
|
-
/** @public */
|
|
325
|
-
const _zSast = zod.z.object({
|
|
311
|
+
const SastSchema = zod.z.object({
|
|
326
312
|
type: zNames(SastType).describe("Normalized sast type"),
|
|
327
313
|
type_id: zNumbers(SastType).describe("Internal sast id"),
|
|
328
314
|
type_raw: zod.z.string().describe("Internal sast type name"),
|
|
329
315
|
sast_bill_number: zod.z.string().describe("Bill number of the sast, e.g. HB 1234"),
|
|
330
316
|
sast_bill_id: zod.z.number().describe("Internal bill id of the sast")
|
|
331
317
|
});
|
|
332
|
-
|
|
333
|
-
const _zSubject = zod.z.object({
|
|
318
|
+
const SubjectSchema = zod.z.object({
|
|
334
319
|
subject_id: zod.z.number().describe("Internal subject id"),
|
|
335
320
|
subject_name: zod.z.string().describe("Name of the subject")
|
|
336
321
|
});
|
|
337
|
-
|
|
338
|
-
const _zVote = zod.z.object({
|
|
322
|
+
const VoteSchema = zod.z.object({
|
|
339
323
|
roll_call_id: zod.z.number().describe("Internal roll call id"),
|
|
340
324
|
date: zod.z.iso.date().describe("Date of the vote"),
|
|
341
325
|
description: zod.z.string().describe("Description of the vote"),
|
|
@@ -348,8 +332,7 @@ const _zVote = zod.z.object({
|
|
|
348
332
|
chamber_id: zod.z.number().describe("Internal chamber id"),
|
|
349
333
|
chamber_raw: zod.z.string().describe("Internal chamber name, e.g. 'S' or 'H'")
|
|
350
334
|
});
|
|
351
|
-
|
|
352
|
-
const _zAmendment = zod.z.object({
|
|
335
|
+
const AmendmentSchema = zod.z.object({
|
|
353
336
|
amendment_id: zod.z.number().describe("Internal amendment id"),
|
|
354
337
|
adopted: zod.z.boolean().describe("Flag for whether the amendment was adopted"),
|
|
355
338
|
chamber_id: zod.z.number().describe("Internal chamber id"),
|
|
@@ -370,16 +353,12 @@ const _zAmendment = zod.z.object({
|
|
|
370
353
|
alt_mime_raw: zod.z.string().nullable().describe("Raw MIME type of the alternate document, e.g. 'application/pdf'"),
|
|
371
354
|
alt_state_link: zod.z.url().nullable().describe("URL of the alternate document on state website"),
|
|
372
355
|
alt_amendment_size: zod.z.number().nullable().describe("Size in bytes of the decoded alternate BASE64 document (add 33% for base64)"),
|
|
373
|
-
alt_amendment_hash: zod.z.hash("md5").nullable().describe("MD5 hash of the decoded alternate BASE64 document")
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
bill_id: zod.z.number().describe("Internal bill id the amendment belongs to"),
|
|
378
|
-
doc: zod.z.base64().describe("BASE64 encoded document"),
|
|
379
|
-
alt_doc: zod.z.base64().nullable().describe("BASE64 encoded alternate document")
|
|
356
|
+
alt_amendment_hash: zod.z.hash("md5").nullable().describe("MD5 hash of the decoded alternate BASE64 document"),
|
|
357
|
+
bill_id: zod.z.number().describe("Internal bill id the amendment belongs to").nullish(),
|
|
358
|
+
doc: zod.z.base64().describe("BASE64 encoded document").nullish(),
|
|
359
|
+
alt_doc: zod.z.base64().nullable().describe("BASE64 encoded alternate document").nullish()
|
|
380
360
|
});
|
|
381
|
-
|
|
382
|
-
const _zSupplement = zod.z.object({
|
|
361
|
+
const SupplementSchema = zod.z.object({
|
|
383
362
|
supplement_id: zod.z.number().describe("Internal supplement id"),
|
|
384
363
|
date: zod.z.iso.date().nullable().describe("Date of the supplement"),
|
|
385
364
|
type: zNames(SupplementType).describe("Normalized supplement type"),
|
|
@@ -398,16 +377,12 @@ const _zSupplement = zod.z.object({
|
|
|
398
377
|
alt_mime_raw: zod.z.string().nullable().describe("Raw MIME type of the alternate document, e.g. 'application/pdf'"),
|
|
399
378
|
alt_state_link: zod.z.url().nullable().describe("URL of the alternate document on state website"),
|
|
400
379
|
alt_supplement_size: zod.z.number().nullable().describe("Size in bytes of the decoded alternate BASE64 document (add 33% for base64)"),
|
|
401
|
-
alt_supplement_hash: zod.z.hash("md5").nullable().describe("MD5 hash of the decoded alternate BASE64 document")
|
|
380
|
+
alt_supplement_hash: zod.z.hash("md5").nullable().describe("MD5 hash of the decoded alternate BASE64 document"),
|
|
381
|
+
bill_id: zod.z.number().describe("Internal bill id the supplement belongs to").nullish(),
|
|
382
|
+
doc: zod.z.base64().describe("BASE64 encoded document").nullish(),
|
|
383
|
+
alt_doc: zod.z.base64().nullable().describe("BASE64 encoded alternate document").nullish()
|
|
402
384
|
});
|
|
403
|
-
|
|
404
|
-
const zGetSupplement = _zSupplement.extend({
|
|
405
|
-
bill_id: zod.z.number().describe("Internal bill id the supplement belongs to"),
|
|
406
|
-
doc: zod.z.base64().describe("BASE64 encoded document"),
|
|
407
|
-
alt_doc: zod.z.base64().nullable().describe("BASE64 encoded alternate document")
|
|
408
|
-
});
|
|
409
|
-
/** @public */
|
|
410
|
-
const _zEvent = zod.z.object({
|
|
385
|
+
const EventSchema = zod.z.object({
|
|
411
386
|
type: zNames(EventType).describe("Normalized event type"),
|
|
412
387
|
type_id: zNumbers(EventType).describe("Internal event type id"),
|
|
413
388
|
type_raw: zod.z.string().describe("Internal event type name"),
|
|
@@ -416,8 +391,7 @@ const _zEvent = zod.z.object({
|
|
|
416
391
|
location: zod.z.string().nullable().describe("Location of the event (if available)"),
|
|
417
392
|
description: zod.z.string().describe("Description of the event")
|
|
418
393
|
});
|
|
419
|
-
|
|
420
|
-
const _zBill = zod.z.object({
|
|
394
|
+
const BillBaseSchema = zod.z.object({
|
|
421
395
|
bill_id: zod.z.number().describe("Internal bill id"),
|
|
422
396
|
bill_number: zod.z.string().describe("Bill number, e.g. HB 1234"),
|
|
423
397
|
title: zod.z.string().describe("Official bill title"),
|
|
@@ -428,43 +402,40 @@ const _zBill = zod.z.object({
|
|
|
428
402
|
status_date: zod.z.iso.date().nullable().describe("Date of last progress update (if available)"),
|
|
429
403
|
change_hash: zod.z.hash("md5").describe("Hash of bill data, used for caching")
|
|
430
404
|
});
|
|
431
|
-
|
|
432
|
-
const _zBillWithAction = _zBill.extend({
|
|
405
|
+
const MasterListSchema = zod.z.array(BillBaseSchema.extend({
|
|
433
406
|
last_action: zod.z.string().nullable().describe("Description of the bill's last action (if available)"),
|
|
434
407
|
last_action_date: zod.z.iso.date().nullable().describe("Date of the bill's last action (if available)")
|
|
435
|
-
});
|
|
436
|
-
const
|
|
437
|
-
zod.z.array(_zBillWithAction.extend({
|
|
408
|
+
}));
|
|
409
|
+
const SearchSchema = zod.z.array(BillBaseSchema.extend({
|
|
438
410
|
relevance: zod.z.number().describe("Relevance score of the search result"),
|
|
439
411
|
state: zNames(State).describe("Normalized state"),
|
|
440
412
|
state_id: zNumbers(State).describe("Internal state id"),
|
|
441
413
|
bill_id: zod.z.number().describe("Internal bill id"),
|
|
442
414
|
text_url: zod.z.url().describe("URL of the bill text on legiscan.com"),
|
|
443
|
-
research_url: zod.z.url().describe("URL of the bill research page on legiscan.com")
|
|
415
|
+
research_url: zod.z.url().describe("URL of the bill research page on legiscan.com"),
|
|
416
|
+
last_action: zod.z.string().nullable().describe("Description of the bill's last action (if available)"),
|
|
417
|
+
last_action_date: zod.z.iso.date().nullable().describe("Date of the bill's last action (if available)")
|
|
444
418
|
}).omit({
|
|
445
419
|
description: true,
|
|
446
420
|
status: true,
|
|
447
421
|
status_id: true,
|
|
448
422
|
status_date: true
|
|
449
423
|
}));
|
|
450
|
-
|
|
451
|
-
const _zBillVote = _zVote.extend({
|
|
424
|
+
const BillVoteSchema = VoteSchema.extend({
|
|
452
425
|
url: zod.z.url().describe("URL of the vote on legiscan.com"),
|
|
453
426
|
state_link: zod.z.url().describe("URL of the vote on state website")
|
|
454
427
|
});
|
|
455
|
-
|
|
456
|
-
const _zSponsor = _zPerson.extend({
|
|
428
|
+
const SponsorSchema = PersonSchema.extend({
|
|
457
429
|
sponsor_type: zNames(SponsorType).describe("Normalized sponsor type"),
|
|
458
430
|
sponsor_type_id: zNumbers(SponsorType).describe("Internal sponsor type id"),
|
|
459
431
|
sponsor_order: zod.z.number().describe("Order of sponsorship")
|
|
460
432
|
});
|
|
461
|
-
|
|
462
|
-
const zGetBill = _zBill.extend({
|
|
433
|
+
const BillSchema = BillBaseSchema.extend({
|
|
463
434
|
session_id: zod.z.number().describe("Internal session id"),
|
|
464
|
-
session:
|
|
435
|
+
session: SessionSchema.describe("Session object"),
|
|
465
436
|
state_link: zod.z.url().describe("URL of bill on state website"),
|
|
466
437
|
completed: zod.z.boolean().describe("Flag for whether bill is completed"),
|
|
467
|
-
progress: zod.z.array(
|
|
438
|
+
progress: zod.z.array(BillProgressSchema).describe("Major history of the bill (i.e. important items from history)"),
|
|
468
439
|
state: zNames(State).describe("Normalized state"),
|
|
469
440
|
state_id: zNumbers(State).describe("Internal state id"),
|
|
470
441
|
state_raw: zod.z.string().describe("Internal state name"),
|
|
@@ -476,37 +447,33 @@ const zGetBill = _zBill.extend({
|
|
|
476
447
|
current_body_id: zod.z.number().nullable().describe("Internal body id (current)"),
|
|
477
448
|
current_body_raw: zod.z.string().nullable().describe("Internal body name (current)"),
|
|
478
449
|
pending_committee_id: zod.z.number().describe("Internal committee id"),
|
|
479
|
-
committee: zod.z.array(
|
|
480
|
-
referrals: zod.z.array(
|
|
481
|
-
history: zod.z.array(
|
|
482
|
-
sponsors: zod.z.array(
|
|
483
|
-
sasts: zod.z.array(
|
|
484
|
-
subjects: zod.z.array(
|
|
485
|
-
texts: zod.z.array(
|
|
486
|
-
votes: zod.z.array(
|
|
487
|
-
amendments: zod.z.array(
|
|
488
|
-
supplements: zod.z.array(
|
|
489
|
-
calendar: zod.z.array(
|
|
450
|
+
committee: zod.z.array(CommitteeSchema).describe("List of committees if pending"),
|
|
451
|
+
referrals: zod.z.array(CommitteeReferralSchema).describe("History of committee referrals"),
|
|
452
|
+
history: zod.z.array(BillHistorySchema).describe("Full history of the bill"),
|
|
453
|
+
sponsors: zod.z.array(SponsorSchema).describe("Sponsors of the bill"),
|
|
454
|
+
sasts: zod.z.array(SastSchema).describe("SASTs of the bill"),
|
|
455
|
+
subjects: zod.z.array(SubjectSchema).describe("Subjects of the bill"),
|
|
456
|
+
texts: zod.z.array(BillTextSchema).describe("Documents from the bill"),
|
|
457
|
+
votes: zod.z.array(BillVoteSchema).describe("Votes for the bill"),
|
|
458
|
+
amendments: zod.z.array(AmendmentSchema).describe("Amendments to the bill"),
|
|
459
|
+
supplements: zod.z.array(SupplementSchema).describe("Supplements to the bill"),
|
|
460
|
+
calendar: zod.z.array(EventSchema).describe("Events related to the bill")
|
|
490
461
|
});
|
|
491
|
-
|
|
492
|
-
const _zRollCallVote = zod.z.object({
|
|
462
|
+
const RollCallVoteSchema = zod.z.object({
|
|
493
463
|
people_id: zod.z.number().describe("Internal person id"),
|
|
494
|
-
vote: zNames(
|
|
495
|
-
vote_id: zNumbers(
|
|
464
|
+
vote: zNames(VoteType).describe("Vote of the person"),
|
|
465
|
+
vote_id: zNumbers(VoteType).describe("Internal vote id"),
|
|
496
466
|
vote_raw: zod.z.string().describe("Internal vote name")
|
|
497
467
|
});
|
|
498
|
-
|
|
499
|
-
const zGetRollCall = _zVote.extend({
|
|
468
|
+
const RollCallSchema = VoteSchema.extend({
|
|
500
469
|
bill_id: zod.z.number().describe("Internal bill id the vote belongs to"),
|
|
501
|
-
votes: zod.z.array(
|
|
470
|
+
votes: zod.z.array(RollCallVoteSchema).describe("Individual votes for the roll call")
|
|
502
471
|
});
|
|
503
|
-
|
|
504
|
-
const
|
|
505
|
-
/** @public */
|
|
506
|
-
const zGetSponsoredList = zod.z.array(zod.z.object({
|
|
472
|
+
const SessionPeopleSchema = zod.z.array(PersonSchema.extend({}));
|
|
473
|
+
const SponsoredListSchema = zod.z.array(zod.z.object({
|
|
507
474
|
bill_id: zod.z.number().describe("Internal bill id"),
|
|
508
475
|
bill_number: zod.z.string().describe("Bill number, e.g. HB 1234"),
|
|
509
|
-
session:
|
|
476
|
+
session: SessionSchema
|
|
510
477
|
}));
|
|
511
478
|
// src/client.ts
|
|
512
479
|
/**
|
|
@@ -558,7 +525,7 @@ var LegiscanClient = class {
|
|
|
558
525
|
*/
|
|
559
526
|
async getSessionList({ state }) {
|
|
560
527
|
const { sessions } = await this.request("getSessionList", { ...state ? { state: asName(State, state) } : {} });
|
|
561
|
-
return
|
|
528
|
+
return SessionListSchema.parse(sessions.map((s) => ({
|
|
562
529
|
session_id: s.session_id,
|
|
563
530
|
state: asName(State, s.state_id),
|
|
564
531
|
state_id: s.state_id,
|
|
@@ -586,7 +553,7 @@ var LegiscanClient = class {
|
|
|
586
553
|
...state ? { state: asName(State, state) } : {},
|
|
587
554
|
...session ? { id: session.toString() } : {}
|
|
588
555
|
});
|
|
589
|
-
return
|
|
556
|
+
return MasterListSchema.parse(numericalToArray(masterlist).map((b) => ({
|
|
590
557
|
bill_id: b.bill_id,
|
|
591
558
|
bill_number: b.number,
|
|
592
559
|
title: b.title,
|
|
@@ -607,7 +574,7 @@ var LegiscanClient = class {
|
|
|
607
574
|
*/
|
|
608
575
|
async getBillText({ id }) {
|
|
609
576
|
const { text } = await this.request("getBillText", { id });
|
|
610
|
-
return
|
|
577
|
+
return BillTextSchema.parse({
|
|
611
578
|
doc_id: text.doc_id,
|
|
612
579
|
bill_id: text.bill_id,
|
|
613
580
|
type: asName(TextType, text.type_id),
|
|
@@ -640,7 +607,7 @@ var LegiscanClient = class {
|
|
|
640
607
|
async getBill({ id }) {
|
|
641
608
|
const { bill } = await this.request("getBill", { id });
|
|
642
609
|
if (!Array.isArray(bill.committee)) bill.committee = [bill.committee];
|
|
643
|
-
return
|
|
610
|
+
return BillSchema.parse({
|
|
644
611
|
bill_id: bill.bill_id,
|
|
645
612
|
change_hash: bill.change_hash,
|
|
646
613
|
session_id: bill.session_id,
|
|
@@ -845,7 +812,7 @@ var LegiscanClient = class {
|
|
|
845
812
|
*/
|
|
846
813
|
async getAmendment({ id }) {
|
|
847
814
|
const { amendment } = await this.request("getAmendment", { id });
|
|
848
|
-
return
|
|
815
|
+
return AmendmentSchema.parse({
|
|
849
816
|
amendment_id: amendment.amendment_id,
|
|
850
817
|
bill_id: amendment.bill_id,
|
|
851
818
|
adopted: Boolean(amendment.adopted),
|
|
@@ -879,7 +846,7 @@ var LegiscanClient = class {
|
|
|
879
846
|
*/
|
|
880
847
|
async getSupplement({ id }) {
|
|
881
848
|
const { supplement } = await this.request("getSupplement", { id });
|
|
882
|
-
return
|
|
849
|
+
return SupplementSchema.parse({
|
|
883
850
|
supplement_id: supplement.supplement_id,
|
|
884
851
|
bill_id: supplement.bill_id,
|
|
885
852
|
date: supplement.date !== "0000-00-00" ? supplement.date : null,
|
|
@@ -911,7 +878,7 @@ var LegiscanClient = class {
|
|
|
911
878
|
*/
|
|
912
879
|
async getRollCall({ id }) {
|
|
913
880
|
const { roll_call } = await this.request("getRollCall", { id });
|
|
914
|
-
return
|
|
881
|
+
return RollCallSchema.parse({
|
|
915
882
|
roll_call_id: roll_call.roll_call_id,
|
|
916
883
|
bill_id: roll_call.bill_id,
|
|
917
884
|
date: roll_call.date,
|
|
@@ -926,7 +893,7 @@ var LegiscanClient = class {
|
|
|
926
893
|
chamber_raw: roll_call.chamber,
|
|
927
894
|
votes: numericalToArray(roll_call.votes).map((v) => ({
|
|
928
895
|
people_id: v.people_id,
|
|
929
|
-
vote: asName(
|
|
896
|
+
vote: asName(VoteType, v.vote_id),
|
|
930
897
|
vote_id: v.vote_id,
|
|
931
898
|
vote_raw: v.vote_text
|
|
932
899
|
}))
|
|
@@ -939,7 +906,7 @@ var LegiscanClient = class {
|
|
|
939
906
|
*/
|
|
940
907
|
async getPerson({ id }) {
|
|
941
908
|
const { person } = await this.request("getPerson", { id });
|
|
942
|
-
return
|
|
909
|
+
return PersonSchema.parse({
|
|
943
910
|
people_id: person.people_id,
|
|
944
911
|
person_hash: person.person_hash,
|
|
945
912
|
party: asName(Party, parseInt(person.party_id, 10)),
|
|
@@ -976,7 +943,7 @@ var LegiscanClient = class {
|
|
|
976
943
|
*/
|
|
977
944
|
async getSessionPeople({ id }) {
|
|
978
945
|
const { sessionpeople: { people } } = await this.request("getSessionPeople", { id });
|
|
979
|
-
return
|
|
946
|
+
return SessionPeopleSchema.parse((people ?? []).map((person) => ({
|
|
980
947
|
people_id: person.people_id,
|
|
981
948
|
person_hash: person.person_hash,
|
|
982
949
|
party: asName(Party, parseInt(person.party_id, 10)),
|
|
@@ -1013,7 +980,7 @@ var LegiscanClient = class {
|
|
|
1013
980
|
*/
|
|
1014
981
|
async getSponsoredList({ id }) {
|
|
1015
982
|
const { sponsoredbills: { sessions, bills } } = await this.request("getSponsoredList", { id });
|
|
1016
|
-
return
|
|
983
|
+
return SponsoredListSchema.parse(bills.map((b) => ({
|
|
1017
984
|
bill_id: b.bill_id,
|
|
1018
985
|
bill_number: b.number,
|
|
1019
986
|
session: sessions.map((s) => ({
|
|
@@ -1063,7 +1030,7 @@ var LegiscanClient = class {
|
|
|
1063
1030
|
...state ? { state: asName(State, state) } : {},
|
|
1064
1031
|
...year ? { year: year.toString() } : {}
|
|
1065
1032
|
});
|
|
1066
|
-
yield* numericalToArray(searchresult).map((b) => ({
|
|
1033
|
+
yield* SearchSchema.parse(numericalToArray(searchresult).map((b) => ({
|
|
1067
1034
|
relevance: b.relevance,
|
|
1068
1035
|
state: b.state,
|
|
1069
1036
|
state_id: asNumber(State, b.state),
|
|
@@ -1076,27 +1043,51 @@ var LegiscanClient = class {
|
|
|
1076
1043
|
last_action: b.last_action,
|
|
1077
1044
|
last_action_date: b.last_action_date,
|
|
1078
1045
|
title: b.title
|
|
1079
|
-
}));
|
|
1046
|
+
})));
|
|
1080
1047
|
page++;
|
|
1081
1048
|
if (searchresult.summary.page_total < page) return;
|
|
1082
1049
|
}
|
|
1083
1050
|
}
|
|
1084
1051
|
};
|
|
1052
|
+
exports.AmendmentSchema = AmendmentSchema;
|
|
1053
|
+
exports.BillBaseSchema = BillBaseSchema;
|
|
1054
|
+
exports.BillHistorySchema = BillHistorySchema;
|
|
1055
|
+
exports.BillProgressSchema = BillProgressSchema;
|
|
1056
|
+
exports.BillSchema = BillSchema;
|
|
1057
|
+
exports.BillTextSchema = BillTextSchema;
|
|
1085
1058
|
exports.BillType = BillType;
|
|
1059
|
+
exports.BillVoteSchema = BillVoteSchema;
|
|
1060
|
+
exports.CommitteeReferralSchema = CommitteeReferralSchema;
|
|
1061
|
+
exports.CommitteeSchema = CommitteeSchema;
|
|
1062
|
+
exports.EventSchema = EventSchema;
|
|
1086
1063
|
exports.EventType = EventType;
|
|
1087
1064
|
exports.LegiscanClient = LegiscanClient;
|
|
1065
|
+
exports.MasterListSchema = MasterListSchema;
|
|
1088
1066
|
exports.Mime = Mime;
|
|
1089
1067
|
exports.Party = Party;
|
|
1068
|
+
exports.PersonSchema = PersonSchema;
|
|
1090
1069
|
exports.Progress = Progress;
|
|
1091
1070
|
exports.Reason = Reason;
|
|
1092
1071
|
exports.Role = Role;
|
|
1072
|
+
exports.RollCallSchema = RollCallSchema;
|
|
1073
|
+
exports.RollCallVoteSchema = RollCallVoteSchema;
|
|
1074
|
+
exports.SastSchema = SastSchema;
|
|
1093
1075
|
exports.SastType = SastType;
|
|
1076
|
+
exports.SearchSchema = SearchSchema;
|
|
1077
|
+
exports.SessionListSchema = SessionListSchema;
|
|
1078
|
+
exports.SessionPeopleSchema = SessionPeopleSchema;
|
|
1079
|
+
exports.SessionSchema = SessionSchema;
|
|
1080
|
+
exports.SponsorSchema = SponsorSchema;
|
|
1094
1081
|
exports.SponsorType = SponsorType;
|
|
1082
|
+
exports.SponsoredListSchema = SponsoredListSchema;
|
|
1095
1083
|
exports.Stance = Stance;
|
|
1096
1084
|
exports.State = State;
|
|
1085
|
+
exports.SubjectSchema = SubjectSchema;
|
|
1086
|
+
exports.SupplementSchema = SupplementSchema;
|
|
1097
1087
|
exports.SupplementType = SupplementType;
|
|
1098
1088
|
exports.TextType = TextType;
|
|
1099
|
-
exports.
|
|
1089
|
+
exports.VoteSchema = VoteSchema;
|
|
1090
|
+
exports.VoteType = VoteType;
|
|
1100
1091
|
exports.asName = asName;
|
|
1101
1092
|
exports.asNumber = asNumber;
|
|
1102
1093
|
exports.numericalToArray = numericalToArray;
|