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

@wide-events/sdk

v1.0.0

Published

Structured event SDK for Node, Lambda, and edge runtimes.

Readme

@wide-events/sdk

Structured event SDK for Node, Lambda, and edge runtimes.

Install

npm install @wide-events/sdk

Node

import { WideEvents } from "@wide-events/sdk";

const wideEvents = new WideEvents({
  serviceName: "orders-api",
  environment: "production",
  collectorUrl: "http://localhost:4318",
});

app.use(wideEvents.middleware());

app.post("/orders", async (req, res) => {
  wideEvents.annotate(
    {
      "user.id": req.user.id,
      "order.total": req.body.total,
    },
    { promote: ["order.total"] },
  );

  wideEvents.push("db.queries", {
    operation: "select_order",
    duration_ms: 12,
  });

  res.sendStatus(201);
});

Lambda

import { WideEvents } from "@wide-events/sdk";

const wideEvents = new WideEvents({
  serviceName: "orders-lambda",
  collectorUrl: process.env.WIDE_EVENTS_COLLECTOR_URL,
});

export const handler = wideEvents.wrapHandler(async (event) => {
  wideEvents.annotate({ "http.route": event.rawPath });
  return { statusCode: 200, body: "ok" };
});

wrapHandler() records thrown errors automatically, flushes in finally, and rethrows failures.

Edge

import { WideEvents } from "@wide-events/sdk/edge";

const wideEvents = new WideEvents({
  serviceName: "edge-gateway",
  collectorUrl: "https://collector.example.com",
});

export default {
  fetch(request: Request, env: Env, ctx: ExecutionContext) {
    return wideEvents.fetchHandler(request, ctx, () => new Response("ok"));
  },
};

Core API

| Method | Purpose | | --- | --- | | run(initial, callback) | Manually create an event context. | | middleware() | Node request lifecycle middleware. | | route(handler) | Wrap a Node HTTP route handler with event lifecycle and error capture. | | expressMiddleware() / fastifyPlugin() | Express and Fastify request lifecycle adapters. | | honoMiddleware() / nestMiddleware() / nestInterceptor() | Hono and Nest request lifecycle adapters. | | wrapHandler(handler) | Lambda-style event lifecycle wrapper. | | fetchHandler(request, ctx, handler) | Edge request lifecycle helper. | | annotate(attributes, options?) | Add structured fields to the active event. | | push(key, value) | Append repeated nested values such as DB calls. | | recordError(error, options?) | Record an error on the active event. | | current() | Return the current materialized event, if one is active. | | wrapFetch(fetch?) / instrumentFetch() | Instrument outbound fetch calls. | | restoreFetch() | Restore a patched global fetch. | | flush() / forceFlush() | Send queued events to the collector. | | shutdown() | Restore patched fetch and flush queued events. |

Automatic exception details are guaranteed only when the SDK owns the execution boundary. Plain Node middleware marks status >= 500 responses as failed; use platform wrappers when you need thrown-error details without manual recordError().

Instrumentation

Node-only integrations can be configured when the SDK is created:

const wideEvents = new WideEvents(
  { serviceName: "api", collectorUrl },
  {
    fetch: true,
    pg: [pool],
    redis: [redis],
    aws: [dynamoClient],
  },
);

Manual installers are also available as subpaths:

  • @wide-events/sdk/instrumentation/pg
  • @wide-events/sdk/instrumentation/aws-sdk-v3
  • @wide-events/sdk/instrumentation/ioredis

Emitted attribute arrays use these keys:

| Integration | Success key | Failure key | | --- | --- | --- | | fetch | http.client.requests | http.client.errors | | Postgres | db.queries | db.errors | | AWS SDK v3 | aws.client.operations | aws.client.errors | | ioredis | redis.commands | redis.errors |

See the Node service example for optional Postgres, Redis, and DynamoDB snippets.

Framework Adapters

Use the framework-specific helpers when you want request lifecycle integration without wiring the generic middleware yourself:

app.use(wideEvents.expressMiddleware());
await fastify.register(wideEvents.fastifyPlugin());

Hono and Nest helpers are exported as honoMiddleware(), nestMiddleware(), and nestInterceptor().