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 🙏

© 2024 – Pkg Stats / Ryan Hefner

repost

v1.0.1

Published

repost is a system that enables fast and easy request transformation proxying.

Downloads

3

Readme

rePOST

repost is a system that enables fast and easy request transformation proxying.

It includes a simple web interface that allows you to manage what incoming requests to listen for, and the resulting transformations.

Configuration

Configure repost by passing in environment variables

  • REPOST_PRIVATE_PORT number – default: 3000 The private port where the control panel and configuration api is exposed

  • REPOST_PUBLIC_PORT number – default: 3001 The public port where repost listens for incoming events

  • REPOST_DB_CLIENT – sqlite3 | better-sqlite3 | mysql | mysql2 | oracledb | pg – default: sqlite3

    The database client to use. See knex configuration options for more information.

  • REPOST_DB_CONNECTION string – default: repost.db

    The database connection configuration. See knex configuration options for more information.

    To use an object for configuration, set the environment variable to a valid json string

Usage

Create events, actions and entries to enable functionality in repost

event

An event is an endpoint or request configuration that repost will be able to listen for.

Properties

  • method – GET | POST | PUT | PATCH | DELETE The HTTP method to accept requests for

  • path - string The path to listen on

  • Basic auth - json A json object containing username and password which must be matched when the validation strategy is set to "basic"

  • Headers - json A json object containing headers which must be matched when the validation strategy is set to "basic"

  • Data - json A json object containing a default body which will merge with the request body and propagate on to the action (not supported for GET requests)

  • Validation Strategy - basic | none When set to basic, the basic auth and request headers will be validated against the supplied json values

action

An action is a request transformation and resulting request, that follows an event

Properties

  • name - string A label for the action

  • Repost Target - url The target URL to send the request to

  • Strategy - Static | JavaScript

    Static

    The supplied code must be a static json object following the Request Configuration model (See below)

    JavaScript

    The supplied code must be valid JavaScript. The incoming event is a javascript object following the Request Configuration model, and can be accessed from the script using event

    The variable event has been updated with the url to the Repost Target set in the action. The requested url is also available on event.incomingRequestUrl

    To transform the request, a call must be made to repost(event) where the event is also an object following the Request Configuration model. event can be mutated and then reposted like so repost(event)

    The third-party libraries axios and lodash can be utilized in the script using const _ = require("lodash") and const axios = require("axios") respectively.

    The Request Configuration model is compatible with axios, so additional requests may be sent using axios(event)

  • URL - url Direct link to a script compliant with the selected strategy. The content-type must be text/plain or text/html

  • Code - string Plain text script compliant with the selected strategy. If a URL is specified it will take precedence

entry

An entry is the entity that connects an event to an action.

While an action can be reused across multiple events, each event may only trigger a single action, and should only have one entry. If multiple entries use the same event, the last one will take precedence

Properties

  • Label - string A label for the entry

  • Action - number The ID of the chosen action

  • Event - number The ID of the chosen event

Request Configuration Model

The model that is used for incoming and outgoing requests in rePOST.

{
  auth?: {
    username: string,
    password: string
  },
  data?: any;
  headers?: Record<string, string>;
  incomingRequestUrl?: string;
  url: string;
  method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
}