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

leumas-axios

v1.0.2

Published

An advanced Axios wrapper with extended features and Express multi-post middleware for conversational API endpoints.

Readme

Leumas Axios

Leumas Axios is an advanced wrapper around Axios that extends the full capabilities of Axios with additional features designed for building conversational, multi-step API interactions. This package includes advanced methods, interactive helpers, and Express middleware to simplify the creation of multi-step POST endpoints.


Features

  • Full Axios API
    Use all standard HTTP methods (get, post, put, delete, etc.) exactly as you would with Axios.

  • Advanced Methods

    • multiGet: Fetch data concurrently from multiple endpoints.
    • multiPost: Perform multi-step POST requests with a built-in feedback loop to gather missing information.
    • generativePost: Automatically complete your payload using a provided schema generator.
  • Interactive Helpers

    • askQuestion: Prompt the user via the terminal for input.
    • promptForMissingFields: Automatically prompt for and collect values for any missing fields during a multi-step request.
  • Express Middleware

    • multiPostMiddleware: Easily integrate multi-step POST functionality into your Express server, managing sessions and data aggregation.

Installation

Install Leumas Axios via npm:

npm i leumas-axios

Usage

Importing Leumas Axios

const AdvancedAxios = require('leumas-axios');

Creating an AdvancedAxios Instance

const AdvancedAxios = require('leumas-axios');
// and then you can ...
const advancedAxios = new AdvancedAxios({ timeout: 5000 });

Using Standard Axios Methods


const results = await axiosInstance.get('https://api.github.com/users/octocat')
  .then(response => console.log(response.data))
  .catch(error => console.error(error));


Using multiGet

// test/multi-get-test.js
const AdvancedAxios = require('leumas-axios');
// const AdvancedAxios = require('../index');

const advancedAxios = new AdvancedAxios({ timeout: 5000 });

async function testMultiGet() {
  try {
    const urls = [
      'https://api.github.com/users/octocat',
      'https://api.github.com/users/defunkt',
    ];
    const responses = await advancedAxios.multiGet(urls);
    console.log('multiGet responses:');
    console.log(responses);
  } catch (error) {
    console.error('Error in multiGet test:', error);
  }
}

testMultiGet();

Using multiPost

  • Leumas Axios supports multi-step POST requests with an interactive feedback loop.
// tests/multi-post-test.js
const  AdvancedAxios  = require('leumas-axios');
const advancedAxios = new AdvancedAxios({ timeout: 5000 });
const multiPostUrl = 'http://localhost:7643/api/multi-post';

async function testMultiPost() {
  try {
    // Start with initial data that is intentionally incomplete.
    const initialData = {  }; // Missing "email"

    const result = await advancedAxios.multiPost(
      multiPostUrl,
      { data: initialData },
      {
        // onFeedback is called when the server indicates more data is required.
        onFeedback: async (missingFields) => {
          console.log('\nServer requires additional information:', missingFields);
          // Use the built-in helper to prompt the user for each missing field.
          const additionalData = await AdvancedAxios.promptForMissingFields(missingFields);
          console.log('Received additional data:', additionalData);
          return additionalData;
        },
      }
    );

    console.log('\nMulti-post process complete. Final result:');
    console.log(result);
  } catch (error) {
    console.error('Error during multiPost test:', error);
  }
}

testMultiPost();

Server.js

const express = require('express');
const bodyParser = require('body-parser');
const AdvancedAxios = require('leumas-axios');

const app = express();
app.use(bodyParser.json());

// Multi-post route requiring "name" and "email"
app.post(
  '/api/multi-post',
  AdvancedAxios.multiPostMiddleware(['name', 'email']),
  (req, res) => {
    res.json({
      sessionId: req.sessionId,
      status: 'completed',
      data: req.multiPostData,
    });
  }
);

// Another multi-post route requiring "username" and "password"
app.post(
  '/api/another-multi-post',
  AdvancedAxios.multiPostMiddleware(['username', 'password']),
  (req, res) => {
    res.json({
      sessionId: req.sessionId,
      status: 'completed',
      data: req.multiPostData,
    });
  }
);

const PORT = process.env.PORT || 7643;
app.listen(PORT, () => {
  console.log(`Server running on port ${PORT}`);
});

Using generativePost

-Automatically complete your payload with a schema generator function.

// test/generative-post-test.js
const AdvancedAxios = require('leumas-axios');

const advancedAxios = new AdvancedAxios({ timeout: 5000 });
const generativePostUrl = 'http://localhost:3000/api/generative-post';

async function testGenerativePost() {
  try {
    const initialData = { name: 'Alice' }; // Intentionally missing "email"
    const result = await advancedAxios.generativePost(
      generativePostUrl,
      { data: initialData },
      {
        // schemaGenerator simulates AI-based schema completion.
        schemaGenerator: async (currentData) => {
          console.log('Schema generator received data:', currentData);
          // For demonstration, we add a missing email.
          return { ...currentData, email: '[email protected]' };
        },
      }
    );
    console.log('generativePost result:');
    console.log(result);
  } catch (error) {
    console.error('Error in generativePost test:', error);
  }
}

testGenerativePost();

Express Middleware for Multi-Post

-Leumas Axios includes Express middleware for creating multi-step POST endpoints. This middleware manages sessions, aggregates data, and validates required fields.

Example Express Sevrer

const express = require('express');
const bodyParser = require('body-parser');
const AdvancedAxios = require('leumas-axios');

const app = express();
app.use(bodyParser.json());

// Multi-post route requiring "name" and "email"
app.post(
  '/api/multi-post',
  AdvancedAxios.multiPostMiddleware(['name', 'email']),
  (req, res) => {
    res.json({
      sessionId: req.sessionId,
      status: 'completed',
      data: req.multiPostData,
    });
  }
);

// Another multi-post route requiring "username" and "password"
app.post(
  '/api/another-multi-post',
  AdvancedAxios.multiPostMiddleware(['username', 'password']),
  (req, res) => {
    res.json({
      sessionId: req.sessionId,
      status: 'completed',
      data: req.multiPostData,
    });
  }
);

const PORT = process.env.PORT || 7643;
app.listen(PORT, () => {
  console.log(`Server running on port ${PORT}`);
});

Interactive Helpers

  • Leumas Axios provides built-in interactive helper methods:

askQuestion(query): Prompts the user with a question and returns their input. promptForMissingFields(missingFields): Iterates over an array of missing fields and prompts the user to supply values.

Example Usage of Interactive Helpers

(async () => {
  // Ask a single question
  const answer = await AdvancedAxios.askQuestion('What is your email? ');
  console.log('You entered:', answer);

  // Prompt for multiple missing fields
  const missingFields = ['email', 'phone'];
  const responses = await AdvancedAxios.promptForMissingFields(missingFields);
  console.log('Collected responses:', responses);
})();

Contributing

  • Contributions are welcome! Please open an issue or submit a pull request on our GitHub repository.

License

  • This project is licensed under the ISC License.

Author

  • William Bermudez
  • https://leumas.tech
  • https://github.com/leumas-tech