UNPKG

@ansvar/singapore-law-mcp

Version:

Complete Singapore law database — 523 Acts, 28K+ provisions from Singapore Statutes Online (sso.agc.gov.sg) with full-text search, definitions, and citation support

47 lines 1.85 kB
/** * Rate-limited HTTP client for Singapore Statutes Online (sso.agc.gov.sg) * * SSO serves legislation as server-rendered HTML with lazy-loaded parts. * The initial page contains Part 1 inline and a table of contents with * series IDs for remaining parts. Each additional part is fetched via * the /Details/GetLazyLoadContent AJAX endpoint. * * - 500ms minimum delay between requests (be respectful to government servers) * - Browser-like User-Agent required (CloudFront blocks bot UAs) * - No auth needed (Singapore Open Data Licence) */ export interface FetchResult { status: number; body: string; contentType: string; } /** * Fetch a URL with rate limiting and browser-like headers. * Retries up to 3 times on 429/5xx errors with exponential backoff. */ export declare function fetchWithRateLimit(url: string, extraHeaders?: Record<string, string>, maxRetries?: number): Promise<FetchResult>; /** * Result of fetching a complete Act from SSO. */ export interface SsoActFetchResult { /** The initial page HTML (contains Part 1 inline) */ initialHtml: string; /** All lazy-loaded body chunks concatenated */ bodyChunksHtml: string[]; /** All lazy-loaded tail/schedule chunks concatenated */ tailChunksHtml: string[]; /** Total number of AJAX chunks fetched */ chunksLoaded: number; } /** * Fetch a complete Act from Singapore Statutes Online. * * This performs the same sequence a browser would: * 1. GET the Act page (receives Part 1 inline + ToC with series IDs) * 2. For each series ID, GET /Details/GetLazyLoadContent to fetch that part * * Returns the initial HTML and all lazy-loaded chunks separately so the * parser can extract provisions from each. */ export declare function fetchFullAct(actUrl: string): Promise<SsoActFetchResult>; //# sourceMappingURL=fetcher.d.ts.map