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

@vouchington/dynamic-config

v0.3.0

Published

Role authorizer and snake_case admin view primitives for valkyries dynamic-config.

Readme

@vouchington/dynamic-config

Pure primitives for building a dynamic-config admin on top of valkyries/dynamic-config (^0.10.0). There is no orchestration here: the application owns the sequence of authorize, validate, record, and write.

  • createRoleAuthorizer: a pure role predicate (user, entry, permission) => boolean.
  • toAdminNamespaceSummary / toAdminNamespaceView: snake_case admin view serializers over a registry entry. The caller supplies { can_view, can_update }, and calls waitForInitialization() before toAdminNamespaceView.
  • normalizeFields: reads every declared field with default fallback and verifies runtime types.
  • Types: DynamicConfigRegistryEntry is valkyries' DynamicConfigNamespaceDefinition plus label, description, and access. Field rules are valkyries' camelCase DynamicConfigFieldRules.

The registry, namespace definitions, validators, DynamicConfigValidationError, and validateDynamicConfigUpdate live in valkyries/dynamic-config; import them from there. valkyries is a peer dependency because the application owns the DynamicConfig instances and this package only uses its types.

Example: the update sequence the application writes itself

import {
  createDynamicConfigRegistry,
  defineDynamicConfigNamespace,
  validateDynamicConfigUpdate,
} from 'valkyries/dynamic-config'
import {
  createRoleAuthorizer,
  normalizeFields,
  toAdminNamespaceView,
  type DynamicConfigRegistryEntry,
} from '@vouchington/dynamic-config'

const registry = createDynamicConfigRegistry<DynamicConfigRegistryEntry>([
  defineDynamicConfigNamespace<DynamicConfigRegistryEntry>({
    namespace: 'limits',
    label: 'Limits',
    description: 'Request limits.',
    config: limitsConfig, // a valkyries DynamicConfig
    access: { update_roles: ['developer'] },
    fields: { soft: { minValue: 1, integer: true }, hard: { minValue: 1, integer: true } },
  }),
])
const authorize = createRoleAuthorizer({
  getRoles: (user: User) => user.roles,
  adminRoles: ['administrator'],
  viewerRoles: ['moderator'],
})

async function update(user: User, namespace: string, body: unknown) {
  const entry = registry.get(namespace)
  if (!entry || !authorize(user, entry, 'update')) return null
  await entry.config.waitForInitialization()
  const current = normalizeFields(entry, entry.config.getFields())
  const result = validateDynamicConfigUpdate(entry, current, body)
  if (result.changed) {
    await recordAudit(user, namespace, current, result.next) // application persistence
    await entry.config.setFields(result.changes)
  }
  return toAdminNamespaceView(entry, {
    can_view: authorize(user, entry, 'view'),
    can_update: true,
  })
}

Migrating from 0.1.x

  • createDynamicConfigAdmin is removed. Compose list / get / update / history in the application as above (unknown namespace and unauthorized both returning null, audit before setFields, history persistence).
  • Import createDynamicConfigRegistry, defineDynamicConfigNamespace, withMaxValueExemption, getChangedFields, DynamicConfigValidationError, and the validate* helpers from valkyries/dynamic-config.
  • Rename field rules to camelCase: min_value to minValue, max_value to maxValue, max_value_exemption to maxValueExemption. Admin output stays snake_case.
  • Type entries as DynamicConfigRegistryEntry and pass it as the generic to createDynamicConfigRegistry and defineDynamicConfigNamespace.
  • Error texts follow valkyries (Changes must be an object, Unknown field: x, Field <f> must be one of: a, b, DynamicConfig field rules drift for <ns>: missing rules: a; extra rules: b). Updates use strict types (no coercion); validateStrictlyAscending requires real numbers. Valkyries result objects have a null prototype: use Object.hasOwn.