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

@bernierllc/nevar-rule-seeder

v0.1.0

Published

Idempotent rule seeding for the Nevar rules engine — load default rules from config at startup with skip/update/replace strategies

Downloads

200

Readme

@bernierllc/nevar-rule-seeder

Idempotent rule seeder for the Nevar rules engine. Loads default rule groups and rules from configuration into storage using configurable strategies.

Installation

npm install @bernierllc/nevar-rule-seeder

Usage

import { RuleSeeder } from '@bernierllc/nevar-rule-seeder';
import { InMemoryStorageAdapter } from '@bernierllc/nevar-storage';

const storage = new InMemoryStorageAdapter();
const seeder = new RuleSeeder(storage);

const result = await seeder.seed(
  {
    groups: [
      {
        slug: 'onboarding-rules',
        name: 'Onboarding Rules',
        isActive: true,
        rules: [
          {
            name: 'Welcome Email',
            slug: 'welcome-email',
            triggerType: 'user.created',
            conditions: { operator: 'AND', conditions: [] },
            actions: [
              {
                actionType: 'send-email',
                config: { template: 'welcome' },
                executionOrder: 1,
              },
            ],
            executionOrder: 1,
          },
        ],
      },
    ],
  },
  { strategy: 'update_existing', matchBy: 'slug' },
);

console.log(result);
// { groupsCreated: 1, groupsUpdated: 0, groupsSkipped: 0,
//   rulesCreated: 1, rulesUpdated: 0, rulesSkipped: 0, rulesDeleted: 0 }

Seed Strategies

  • skip_existing - Create new groups/rules, skip any that already exist (matched by slug or id)
  • update_existing - Create new groups/rules, update any that already exist with the seed data
  • replace_all - Delete all existing groups and rules, then create everything from the seed data

API

RuleSeeder

Idempotent seeder that loads groups and rules into a storage adapter.

  • constructor(storage: StorageForSeeding) - Create a seeder with a storage adapter
  • seed(data: SeedData, options: SeedOptions): Promise<SeedResult> - Seed groups and rules according to the given strategy

SeedData (type)

Top-level seed input: { groups: SeedGroupData[] }.

SeedGroupData (type)

Group definition for seeding: slug, name, rules, and optional isDefault, isActive, metadata.

SeedRuleData (type)

Rule definition for seeding: name, slug, triggerType, conditions, actions, executionOrder, and optional isActive, stopOnMatch, allowLoop, logLevel, metadata.

SeedOptions (type)

Controls seeding behavior: { strategy: 'skip_existing' | 'update_existing' | 'replace_all'; matchBy: 'slug' | 'id' }.

SeedResult (type)

Reports what changed: counts for groupsCreated, groupsUpdated, groupsSkipped, rulesCreated, rulesUpdated, rulesSkipped, rulesDeleted.

StorageForSeeding (interface)

Minimal storage interface required for seeding. Subset of NevarStorageAdapter covering group and rule CRUD operations.

NevarSeedError

Custom error class thrown on seed failures. Chains the original error via cause.

Integration Documentation

Logger Integration

This package supports optional integration with @bernierllc/logger for structured logging. Service packages that use the seeder should log seed results and failures through logger for observability into rule provisioning.

NeverHub Integration

This package supports optional integration with @bernierllc/neverhub-adapter. When NeverHub is available, seeding operations can be registered for discovery and monitoring, providing visibility into rule provisioning across environments. Graceful degradation is supported when NeverHub is not present.

License

Copyright (c) 2025 Bernier LLC. All rights reserved.