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

@openintegrationhub/component-sdk-nodejs

v0.0.1

Published

The official elastic.io library for bootstrapping and executing for Node.js connectors

Downloads

3

Readme

elasticio-sailor-nodejs Build Status Dependency Status

The official elastic.io library for bootstrapping and executing for Node.js connectors.

NPM

elasticio-sailor-nodejs is a required dependency for all components build for elastic.io platform in Node.js. Add the dependency in the package.json file in the following way:

    "dependencies": {
        "q": "^1.4.1",
        "elasticio-sailor-nodejs": "^2.2.1",
        "elasticio-node": "^0.0.8"
    }

Building components in Node.js

If you plan to build a component for elastic.io platform in Node.js then you can visit our dedicated documentation page which describes how to build a component in node.js.

Before you start

Before you can deploy any code into our system you must be a registered elastic.io platform user. Please see our home page at http://www.elastic.io to learn how.

Any attempt to deploy a code into our platform without a registration would fail.

After the registration and opening of the account you must upload your SSH Key into our platform.

If you fail to upload you SSH Key you will get permission denied error during the deployment.

Getting Started

After registration and uploading of your SSH Key you can proceed to deploy it into our system. At this stage we suggest you to:

  • Create a team to work on your new component. This is not required but will be automatically created using random naming by our system so we suggest you name your team accordingly.
  • Create a repository inside the team to deploy your new component code.

Examples of Node.js components

Here is a list of components build on Node.js:

Sailor hooks

Init hook

/**
* cfg - This is the same config as the one passed to "processMessage" method of the trigger or action
*/
exports.init = function(cfg) {
    //do stuff
    return Promise.resolve();
}

Startup hook

/**
* cfg - This is the same config as the one passed to "processMessage" method of the trigger or action
*/
exports.startup = function(cfg) {
    //do stuff
    const data = {
        message: 'Hello from STARTUP_HOOK'
    };
    return Promise.resolve(data);
}
  • Only on the first trigger

  • Called without this

  • May return promise

  • May return value

  • May throw - not recommended

  • May return a promise that will fail

  • Startup logs can be found in the tab of the component on execution page

  • TBD - Separate them under different tab in UI

  • TBD - Where to see restart errors?overwritten

Startup state data - either return value or the result of the promise

  • OK
    • Results will be stored as the startup state, previous will be overwritten with warning
    • After that init hook will be run, etc
  • NOK
    • Sailor will exit the process
    • Platform will restart the component immediately
    • If init wont' happen it will be removed after 5 minutes (see restart policy)
    • In the next scheduling interval initialisation will repeat

Shutdown hook

/**
* cfg - This is the same config as the one passed to "processMessage" method of the trigger or action
* startData - result from the startup
*/
exports.shutdown = function(cfg, startData) {
    //corresponding to the startup example above, startData is { message: 'Hello from STARTUP_HOOK' }
    //do stuff
    return Promise.resolve();
}
  • Only on the first trigger
  • One stop is pressed
    • If task is running then containers are shutdown
    • If task is sleeping then do nothing
  • Start new trigger container
  • Trigger starts without this context - it's not possible to log errors or send new data
  • Should either return value (ignored) or promise (resolved).
  • Startup data is removed after shutdown hook
  • Call the shutdown hook, parameters that are passed is from the startup results or {} if nothing was returned
  • Errors are ignored
  • If shutdown hook won't complete within 60 seconds then container will be killed
  • As soon as user pressed stop, task is marked as inactive and 'webhooks gateway' will start responding with the error (Task either does not exist or is inactive) to possible data

TBD - log for shutdown hooks?