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

@runnerty/executor-http

v3.2.1

Published

Runnerty module: HTTP executor

Downloads

14

Readme

NPM version Downloads

Executor for Runnerty: HTTP

Installation:

Through NPM

npm i @runnerty/executor-http

You can also add modules to your project with runnerty

npx runnerty add @runnerty/executor-http

This command installs the module in your project, adds example configuration in your config.json and creates an example plan of use.

If you have installed runnerty globally you can include the module with this command:

runnerty add @runnerty/executor-http

Configuration sample:

Add in config.json:

{
  "id": "http_default",
  "type": "@runnerty-executor-http"
}

Plan sample:

Add in plan.json:

{
  "id": "http_default",
  "headers": { "User-Agent": "runnerty" },
  "method": "get",
  "url": "https://api.github.com/search/repositories",
  "params": { "q": "runnerty" },
  "responseType": "json"
}
{
  "id": "http_default",
  "headers": { "User-Agent": "runnerty" },
  "url": "http://www.sample.com/form",
  "method": "post",
  "data": {
    "key1": "value1",
    "key2": "value2"
  },
  "responseType": "json",
  "withCredentials": true
}
{
  "id": "http_default",
  "headers": { "User-Agent": "runnerty" },
  "url": "http://www.sample.com/uploadfile",
  "method": "post",
  "files": [
    { "name": "fileOne", "path": "/var/myfile.txt" },
    { "name": "fileTwo", "path": "/var/www/runnerty.jpg" }
  ],
  "responseType": "json",
  "returnHeaderDataOutput": true
}
{
  "id": "http_default",
  "headers": { "User-Agent": "runnerty", "Content-Type": "application/xml" },
  "method": "post",
  "url": "https://sample.com/api-sample",
  "auth": {
    "username": "@GV(MY_USER_AUTH)",
    "password": "@GV(MY_PASS_AUTH)"
  },
  "data": "@GV(SAMPLE_BODY)"
}

Pagination:

It is possible to make calls to APIs that return JSON data that requires paging. The parameters available for paging are.

| Parameter | Description | | ------------------------------ | ---------------------------------------------------------------------------------------------------- | | start | page from which the query is initiated, by default 1 | | limit | maximum elements per page | | pages | total pages to consult | | total | total items for automatic page calculation | | total_from_header | header from which to get the total of items for automatic page calculation | | total_from_response | params path of the response data from which to get the total of items for automatic page calculation | | next_page_url_from_response | params path of the response data from which to get the url for the next page | | token.query_param_name | name of parameter to send in url query with token of next page | | token.data_param_name | name of the parameter to be sent in the body with the token of next page | | token.next_token_from_response | params path of the response data from which to get the next page token | | token.next_token_from_header | params path of the header data from which to get the next page token |

Some paginations examples:

{
  "id": "http_default",
  "method": "get",
  "url": "https://endpoint.sample.com/items",
  "pagination": {
    "limit": "2000",
    "total_from_header": "x-total-items"
  },
  "responseType": "json",
  "responseToFile": "/var/www/data/sample.json",
  "noReturnDataOutput": true
}
{
  "id": "http_default",
  "method": "get",
  "url": "https://endpoint.sample.com/items",
  "pagination": {
    "limit": "2000",
    "next_page_url_from_response": "paging.nextPage"
  },
  "responseType": "json",
  "responseToFile": "/var/www/data/sample.json",
  "noReturnDataOutput": true
}
{
  "id": "http_default",
  "method": "get",
  "url": "https://endpoint.sample.com/items",
  "pagination": {
    "limit": "2000",
    "token": {
      "next_token_from_response": "paging.continuationToken",
      "query_param_name": "nextPageToken"
    }
  },
  "responseType": "json",
  "responseToFile": "/var/www/data/sample.json",
  "noReturnDataOutput": true
}

Output (Process values):

  • PROCESS_EXEC_DATA_OUTPUT: Response output data. It is possible to return the header response in dataoutput by activating the returnHeaderDataOutput (boolean) parameter
  • EXTRA_DATA: If the response is a JSON it is possible to work with the parsed values of the response using the "responseType": "json" parameter. If we receive for example:
{
  "planet": {
    "name": "Mars",
    "satellites": [
      {
        "name": "phobos"
      },
      {
        "name": "deimos"
      }
    ]
  }
}

It is possible to access the values by (GETVALUE function): PROCESS_EXEC_PLANET_NAME: "Mars", PROCESS_EXEC_PLANET_NAME_SATELLITES_1_NAME:"phobos"

  • PROCESS_EXEC_ERR_OUTPUT: Error output message.

Other considerations

If the result is very large, you should consider using the "noReturnDataOutput" (boolean) property to prevent a large amount of data from entering memory and being interpreted by Runnerty, which could cause performance problems.

{
  "id": "http_default",
  "headers": { "User-Agent": "runnerty" },
  "method": "get",
  "url": "http://host.com/big_file.zip",
  "responseToFile": "/etc/runnerty/big_file.zip",
  "noReturnDataOutput": true
}