Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@axway/amplify-cli-utils
Advanced tools
A common utils library for AMPLIFY CLI and related packages.
npm i @axway/amplify-cli-utils --save
buildParams(opts, config)
Creates an AMPLIFY SDK or AMPLIFY Auth SDK constructor options object based on the supplied opts
and AMPLIFY CLI config
object. If config
is not defined, the config is loaded from disk.
import { buildParams } from '@axway/amplify-cli-utils';
const opts = buildParams({
baseUrl: 'foo',
clientId: 'bar'
});
createTable(heading1, heading2, heading3, ...)
Creates a cli-table3
instance with common table padding and styling.
import { createTable } from '@axway/amplify-cli-utils';
const table = createTable('Name', 'Version');
table.push([ 'foo', '1.0.0' ]);
table.push([ 'bar', '2.0.0' ]);
console.log(table.toString());
environments.resolve(env)
Returns environment specific settings.
import { environments } from '@axway/amplify-cli-utils';
console.log(environments.resolve());
console.log(environments.resolve('prod'));
console.log(environments.resolve('production'));
locations
An object containing the axwayHome
and configFile
paths.
import { locations } from '@axway/amplify-cli-utils';
console.log('Axway Home Directory:', locations.axwayHome);
console.log('AMPLIFY CLI Config Path:', locations.configFile);
initSDK(opts, config)
Loads the AMPLIFY CLI config and initializes an AMPLIFY SDK instance.
import { initSDK } from '@axway/amplify-cli-utils';
(async () => {
const { sdk, config } = initSDK({
baseUrl: '',
clientId: '',
clientSecret: '',
env: '',
password: '',
realm: '',
secretFile: '',
username: ''
});
const account = await sdk.auth.find('foo');
if (account && !account.expired) {
console.log('Found a valid access token!');
console.log(account);
return;
}
console.error('No valid authentication token found. Please login in again by running:');
console.error(' amplify auth login');
process.exit(1);
}());
const accountName = '<client_id>:<email_address>';
const account = await sdk.auth.getAccount(accountName);
const accounts = await sdk.auth.list();
console.log(accounts);
loadConfig()
Loads the AMPLIFY CLI config file using the lazy loaded AMPLIFY Config package.
import { loadConfig } from '@axway/amplify-cli-utils';
const config = loadConfig();
console.log(config);
In v2, the entire auth
API was removed to take advantage of the new AMPLIFY SDK, which now
contains the auth API.
// Find account by login parameters
// v1
import { auth } from '@axway/amplify-cli-utils';
const { account, client, config } = await auth.getAccount({ /* auth options */ });
// v2
import { initSDK } from '@axway/amplify-cli-utils';
const { config, sdk } = initSDK({ /* auth options */ });
const account = await sdk.auth.find();
// Find account by id
// v1
import { auth } from '@axway/amplify-cli-utils';
const { account, client, config } = await auth.getAccount('<CLIENT_ID>:<EMAIL>');
// v2
import { initSDK } from '@axway/amplify-cli-utils';
const { config, sdk } = initSDK({ /* auth options */ });
const account = await sdk.auth.find('<CLIENT_ID>:<EMAIL>');
// Get all credentialed accounts
// v1
import { auth } from '@axway/amplify-cli-utils';
const accounts = await auth.list();
// v2
import { initSDK } from '@axway/amplify-cli-utils';
const { config, sdk } = initSDK({ /* auth options */ });
const accounts = await sdk.auth.list();
This project is open source under the Apache Public License v2 and is developed by
Axway, Inc and the community. Please read the LICENSE
file included
in this distribution for more information.
FAQs
Common utils for Axway CLI packages
The npm package @axway/amplify-cli-utils receives a total of 2,663 weekly downloads. As such, @axway/amplify-cli-utils popularity was classified as popular.
We found that @axway/amplify-cli-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.