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

80 lines 2.83 kB
/** * HTML parser for Singapore legislation from Singapore Statutes Online (SSO). * * SSO serves each Act as server-rendered HTML. The initial page contains * Part 1 inline; remaining parts are loaded via AJAX. The HTML structure * uses consistent CSS classes: * * <div class="prov1"> -- provision wrapper * <td class="prov1Hdr" id="prN-"> -- section header, N = section number * <span class="">Title</span> -- section title * <td class="prov1Txt"> -- section text content * <strong>N.</strong> ... -- section number + text * * <td class="part" id="P1N-"> -- part wrapper * <div class="partNo">PART N</div> -- part number * <td class="partHdr">TITLE</td> -- part title * * <td class="def"> -- definition entry * "term" means ...; -- definition text * * Singapore statutes use "Section" numbering (s1, s2, ...) not "Article". * Section numbers can include letters (e.g., s26A, s48P). */ import type { SsoActFetchResult } from './fetcher.js'; export interface ActIndexEntry { id: string; actCode: string; title: string; titleEn: string; abbreviation: string; status: 'in_force' | 'amended' | 'repealed' | 'not_yet_in_force'; issuedDate: string; inForceDate: string; url: string; } export interface ParsedProvision { provision_ref: string; chapter?: string; section: string; title: string; content: string; } export interface ParsedDefinition { term: string; definition: string; source_provision?: string; } export interface ParsedAct { id: string; type: 'statute'; title: string; title_en: string; short_name: string; status: 'in_force' | 'amended' | 'repealed' | 'not_yet_in_force'; issued_date: string; in_force_date: string; url: string; description?: string; provisions: ParsedProvision[]; definitions: ParsedDefinition[]; } /** * Parse a complete SSO Act fetch result into structured data. * * Processes the initial HTML (which contains Part 1 inline) and all * lazy-loaded body chunks to extract every provision. */ export declare function parseSsoAct(fetchResult: SsoActFetchResult, act: ActIndexEntry): ParsedAct; /** * Legacy compatibility wrapper: parse from raw HTML string. * Used when working with cached HTML files. */ export declare function parseSsoHtml(html: string, act: ActIndexEntry): ParsedAct; /** * Pre-configured list of key Singapore Acts to ingest. * These are the most important Acts for cybersecurity, data protection, * and compliance use cases. */ export declare const KEY_SG_ACTS: ActIndexEntry[]; //# sourceMappingURL=parser.d.ts.map