Manage the company registry
The package ships seedCompanies. On first use they initialize the live registry; runtime discoveries are appended to persistent state, never to the shipped source list.
Use listCompanies and findCompany to inspect known records, and registerCompany to persist a board you already know:
import {
listCompanies,
registerCompany,
resolveCompany,
} from '@chrisdothtml/job-scraper';
await resolveCompany('Klaviyo');
// { name: 'Klaviyo', scraper: 'GreenhouseScraper', slug: 'klaviyo', discovered: true }
await listCompanies(); // everything currently known
await registerCompany({ name: 'Acme', scraper: 'LeverScraper', slug: 'acme' });Record identity and provenance
Section titled “Record identity and provenance”Company records contain a display name, scraper, and slug, with optional careers domains and website homepage. StoredCompany adds source: 'seed' | 'discovered' and an optional homepage miss. Never register a shared board host as one company’s domain; that would misidentify other tenants. addCompanyDomain rejects those hosts and respects existing ownership.
Re-registering an existing normalized name replaces its record. Use mutation APIs to persist changes rather than editing the map returned by loadCompanies.
Upgrade without losing discoveries
Section titled “Upgrade without losing discoveries”Stored state records the package version it was reconciled against. Matching versions load directly. After an upgrade, mergeRegistry reconciles records:
- Shipped names win for scraper/slug, allowing corrected board identities to take effect.
- Discoveries absent from the shipped list survive.
- Removed seed entries disappear.
- Careers domains are additive. A stored homepage is retained when the shipped entry has no homepage.
clearCompaniesCache only drops in-memory state; the next load rereads storage. For resetting stored state and controlling its location, see state storage.