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

@absinthelabs/adapters

v1.5.0

Published

Shared **types and Zod schemas** used across the Absinthe indexing pipeline. This package defines the _canonical shape_ of enriched actions, enriched positions, and adapter configuration — ensuring all Absinthe services interpret protocol data consisten

Readme

@absinthelabs/adapters

Shared types and Zod schemas used across the Absinthe indexing pipeline.
This package defines the canonical shape of enriched actions, enriched positions, and adapter configuration — ensuring all Absinthe services interpret protocol data consistently.

It is currently a types-only package that exports:

  • Enriched Action schema & type
  • Enriched Position schema & type
  • RegisterConfig schema & type
  • Chain/Asset/Denomination/Measurement enums
  • POSITION_REASONS constant
  • CommonFields + AssetFields shared structures

This package forms the foundation of the new adapter architecture (manifest-driven, priced, multi-protocol).


📦 Installation

npm install @absinthelabs/adapters
# or
pnpm add @absinthelabs/adapters

🛠 Usage Examples

Validate an Incoming Action

import { ActionSchema } from '@absinthelabs/adapters';

const action = ActionSchema.parse(rawData);What this does:

  • ✅ Validates all required fields are present (user, ts_ms, height, tx_ref, etc.)
  • ✅ Ensures field types match the schema
  • ✅ Automatically strips extra fields not in the schema
  • ❌ Throws ZodError if validation fails (use .safeParse() for non-throwing validation)

Validate a Position

script import { PositionSchema } from '@absinthelabs/adapters';

const pos = PositionSchema.parse(rawPos);What this does:

  • ✅ Validates position window fields (window_utc_start_ts_ms, window_utc_end_ts_ms, etc.)
  • ✅ Validates asset fields (asset_key, decimals, asset_type) - required for positions
  • ✅ Validates common fields (chain metadata, measurement type, etc.)
  • ❌ Throws if any required field is missing

Use TypeScript Types

import type { EnrichedAction, EnrichedPosition } from '@absinthelabs/adapters';

function consume(p: EnrichedPosition) { console.log(p.user, p.raw_after); // TypeScript knows all available fields and their types }Benefits:

  • 🎯 Full type safety and autocomplete
  • 🔍 Type inference from Zod schemas (single source of truth)
  • ⚡ No runtime overhead (types are stripped at compile time)

📚 Exports

✔ Zod Schemas

| Schema | Purpose | Use Case | | ---------------------------- | --------------------------------------------------------------- | ---------------------------------- | | EnrichedActionSchema | Validates enriched action events | API ingestion, database validation | | EnrichedPositionSchema | Validates enriched position windows | Position tracking, analytics | | RegisterConfigSchema | Validates adapter registration config | Adapter setup | | ChainArchSchema | Validates chain architecture (evm | solana) | Chain-specific logic | | MeasurementTypeSchema | Validates measurement type (token_based | count | none) | Trackable configuration | | DenominationSchema | Validates denomination (usd | scaled_token | none) | Pricing configuration | | AssetEnum | Validates asset type (erc20 | erc721 | spl | custom) | Asset identification |

✔ TypeScript Types

| Type | Inferred From | Description | | ---------------------- | ------------------------ | ---------------------------------- | | EnrichedAction | EnrichedActionSchema | Type-safe action event shape | | EnrichedPosition | EnrichedPositionSchema | Type-safe position window shape | | RegisterConfig | RegisterConfigSchema | Adapter registration configuration |


⚠️ Common Validation Errors

Missing Required Fields

// ❌ This will throw
ActionSchema.parse({ user: '0x123' });
// Error: Required field 'ts_ms' is missingcript
// ✅ Use safeParse for graceful handling
const result = ActionSchema.safeParse({ user: '0x123' });
if (!result.success) {
console.error(result.error.errors);
}---

Type Mismatches

// ❌ This will throw
ActionSchema.parse({
user: '0x123',
ts_ms: 'not-a-number' // Should be number
});
// Error: Expected number, received string---

Unknown Fields

// ✅ Extra fields are automatically stripped
const action = ActionSchema.parse({
user: '0x123',
ts_ms: Date.now(),
height: 12345,
tx_ref: '0xabc',
extraField: 'will be removed', // Automatically stripped
// ... all required fields
});
// Result: action.extraField is undefined

Note: The schema uses .strip() which automatically removes any fields not defined in the schema definition. This ensures data consistency across all consumers.