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

@weaver-conf/config-types

v0.1.0

Published

Core type definitions, Zod schemas, and the defineWeaver() builder for declaring layered configuration stacks

Downloads

107

Readme

@weaver-conf/config-types

Core type definitions, Zod schemas, and the defineWeaver() builder for declaring layered configuration stacks.

Installation

pnpm add @weaver-conf/config-types

Overview

@weaver-conf/config-types is the foundational package in the Weaver configuration system. It defines the type-level contracts that all other @weaver-conf/config-* packages depend on: layer definitions, storage provider interfaces, property schemas, session types, sync types, and access control types.

The centerpiece is defineWeaver() — a builder that takes an as const tuple of layer definitions and returns a fully-typed WeaverConfig. Layer names, order (rank), and types are all consumer-declared. There are no hardcoded layer names or roles.

The package also exports Layers.* factories for the four built-in layer types (Static, Dynamic, Personal, Ephemeral) and replaceOnly as an alternative merge strategy. Consumers can implement the LayerType interface to create custom layer types.

Usage

Declaring a layer stack with defineWeaver

import { defineWeaver, Layers, replaceOnly } from "@weaver-conf/config-types";

const weaver = defineWeaver([
  Layers.Static("core"),
  Layers.Static("app"),
  Layers.Dynamic("features"),
  Layers.Static("module"),
  Layers.Static("integrator"),
  Layers.Static("tenant"),
  Layers.Dynamic("organizational"),
  Layers.Personal("user"),
  Layers.Personal("device"),
  Layers.Ephemeral("session", { merge: replaceOnly }),
] as const);

// Type-safe layer access
weaver.getRank("tenant"); // => 5
weaver.getLayer("user");  // => LayerDefinition<"user">
weaver.getLayersByType("dynamic"); // => [features, organizational]
weaver.layerNames; // => readonly ["core", "app", ..., "session"]

Implementing a custom LayerType

import type { LayerType } from "@weaver-conf/config-types";

const cacheBustedType: LayerType = {
  id: "cache-busted",
  persistent: false,
  defaultMerge: (base, override) => override ?? base,
  createResolver(provider, config) {
    return { resolve: (ctx) => [] };
  },
};

Using Zod schemas for runtime validation

import {
  configurationLayerSchema,
  configurationPropertySchemaSchema,
} from "@weaver-conf/config-types";

const parsed = configurationPropertySchemaSchema.parse(untrustedInput);

API Reference

Builder & Layers

| Export | Description | |---|---| | defineWeaver(layers) | Create a typed WeaverConfig from an as-const layer array | | Layers.Static(name, config?) | Factory for persistent, non-scoped layers | | Layers.Dynamic(name, config?) | Factory for persistent, scope-aware layers | | Layers.Personal(name, config?) | Factory for persistent, user-bound layers | | Layers.Ephemeral(name, config?) | Factory for non-persistent session layers | | replaceOnly | Merge function that replaces entirely (no deep merge) |

Key Types

| Type | Description | |---|---| | WeaverConfig<T> | Typed config object with getRank(), getLayer(), getLayersByType() | | LayerDefinition<N> | A bound layer: name + type + config | | LayerType | Interface for implementing custom layer types | | MergeFunction | (base, override) => merged — layer merge strategy | | ConfigurationStorageProvider | Read/write interface for layer storage backends | | ConfigurationService | High-level service interface (get, set, inspect, onChange) | | ConfigurationPropertySchema | Schema for a single config key (type, visibility, changePolicy, etc.) | | ConfigurationLayerStack | Ordered array of layer entries for resolution | | OverrideSession | Session state with expiration and override tracking | | ConfigurationAccessContext | Caller identity (roles, sessionMode) for auth checks |

Zod Schemas

All core types have corresponding Zod schemas exported from schemas-core and schemas-providers (e.g., configurationLayerSchema, writeResultSchema, promotionRequestSchema).

License

MIT