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

@systemfsoftware/effect-schema-law

v3.0.0

Published

Property-test any Effect Schema's codec laws — round-trip identity and encode stability, generated with @systemfsoftware/vitest and fast-check.

Readme

@systemfsoftware/effect-schema-law

Property-test codec laws for Effect Schema.

A schema is a two-way codec. ruleOfSchemas asserts the two laws, generating inputs from the schema itself (via @systemfsoftware/vitest's it.prop + fast-check):

  • Round-trip identity — decode(encode(x)) equals x.
  • Encode stability — re-encoding the decoded value reproduces the original encoded form.
import { ruleOfSchemas } from '@systemfsoftware/effect-schema-law'
import { Schema as S } from 'effect'

const Email = S.String.pipe(S.brand('Email'))

// inside a Vitest file — registers two property tests
ruleOfSchemas('Email', Email)

Recursive schemas

recursionLaws(label, schema) adds the generation laws a recursive union needs, and registers nothing at all for a schema whose syntax tree carries no recursion cycle. Pass the schema that is the recursion point — the Schema.suspend that returns the union, or the union itself:

  • Nesting inside the declared ceiling — every generated value stays within the budget the schema declares (a schema that declares none is held to the fixed per-suspension ceiling).
  • Deep values stay reachable — a sample of generated values keeps a floor of deeply nested values. Registered only when the declaration asks for more depth than the stock derivation reaches, so it is never a claim that cannot be made.
  • Every member stays inhabited — each member of the cycle is reachable from generation.
import { recursionLaws } from '@systemfsoftware/effect-schema-law'

// beside ruleOfSchemas — registers two more property tests for a recursive union
recursionLaws('Expr', Expr)

A recursionBudget annotation that nothing materialized — the plugin that builds the derivation hook is missing from the test run — fails the suite by name rather than quietly generating stock values.

Install

pnpm add -D @systemfsoftware/effect-schema-law

Install as a devDependency — the entry registers tests. effect, vitest, and @systemfsoftware/vitest are peer dependencies: you bring your own (you already have them to run your tests), so the helper shares your single test-runner instance.

Call ruleOfSchemas(name, schema) at the top level of a Vitest test file, or inside an if (import.meta.vitest !== void 0) block in the module that declares the schema — a bundler that defines import.meta.vitest as undefined compiles that branch away, so nothing reaches your published output.