open-index/open-npm huggingface dataset:
npm package: @intrface/scraper-contracts
Description: TypeScript types and validators for the Scraper API with LangExtract workflow support
Latest version: 0.2.3

@intrface/scraper-contracts

Canonical, versioned types and runtime validators for the Scraper API, generated from JSON Schemas.

Install (npm registry)

- npm: npm install @intrface/scraper-contracts
- pnpm: pnpm add @intrface/scraper-contracts
- yarn: yarn add @intrface/scraper-contracts

Usage

import { validators } from "@intrface/scraper-contracts";

// Validate a job create payload before sending to API
const payload = {
  start_url: "https://example.org",
  max_depth: 2,
  extraction_workflow: "custom",
  schema_inline: { type: "object", properties: { title: { type: "string" } }, required: ["title"] }
};

const ok = validators.jobs.createV1(payload);
if (!ok) {
  // validators.jobs.createV1.errors contains Ajv error details
  throw new Error("Invalid job payload");
}

// Validate a response shape (example)
// const validResp = validators.jobs.responseV1(respJson);

Development notes (for contributors)

- JSON Schemas live under docs/api/schemas
- Build generates TypeScript types and Ajv validators into dist/
- Scripts: npm run build

Tooling

- Types: json-schema-to-typescript
- Validators: Ajv v8 with ajv-formats

Notes

- If schemas are missing, the package builds with placeholders so downstream apps can still run. Once schemas are added, rebuild to get full types and validators.