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

@on-the-ground/effect-dependency

v0.0.3

Published

> ๐Ÿฅ‰ย **Dynamically route effectful calls to matching dependencies โ€” at runtime, with role-based duck typing.**\ > This is not your typical DI. This is actor-style delegation.

Readme

@on-the-ground/effect-dependency

๐Ÿฅ‰ย Dynamically route effectful calls to matching dependencies โ€” at runtime, with role-based duck typing.
This is not your typical DI. This is actor-style delegation.


โœจ Features

  • ๐Ÿ”€ Message-based delegation of effectful function calls
  • ๐Ÿฅ† Duck-typed role matching via quackquack
  • ๐Ÿ”— Fallback delegation chain for unhandled messages
  • ๐ŸŽญ No need to wire static interfaces or inject services โ€” just declare a role and call it

๐Ÿš€ Quick Example

import {
  withDependencyEffectHandler,
  dependencyEffect,
} from "@on-the-ground/effect-dependency";

import { quackable } from "@on-the-ground/quackquack";
import { withSignal, emptyContext } from "@on-the-ground/effect";

const greeter = {
  greet: quackable("(name: string) => string")((name) => `Hello, ${name}!`),
};

const pctx = withSignal(new AbortController().signal, emptyContext);

await withDependencyEffectHandler(pctx, [greeter], async (ctx) => {
  const result = await dependencyEffect(ctx, {
    role: { greet: "(name: string) => string" },
    call: { name: "greet", args: ["Juno"] },
  });

  console.log(result); // => "Hello, Juno!"
});

๐Ÿง  Concept

This is not a DI container.
This is a message-routing system based on duck-typed roles.

It answers the question:

โ€œWhoever can handle this message โ€” please do.โ€

The Delegation Chain

  1. You describe the role you're trying to call:

    role: {
      greet: "(name: string) => string";
    }
  2. You issue a call into the effect system:

    call: { name: "greet", args: ["Alice"] }
  3. Any dependency that matches the shape and name will be called.

  4. If no match is found locally, the message bubbles up to the parent context (if available).


๐Ÿงช Testing Example

it("delegates to matching dependency", async () => {
  const greeter = {
    greet: quackable("(name: string) => string")((n) => `Hi ${n}`),
  };

  const pctx = withSignal(new AbortController().signal, emptyContext);

  await withDependencyEffectHandler(pctx, [greeter], async (ctx) => {
    const result = await dependencyEffect(ctx, {
      role: { greet: "(name: string) => string" },
      call: { name: "greet", args: ["Jo"] },
    });

    expect(result).toBe("Hi Jo");
  });
});

๐Ÿ—๏ธ When to Use This

โœ… You want flexible message passing instead of tight coupling
โœ… You want actor-style delegation across contexts
โœ… You want role-based resolution rather than static DI graphs
โœ… You want to support plugin-like dependency injection with fallback chaining


๐Ÿ“ฆ Installation

yarn add @on-the-ground/effect-dependency

This package depends on:

  • @on-the-ground/effect
  • @on-the-ground/quackquack

Make sure they're installed if you're using raw effect contexts.


๐Ÿ’ฌ Philosophy

Most dependency injection systems are about wiring who to call.
This system is about describing what kind of role should be fulfilled โ€” and letting the system find someone who can.

Think of it like actor delegation or post office routing:

If you match the signature, you get the message.


๐Ÿ› ๏ธ API

withDependencyEffectHandler(ctx, dependencies, thunk)

Wraps a context with a handler that intercepts dependencyEffect calls and tries to match them to the given dependencies.

dependencyEffect(ctx, payload)

Performs a role-based message call.
Returns the result of the matched method, or null if not handled.

type Payload<Messages extends string = string> = {
  role: { [K in Messages]: QuackDSL };
  call: {
    name: Messages;
    args: unknown[];
  };
};

๐Ÿ“ Related Packages


๐Ÿงฐ Designed for the effect-ive-* ecosystem

This package is part of the effect-ive programming family โ€” a new way to write real-world code with effects, not mocks.