@cyanheads/congressgov-mcp-server 0.8.1 → 0.9.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.
Files changed (84) hide show
  1. package/AGENTS.md +44 -17
  2. package/CLAUDE.md +44 -17
  3. package/Dockerfile +4 -0
  4. package/README.md +35 -124
  5. package/changelog/0.9.x/0.9.0.md +25 -0
  6. package/changelog/0.9.x/0.9.1.md +31 -0
  7. package/dist/config/server-config.d.ts +0 -7
  8. package/dist/config/server-config.d.ts.map +1 -1
  9. package/dist/config/server-config.js +1 -9
  10. package/dist/config/server-config.js.map +1 -1
  11. package/dist/index.js +1 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/mcp-server/tools/definitions/bill-lookup.tool.d.ts +9 -2
  14. package/dist/mcp-server/tools/definitions/bill-lookup.tool.d.ts.map +1 -1
  15. package/dist/mcp-server/tools/definitions/bill-summaries.tool.d.ts +9 -2
  16. package/dist/mcp-server/tools/definitions/bill-summaries.tool.d.ts.map +1 -1
  17. package/dist/mcp-server/tools/definitions/committee-lookup.tool.d.ts +9 -2
  18. package/dist/mcp-server/tools/definitions/committee-lookup.tool.d.ts.map +1 -1
  19. package/dist/mcp-server/tools/definitions/committee-reports.tool.d.ts +9 -2
  20. package/dist/mcp-server/tools/definitions/committee-reports.tool.d.ts.map +1 -1
  21. package/dist/mcp-server/tools/definitions/crs-reports.tool.d.ts +9 -2
  22. package/dist/mcp-server/tools/definitions/crs-reports.tool.d.ts.map +1 -1
  23. package/dist/mcp-server/tools/definitions/daily-record.tool.d.ts +9 -2
  24. package/dist/mcp-server/tools/definitions/daily-record.tool.d.ts.map +1 -1
  25. package/dist/mcp-server/tools/definitions/enacted-laws.tool.d.ts +9 -2
  26. package/dist/mcp-server/tools/definitions/enacted-laws.tool.d.ts.map +1 -1
  27. package/dist/mcp-server/tools/definitions/member-lookup.tool.d.ts +9 -2
  28. package/dist/mcp-server/tools/definitions/member-lookup.tool.d.ts.map +1 -1
  29. package/dist/mcp-server/tools/definitions/roll-votes.tool.d.ts +9 -2
  30. package/dist/mcp-server/tools/definitions/roll-votes.tool.d.ts.map +1 -1
  31. package/dist/mcp-server/tools/definitions/roll-votes.tool.js +3 -2
  32. package/dist/mcp-server/tools/definitions/roll-votes.tool.js.map +1 -1
  33. package/dist/mcp-server/tools/definitions/senate-nominations.tool.d.ts +49 -4
  34. package/dist/mcp-server/tools/definitions/senate-nominations.tool.d.ts.map +1 -1
  35. package/dist/mcp-server/tools/definitions/senate-nominations.tool.js +102 -5
  36. package/dist/mcp-server/tools/definitions/senate-nominations.tool.js.map +1 -1
  37. package/dist/mcp-server/tools/format-helpers.d.ts.map +1 -1
  38. package/dist/mcp-server/tools/format-helpers.js +37 -8
  39. package/dist/mcp-server/tools/format-helpers.js.map +1 -1
  40. package/dist/mcp-server/tools/tool-helpers.d.ts +11 -4
  41. package/dist/mcp-server/tools/tool-helpers.d.ts.map +1 -1
  42. package/dist/mcp-server/tools/tool-helpers.js +12 -4
  43. package/dist/mcp-server/tools/tool-helpers.js.map +1 -1
  44. package/dist/services/call-budget.d.ts +77 -0
  45. package/dist/services/call-budget.d.ts.map +1 -0
  46. package/dist/services/call-budget.js +118 -0
  47. package/dist/services/call-budget.js.map +1 -0
  48. package/dist/services/congress-api/congress-api-service.d.ts +4 -0
  49. package/dist/services/congress-api/congress-api-service.d.ts.map +1 -1
  50. package/dist/services/congress-api/congress-api-service.js +60 -32
  51. package/dist/services/congress-api/congress-api-service.js.map +1 -1
  52. package/dist/services/congress-documents/congress-documents-service.d.ts +46 -15
  53. package/dist/services/congress-documents/congress-documents-service.d.ts.map +1 -1
  54. package/dist/services/congress-documents/congress-documents-service.js +95 -24
  55. package/dist/services/congress-documents/congress-documents-service.js.map +1 -1
  56. package/dist/services/congress-documents/document-body-cache.d.ts +66 -0
  57. package/dist/services/congress-documents/document-body-cache.d.ts.map +1 -0
  58. package/dist/services/congress-documents/document-body-cache.js +122 -0
  59. package/dist/services/congress-documents/document-body-cache.js.map +1 -0
  60. package/dist/services/congress-mirror/ingest.d.ts +13 -7
  61. package/dist/services/congress-mirror/ingest.d.ts.map +1 -1
  62. package/dist/services/congress-mirror/ingest.js +33 -10
  63. package/dist/services/congress-mirror/ingest.js.map +1 -1
  64. package/dist/services/congress-mirror/schema.d.ts.map +1 -1
  65. package/dist/services/congress-mirror/schema.js +15 -1
  66. package/dist/services/congress-mirror/schema.js.map +1 -1
  67. package/dist/services/senate-lis/parse.d.ts +23 -0
  68. package/dist/services/senate-lis/parse.d.ts.map +1 -1
  69. package/dist/services/senate-lis/parse.js +49 -5
  70. package/dist/services/senate-lis/parse.js.map +1 -1
  71. package/dist/services/senate-lis/senate-vote-service.d.ts.map +1 -1
  72. package/dist/services/senate-lis/senate-vote-service.js +32 -25
  73. package/dist/services/senate-lis/senate-vote-service.js.map +1 -1
  74. package/dist/utils/congress-calendar.d.ts +15 -0
  75. package/dist/utils/congress-calendar.d.ts.map +1 -0
  76. package/dist/utils/congress-calendar.js +33 -0
  77. package/dist/utils/congress-calendar.js.map +1 -0
  78. package/package.json +7 -6
  79. package/scripts/_mirror-context.ts +15 -9
  80. package/scripts/congress-mirror-init.ts +1 -1
  81. package/scripts/congress-mirror-refresh.ts +1 -1
  82. package/scripts/congress-mirror-verify.ts +5 -4
  83. package/server.json +3 -3
  84. package/skills/congressgov-guide/SKILL.md +50 -0
@@ -8,20 +8,30 @@
8
8
  * its own service the way `SenateVoteService` does for the Senate LIS feed.
9
9
  *
10
10
  * Two bounds, deliberately separate:
11
- * - **The fetch** is bounded by {@link MAX_DOCUMENT_BYTES}, a request timeout, and
12
- * a content-type allowlist. The body is extracted as it streams and only the
13
- * requested window is kept, so what a read *retains* is flat in the size of
14
- * the document and the ceiling bounds how long a response may run rather than
15
- * how much of one fits in a buffer.
11
+ * - **The fetch** is bounded by {@link MAX_DOCUMENT_BYTES}, a per-attempt timeout,
12
+ * the tool call's one time budget (`call-budget.ts`), which the format lookup
13
+ * before it spends from too, and a content-type allowlist. The body is
14
+ * extracted as it streams and only the requested window is extracted into
15
+ * memory, so the ceiling bounds how long a response may run rather than how
16
+ * much of one fits in a buffer.
16
17
  * - **The response** is bounded by an exact character offset/limit window. Offsets
17
18
  * index into the extracted plain text and are never snapped to section or
18
19
  * paragraph breaks, so feeding `nextOffset` back walks a document with every
19
20
  * character returned exactly once — no overlap, no gap.
20
21
  *
22
+ * Every window streams the whole body to learn `totalCharacters`, so a walk
23
+ * would fetch its document once per window. Instead the first read of a
24
+ * document that runs past its window keeps the decompressed body in a
25
+ * {@link DocumentBodyCache} (64 MB total, 16 MB per body, 10-minute TTL), and
26
+ * later windows replay those bytes through the same extractor: one fetch per
27
+ * document per TTL. A replay is local work and never touches the time budget.
28
+ *
21
29
  * @module services/congress-documents/congress-documents-service
22
30
  */
23
- import { JsonRpcErrorCode, McpError, notFound, serviceUnavailable, validationError, } from '@cyanheads/mcp-ts-core/errors';
24
- import { defaultIsTransient, fetchWithTimeout, requestContextService, withRetry, } from '@cyanheads/mcp-ts-core/utils';
31
+ import { JsonRpcErrorCode, McpError, notFound, requestCancelled, serviceUnavailable, validationError, } from '@cyanheads/mcp-ts-core/errors';
32
+ import { defaultIsTransient, fetchWithTimeout, requestContextService, } from '@cyanheads/mcp-ts-core/utils';
33
+ import { withCallBudget } from '../call-budget.js';
34
+ import { DocumentBodyCache } from './document-body-cache.js';
25
35
  import { createStreamingExtractor } from './extract-text-stream.js';
26
36
  /**
27
37
  * Ceiling on a single document. The largest bodies Congress.gov publishes are
@@ -29,13 +39,22 @@ import { createStreamingExtractor } from './extract-text-stream.js';
29
39
  * 6,790,482 bytes as Formatted Text and 9,812,888 as XML — and both formats of a
30
40
  * document have to clear it, since a caller sent to the other one by a recovery
31
41
  * hint would hit the same refusal. This clears the largest by better than a
32
- * factor of two; the request deadline is what a runaway response meets first.
42
+ * factor of two; the per-attempt timeout is what a runaway response meets first.
33
43
  */
34
44
  export const MAX_DOCUMENT_BYTES = 25_000_000;
35
- /** Bounds the whole exchange, headers and body — a megabyte-scale body needs the room. */
45
+ /**
46
+ * Bounds one attempt's whole exchange, headers and body — a megabyte-scale body
47
+ * needs the room. Clamped to what is left of the call's budget.
48
+ */
36
49
  export const REQUEST_TIMEOUT_MS = 30_000;
37
50
  const MAX_ATTEMPTS = 3;
38
51
  const BASE_BACKOFF_MS = 500;
52
+ /**
53
+ * Largest piece of a cached body replayed between macrotask yields. Replaying
54
+ * from memory has no network waits, so without the yields a large document's
55
+ * whole parse would hold the event loop in one block.
56
+ */
57
+ const REPLAY_SLICE_BYTES = 128 * 1024;
39
58
  /** Every format URL these tools resolve points here; nothing else is fetched. */
40
59
  const ALLOWED_HOSTS = new Set(['www.congress.gov']);
41
60
  /** Content types the text extractor can read. PDF and everything else are refused. */
@@ -65,8 +84,10 @@ function isNativeAbortSignal(value) {
65
84
  }
66
85
  export class CongressDocumentsService {
67
86
  maxDocumentBytes;
68
- constructor(maxDocumentBytes = MAX_DOCUMENT_BYTES) {
87
+ bodyCache;
88
+ constructor(maxDocumentBytes = MAX_DOCUMENT_BYTES, bodyCache = new DocumentBodyCache()) {
69
89
  this.maxDocumentBytes = maxDocumentBytes;
90
+ this.bodyCache = bodyCache;
70
91
  }
71
92
  /**
72
93
  * Fetch one document and return the requested character window of its text.
@@ -75,13 +96,25 @@ export class CongressDocumentsService {
75
96
  * one — and is still checked against {@link ALLOWED_HOSTS} before any request
76
97
  * goes out, so a redirected or malformed upstream link cannot turn this into a
77
98
  * general-purpose fetcher.
99
+ *
100
+ * A document whose body is cached is replayed from it with no request at all.
101
+ * Otherwise the fetch spends what is left of the tool call's budget
102
+ * (`call-budget.ts`): running out throws `Timeout` (`upstream_timeout`), and a
103
+ * caller abort ends the call at once.
78
104
  */
79
105
  async fetchDocument(params, ctx) {
80
106
  this.assertAllowedHost(params.url);
107
+ const signal = this.getAbortSignal(ctx);
108
+ const cached = this.bodyCache.get(params.url);
109
+ if (cached)
110
+ return this.describeWindow(await this.replayWindow(cached, params, signal), params);
81
111
  const operation = 'CongressDocumentsService GET document';
82
112
  const requestContext = this.getRequestContext(ctx, operation);
83
- const signal = this.getAbortSignal(ctx);
84
- const window = await withRetry(() => this.doFetch(params, requestContext, signal), {
113
+ const read = await withCallBudget((attempt) => this.doFetch(params, requestContext, attempt), {
114
+ call: ctx,
115
+ attemptTimeoutMs: REQUEST_TIMEOUT_MS,
116
+ upstream: 'Congress.gov',
117
+ request: 'the document',
85
118
  operation,
86
119
  context: requestContext,
87
120
  baseDelayMs: BASE_BACKOFF_MS,
@@ -89,7 +122,33 @@ export class CongressDocumentsService {
89
122
  isTransient: (error) => this.isRetryableError(error),
90
123
  ...(signal ? { signal } : {}),
91
124
  });
92
- return this.describeWindow(window, params);
125
+ const content = this.describeWindow(read.window, params);
126
+ /** A document the window covers to its end is never retained. */
127
+ if (content.nextOffset !== null)
128
+ this.bodyCache.insert(params.url, read.body);
129
+ return content;
130
+ }
131
+ /**
132
+ * Serve a window from a cached body: the decoder and extractor a fetch feeds,
133
+ * given the body in slices with a macrotask between them, checking the
134
+ * caller's signal at each one.
135
+ */
136
+ async replayWindow(body, params, signal) {
137
+ const decoder = new TextDecoder('utf-8');
138
+ const extractor = createStreamingExtractor({
139
+ characterLimit: params.characterLimit,
140
+ characterOffset: params.characterOffset,
141
+ });
142
+ for (let start = 0; start < body.byteLength; start += REPLAY_SLICE_BYTES) {
143
+ if (start > 0)
144
+ await new Promise((resolve) => setImmediate(resolve));
145
+ if (signal?.aborted)
146
+ throw requestCancelled('The document read was cancelled.');
147
+ const slice = body.subarray(start, start + REPLAY_SLICE_BYTES);
148
+ extractor.push(decoder.decode(slice, { stream: true }));
149
+ }
150
+ extractor.push(decoder.decode());
151
+ return extractor.finish();
93
152
  }
94
153
  /** Describe the extracted `[offset, offset + limit)` window and what remains. */
95
154
  describeWindow(window, params) {
@@ -131,13 +190,17 @@ export class CongressDocumentsService {
131
190
  });
132
191
  }
133
192
  }
134
- async doFetch(params, requestContext, signal) {
193
+ /**
194
+ * One attempt. `attempt.signal` carries both the caller's abort and the call
195
+ * budget, so either ends an exchange already in flight, body included.
196
+ */
197
+ async doFetch(params, requestContext, attempt) {
135
198
  let response;
136
199
  try {
137
- response = await fetchWithTimeout(params.url, REQUEST_TIMEOUT_MS, requestContext, {
200
+ response = await fetchWithTimeout(params.url, attempt.timeoutMs, requestContext, {
138
201
  headers: { Accept: 'text/html, application/xml, text/plain, */*' },
139
202
  expectedStatuses: [404],
140
- ...(signal ? { signal } : {}),
203
+ signal: attempt.signal,
141
204
  });
142
205
  }
143
206
  catch (error) {
@@ -195,12 +258,14 @@ export class CongressDocumentsService {
195
258
  * Extract the requested character window as the body streams, under a hard
196
259
  * byte budget that cancels the stream the moment it is exceeded.
197
260
  *
198
- * Nothing but the window is retained: the decoder carries a partial character
199
- * across a chunk boundary and the extractor carries its parse state, so the
200
- * live set stays near the window's own size however large the document is.
201
- * Transient allocation still scales with the body — peak RSS is higher than a
202
- * buffered read of the same document — but it is garbage, not live, so it is
203
- * concurrent reads rather than one large read that the ceiling has to survive.
261
+ * Only the window is extracted into memory: the decoder carries a partial
262
+ * character across a chunk boundary and the extractor carries its parse
263
+ * state. The raw chunks are also captured for the body cache, up to its entry
264
+ * ceiling and no further, so a body past that ceiling keeps the read's live
265
+ * set near the window's own size. Transient allocation still scales with the
266
+ * body — peak RSS is higher than a buffered read of the same document — but
267
+ * it is garbage, not live, so it is concurrent reads rather than one large
268
+ * read that the ceiling has to survive.
204
269
  */
205
270
  async readWindow(response, params) {
206
271
  const reader = response.body?.getReader();
@@ -209,6 +274,7 @@ export class CongressDocumentsService {
209
274
  characterLimit: params.characterLimit,
210
275
  characterOffset: params.characterOffset,
211
276
  });
277
+ const body = this.bodyCache.capture();
212
278
  let bytes = 0;
213
279
  if (reader) {
214
280
  for (;;) {
@@ -222,6 +288,7 @@ export class CongressDocumentsService {
222
288
  await reader.cancel().catch(() => undefined);
223
289
  throw this.tooLarge({ bytesRead: bytes });
224
290
  }
291
+ body.add(value);
225
292
  extractor.push(decoder.decode(value, { stream: true }));
226
293
  }
227
294
  }
@@ -232,17 +299,21 @@ export class CongressDocumentsService {
232
299
  });
233
300
  }
234
301
  extractor.push(decoder.decode());
235
- return extractor.finish();
302
+ return { window: extractor.finish(), body };
236
303
  }
237
304
  /**
238
305
  * A body that dies partway through is the transport failing, not a malformed
239
- * document — the same classification a connection that never opened gets.
306
+ * document — the same classification a connection that never opened gets. A
307
+ * caller abort mid-body stays the cancellation it is.
240
308
  */
241
309
  async readChunk(reader) {
242
310
  try {
243
311
  return await reader.read();
244
312
  }
245
313
  catch (error) {
314
+ if (error instanceof McpError && error.code === JsonRpcErrorCode.RequestCancelled) {
315
+ throw error;
316
+ }
246
317
  throw serviceUnavailable('The document body from Congress.gov ended before it was complete.', { reason: DOCUMENT_FETCH_FAILED }, { cause: error });
247
318
  }
248
319
  }
@@ -1 +1 @@
1
- {"version":3,"file":"congress-documents-service.js","sourceRoot":"","sources":["../../../src/services/congress-documents/congress-documents-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,SAAS,GACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAwB,MAAM,0BAA0B,CAAC;AAG1F;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAE7C,0FAA0F;AAC1F,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,iFAAiF;AACjF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAEpD,sFAA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,cAAc,CAAC,GAAY;QACjC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QAC1B,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1D,CAAC;CACF;AAED,IAAI,QAA8C,CAAC;AAEnD,MAAM,UAAU,qBAAqB;IACnC,QAAQ,GAAG,IAAI,wBAAwB,EAAE,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
1
+ {"version":3,"file":"congress-documents-service.js","sourceRoot":"","sources":["../../../src/services/congress-documents/congress-documents-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAwB,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAoB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAwB,MAAM,0BAA0B,CAAC;AAG1F;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,GAAG,GAAG,IAAI,CAAC;AAEtC,iFAA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AAK,EAAE,CACjB,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,QAAQ,CAAC,IAA6B;QAC5C,OAAO,eAAe,CACpB,6BAA6B,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,OAAO,CAAC,sCAAsC,EAChH;YACE,MAAM,EAAE,kBAAkB;YAC1B,GAAG,IAAI;YACP,QAAQ,EAAE,IAAI,CAAC,gBAAgB;YAC/B,SAAS,EAAE,KAAK;SACjB,CACF,CAAC;IACJ,CAAC;IAEO,gBAAgB,CAAC,KAAc;QACrC,OAAO,CACL,CAAC,CAAC,KAAK,YAAY,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,CAAC,WAAW,CAAC;YAC3E,kBAAkB,CAAC,KAAK,CAAC,CAC1B,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACK,iBAAiB,CAAC,GAAY,EAAE,SAAiB;QACvD,OAAO,qBAAqB,CAAC,oBAAoB,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;IACvF,CAAC;IAEO,cAAc,CAAC,GAAY;QACjC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QAC1B,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1D,CAAC;CACF;AAED,IAAI,QAA8C,CAAC;AAEnD,MAAM,UAAU,qBAAqB;IACnC,QAAQ,GAAG,IAAI,wBAAwB,EAAE,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @fileoverview Process-local cache of decompressed document bodies, so a walk
3
+ * through a multi-window document fetches it once per TTL instead of once per
4
+ * window.
5
+ *
6
+ * Every window streams the whole body, because `totalCharacters` is known only
7
+ * at the end of it. Caching the bytes rather than extracted text keeps the
8
+ * extractor and its input unchanged — a window replayed from cache is the
9
+ * window a fresh fetch returns — and holds each body at one byte per byte with
10
+ * nothing sliced out of it to pin a larger parent.
11
+ *
12
+ * One cache serves every tenant: each body is a public document fetched without
13
+ * credentials from a URL the server resolved and allowlisted itself.
14
+ *
15
+ * @module services/congress-documents/document-body-cache
16
+ */
17
+ /** Bytes all entries together may hold; the least recently used entries go first. */
18
+ export declare const BODY_CACHE_MAX_BYTES = 64000000;
19
+ /**
20
+ * Largest body one entry holds. Clears the largest known body (116th Congress
21
+ * H.R. 133 enrolled as XML, 9,812,888 bytes); a body past it is read as before
22
+ * and never cached.
23
+ */
24
+ export declare const BODY_CACHE_MAX_ENTRY_BYTES = 16000000;
25
+ /** How long an entry serves, from its insert — inside congress.gov's own `max-age=1800`. */
26
+ export declare const BODY_CACHE_TTL_MS: number;
27
+ /** The bounds one cache enforces. */
28
+ export interface BodyCacheLimits {
29
+ maxBytes: number;
30
+ maxEntryBytes: number;
31
+ ttlMs: number;
32
+ }
33
+ /**
34
+ * The chunks of one body as a fetch streams them, from
35
+ * {@link DocumentBodyCache.capture}. Kept until the body passes the entry
36
+ * ceiling, then dropped, after which nothing more is kept.
37
+ */
38
+ export declare class BodyCapture {
39
+ private readonly maxBytes;
40
+ private byteLength;
41
+ private chunks;
42
+ constructor(maxBytes: number);
43
+ /** Record the next chunk of the body. */
44
+ add(chunk: Uint8Array): void;
45
+ /** The whole body as one buffer it owns, or undefined once it passed the ceiling. */
46
+ toBody(): Uint8Array | undefined;
47
+ }
48
+ /** LRU over decompressed document bodies, keyed by the server-resolved URL. */
49
+ export declare class DocumentBodyCache {
50
+ private readonly limits;
51
+ private readonly entries;
52
+ private totalBytes;
53
+ constructor(limits?: BodyCacheLimits);
54
+ /** Start capturing a body as it streams, under this cache's entry ceiling. */
55
+ capture(): BodyCapture;
56
+ /** The body cached for `url`, now the most recently used, or undefined when absent or expired. */
57
+ get(url: string): Uint8Array | undefined;
58
+ /**
59
+ * Cache a captured body as one owned buffer, replacing any entry for `url`
60
+ * and evicting expired, then least recently used, entries until it fits. A
61
+ * capture dropped at the entry ceiling inserts nothing.
62
+ */
63
+ insert(url: string, capture: BodyCapture): void;
64
+ private remove;
65
+ }
66
+ //# sourceMappingURL=document-body-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-body-cache.d.ts","sourceRoot":"","sources":["../../../src/services/congress-documents/document-body-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,qFAAqF;AACrF,eAAO,MAAM,oBAAoB,WAAa,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,WAAa,CAAC;AAErD,4FAA4F;AAC5F,eAAO,MAAM,iBAAiB,QAAc,CAAC;AAE7C,qCAAqC;AACrC,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,qBAAa,WAAW;IAIV,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAHrC,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,MAAM,CAA2B;IAEzC,YAA6B,QAAQ,EAAE,MAAM,EAAI;IAEjD,yCAAyC;IACzC,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAK3B;IAED,qFAAqF;IACrF,MAAM,IAAI,UAAU,GAAG,SAAS,CAS/B;CACF;AAOD,+EAA+E;AAC/E,qBAAa,iBAAiB;IAK1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IACpD,OAAO,CAAC,UAAU,CAAK;IAEvB,YACmB,MAAM,GAAE,eAIxB,EACC;IAEJ,8EAA8E;IAC9E,OAAO,IAAI,WAAW,CAErB;IAED,kGAAkG;IAClG,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAUvC;IAED;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAc9C;IAED,OAAO,CAAC,MAAM;CAMf"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * @fileoverview Process-local cache of decompressed document bodies, so a walk
3
+ * through a multi-window document fetches it once per TTL instead of once per
4
+ * window.
5
+ *
6
+ * Every window streams the whole body, because `totalCharacters` is known only
7
+ * at the end of it. Caching the bytes rather than extracted text keeps the
8
+ * extractor and its input unchanged — a window replayed from cache is the
9
+ * window a fresh fetch returns — and holds each body at one byte per byte with
10
+ * nothing sliced out of it to pin a larger parent.
11
+ *
12
+ * One cache serves every tenant: each body is a public document fetched without
13
+ * credentials from a URL the server resolved and allowlisted itself.
14
+ *
15
+ * @module services/congress-documents/document-body-cache
16
+ */
17
+ /** Bytes all entries together may hold; the least recently used entries go first. */
18
+ export const BODY_CACHE_MAX_BYTES = 64_000_000;
19
+ /**
20
+ * Largest body one entry holds. Clears the largest known body (116th Congress
21
+ * H.R. 133 enrolled as XML, 9,812,888 bytes); a body past it is read as before
22
+ * and never cached.
23
+ */
24
+ export const BODY_CACHE_MAX_ENTRY_BYTES = 16_000_000;
25
+ /** How long an entry serves, from its insert — inside congress.gov's own `max-age=1800`. */
26
+ export const BODY_CACHE_TTL_MS = 10 * 60_000;
27
+ /**
28
+ * The chunks of one body as a fetch streams them, from
29
+ * {@link DocumentBodyCache.capture}. Kept until the body passes the entry
30
+ * ceiling, then dropped, after which nothing more is kept.
31
+ */
32
+ export class BodyCapture {
33
+ maxBytes;
34
+ byteLength = 0;
35
+ chunks = [];
36
+ constructor(maxBytes) {
37
+ this.maxBytes = maxBytes;
38
+ }
39
+ /** Record the next chunk of the body. */
40
+ add(chunk) {
41
+ if (this.chunks === null)
42
+ return;
43
+ this.byteLength += chunk.byteLength;
44
+ if (this.byteLength > this.maxBytes)
45
+ this.chunks = null;
46
+ else
47
+ this.chunks.push(chunk);
48
+ }
49
+ /** The whole body as one buffer it owns, or undefined once it passed the ceiling. */
50
+ toBody() {
51
+ if (this.chunks === null)
52
+ return;
53
+ const body = new Uint8Array(this.byteLength);
54
+ let offset = 0;
55
+ for (const chunk of this.chunks) {
56
+ body.set(chunk, offset);
57
+ offset += chunk.byteLength;
58
+ }
59
+ return body;
60
+ }
61
+ }
62
+ /** LRU over decompressed document bodies, keyed by the server-resolved URL. */
63
+ export class DocumentBodyCache {
64
+ limits;
65
+ entries = new Map();
66
+ totalBytes = 0;
67
+ constructor(limits = {
68
+ maxBytes: BODY_CACHE_MAX_BYTES,
69
+ maxEntryBytes: BODY_CACHE_MAX_ENTRY_BYTES,
70
+ ttlMs: BODY_CACHE_TTL_MS,
71
+ }) {
72
+ this.limits = limits;
73
+ }
74
+ /** Start capturing a body as it streams, under this cache's entry ceiling. */
75
+ capture() {
76
+ return new BodyCapture(this.limits.maxEntryBytes);
77
+ }
78
+ /** The body cached for `url`, now the most recently used, or undefined when absent or expired. */
79
+ get(url) {
80
+ const entry = this.entries.get(url);
81
+ if (!entry)
82
+ return;
83
+ this.entries.delete(url);
84
+ if (entry.expiresAt <= Date.now()) {
85
+ this.totalBytes -= entry.body.byteLength;
86
+ return;
87
+ }
88
+ this.entries.set(url, entry);
89
+ return entry.body;
90
+ }
91
+ /**
92
+ * Cache a captured body as one owned buffer, replacing any entry for `url`
93
+ * and evicting expired, then least recently used, entries until it fits. A
94
+ * capture dropped at the entry ceiling inserts nothing.
95
+ */
96
+ insert(url, capture) {
97
+ const body = capture.toBody();
98
+ if (body === undefined)
99
+ return;
100
+ this.remove(url);
101
+ const now = Date.now();
102
+ for (const [key, entry] of this.entries) {
103
+ if (entry.expiresAt <= now)
104
+ this.remove(key);
105
+ }
106
+ for (const key of this.entries.keys()) {
107
+ if (this.totalBytes + body.byteLength <= this.limits.maxBytes)
108
+ break;
109
+ this.remove(key);
110
+ }
111
+ this.entries.set(url, { body, expiresAt: now + this.limits.ttlMs });
112
+ this.totalBytes += body.byteLength;
113
+ }
114
+ remove(url) {
115
+ const entry = this.entries.get(url);
116
+ if (!entry)
117
+ return;
118
+ this.entries.delete(url);
119
+ this.totalBytes -= entry.body.byteLength;
120
+ }
121
+ }
122
+ //# sourceMappingURL=document-body-cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-body-cache.js","sourceRoot":"","sources":["../../../src/services/congress-documents/document-body-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,qFAAqF;AACrF,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;AAErD,4FAA4F;AAC5F,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,GAAG,MAAM,CAAC;AAS7C;;;;GAIG;AACH,MAAM,OAAO,WAAW;IAIO,QAAQ;IAH7B,UAAU,GAAG,CAAC,CAAC;IACf,MAAM,GAAwB,EAAE,CAAC;IAEzC,YAA6B,QAAgB;wBAAhB,QAAQ;IAAW,CAAC;IAEjD,yCAAyC;IACzC,GAAG,CAAC,KAAiB;QACnB,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI;YAAE,OAAO;QACjC,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC;QACpC,IAAI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,QAAQ;YAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;;YACnD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,qFAAqF;IACrF,MAAM;QACJ,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI;YAAE,OAAO;QACjC,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,MAAM,GAAG,CAAC,CAA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OAAO;QAC/B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACxC,IAAI,KAAK,CAAC,SAAS,IAAI,GAAG;gBAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC/C,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YACtC,IAAI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ;gBAAE,MAAM;YACrE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QACpE,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC;IACrC,CAAC;IAEO,MAAM,CAAC,GAAW;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;IAC3C,CAAC;CACF"}
@@ -9,11 +9,14 @@
9
9
  * Merge order matters: the framework upsert writes every declared column for each
10
10
  * record, so a partial (summary-only) upsert would null the title. The summaries
11
11
  * are therefore loaded into a per-congress map first, then attached as each full
12
- * bill row is emitted. Summaries are fully re-walked every sync (not date-filtered)
13
- * so a re-emitted bill never loses a previously-stored summary. The durable
14
- * checkpoint is the bills' `updateDate` high-water mark; refresh re-scans bills
15
- * from it inclusively (`sort=updateDate asc`), and the upsert makes the overlap
16
- * harmless.
12
+ * bill row is emitted. Every sync re-walks a congress's whole summaries list, so a
13
+ * re-emitted bill never loses a previously-stored summary: the list is requested
14
+ * from the congress's first day with no end, because without `fromDateTime`
15
+ * Congress.gov returns only the last day's summaries, and summaries keep being
16
+ * rewritten long after their congress ends. The durable checkpoint is the bills'
17
+ * `updateDate` high-water mark across every congress, persisted only once the
18
+ * whole walk finishes; refresh re-scans bills from it inclusively
19
+ * (`sort=updateDate asc`), and the upsert makes the overlap harmless.
17
20
  * @module services/congress-mirror/ingest
18
21
  */
19
22
  import type { SyncGenerator } from '@cyanheads/mcp-ts-core/mirror';
@@ -23,8 +26,11 @@ export type MirrorApi = Pick<CongressApiService, 'listBills' | 'listSummaries'>;
23
26
  /**
24
27
  * Build the Congress bill ingester. The returned generator walks the configured
25
28
  * congresses; for each, it loads the summary map, then streams bill pages
26
- * (`sort=updateDate asc`) as full merged rows, advancing the durable checkpoint
27
- * to the max `updateDate` seen.
29
+ * (`sort=updateDate asc`) as full merged rows. The durable checkpoint — the max
30
+ * `updateDate` seen across every congress — rides only the final page, so a run
31
+ * that fails partway leaves the stored checkpoint where it started: a mid-walk
32
+ * checkpoint could already sit past the unvisited updates of a later congress,
33
+ * and the next refresh would skip them.
28
34
  *
29
35
  * @param getApi - Accessor for the Congress API service (injectable for tests).
30
36
  * @param congresses - Congress numbers to mirror.
@@ -1 +1 @@
1
- {"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../../../src/services/congress-mirror/ingest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAGV,aAAa,EAEd,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAM1F,yFAAyF;AACzF,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,eAAe,CAAC,CAAC;AA8GhF;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,SAAS,EACvB,UAAU,EAAE,MAAM,EAAE,GACnB,aAAa,CA+Cf"}
1
+ {"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../../../src/services/congress-mirror/ingest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAGV,aAAa,EAEd,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAO1F,yFAAyF;AACzF,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,eAAe,CAAC,CAAC;AAwHhF;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,SAAS,EACvB,UAAU,EAAE,MAAM,EAAE,GACnB,aAAa,CAqDf"}
@@ -9,14 +9,18 @@
9
9
  * Merge order matters: the framework upsert writes every declared column for each
10
10
  * record, so a partial (summary-only) upsert would null the title. The summaries
11
11
  * are therefore loaded into a per-congress map first, then attached as each full
12
- * bill row is emitted. Summaries are fully re-walked every sync (not date-filtered)
13
- * so a re-emitted bill never loses a previously-stored summary. The durable
14
- * checkpoint is the bills' `updateDate` high-water mark; refresh re-scans bills
15
- * from it inclusively (`sort=updateDate asc`), and the upsert makes the overlap
16
- * harmless.
12
+ * bill row is emitted. Every sync re-walks a congress's whole summaries list, so a
13
+ * re-emitted bill never loses a previously-stored summary: the list is requested
14
+ * from the congress's first day with no end, because without `fromDateTime`
15
+ * Congress.gov returns only the last day's summaries, and summaries keep being
16
+ * rewritten long after their congress ends. The durable checkpoint is the bills'
17
+ * `updateDate` high-water mark across every congress, persisted only once the
18
+ * whole walk finishes; refresh re-scans bills from it inclusively
19
+ * (`sort=updateDate asc`), and the upsert makes the overlap harmless.
17
20
  * @module services/congress-mirror/ingest
18
21
  */
19
22
  import { logger } from '@cyanheads/mcp-ts-core/utils';
23
+ import { congressFirstYear } from '../../utils/congress-calendar.js';
20
24
  import { htmlToPlainText } from './normalize.js';
21
25
  /** Congress.gov list endpoints cap the page size at 250 (confirmed live). */
22
26
  const PAGE_SIZE = 250;
@@ -59,16 +63,25 @@ function deriveBillId(congress, billType, billNumber) {
59
63
  function toFromDateTime(checkpoint) {
60
64
  return /^\d{4}-\d{2}-\d{2}$/.test(checkpoint) ? `${checkpoint}T00:00:00Z` : checkpoint;
61
65
  }
66
+ /** January 1 of a congress's first year as a `fromDateTime` that no summary of its bills predates. */
67
+ function congressStartDateTime(congress) {
68
+ return `${congressFirstYear(congress)}-01-01T00:00:00Z`;
69
+ }
62
70
  /**
63
71
  * Page the CRS summaries list for one congress into a `billId → plain-text
64
72
  * summary` map, keeping the latest version per bill (by summary update/action
65
- * stamp). Summaries ship as HTML and are stripped to plain text before storage.
73
+ * stamp). The window opens on the congress's first day with no end. The walk
74
+ * keeps the upstream newest-first order: a summary updated mid-walk moves to the
75
+ * front and at worst repeats a row, where oldest-first it would move to the end
76
+ * and the row crossing the next page boundary would be skipped. Summaries ship as
77
+ * HTML and are stripped to plain text before storage.
66
78
  */
67
79
  async function buildSummaryMap(api, congress, signal) {
68
80
  const latest = new Map();
81
+ const fromDateTime = congressStartDateTime(congress);
69
82
  let offset = 0;
70
83
  while (!signal.aborted) {
71
- const result = await api.listSummaries({ congress, limit: PAGE_SIZE, offset });
84
+ const result = await api.listSummaries({ congress, limit: PAGE_SIZE, offset, fromDateTime });
72
85
  const rows = result.data;
73
86
  if (rows.length === 0)
74
87
  break;
@@ -124,8 +137,11 @@ function toBillRow(raw, fallbackCongress, summaries) {
124
137
  /**
125
138
  * Build the Congress bill ingester. The returned generator walks the configured
126
139
  * congresses; for each, it loads the summary map, then streams bill pages
127
- * (`sort=updateDate asc`) as full merged rows, advancing the durable checkpoint
128
- * to the max `updateDate` seen.
140
+ * (`sort=updateDate asc`) as full merged rows. The durable checkpoint — the max
141
+ * `updateDate` seen across every congress — rides only the final page, so a run
142
+ * that fails partway leaves the stored checkpoint where it started: a mid-walk
143
+ * checkpoint could already sit past the unvisited updates of a later congress,
144
+ * and the next refresh would skip them.
129
145
  *
130
146
  * @param getApi - Accessor for the Congress API service (injectable for tests).
131
147
  * @param congresses - Congress numbers to mirror.
@@ -135,6 +151,8 @@ export function createCongressBillIngester(getApi, congresses) {
135
151
  const api = getApi();
136
152
  const fromDateTime = mode === 'refresh' && checkpoint ? toFromDateTime(checkpoint) : undefined;
137
153
  let maxUpdate = checkpoint;
154
+ // Each page is yielded one fetch late, so the last one can carry the checkpoint.
155
+ let held;
138
156
  logger.info(`Congress bill mirror sync starting (mode=${mode}, congresses=${congresses.join(',')}${fromDateTime ? `, since=${fromDateTime}` : ''})`);
139
157
  for (const congress of congresses) {
140
158
  if (signal.aborted)
@@ -167,13 +185,18 @@ export function createCongressBillIngester(getApi, congresses) {
167
185
  maxUpdate = updated;
168
186
  }
169
187
  billsMirrored += records.length;
170
- yield { records, ...(maxUpdate ? { checkpoint: maxUpdate } : {}) };
188
+ if (held)
189
+ yield { records: held };
190
+ held = records;
171
191
  if (rows.length < PAGE_SIZE || result.pagination.nextOffset == null)
172
192
  break;
173
193
  offset += PAGE_SIZE;
174
194
  }
175
195
  logger.info(`Congress ${congress}: ${billsMirrored} bills mirrored`);
176
196
  }
197
+ if (held && !signal.aborted) {
198
+ yield { records: held, ...(maxUpdate ? { checkpoint: maxUpdate } : {}) };
199
+ }
177
200
  };
178
201
  }
179
202
  //# sourceMappingURL=ingest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ingest.js","sourceRoot":"","sources":["../../../src/services/congress-mirror/ingest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAQH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,gBA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CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;oBACtF,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,OAAO,GAAG,SAAS,CAAC;wBAAE,SAAS,GAAG,OAAO,CAAC;gBACvF,CAAC;gBACD,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;gBAChC,IAAI,IAAI;oBAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gBAClC,IAAI,GAAG,OAAO,CAAC;gBAEf,IAAI,IAAI,CAAC,MAAM,GAAG,SAAS,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,IAAI,IAAI;oBAAE,MAAM;gBAC3E,MAAM,IAAI,SAAS,CAAC;YACtB,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,YAAY,QAAQ,KAAK,aAAa,iBAAiB,CAAC,CAAC;QACvE,CAAC;QACD,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAC5B,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3E,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/services/congress-mirror/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E,0DAA0D;AAC1D,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CA0BjE"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/services/congress-mirror/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAa,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtF,0DAA0D;AAC1D,eAAO,MAAM,WAAW,UAAU,CAAC;AAgBnC;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CA2BjE"}