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

@macavitymadcap/hyper-dank-data

v0.4.0

Published

Database lifecycle and adapter-test primitives for Hyper-Dank apps.

Readme

Hyper-Dank Database

Database lifecycle, migration planning, and adapter-test primitives for Hyper-Dank apps.

App packages own their domain schemas and repositories. This package only defines shared provider shape, migration helpers, and conformance checks that future adapters can reuse.

Installation

@macavitymadcap/hyper-dank-data is public on npm:

npm install @macavitymadcap/hyper-dank-data typescript

Package page: https://www.npmjs.com/package/@macavitymadcap/hyper-dank-data

Static docs: https://macavitymadcap.github.io/hyper-dank/libraries/data/

Consumer setup: https://macavitymadcap.github.io/hyper-dank/libraries/consumer-setup/

For local package development, pack the Hyper-Dank workspace and install the tarball into a downstream app:

# from hyper-dank
bun run pack:packages

# from a downstream app
bun add ../hyper-dank/.cache/packages/macavitymadcap-hyper-dank-data-0.1.1.tgz
bun add typescript

The package peers on typescript for declaration-aware tooling. The tarball route is verified by bun run test:packages, which installs the package into a clean temporary app outside this workspace and imports both @macavitymadcap/hyper-dank-data and @macavitymadcap/hyper-dank-data/testing by package name.

Future npm releases use trusted publishing with provenance and staged package approval so a maintainer can review the release before it becomes public. Managed adapter packages remain future work.

Public Exports

  • Main export: DatabaseAdapterKind, MaybePromise, DatabaseLifecycle, RepositoryFactory, DatabaseProviderBase, ReadableRepository, WritableRepository, RepositoryContract, DatabaseProviderFactory, ProviderRegistry, createProviderRegistry, Migration, MigrationStore, MigrationPlan, SkippedMigration, validateMigrations, planMigrations, and runPendingMigrations.
  • Testing export: DatabaseLifecycleHarness, ProviderHarness, RepositoryHarness, runRepositoryHarness, runWithProviderHarness, and describeDatabaseLifecycleContract from @macavitymadcap/hyper-dank-data/testing.

Repository Contracts

ReadableRepository<TRecord, TId> and WritableRepository<TRecord, TId> are small structural contracts for app-owned repositories. They are useful when a dashboard, admin tool, or server app has a conventional findById, list, save, and delete shape, but they do not require apps to rename richer domain methods or hide SQL behind this package.

RepositoryContract<TRecord, TId> combines the readable and writable contracts. It is only a type: there is no runtime base class and no schema, query builder, transaction, or model mapping layer.

Provider Registry

createProviderRegistry() accepts app-owned provider factories keyed by adapter kind. The helper selects the right factory and reports missing kinds clearly, while the app still parses environment variables, constructs adapters, and decides which kind to request.

import { createProviderRegistry } from "@macavitymadcap/hyper-dank-data";

const providers = createProviderRegistry({
  sqlite: ({ path }: { path: string }) => createSqliteProvider(path),
  postgres: ({ databaseUrl }: { databaseUrl: string }) => createPostgresProvider(databaseUrl),
});

const provider = await providers.create("sqlite", { path: "./local.db" });

Migration Planning

validateMigrations() checks migration ids before a store executes anything. It throws when a migration id is blank or duplicated.

planMigrations() asks a MigrationStore which migrations are already recorded and returns a MigrationPlan containing pending migrations plus skipped entries marked as already-applied. It never calls runMigration() or recordMigration(), so apps can use it for dry-run output.

runPendingMigrations() now validates and plans first, then executes only the pending migrations. It remains backwards compatible for callers that ignore the return value, and callers that need reporting can inspect the returned plan.

Testing Harnesses

runRepositoryHarness() and runWithProviderHarness() centralise the setup/assertion/cleanup shape used by adapter conformance tests. Provider harnesses close the provider before optional cleanup runs. Repository harnesses leave domain assertions in the app test suite while keeping cleanup predictable after both successful and failing assertions.

The public docs site includes examples for provider typing, migration stores, planning, and lifecycle contract tests.

For the full public API reference, see site/libraries-data.md.

For app-shape guidance, see the public recipes under site/recipes.md and site/recipes-*.md.