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

@walkeros/web-destination-api

v2.0.1

Published

Web API destination for walkerOS

Readme

Web API Destination for walkerOS

Source CodeNPM Package

The API destination allows you to send events to any HTTP endpoint with customizable data transformation and transport methods.

walkerOS follows a source → collector → destination architecture. This API destination receives processed events from the walkerOS collector and sends them to your custom API endpoint, enabling integration with internal analytics systems, data warehouses, or custom business logic that requires real-time event data.

Installation

npm install @walkeros/web-destination-api

Configuration

| Name | Type | Description | Required | Example | | ----------- | ------------------------------ | ------------------------------------------------ | -------- | ------------------------------------------------------------------------- | | url | string | The HTTP endpoint URL to send events to | Yes | 'https://api.example.com/events' | | headers | Record<string, string> | Additional HTTP headers to include with requests | No | { 'Authorization': 'Bearer token', 'Content-Type': 'application/json' } | | method | string | HTTP method for the request | No | 'POST' | | transform | function | Function to transform event data before sending | No | (data, config, mapping) => JSON.stringify(data) | | transport | 'fetch' \| 'xhr' \| 'beacon' | Transport method for sending requests | No | 'fetch' |

Quick Start

Configure in your Flow JSON:

{
  "version": 1,
  "flows": {
    "default": {
      "web": {},
      "destinations": {
        "api": {
          "package": "@walkeros/web-destination-api",
          "config": {
            "settings": {
              "url": "https://api.example.com/events",
              "method": "POST",
              "headers": { "Authorization": "Bearer your-token" }
            }
          }
        }
      }
    }
  }
}

Or programmatically:

import { startFlow } from '@walkeros/collector';
import { destinationAPI } from '@walkeros/web-destination-api';

const { elb } = await startFlow({
  destinations: [
    {
      destination: destinationAPI,
      config: {
        settings: {
          url: 'https://api.example.com/events',
          method: 'POST',
          headers: { Authorization: 'Bearer your-token' },
        },
      },
    },
  ],
});

Usage

Advanced Usage with Transform

import { startFlow } from '@walkeros/collector';
import { destinationAPI } from '@walkeros/web-destination-api';

const { elb } = await startFlow({
  destinations: [
    {
      destination: destinationAPI,
      config: {
        settings: {
          url: 'https://api.example.com/events',
          transport: 'fetch',
          transform: (event, config, mapping) => {
            return JSON.stringify({
              timestamp: Date.now(),
              event_name: `${event.entity}_${event.action}`,
              properties: event.data,
              context: event.context,
            });
          },
        },
      },
    },
  ],
});

Examples

Sending to Analytics API

{
  "destinations": {
    "analytics": {
      "package": "@walkeros/web-destination-api",
      "config": {
        "settings": {
          "url": "https://analytics.example.com/track",
          "method": "POST",
          "headers": {
            "Content-Type": "application/json",
            "X-API-Key": "your-api-key"
          }
        }
      }
    }
  }
}

Using Beacon Transport

For critical events that need to be sent even when the page is unloading:

{
  "destinations": {
    "critical": {
      "package": "@walkeros/web-destination-api",
      "config": {
        "settings": {
          "url": "https://api.example.com/critical-events",
          "transport": "beacon"
        }
      }
    }
  }
}

Custom Data Mapping

Use mapping rules to control which events are sent:

{
  "destinations": {
    "api": {
      "package": "@walkeros/web-destination-api",
      "config": {
        "settings": { "url": "https://api.example.com/events" },
        "mapping": {
          "entity": {
            "action": { "data": "data" }
          }
        }
      }
    }
  }
}

Transport Methods

  • fetch (default): Modern, promise-based HTTP requests
  • xhr: Traditional XMLHttpRequest for older browser compatibility
  • beacon: Uses Navigator.sendBeacon() for reliable data transmission during page unload

Type Definitions

See src/types/ for TypeScript interfaces.

Related

Contribute

Feel free to contribute by submitting an issue, starting a discussion, or getting in contact.

License

This project is licensed under the MIT License.