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

@triadlabs/connectors-core

v0.1.0

Published

Shared contracts for Triad Labs connectors

Readme

@triadlabs/connectors-core

Shared contracts for Triad Labs connectors. Plumbing, not a silo.

This package holds the source-agnostic types every connector implements and every consumer codes against: the normalized document shape, the parser socket, the generic connector interface, and typed errors. It has no runtime dependencies.

You normally do not install this directly — source packages like @triadlabs/connectors-gdrive re-export everything here. Install it when you are building your own connector or writing consumer code that should work across sources.

Requires Node.js >= 20. ESM only.

Install

npm install @triadlabs/connectors-core

What's inside

import {
  type Connector,
  type ConnectorDocument,
  type ParserFn,
  type ParserContext,
  type FetchContentOptions,
  ConnectorAuthError,
  ConnectorCursorExpiredError,
  ConnectorExtractionError,
  ConnectorScopeError,
} from "@triadlabs/connectors-core";

ConnectorDocument — the normalized unit every connector returns:

interface ConnectorDocument {
  providerDocId: string;   // stable ID in the source system
  name: string;
  mimeType: string;
  webViewLink?: string;
  url?: string;
  modifiedAt: string;
  sizeBytes?: number;
  providerVersion?: string;
  contentHash: string;     // SHA-256 of markdown, filled by fetchContent
  markdown: string;        // empty until fetchContent
}

ParserFn — the consumer-injected socket for binary formats. Connectors never bundle a parser; you bring your own pipeline (local parser, paid API, LLM, whatever):

type ParserFn = (bytes: Uint8Array, mimeType: string, context?: ParserContext) => Promise<string>;

Connector<Cursor, Result, Document> — the minimal source-agnostic contract:

interface Connector<Cursor, Result, Document extends ConnectorDocument> {
  listChanges(cursor?: Cursor): Promise<Result>;
  fetchContent(doc: Document, options?: FetchContentOptions): Promise<Document>;
}

Typed errors — all catchable with instanceof:

  • ConnectorAuthError — credentials malformed or unparseable
  • ConnectorScopeError — scope configuration invalid
  • ConnectorExtractionError — item cannot be extracted (e.g. no parser for its type)
  • ConnectorCursorExpiredError — a persisted cursor can no longer be used; catch it and run a full backfill
  • ConnectorResumeError — malformed or incompatible state; cursor-error subtype
  • ConnectorRescanRequiredError — source topology needs a new inventory; cursor-error subtype
  • ConnectorProviderError — safe status, retryable, and optional retryAfterMs
  • ConnectorContentChangedError — content changed during download; retry the file

FetchContentOptions carries an optional signal, maxBytes, and maxOutputCharacters. ParserContext carries the document ID, name, MIME type, optional size, and signal. Parsers remain consumer-owned; a signal requires cooperative cancellation or an external worker/process supervisor.

ConnectorExtractionError has a reason and optional providerDocId. Its reasons are unsupported, encrypted, malformed, resourceLimit, needsOcr, and parserFailed. Existing message-only constructors remain valid.

Building a connector

Implement the interface, keep all source-specific types in your own package, and own no consumer state — resume data goes in as an argument and comes out in the result:

import type {
  Connector,
  ConnectorDocument,
  ParserFn,
} from "@triadlabs/connectors-core";

interface HubSpotResume { cursor?: string; }
interface HubSpotResult {
  documents: ConnectorDocument[];
  removed: string[];
  cursor: string;
}

export function createHubSpotConnector(options: {
  apiKey: string;
  parser?: ParserFn;
}): Connector<HubSpotResume, HubSpotResult> {
  // auth, change detection, normalization — your code
  // storage, indexing, scheduling — the consumer's code
}

See the connector-sdk design doc for the architecture these contracts come from.

License

MIT