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 🙏

© 2025 – Pkg Stats / Ryan Hefner

anypoint-utils

v1.0.23

Published

Javascript for Anypoint API Management

Readme

anypoint-utils

npm downloads Build Status

This npm package provides utility methods that can be used within your CI/CD environment and MuleSoft API release management strategy. MuleSoft provides REST API resources for managing your Mule products and hostings on Cloudhub or On-Premise.

Installation

$ npm install anypoint-utils --save

Example Code (with use of corp proxy)

// tmp.js

const AnypointUtils = require('./main');
require('console-stamp')(console, { pattern: 'dd/mm/yyyy HH:MM:ss.l' });

const s = new AnypointUtils('user', 'password', 'http://corp.proxy.int:8080');

async function main() {
  const authtoken = await s.getToken();
  console.info(`token: ${authtoken}`);

  const orgId = await AnypointUtils.getOrganizationId(authtoken);
  console.info(`orgId: ${orgId}`);

  const stuff = await AnypointUtils.createApiManagerInstance(authtoken, 'emp-xapi', '1.0.0', orgId, 'Sandbox2');
  console.info(`This id is used for API auto-discovery. Id:${stuff}`);
}

main();

Note: if proxy not used, send 'null'

Functions

These are the current functions that have been coded so far. A listing is given here with comments for your reference.

getOrganizationId(token)

This function takes an active bearer token and returns an organization id in the same form/syntax of the token.

getDefaultEnvironmentId(token)

This function returns the environment id that is set as default by the user that supplied the credentials for the bearer token (authenticated).

getEnvironments(token)

This function returns a JSON array of environments that are associated to the authenticated user.

getApplications(token)

This function returns a JSON array of client applications that are associated to the authenticated user.

getApis(token)

This function returns a JSON array of APIs (needs closer review).

getEnvApis(token)

This function returns a JSON array of "instanced" APIs that are associated to the authenticated user.

getExchangeGroups(token)

This function returns the organization id and business group ids from Exchange that are associated to the authenticated user.

getExchangeAssetById(token, groupId, assetId)

This function returns an Exchange asset by giving the group id and the asset id (name).

getExchangeAssets(token)

This function returns all Exchange assets visible to the authenticated user. This function is not very useful. Needs a filter.

createClientApplication(token, clientName)

This function creates a new client application. This client application is a representational object of either an API or an external API consumer. The client application will be requesting access to registered (running) APIs. These API's should already be in Exchange as managed assets.

deleteApplication(token, appId)

This function will delete a client application (remember it's a representational object only) using a bearer token (authorization) and the client application's application id or primary key.

getApplicationIdByName(token, applicationName)

This function gets the application id for client application name given, along with the bearer token (authorization) of course.

getApiIdByName(token, apiName)

This function gets the API id for the API name or artifact id given.

getApi(token, apiId)

This function returns a JSON object representing the API for the API id given.

getVersionId(token, apiId, productVersion)

This function returns a version id for the API id and productVersion (e.g. v1) given.

createApiManagerInstance(token, assetId, version, groupId)

This function creates an unregistered API instance in API Manager. The function returns an API id for use with runtime API auto-discovery.

createContractWithAsset(token, clientAppName, primeArtifactName)

This function creates a contract between a client application and a registered API to be consumed. Refactoring is needed because this calls another function that really does the work.

isClientApplicationByName(token, clientApplicationName)

This function returns true if the named client application exists that's related to the authenticated user sending the bearer token (authorization) also.

promoteApiCreatingNewInstance(token, organizationId, environmentId, originalApiId)

This function essentially promotes an existing (registered) API into a new environment, specified by the environment id, and using the original API id. A new API id for runtime auto-discovery is returned by the function.

getEnvironmentIdByName(token, environmentName)

This function returns the id for the environment name given.

Notes

As of version 1.0.18 there are still many additions needed to this, however they will be added as work requires them. The createContractWithAssetfunction requires refactoring. Updates will be noted with future releases of this package.