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
14
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axway/amplify-cli-utils - npm Package Compare versions

Comparing version 2.3.0 to 3.0.0

46

dist/environments.js

@@ -6,3 +6,4 @@ "use strict";

});
exports.default = exports.environments = void 0;
exports.resolve = resolve;
exports.environments = void 0;

@@ -33,11 +34,2 @@ /**

},
staging: {
auth: {
clientId: 'amplify-cli',
realm: 'Broker'
},
registry: {
url: 'https://registry.axwaytest.net'
}
},
prod: {

@@ -54,4 +46,32 @@ auth: {

exports.environments = environments;
var _default = environments;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImVudmlyb25tZW50cy5qcyJdLCJuYW1lcyI6WyJlbnZpcm9ubWVudHMiLCJkZXYiLCJhdXRoIiwiY2xpZW50SWQiLCJyZWFsbSIsInJlZ2lzdHJ5IiwidXJsIiwicHJlcHJvZCIsInN0YWdpbmciLCJwcm9kIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQUE7Ozs7O0FBS08sTUFBTUEsWUFBWSxHQUFHO0FBQzNCQyxFQUFBQSxHQUFHLEVBQUU7QUFDSkMsSUFBQUEsSUFBSSxFQUFFO0FBQ0xDLE1BQUFBLFFBQVEsRUFBRSxpQkFETDtBQUVMQyxNQUFBQSxLQUFLLEVBQUU7QUFGRixLQURGO0FBS0pDLElBQUFBLFFBQVEsRUFBRTtBQUNUQyxNQUFBQSxHQUFHLEVBQUU7QUFESTtBQUxOLEdBRHNCO0FBVTNCQyxFQUFBQSxPQUFPLEVBQUU7QUFDUkwsSUFBQUEsSUFBSSxFQUFFO0FBQ0xDLE1BQUFBLFFBQVEsRUFBRSxhQURMO0FBRUxDLE1BQUFBLEtBQUssRUFBRTtBQUZGLEtBRE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RcdHVybDogJ2h0dHBzOi8vcmVnaXN0cnkuYXh3YXl0ZXN0Lm5ldCdcblx0XHR9XG5cdH0sXG5cdHN0YWdpbmc6IHtcblx0XHRhdXRoOiB7XG5cdFx0XHRjbGllbnRJZDogJ2FtcGxpZnktY2xpJyxcblx0XHRcdHJlYWxtOiAnQnJva2VyJ1xuXHRcdH0sXG5cdFx0cmVnaXN0cnk6IHtcblx0XHRcdHVybDogJ2h0dHBzOi8vcmVnaXN0cnkuYXh3YXl0ZXN0Lm5ldCdcblx0XHR9XG5cdH0sXG5cdHByb2Q6IHtcblx0XHRhdXRoOiB7XG5cdFx0XHRjbGllbnRJZDogJ2FtcGxpZnktY2xpJyxcblx0XHRcdHJlYWxtOiAnQnJva2VyJ1xuXHRcdH0sXG5cdFx0cmVnaXN0cnk6IHtcblx0XHRcdHVybDogJ2h0dHBzOi8vcmVnaXN0cnkucGxhdGZvcm0uYXh3YXkuY29tJ1xuXHRcdH1cblx0fVxufTtcblxuZXhwb3J0IGRlZmF1bHQgZW52aXJvbm1lbnRzO1xuIl0sImZpbGUiOiJlbnZpcm9ubWVudHMuanMifQ==
const mapping = {
development: 'dev',
preproduction: 'preprod',
'pre-production': 'preprod',
production: 'prod',
staging: 'preprod',
test: 'preprod'
};
function resolve(env) {
let environment = 'prod';
if (env) {
if (typeof env !== 'string') {
throw new TypeError('Expected environment to be a string');
}
environment = env.toLowerCase();
environment = mapping[environment] || environment;
if (!environments[environment]) {
throw new Error(`Invalid environment "${env}"`);
}
}
return {
name: environment,
...environments[environment]
};
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImVudmlyb25tZW50cy5qcyJdLCJuYW1lcyI6WyJlbnZpcm9ubWVudHMiLCJkZXYiLCJhdXRoIiwiY2xpZW50SWQiLCJyZWFsbSIsInJlZ2lzdHJ5IiwidXJsIiwicHJlcHJvZCIsInByb2QiLCJtYXBwaW5nIiwiZGV2ZWxvcG1lbn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dGlmICghZW52aXJvbm1lbnRzW2Vudmlyb25tZW50XSkge1xuXHRcdFx0dGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGVudmlyb25tZW50IFwiJHtlbnZ9XCJgKTtcblx0XHR9XG5cdH1cblxuXHRyZXR1cm4ge1xuXHRcdG5hbWU6IGVudmlyb25tZW50LFxuXHRcdC4uLmVudmlyb25tZW50c1tlbnZpcm9ubWVudF1cblx0fTtcbn1cbiJdLCJmaWxlIjoiZW52aXJvbm1lbnRzLmpzIn0=

@@ -6,24 +6,20 @@ "use strict";

});
Object.defineProperty(exports, "environments", {
exports.buildParams = buildParams;
exports.createTable = createTable;
exports.initSDK = initSDK;
exports.loadConfig = loadConfig;
Object.defineProperty(exports, "AmplifySDK", {
enumerable: true,
get: function () {
return _environments.default;
return _amplifySdk.default;
}
});
Object.defineProperty(exports, "loadConfig", {
enumerable: true,
get: function () {
return _amplifyConfig.default;
}
});
exports.locations = exports.auth = void 0;
exports.locations = exports.environments = void 0;
var _environments = _interopRequireDefault(require("./environments"));
var _amplifySdk = _interopRequireDefault(require("@axway/amplify-sdk"));
var _amplifyConfig = _interopRequireDefault(require("@axway/amplify-config"));
var environments = _interopRequireWildcard(require("./environments"));
var auth = _interopRequireWildcard(require("./auth"));
exports.environments = environments;
exports.auth = auth;
var locations = _interopRequireWildcard(require("./locations"));

@@ -35,3 +31,3 @@

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

@@ -44,2 +40,119 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbIkVycm9yIiwicHJlcGFyZVN0YWNrVHJhY2UiLCJyZXF1aXJlIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBS0E7O0FBQ0E7O0FBRUE7Ozs7QUFDQTs7Ozs7Ozs7OztBQVRBO0FBQ0EsSUFBSSxDQUFDQSxLQUFLLENBQUNDLGlCQUFYLEVBQThCO0FBQzdCQyxFQUFBQSxPQUFPLENBQUMsNkJBQUQsQ0FBUDtBQUNBIiwic291cmNlc0NvbnRlbnQiOlsiLyogaXN0YW5idWwgaWdub3JlIGlmICovXG5pZiAoIUVycm9yLnByZXBhcmVTdGFja1RyYWNlKSB7XG5cdHJlcXVpcmUoJ3NvdXJjZS1tYXAtc3VwcG9ydC9yZWdpc3RlcicpO1xufVxuXG5pbXBvcnQgZW52aXJvbm1lbnRzIGZyb20gJy4vZW52aXJvbm1lbnRzJztcbmltcG9ydCBsb2FkQ29uZmlnIGZyb20gJ0BheHdheS9hbXBsaWZ5LWNvbmZpZyc7XG5cbmltcG9ydCAqIGFzIGF1dGggZnJvbSAnLi9hdXRoJztcbmltcG9ydCAqIGFzIGxvY2F0aW9ucyBmcm9tICcuL2xvY2F0aW9ucyc7XG5cbmV4cG9ydCB7XG5cdGF1dGgsXG5cdGVudmlyb25tZW50cyxcblx0bG9hZENvbmZpZyxcblx0bG9jYXRpb25zXG59O1xuIl0sImZpbGUiOiJpbmRleC5qcyJ9
/**
* Constructs a parameters object to pass into an Auth instance.
*
* @param {Object} [opts] - User option overrides.
* @param {Config} [config] - The AMPLIFY config object.
* @returns {Object}
*/
function buildParams(opts = {}, config) {
if (opts && typeof opts !== 'object') {
throw new Error('Expected options to be an object');
}
if (!config) {
config = loadConfig();
}
const env = environments.resolve(opts.env || config.get('env'));
const {
clientId,
realm
} = env.auth;
const params = {};
const props = {
baseUrl: undefined,
clientId,
clientSecret: undefined,
env: env.name,
interactiveLoginTimeout: undefined,
homeDir: locations.axwayHome,
password: undefined,
platformUrl: undefined,
realm,
secretFile: undefined,
serverHost: undefined,
serverPort: undefined,
tokenRefreshThreshold: undefined,
tokenStore: undefined,
tokenStoreDir: locations.axwayHome,
tokenStoreType: undefined,
username: undefined
};
for (const prop of Object.keys(props)) {
params[prop] = opts[prop] || config.get(`auth.${prop}`, props[prop]);
}
return params;
}
/**
* Creates a table with default styles and padding.
*
* @param {...String} head - One or more headings.
* @returns {Table}
*/
function createTable(...head) {
const Table = require('cli-table3');
return new Table({
chars: {
bottom: '',
'bottom-left': '',
'bottom-mid': '',
'bottom-right': '',
left: '',
'left-mid': '',
mid: '',
'mid-mid': '',
middle: ' ',
right: '',
'right-mid': '',
top: '',
'top-left': '',
'top-mid': '',
'top-right': ''
},
head,
style: {
head: ['bold'],
'padding-left': 0,
'padding-right': 0
}
});
}
/**
* Loads the config and creates an AMPLIFY SDK object, then returns both of them.
*
* @param {Object} [opts] - SDK options including `env` and auth options.
* @param {Object} [config] - The AMPLIFY config. If not passed in, the config file is loaded.
* @returns {Object} Returns an object containing the AMPLIFY CLI config and an initialized
* AMPLIFY SDK instance.
*/
function initSDK(opts = {}, config) {
if (!config) {
config = loadConfig();
}
return {
config,
sdk: new _amplifySdk.default(buildParams(opts, config))
};
}
/**
* Loads the AMPLIFY CLI config file using the lazy loaded AMPLIFY Config package.
*
* @param {Object} [opts] - Various options. See `@axway/amplify-config` for more details.
* @returns {Config}
*/
function loadConfig(opts) {
return require('@axway/amplify-config').default(opts);
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbIkVycm9yIiwicHJlcGFyZVN0YWNrVHJhY2UiLCJyZXF1aXJlIiwiYnVpbGRQYXJhbXMiLCJvcHRzIiwiY29uZmlnIiwibG9hZENvbmZpZyIsImVudiIsImVudmlyb25tZW50cyIsInJlc29sdmUiLCJnZXQiLCJjbGllbnRJZCIsInJlYWxtIiwiYXV0aCIsInBhcmFtcyIsInByb3BzIiwiYmFzZVVybCIsInVuZGVmaW5lZCIsImNsaWVudFNlY3JldCIsIm5hbWUiLCJpbnRlcmFjdGl2ZUxvZ2luVGltZW91dCIsImhvbWVEaXIiLCJsb2NhdGlvbnMiLCJheHdheUhvbWUiLCJwYXNzd29yZCIsInBsYXRmb3JtVXJsIiwic2VjcmV0RmlsZSIsInNlcnZlckhvc3QiLCJzZXJ2ZXJQb3J0IiwidG9rZW5SZWZyZXNoVGhyZXNob2xkIiwidG9rZW5TdG9yZSIsInRva2VuU3RvcmVEaXIiLCJ0b2tlblN0b3JlVHlwZSIsInVzZXJuYW1lIiwicHJvcCIsIk9iamVjdCIsImtleXMiLCJjcmVhdGVUYWJsZSIsImhlYWQiLCJUYWJsZSIsImNoYXJzIiwiYm90dG9tIiwibGVmdCIsIm1pZCIsIm1pZGRsZSIsInJpZ2h0IiwidG9wIiwic3R5bGUiLCJpbml0U0RLIiwic2RrIiwiQW1wbGlmeVNESyIsImRlZmF1bHQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBS0E7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52YCBhbmQgYXV0aCBvcHRpb25zLlxuICogQHBhcmFtIHtPYmplY3R9IFtjb25maWddIC0gVGhlIEFNUExJRlkgY29uZmlnLiBJZiBub3QgcGFzc2VkIGluLCB0aGUgY29uZmlnIGZpbGUgaXMgbG9hZGVkLlxuICogQHJldHVybnMge09iamVjdH0gUmV0dXJucyBhbiBvYmplY3QgY29udGFpbmluZyB0aGUgQU1QTElGWSBDTEkgY29uZmlnIGFuZCBhbiBpbml0aWFsaXplZFxuICogQU1QTElGWSBTREsgaW5zdGFuY2UuXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBpbml0U0RLKG9wdHMgPSB7fSwgY29uZmlnKSB7XG5cdGlmICghY29uZmlnKSB7XG5cdFx0Y29uZmlnID0gbG9hZENvbmZpZygpO1xuXHR9XG5cblx0cmV0dXJuIHtcblx0XHRjb25maWcsXG5cdFx0c2RrOiBuZXcgQW1wbGlmeVNESyhidWlsZFBhcmFtcyhvcHRzLCBjb25maWcpKVxuXHR9O1xufVxuXG4vKipcbiAqIExvYWRzIHRoZSBBTVBMSUZZIENMSSBjb25maWcgZmlsZSB1c2luZyB0aGUgbGF6eSBsb2FkZWQgQU1QTElGWSBDb25maWcgcGFja2FnZS5cbiAqXG4gKiBAcGFyYW0ge09iamVjdH0gW29wdHNdIC0gVmFyaW91cyBvcHRpb25zLiBTZWUgYEBheHdheS9hbXBsaWZ5LWNvbmZpZ2AgZm9yIG1vcmUgZGV0YWlscy5cbiAqIEByZXR1cm5zIHtDb25maWd9XG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBsb2FkQ29uZmlnKG9wdHMpIHtcblx0cmV0dXJuIHJlcXVpcmUoJ0BheHdheS9hbXBsaWZ5LWNvbmZpZycpLmRlZmF1bHQob3B0cyk7XG59XG4iXSwiZmlsZSI6ImluZGV4LmpzIn0=

@@ -8,6 +8,6 @@ "use strict";

var _os = _interopRequireDefault(require("os"));
var _path = _interopRequireDefault(require("path"));
var _os = _interopRequireDefault(require("os"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -24,2 +24,2 @@

exports.configFile = configFile;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxvY2F0aW9ucy5qcyJdLCJuYW1lcyI6WyJheHdheUhvbWUiLCJwYXRoIiwiam9pbiIsIm9zIiwiaG9tZWRpciIsImNvbmZpZ0ZpbGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7QUFDQTs7OztBQUVBO0FBQ08sTUFBTUEsU0FBUyxHQUFHQyxjQUFLQyxJQUFMLENBQVVDLFlBQUdDLE9BQUgsRUFBVixFQUF3QixRQUF4QixDQUFsQixDLENBRVA7Ozs7O0FBQ08sTUFBTUMsVUFBVSxHQUFHSixjQUFLQyxJQUFMLENBQVVGLFNBQVYsRUFBcUIsa0JBQXJCLENBQW5CIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHBhdGggZnJvbSAncGF0aCc7XG5pbXBvcnQgb3MgZnJvbSAnb3MnO1xuXG4vLyBEaXJlY3Rvcmllc1xuZXhwb3J0IGNvbnN0IGF4d2F5SG9tZSA9IHBhdGguam9pbihvcy5ob21lZGlyKCksICcuYXh3YXknKTtcblxuLy8gRmlsZXNcbmV4cG9ydCBjb25zdCBjb25maWdGaWxlID0gcGF0aC5qb2luKGF4d2F5SG9tZSwgJ2FtcGxpZnktY2xpLmpzb24nKTtcbiJdLCJmaWxlIjoibG9jYXRpb25zLmpzIn0=
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxvY2F0aW9ucy5qcyJdLCJuYW1lcyI6WyJheHdheUhvbWUiLCJwYXRoIiwiam9pbiIsIm9zIiwiaG9tZWRpciIsImNvbmZpZ0ZpbGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7QUFDQTs7OztBQUVBO0FBQ08sTUFBTUEsU0FBUyxHQUFHQyxjQUFLQyxJQUFMLENBQVVDLFlBQUdDLE9BQUgsRUFBVixFQUF3QixRQUF4QixDQUFsQixDLENBRVA7Ozs7O0FBQ08sTUFBTUMsVUFBVSxHQUFHSixjQUFLQyxJQUFMLENBQVVGLFNBQVYsRUFBcUIsa0JBQXJCLENBQW5CIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IG9zIGZyb20gJ29zJztcbmltcG9ydCBwYXRoIGZyb20gJ3BhdGgnO1xuXG4vLyBEaXJlY3Rvcmllc1xuZXhwb3J0IGNvbnN0IGF4d2F5SG9tZSA9IHBhdGguam9pbihvcy5ob21lZGlyKCksICcuYXh3YXknKTtcblxuLy8gRmlsZXNcbmV4cG9ydCBjb25zdCBjb25maWdGaWxlID0gcGF0aC5qb2luKGF4d2F5SG9tZSwgJ2FtcGxpZnktY2xpLmpzb24nKTtcbiJdLCJmaWxlIjoibG9jYXRpb25zLmpzIn0=
{
"name": "@axway/amplify-cli-utils",
"version": "2.3.0",
"version": "3.0.0",
"description": "Common utils for AMPLIFY CLI packages",

@@ -24,12 +24,12 @@ "author": "Axway, Inc. <npmjs@appcelerator.com>",

"dependencies": {
"@axway/amplify-auth-sdk": "^1.4.0",
"@axway/amplify-config": "^1.3.0",
"appcd-config": "^1.3.1",
"appcd-fs": "^1.1.8",
"fs-extra": "^8.1.0",
"snooplogg": "^2.3.2",
"source-map-support": "^0.5.13"
"@axway/amplify-auth-sdk": "^2.0.0",
"@axway/amplify-config": "^2.0.0",
"appcd-fs": "^1.1.10",
"cli-table3": "^0.6.0",
"fs-extra": "^9.0.0",
"snooplogg": "^3.0.0",
"source-map-support": "^0.5.19"
},
"devDependencies": {
"appcd-gulp": "^2.2.0"
"appcd-gulp": "^3.0.0"
},

@@ -40,6 +40,6 @@ "homepage": "https://github.com/appcelerator/amplify-tooling#readme",

"engines": {
"node": ">=8.0.0"
"node": ">=10.13.0"
},
"main": "./dist/index",
"gitHead": "9ffc1fbd088d5f059f358a68d3483f0244d39f71"
"gitHead": "eefa21264fb5f89697020e22db1087ce0f8116e3"
}

@@ -7,16 +7,67 @@ # AMPLIFY CLI Utils

npm i -g @axway/amplify-cli-utils
npm i @axway/amplify-cli-utils --save
## Authentication Helper
## API
A simple helper that loads the config file and attempts to find the account tokens by auth params
or by id.
### `buildParams(opts, config)`
### Find account by login parameters
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.
```js
import { auth } from '@axway/amplify-cli-utils';
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.
```js
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.
```js
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.
```js
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.
#### Find account by login parameters
```js
import { initSDK } from '@axway/amplify-cli-utils';
(async () => {
const params = {
const { sdk, config } = initSDK({
baseUrl: '',

@@ -30,5 +81,5 @@ clientId: '',

username: ''
};
});
const { account, client, config } = await auth.getAccount(params);
const account = await sdk.auth.find('foo');

@@ -50,32 +101,68 @@ if (account && !account.expired) {

```js
import { auth } from '@axway/amplify-cli-utils';
const accountName = '<client_id>:<email_address>';
const account = await sdk.auth.getAccount(accountName);
```
(async () => {
const id = 'ID GOES HERE';
### Get all credentialed accounts
const { account, client, config } = await auth.getAccount(id);
```js
const accounts = await sdk.auth.list();
console.log(accounts);
```
if (account && !account.expired) {
console.log('Found a valid access token!');
console.log(account);
return;
}
### `loadConfig()`
console.error('No valid authentication token found. Please login in again by running:');
console.error(' amplify auth login');
process.exit(1);
}());
Loads the AMPLIFY CLI config file using the lazy loaded AMPLIFY Config package.
```js
import { loadConfig } from '@axway/amplify-cli-utils';
const config = loadConfig();
console.log(config);
```
### Get all credentialed accounts
## Upgrading from version 1.x
In v2, the entire `auth` API was removed to take advantage of the new AMPLIFY SDK, which now
contains the auth API.
```js
// Find account by login parameters
// v1
import { auth } from '@axway/amplify-cli-utils';
const { account, client, config } = await auth.getAccount({ /* auth options */ });
(async () => {
const accounts = await auth.list();
console.log(accounts);
}());
// v2
import { initSDK } from '@axway/amplify-cli-utils';
const { config, sdk } = initSDK({ /* auth options */ });
const account = await sdk.auth.find();
```
```js
// 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>');
```
```js
// 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();
```
## Legal

@@ -82,0 +169,0 @@

Sorry, the diff of this file is not supported yet

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