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

apcore-toolkit

v0.3.0

Published

Shared scanner, schema extraction, and output toolkit for apcore framework adapters

Readme

apcore-toolkit

Shared scanner, schema extraction, and output toolkit for apcore framework adapters (TypeScript).

Install

npm install apcore-toolkit

Features

  • Abstract BaseScanner for framework-specific endpoint scanning
  • OpenAPI schema extraction (extractInputSchema, extractOutputSchema)
  • Multi-format output writers (YAML, TypeScript, Registry) with pluggable verification
  • Markdown formatting with depth control and table heuristics
  • Module serialization utilities
  • flattenParams for Zod-based parameter flattening

Usage

ScannedModule

The canonical representation of a scanned endpoint:

import { createScannedModule, cloneModule } from 'apcore-toolkit';

const mod = createScannedModule({
  moduleId: 'users.get_user',
  description: 'Get a user by ID',
  inputSchema: { type: 'object', properties: { id: { type: 'string' } } },
  outputSchema: { type: 'object', properties: { name: { type: 'string' } } },
  tags: ['users'],
  target: 'myapp/users:getUser',
});

BaseScanner

Abstract base class for framework-specific scanners:

import { BaseScanner } from 'apcore-toolkit';
import type { ScannedModule } from 'apcore-toolkit';

class MyScanner extends BaseScanner {
  scan(): ScannedModule[] {
    // scan your framework endpoints
    return [];
  }
  getSourceName(): string {
    return 'my-framework';
  }
}

Output Writers

Three output strategies for scanned modules:

import { YAMLWriter, TypeScriptWriter, RegistryWriter, getWriter } from 'apcore-toolkit';

// YAML binding files
const yamlWriter = new YAMLWriter();
yamlWriter.write(modules, './output');

// TypeScript module wrappers
const tsWriter = new TypeScriptWriter();
tsWriter.write(modules, './output');

// Direct registry registration
const regWriter = new RegistryWriter();
await regWriter.write(modules, registry);

// Or use the factory
const writer = getWriter('yaml'); // 'yaml' | 'typescript' | 'registry'

OpenAPI Schema Extraction

import { extractInputSchema, extractOutputSchema } from 'apcore-toolkit';

const inputSchema = extractInputSchema(operation, openapiDoc);
const outputSchema = extractOutputSchema(operation, openapiDoc);

Markdown Formatting

import { toMarkdown } from 'apcore-toolkit';

const md = toMarkdown(data, {
  title: 'Report',
  fields: ['name', 'status'],
  exclude: ['internal'],
  maxDepth: 3,
  tableThreshold: 5,
});

Serializers

import { moduleToDict, modulesToDicts, annotationsToDict } from 'apcore-toolkit';

const dict = moduleToDict(mod);       // snake_case keys
const dicts = modulesToDicts(modules); // batch conversion

API

| Export | Description | |--------|-------------| | ScannedModule | Interface for scanned endpoint data | | createScannedModule() | Factory with defaults for optional fields | | cloneModule() | Defensive copy with optional overrides | | BaseScanner | Abstract base class for scanners | | YAMLWriter | Writes YAML binding files | | TypeScriptWriter | Generates TypeScript module wrappers | | RegistryWriter | Registers modules into an apcore Registry | | getWriter() | Factory for writer instances | | extractInputSchema() | Extract input schema from OpenAPI operation | | extractOutputSchema() | Extract output schema from OpenAPI operation | | resolveRef() | Resolve $ref in OpenAPI documents | | resolveSchema() | Resolve schema with single-level $ref support | | deepResolveRefs() | Recursively resolve all nested $ref pointers in a schema | | enrichSchemaDescriptions() | Merge parameter descriptions into schema | | toMarkdown() | Convert dict to formatted Markdown | | moduleToDict() | Serialize module to snake_case dict | | modulesToDicts() | Batch serialize modules | | annotationsToDict() | Convert annotations to plain dict | | resolveTarget() | Dynamic import + named export resolution | | flattenParams() | Flatten Zod schema params into keyword args | | WriteResult | Structured result type for writer operations | | Verifier | Interface for pluggable output verification | | VerifyResult | Result type for verification operations | | WriteError | Error class for I/O failures during write | | YAMLVerifier | Verifies YAML binding file structure | | SyntaxVerifier | Verifies file is non-empty and readable | | RegistryVerifier | Verifies module registered in registry | | MagicBytesVerifier | Verifies file header matches expected bytes | | JSONVerifier | Verifies valid JSON, optional schema check | | createWriteResult() | Factory for WriteResult with defaults | | runVerifierChain() | Run verifier chain, short-circuit on first failure | | Enhancer | Pluggable interface for metadata enhancement | | AIEnhancer | SLM-based metadata enhancement for scanned modules | | VERSION | Package version string |

Documentation

See the apcore-toolkit documentation for full API reference and guides.

License

Apache-2.0