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

@dblk/autopilot

v1.0.0

Published

Handle all command received as headers for CICP

Downloads

8

Readme

Autopilot (CICP Plugin)

This CICP plugin allows you to dynamically change the configuration of the any other plugins by sending query to any domain with some specific headers.

You first neeed to use registerCommand, then you listen for a specific event with the command you just registered.

How to use it

Add it to CICP

Install it to your plugins folder, then do not forget to add it while launching the cli: cicp -o autopilot,othersPlugins....
For a better usage, this plugin should be the first one in the list.

Require this plugin from another

Simply add the following object in your package.json:

"plugin": {
  "consumes": [
    "autopilot",
  ],
}

Register an event

this.autopilot.registerCommand({
    command: 'NEW-COMMAND',
    bypassQuery: true,
    waitForContinue: true,
});

Arguments

  • object:
    • command (String) - Name of the new command
    • bypassQuery (Boolean) - If true, autopilot will response to client with 204 status. Default false.
    • waitForContinue (Boolean) - If true autopilot will not pass to the next plugin (you must call it yourself). Default false.

Wait for event

Later in your code use something like:

this.autopilot.on('NEW-COMMAND', (params) => {
    console.log(params);
});

Description of params

Params is an object having the following properties:

  • command (String) - Name of the command responsible for the event (Same as the event)
  • value (String) - Value of the specific header
  • req - The initial request object (https://nodejs.org/api/http.html#http_class_http_clientrequest)
  • res - The response to the client (https://nodejs.org/api/http.html#http_class_http_serverresponse)
  • next - Call the next middleware (Pass an object to set the error)

Trigger the event

Simply make a request to any domain with the following header `X-DBLK-CICP-NEW-COMMAND'

Additional Informations

This module use DEBUG so feel free to add DEBUG=cicp:autopilot to see debug logs.

License

Copyright (c) 2019 Rémy Boulanouar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.



THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.