npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@crvouga/mockingbird-service-textract

v3.3.0

Published

Stateful Amazon Textract emulator with document analysis jobs, graph blocks, pagination, and deterministic notifications.

Downloads

3,871

Readme

@crvouga/mockingbird-service-textract

Local emulators. Real API contracts. Part of Mockingbird.

Stateful Amazon Textract emulator for the official SDK v3 client. It models synchronous and asynchronous document analysis, connected block graphs, stable pagination, idempotency, and completion notifications.

Install

npm install -D @crvouga/mockingbird-service-textract

ESM only. Node 22+ or Bun 1.2+.

Usage

import { AnalyzeDocumentCommand, TextractClient } from "@aws-sdk/client-textract"
import { createServer } from "@crvouga/mockingbird-service-textract/server"

// Test setup: start the emulator with a seeded document and point the SDK's endpoint at it.
const server = await createServer({
  corpora: [
    {
      bucket: "fixtures",
      name: "invoice.pdf",
      pages: 1,
      blocks: [{ id: "line-1", blockType: "LINE", page: 1, text: "Total due 42.00", confidence: 99 }],
    },
  ],
})
const textract = new TextractClient({
  endpoint: server.url,
  region: "us-east-1",
  credentials: { accessKeyId: "fixture", secretAccessKey: "fixture" },
})

// Application code: the Textract SDK calls it already makes.
const analysis = await textract.send(
  new AnalyzeDocumentCommand({
    Document: { S3Object: { Bucket: "fixtures", Name: "invoice.pdf" } },
    FeatureTypes: ["FORMS"],
  }),
)
console.log(analysis.Blocks?.map((block) => block.Text)) // [ "Total due 42.00" ]

await server.close()

Point TextractClient.endpoint at server.url with fixture SigV4 credentials. Supported operations are AnalyzeDocument, StartDocumentAnalysis, and GetDocumentAnalysis. Block records retain PAGE, LINE, WORD, KEY_VALUE_SET, TABLE, CELL, and SELECTION_ELEMENT graph fields including Geometry, Confidence, EntityTypes, Text, and Relationships.

Controls

  • GET/POST /__admin/corpora lists or seeds a block graph by S3 bucket, key, and optional version.
  • GET /__admin/jobs and GET /__admin/jobs/:id inspect exact submitted jobs.
  • POST /__admin/jobs/:id/transition moves a job to SUCCEEDED, PARTIAL_SUCCESS, or FAILED, with an optional statusMessage.
  • Corpus fixtures choose pageSize to force deterministic page boundaries and can contain low-confidence blocks, malformed relationships, and warnings.
  • Fault presets are throttled, throughput_exceeded, and unavailable.

Terminal jobs with a NotificationChannel publish an SNS-compatible Textract status body through the shared webhook hub. The shared runtime also provides reset, clock, journal, metrics, faults, and namespace isolation.

API

  • TextractAPI, TextractAPIOptions, TextractNotification: handler and notification contract.
  • TextractBlock, TextractCorpus, TextractJob, TextractJobStatus: fixtures and durable state.
  • createRuntime, TextractRuntime, TextractRuntimeOptions: full Mockingbird runtime and webhook hub.
  • TEXTRACT_NAMESPACE, TEXTRACT_PRESETS, accessKeyCredential: constants and fault controls.
  • document, operationIds, supportedOperationIds: generated OpenAPI metadata.
  • createServer, TextractServerOptions, DEFAULT_PORT, serveTarget from ./server: Node HTTP adapter and CLI integration.

Deliberately not modelled

OCR, S3 access, IAM evaluation, adapters, output delivery, production limits, billing, dashboards, and Textract operations outside the documented subset are not modelled.

Official oracle: Amazon Textract API Reference.