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

@michaelthielemann/kestrel-migrations-default

v5.8.1

Published

migrations@1: applies content migrations once, per document and stored locale, with a ledger.

Readme

migrations/default

migrations@1 on top of content@1: every pending migration ({ id, collection, up } in config) runs exactly once, in config order, against every document of its collection and every stored locale of that document, validated against the current model and — when a validate@1 provider is registered — against the consumer's JSON schemas. A migration is recorded in the ledger (content_migrations) only after it succeeds; a failing migration leaves the documents it already rewrote as they are (no transactions across documents) and names the migration, the document and the locale in its error. No per-document events; a successful non-dry apply() that ran at least one migration emits exactly one migrations.applied with the applied ids and total changed document count. Config: migrations ({ id, collection, up }[], id matching ^[A-Za-z0-9][A-Za-z0-9._-]*$, unique, collection naming a type in content.model().types — otherwise boot fails), mode ("apply" default, "check" fails boot listing what's pending, "off" runs nothing at boot), chunk (paging size, default 50). Steps: migrations.list ({ applied, pending }), migrations.apply (payload.dry === true reports changes without writing). Both write result and read nothing. apply answers CONFLICT (409) while another apply() is already running, MIGRATION_FAILED (500) with the failing migration's own message and details: { migration, document, locale?, problems? }, and TRANSIENT (503, retryable) when the ledger or content@1 fails transiently; list answers TRANSIENT only. Schema evolution: changing a stored field or block shape is a migration, not a one-off script — see helpers (@michaelthielemann/kestrel-migrations-default/helpers, pure, no core import): defineMigration, mapBlocks(document, type, fn, blocksField = "body") (depth-first, slots before the node itself, fn returning null removes the node), renameBlock, renameProp, omit. An example: moving a serviced-apartments block's props.images into its first props.categories entry —

defineMigration({
  id: "serviced-apartments-images-to-categories",
  collection: "pages",
  up: ({ document }) =>
    mapBlocks(document, "serviced-apartments", (block) => {
      const props = block.props ?? {};
      const images = props.images;
      const categories = (props.categories as Array<Record<string, unknown>> | undefined) ?? [];
      if (!Array.isArray(images) || categories.length === 0) return block;
      const [first, ...rest] = categories;
      return { ...block, props: omit({ ...props, categories: [{ ...first, images }, ...rest] }, "images") };
    }),
});

and a rename: renameBlock(document, "serviced-apartments", "apartments"). The boot-time migrations.applied (mode "apply") reaches no listener by construction: it fires inside setup(), and event triggers subscribe in start(), after every module is set up. Only an apply() triggered through a pipeline reaches event triggers; after a partial failure the event still fires, covering only the migrations that were applied before the failing one. Not included: down migrations (point-in-time recovery is the way back), transactions, file discovery of migration modules, a CLI — all a consumer concern.

Generated from the manifest

@michaelthielemann/kestrel-migrations-default – module migrations/default: provides migrations@1; requires content@1, persistence@1, events@1; optional validate@1.

| Config | Type | Required | Default | |---|---|---|---| | migrations | array | yes | – | | mode | enum | no | "apply" | | chunk | integer | no | 50 |

| Step | Summary | Reads | Writes | Input | Output | Errors | |---|---|---|---|---|---|---| | migrations.list | Applied migrations (ledger, oldest first) and still-pending migrations (config order) | – | result | – | { applied: object[], pending: object[], … } | – | | migrations.apply | Apply every pending migration; payload.dry === true reports the changes without writing | – | result | { dry?: boolean } | object | object | 409 another apply() is already running; 500 a migration failed (message names the migration, document and locale) |

Pipelines in examples/minimal using these steps:

  • applyMigrations (POST /admin/migrations/apply): authn.requireUser → authz.require:migrations.manage → migrations.apply
  • listMigrations (GET /admin/migrations): authn.requireUser → authz.require:migrations.manage → migrations.list