Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@axway/amplify-cli-utils

Package Overview
Dependencies
Maintainers
11
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axway/amplify-cli-utils

Common utils for AMPLIFY CLI packages

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
decreased by-24.9%
Maintainers
11
Weekly downloads
 
Created
Source

AMPLIFY CLI Utils

A common utils library for AMPLIFY CLI and related packages.

Installation

npm i -g @axway/amplify-cli-utils

Authentication Helper

A simple helper that loads the config file and attempts to find the account tokens by auth params or by id.

Find account by login parameters

import { auth } from '@axway/amplify-cli-utils';

(async () => {
	const params = {
		baseUrl:      '',
		clientId:     '',
		clientSecret: '',
		env:          '',
		password:     '',
		realm:        '',
		secretFile:   '',
		username:     ''
	};

	const { account, client, config } = await auth.getAccount(params);

	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);
}());

Find account by id

import { auth } from '@axway/amplify-cli-utils';

(async () => {
	const id = 'ID GOES HERE';

	const { account, client, config } = await auth.getAccount(id);

	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);
}());

Get all credentialed accounts

import { auth } from '@axway/amplify-cli-utils';

(async () => {
	const accounts = await auth.list();
	console.log(accounts);
}());

Config Helper

import { loadConfig } from '@axway/amplify-cli-utils';

// load just the amplify-cli.json config file
let config = loadConfig();
console.log(config);

// load a default config file, then merge the amplify-cli-json config on top
config = loadConfig({ configFile: '/path/to/default/config.js' });
console.log(config);

// load a specific config file instead of the default amplify-cli.json file
config = loadConfig({ userConfigFile: '/path/to/default/my-config.js' });
console.log(config);

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.

Keywords

FAQs

Package last updated on 23 Jan 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc