@commercelayer/cli
Advanced tools
Comparing version 3.0.0-alpha.0 to 3.0.0-alpha.1
import { Command, flags } from '@oclif/command'; | ||
import { AppInfo } from '../../config'; | ||
import { IConfig } from '@oclif/config'; | ||
export default class ApplicationsAdd extends Command { | ||
@@ -20,3 +18,1 @@ static description: string; | ||
} | ||
declare const findApplication: (config: IConfig, flags: any) => Promise<AppInfo | undefined>; | ||
export { findApplication }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.findApplication = void 0; | ||
const tslib_1 = require("tslib"); | ||
const command_1 = require("@oclif/command"); | ||
const sdk_1 = require("@commercelayer/sdk"); | ||
const common_1 = require("../../common"); | ||
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk")); | ||
@@ -12,3 +10,2 @@ const config_1 = require("../../config"); | ||
const login_1 = require("./login"); | ||
const inquirer_1 = (0, tslib_1.__importDefault)(require("inquirer")); | ||
class ApplicationsAdd extends command_1.Command { | ||
@@ -20,2 +17,3 @@ async run() { | ||
const scope = (0, login_1.checkScope)(flags.scope); | ||
const alias = (0, login_1.checkAlias)(flags.alias); | ||
const config = { | ||
@@ -38,12 +36,7 @@ clientId: flags.clientId, | ||
} | ||
app.key = (0, common_1.appKey)(app.slug, flags.domain); | ||
app.alias = flags.alias || ''; | ||
app.alias = alias; | ||
(0, config_1.createConfigDir)(this.config); | ||
if ((0, config_1.configFileExists)(this.config, app)) { | ||
this.warn('\nThe application has already been added to the CLI\n'); | ||
return; | ||
} | ||
(0, config_1.writeConfigFile)(this.config, app); | ||
(0, config_1.writeTokenFile)(this.config, app, token === null || token === void 0 ? void 0 : token.data); | ||
this.log(`\n${chalk_1.default.bold.greenBright('Login successful!')} The new abblication has been successfully added to the CLI\n`); | ||
this.log(`\n${chalk_1.default.bold.greenBright('Login successful!')} The new application has been successfully added to the CLI\n`); | ||
} | ||
@@ -111,34 +104,1 @@ catch (error) { | ||
}; | ||
const promptApplication = async (apps) => { | ||
const appMaxLength = (0, common_1.maxLength)(apps, 'name') + 2; | ||
const orgMaxLength = (0, common_1.maxLength)(apps, 'organization'); | ||
const answers = await inquirer_1.default.prompt([{ | ||
type: 'list', | ||
name: 'application', | ||
message: 'Select an application to switch to:`', | ||
choices: apps.map(a => { | ||
return { name: `${a.name.padEnd(appMaxLength, ' ')} [ ${a.organization.padEnd(orgMaxLength, ' ')} | ${a.mode} ]`, value: a }; | ||
}), | ||
loop: false, | ||
pageSize: 10, | ||
}]); | ||
return answers.application; | ||
}; | ||
const findApplication = async (config, flags) => { | ||
const organization = flags.organization; | ||
const mode = flags.mode || (flags.live ? (0, common_1.execMode)(flags.live) : undefined); | ||
const id = flags.id; | ||
const key = (0, common_1.appKey)(organization || '', flags.domain); | ||
let applications = (0, config_1.readConfigDir)(config, { key, id, mode }); | ||
if (flags.kind) | ||
applications = applications.filter(a => a.kind === flags.kind); | ||
if (flags.alias) | ||
applications = applications.filter(a => a.alias === flags.alias); | ||
let app; | ||
if (applications.length === 1) | ||
app = applications[0]; | ||
else | ||
app = await promptApplication(applications); | ||
return app; | ||
}; | ||
exports.findApplication = findApplication; |
@@ -40,2 +40,3 @@ "use strict"; | ||
char: 'j', | ||
description: 'show info in JSON format', | ||
dependsOn: ['info'], | ||
@@ -42,0 +43,0 @@ }), |
@@ -9,2 +9,3 @@ import { Command, flags } from '@oclif/command'; | ||
mode: flags.IOptionFlag<string | undefined>; | ||
appkey: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>; | ||
}; | ||
@@ -11,0 +12,0 @@ static args: never[]; |
@@ -5,4 +5,2 @@ "use strict"; | ||
const command_1 = require("@oclif/command"); | ||
const fs_1 = (0, tslib_1.__importDefault)(require("fs")); | ||
const path_1 = (0, tslib_1.__importDefault)(require("path")); | ||
const config_1 = require("../../config"); | ||
@@ -17,7 +15,3 @@ const cli_ux_1 = (0, tslib_1.__importDefault)(require("cli-ux")); | ||
try { | ||
const configFiles = fs_1.default.readdirSync(this.config.configDir).filter(f => f.endsWith('.config.json') && (f.split('.').length === 5)); | ||
configData = configFiles.map(cf => { | ||
const appConfig = fs_1.default.readFileSync(path_1.default.join(this.config.configDir, cf), { encoding: 'utf-8' }); | ||
return JSON.parse(appConfig); | ||
}); | ||
configData = (0, config_1.readConfigDir)(this.config, flags); | ||
if (flags.kind) | ||
@@ -29,3 +23,3 @@ configData = configData.filter(a => a.kind === flags.kind); | ||
catch (error) { | ||
this.error('No CLI applications config files found', { suggestions: ['Execute first login to at least one CLI application'] }); | ||
this.error('No application config file found', { suggestions: ['Execute first login to at least one Commerce Layer application'] }); | ||
} | ||
@@ -35,18 +29,7 @@ const current = (0, config_1.configParam)(config_1.ConfigParams.currentApplication); | ||
if (configData.length > 0) { | ||
cli_ux_1.default.table(configData, { | ||
current: { header: '[*]', minWidth: 3, get: row => (0, common_1.appKeyMatch)(current, row) ? chalk_1.default.magentaBright(' * ') : ' ' }, | ||
organization: { header: 'ORGANIZATION', get: row => currentColor(row, current)(row.organization) }, | ||
name: { header: 'APPLICATION', get: row => currentColor(row, current)(row.name) }, | ||
kind: { header: 'KIND', get: row => currentColor(row, current)(row.kind) }, | ||
scope: { header: 'SCOPE', minWidth: 10, get: row => currentColor(row, current)(printScope(row.scope)) }, | ||
customer: { header: 'PWD', get: row => (row.email && row.password) ? chalk_1.default.cyanBright((0, common_1.center)('\u25C9', 'PWD'.length)) : '' }, | ||
key: { header: 'SLUG', get: row => currentColor(row, current)(row.key) }, | ||
id: { header: 'ID', get: row => currentColor(row, current)(row.id) }, | ||
mode: { header: 'MODE', get: row => `${((row.mode === 'live') ? chalk_1.default.greenBright : chalk_1.default.yellowBright)(row.mode)}` }, | ||
alias: { header: 'ALIAS', get: row => chalk_1.default.cyanBright(row.alias || '') }, | ||
}, { | ||
cli_ux_1.default.table(configData, Object.assign({ current: { header: '[*]', minWidth: 3, get: row => (0, common_1.appKeyMatch)(current, row) ? chalk_1.default.magentaBright(' * ') : ' ' }, organization: { header: 'ORGANIZATION', get: row => currentColor(row, current)(row.organization) }, slug: { header: 'SLUG', get: row => currentColor(row, current)(row.slug) }, name: { header: 'APPLICATION', get: row => currentColor(row, current)(row.name) }, id: { header: 'ID', get: row => currentColor(row, current)(row.id) }, kind: { header: 'KIND', get: row => currentColor(row, current)(row.kind) }, scope: { header: 'SCOPE', minWidth: 10, get: row => currentColor(row, current)(printScope(row.scope)) }, customer: { header: 'PWD', get: row => (row.email && row.password) ? chalk_1.default.cyanBright((0, common_1.center)('\u25C9', 'PWD'.length)) : '' }, mode: { header: 'MODE', get: row => `${((row.mode === 'live') ? chalk_1.default.greenBright : chalk_1.default.yellowBright)(row.mode)}` }, alias: { header: 'ALIAS', get: row => chalk_1.default.cyanBright(row.alias || '') } }, hiddenColumns(flags)), { | ||
printLine: this.log, | ||
}); | ||
if (current) | ||
this.log(chalk_1.default.italic.magentaBright('\n(*) Current application')); | ||
this.log(chalk_1.default.italic.dim('\n(*) Current application')); | ||
} | ||
@@ -76,4 +59,14 @@ else | ||
}), | ||
appkey: command_1.flags.boolean({ | ||
description: 'show CLI appkey', | ||
hidden: true, | ||
}), | ||
}; | ||
ApplicationsIndex.args = []; | ||
const hiddenColumns = (flags) => { | ||
const hidden = {}; | ||
if (flags.appkey) | ||
hidden.appkey = { header: chalk_1.default.dim('APPKEY'), get: (row) => chalk_1.default.dim(row.key || '') }; | ||
return hidden; | ||
}; | ||
const currentColor = (app, current) => { | ||
@@ -80,0 +73,0 @@ return ((0, common_1.appKeyMatch)(current, app) ? chalk_1.default.magentaBright : chalk_1.default.visible); |
@@ -8,3 +8,5 @@ import { Command, flags } from '@oclif/command'; | ||
domain: flags.IOptionFlag<string | undefined>; | ||
id: flags.IOptionFlag<string>; | ||
mode: flags.IOptionFlag<string | undefined>; | ||
id: flags.IOptionFlag<string | undefined>; | ||
alias: flags.IOptionFlag<string | undefined>; | ||
json: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>; | ||
@@ -11,0 +13,0 @@ }; |
@@ -8,7 +8,7 @@ "use strict"; | ||
const util_1 = require("util"); | ||
const add_1 = require("./add"); | ||
const login_1 = require("./login"); | ||
class ApplicationsInfo extends command_1.Command { | ||
async run() { | ||
const { flags } = this.parse(ApplicationsInfo); | ||
const app = await (0, add_1.findApplication)(this.config, flags); | ||
const app = await (0, login_1.findApplication)(this.config, flags); | ||
if (app === undefined) | ||
@@ -42,10 +42,18 @@ this.error('Unable to find configuration file for application'); | ||
}), | ||
mode: command_1.flags.string({ | ||
char: 'm', | ||
description: 'execution mode', | ||
options: ['test', 'live'], | ||
}), | ||
id: command_1.flags.string({ | ||
description: 'application id', | ||
required: true, | ||
}), | ||
alias: command_1.flags.string({ | ||
char: 'a', | ||
description: 'application alias', | ||
}), | ||
json: command_1.flags.boolean({ | ||
char: 'j', | ||
dependsOn: ['info'], | ||
description: 'show info in JSON format', | ||
}), | ||
}; |
import { Command, flags } from '@oclif/command'; | ||
import { IConfig } from '@oclif/config'; | ||
import { AuthReturnType, AuthScope } from '@commercelayer/js-auth/dist/typings'; | ||
import { AppInfo, AppAuth } from '../../config'; | ||
import { AuthReturnType, AuthScope } from '@commercelayer/js-auth/dist/typings'; | ||
export default class ApplicationsLogin extends Command { | ||
@@ -20,4 +21,7 @@ static description: string; | ||
} | ||
export declare const getAccessToken: (auth: AppAuth) => AuthReturnType; | ||
export declare const getApplicationInfo: (auth: AppAuth, accessToken: string) => Promise<AppInfo>; | ||
export declare const checkScope: (scopes: string[]) => AuthScope; | ||
declare const getAccessToken: (auth: AppAuth) => AuthReturnType; | ||
declare const getApplicationInfo: (auth: AppAuth, accessToken: string) => Promise<AppInfo>; | ||
declare const checkScope: (scopes: string[]) => AuthScope; | ||
declare const findApplication: (config: IConfig, flags: any) => Promise<AppInfo | undefined>; | ||
declare const checkAlias: (alias: string) => string; | ||
export { getAccessToken, getApplicationInfo, checkScope, checkAlias, findApplication }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.checkScope = exports.getApplicationInfo = exports.getAccessToken = void 0; | ||
exports.findApplication = exports.checkAlias = exports.checkScope = exports.getApplicationInfo = exports.getAccessToken = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -14,2 +14,3 @@ const command_1 = require("@oclif/command"); | ||
const current_1 = require("./current"); | ||
const inquirer_1 = (0, tslib_1.__importDefault)(require("inquirer")); | ||
class ApplicationsLogin extends command_1.Command { | ||
@@ -20,3 +21,4 @@ async run() { | ||
this.error(`You must provide one of the arguments ${chalk_1.default.italic('clientSecret')} and ${chalk_1.default.italic('scope')}`); | ||
const scope = (0, exports.checkScope)(flags.scope); | ||
const scope = checkScope(flags.scope); | ||
const alias = checkAlias(flags.alias); | ||
const config = { | ||
@@ -32,4 +34,4 @@ clientId: flags.clientId, | ||
try { | ||
const token = await (0, exports.getAccessToken)(config); | ||
const app = await (0, exports.getApplicationInfo)(config, (token === null || token === void 0 ? void 0 : token.accessToken) || ''); | ||
const token = await getAccessToken(config); | ||
const app = await getApplicationInfo(config, (token === null || token === void 0 ? void 0 : token.accessToken) || ''); | ||
const typeCheck = (0, config_1.configParam)(config_1.ConfigParams.applicationTypeCheck); | ||
@@ -40,12 +42,10 @@ if (typeCheck) { | ||
} | ||
app.key = (0, common_1.appKey)(app.slug, flags.domain); | ||
app.alias = flags.alias || ''; | ||
app.alias = alias; | ||
(0, config_1.createConfigDir)(this.config); | ||
const overwrite = (0, config_1.configFileExists)(this.config, app); | ||
(0, config_1.writeConfigFile)(this.config, app); | ||
(0, config_1.writeTokenFile)(this.config, app, token === null || token === void 0 ? void 0 : token.data); | ||
config_1.default.set(config_1.ConfigParams.currentApplication, { key: app.key, mode: app.mode, id: app.id }); | ||
config_1.default.set(config_1.ConfigParams.currentApplication, app); | ||
const current = (0, config_1.configParam)(config_1.ConfigParams.currentApplication); | ||
this.log(`\nCurrent application: ${(0, current_1.printCurrent)((0, common_1.appKeyMatch)(current, app) ? app : current)}`); | ||
this.log(`\n${chalk_1.default.bold.greenBright('Login successful!')} Your configuration has been stored locally${overwrite ? ' (overwriting the existing one)' : ''}. You can now interact with ${chalk_1.default.italic.bold(app.organization)} organization\n`); | ||
this.log(`\n${chalk_1.default.bold.greenBright('Login successful!')} Your configuration has been stored locally. You can now interact with ${chalk_1.default.italic.bold(app.organization)} organization\n`); | ||
} | ||
@@ -149,3 +149,3 @@ catch (error) { | ||
organization: org.name || '', | ||
key: (0, common_1.appKey)(org.slug || '', auth.domain), | ||
key: (0, common_1.appKey)(), | ||
slug: org.slug || '', | ||
@@ -157,2 +157,3 @@ mode: mode, | ||
id: app.id, | ||
alias: '', | ||
}, auth); | ||
@@ -179,1 +180,47 @@ // if (Array.isArray(appInfo.scope) && (appInfo.scope.length === 0)) appInfo.scope = undefined | ||
exports.checkScope = checkScope; | ||
const promptApplication = async (apps) => { | ||
const appMaxLength = (0, common_1.maxLength)(apps, 'name') + 2; | ||
const orgMaxLength = (0, common_1.maxLength)(apps, 'organization'); | ||
const answers = await inquirer_1.default.prompt([{ | ||
type: 'list', | ||
name: 'application', | ||
message: 'Select an application to switch to:`', | ||
choices: apps.map(a => { | ||
return { name: `${a.name.padEnd(appMaxLength, ' ')} [ ${a.organization.padEnd(orgMaxLength, ' ')} | ${a.mode} ]`, value: a }; | ||
}), | ||
loop: false, | ||
pageSize: 10, | ||
}]); | ||
return answers.application; | ||
}; | ||
const findApplication = async (config, flags) => { | ||
const mode = flags.mode || (flags.live ? (0, common_1.execMode)(flags.live) : undefined); | ||
const applications = (0, config_1.readConfigDir)(config, { key: flags.appkey, mode }).filter(app => { | ||
if (flags.organization && (flags.organization !== app.slug)) | ||
return false; | ||
if (flags.domain && (flags.domain !== app.domain)) | ||
return false; | ||
if (flags.kind && (flags.kind !== app.kind)) | ||
return false; | ||
if (flags.id && (flags.id !== app.id)) | ||
return false; | ||
if (flags.alias && (flags.alias !== app.alias)) | ||
return false; | ||
return true; | ||
}); | ||
let app; | ||
if (applications.length === 1) | ||
app = applications[0]; | ||
else | ||
app = await promptApplication(applications); | ||
return app; | ||
}; | ||
exports.findApplication = findApplication; | ||
const checkAlias = (alias) => { | ||
const match = alias.match(/^[a-z0-9_-]*$/); | ||
if ((match === null) || (match.length > 1)) | ||
throw new Error(`Invalid alias: ${chalk_1.default.redBright(alias)}. Accepted characters are ${chalk_1.default.italic('[a-z0-9_-]')}`); | ||
else | ||
return match[0]; | ||
}; | ||
exports.checkAlias = checkAlias; |
@@ -6,6 +6,7 @@ import { Command, flags } from '@oclif/command'; | ||
static flags: { | ||
organization: flags.IOptionFlag<string>; | ||
organization: flags.IOptionFlag<string | undefined>; | ||
live: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>; | ||
domain: flags.IOptionFlag<string | undefined>; | ||
id: flags.IOptionFlag<string>; | ||
id: flags.IOptionFlag<string | undefined>; | ||
appkey: flags.IOptionFlag<string | undefined>; | ||
revoke: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>; | ||
@@ -12,0 +13,0 @@ }; |
@@ -10,11 +10,8 @@ "use strict"; | ||
const token_1 = require("./token"); | ||
const login_1 = require("./login"); | ||
class ApplicationsLogout extends command_1.Command { | ||
async run() { | ||
const { flags } = this.parse(ApplicationsLogout); | ||
const app = { | ||
key: (0, common_1.appKey)(flags.organization, flags.domain), | ||
mode: (0, common_1.execMode)(flags.live), | ||
id: flags.id, | ||
}; | ||
if ((0, config_1.configFileExists)(this.config, app)) { | ||
const app = await (0, login_1.findApplication)(this.config, flags); | ||
if (app && (0, config_1.configFileExists)(this.config, app)) { | ||
this.log(); | ||
@@ -36,7 +33,7 @@ const ok = await cli_ux_1.default.confirm(`>> Do you really want to remove this application from CLI configuration? ${chalk_1.default.dim('[Yy/Nn]')}`); | ||
(0, config_1.deleteConfigFile)(this.config, app); | ||
this.log(`\n${chalk_1.default.greenBright('Successfully')} removed ${chalk_1.default.bold(app.mode)} application ${chalk_1.default.bold(app.key)}\n`); | ||
this.log(`\n${chalk_1.default.greenBright('Successfully')} removed ${chalk_1.default.bold(app.mode)} application ${chalk_1.default.bold(app.name)}\n`); | ||
} | ||
} | ||
else | ||
this.error(`Unable to find ${chalk_1.default.bold(app.mode)} application ${chalk_1.default.bold(app.key)}`, { | ||
this.error('Unable to find application to logout', { | ||
suggestions: [`Execute command ${chalk_1.default.italic(`${this.config.bin} applications`)} to get a list of all the available active applications`], | ||
@@ -53,7 +50,5 @@ }); | ||
description: 'organization slug', | ||
required: true, | ||
}), | ||
live: command_1.flags.boolean({ | ||
description: 'live execution mode', | ||
dependsOn: ['organization'], | ||
}), | ||
@@ -69,4 +64,7 @@ domain: command_1.flags.string({ | ||
description: 'application id', | ||
required: true, | ||
}), | ||
appkey: command_1.flags.string({ | ||
description: 'application appkey', | ||
hidden: true, | ||
}), | ||
revoke: command_1.flags.boolean({ | ||
@@ -73,0 +71,0 @@ char: 'r', |
@@ -7,3 +7,3 @@ "use strict"; | ||
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk")); | ||
const add_1 = require("./add"); | ||
const login_1 = require("./login"); | ||
const current_1 = require("./current"); | ||
@@ -14,3 +14,3 @@ const common_1 = require("../../common"); | ||
const { flags } = this.parse(ApplicationsSwitch); | ||
const app = await (0, add_1.findApplication)(this.config, flags); | ||
const app = await (0, login_1.findApplication)(this.config, flags); | ||
if (app === undefined) | ||
@@ -17,0 +17,0 @@ this.error(`Unable to find configuration file for application${flags.alias ? ` with alias ${chalk_1.default.bold(flags.alias)}` : ''}`); |
@@ -20,3 +20,3 @@ import { Command, flags } from '@oclif/command'; | ||
run(): Promise<any>; | ||
printAccessToken(accessToken: any): void; | ||
private printAccessToken; | ||
} | ||
@@ -23,0 +23,0 @@ declare const decodeAccessToken: (accessToken: any) => any; |
@@ -12,2 +12,3 @@ "use strict"; | ||
const jsonwebtoken_1 = (0, tslib_1.__importDefault)(require("jsonwebtoken")); | ||
const login_2 = require("./login"); | ||
const defaultTokenExpiration = 60 * 2; | ||
@@ -19,3 +20,2 @@ class ApplicationsToken extends command_1.Command { | ||
let mode = (0, common_1.execMode)(flags.live); | ||
let id = flags.id; | ||
if (!organization) { | ||
@@ -25,11 +25,6 @@ const current = (0, config_1.currentApplication)(); | ||
mode = (current === null || current === void 0 ? void 0 : current.mode) || 'test'; | ||
id = current === null || current === void 0 ? void 0 : current.id; | ||
} | ||
const app = { | ||
key: (0, common_1.appKey)(organization, flags.domain), | ||
mode, | ||
id: id || '', | ||
}; | ||
if (!(0, config_1.configFileExists)(this.config, app)) | ||
this.error(`Unable to find ${chalk_1.default.italic.bold(app.mode)} configuration file for application ${chalk_1.default.italic.bold(app.key)}`, { suggestions: [`execute ${chalk_1.default.italic('applications:login')} command to initialize application and get the first access token`] }); | ||
const app = await (0, login_2.findApplication)(this.config, flags); | ||
if (!app || !(0, config_1.configFileExists)(this.config, app)) | ||
this.error(`Unable to find ${chalk_1.default.italic.bold(mode)} configuration file for application`, { suggestions: [`execute ${chalk_1.default.italic('applications:login')} command to initialize application and get the first access token`] }); | ||
try { | ||
@@ -85,3 +80,2 @@ let expMinutes; | ||
ApplicationsToken.flags = { | ||
// help: flags.help({ char: 'h' }), | ||
organization: command_1.flags.string({ | ||
@@ -91,3 +85,2 @@ char: 'o', | ||
required: false, | ||
// default: currentOrganization(), | ||
}), | ||
@@ -97,3 +90,2 @@ live: command_1.flags.boolean({ | ||
dependsOn: ['organization'], | ||
// default: currentModeLive(), | ||
}), | ||
@@ -100,0 +92,0 @@ domain: command_1.flags.string({ |
@@ -5,8 +5,8 @@ import { AppKey } from './config'; | ||
declare const baseURL: (slug: string, domain: string | undefined) => string; | ||
declare const extractDomain: (baseUrl: string) => string | undefined; | ||
declare const execMode: (liveFlag: string | boolean | undefined) => ApiMode; | ||
declare const appKey: (slug: string, domain: string | undefined) => string; | ||
declare const appKey: () => string; | ||
declare const appKeyValid: (appKey: AppKey) => boolean; | ||
declare const appKeyMatch: (app1: AppKey, app2: AppKey) => boolean; | ||
declare const sleep: (ms: number) => Promise<unknown>; | ||
declare const extractDomain: (baseUrl: string) => string | undefined; | ||
declare const print: (object: any) => string; | ||
@@ -13,0 +13,0 @@ declare const center: (str: string, width: number) => string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.maxLength = exports.center = exports.print = exports.extractDomain = exports.sleep = exports.appKeyMatch = exports.appKeyValid = exports.appKey = exports.execMode = exports.baseURL = void 0; | ||
const tslib_1 = require("tslib"); | ||
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash")); | ||
const util_1 = require("util"); | ||
@@ -11,2 +9,8 @@ const baseURL = (slug, domain) => { | ||
exports.baseURL = baseURL; | ||
const extractDomain = (baseUrl) => { | ||
if (!baseUrl) | ||
return undefined; | ||
return baseUrl.substring(baseUrl.indexOf('.') + 1); | ||
}; | ||
exports.extractDomain = extractDomain; | ||
const execMode = (liveFlag) => { | ||
@@ -16,12 +20,12 @@ return (liveFlag || (liveFlag === 'live')) ? 'live' : 'test'; | ||
exports.execMode = execMode; | ||
const appKey = (slug, domain) => { | ||
return String(domain ? lodash_1.default.kebabCase(`${slug}.${domain}`) : slug).toLowerCase(); | ||
const appKey = () => { | ||
return Date.now().toString(36); | ||
}; | ||
exports.appKey = appKey; | ||
const appKeyValid = (appKey) => { | ||
return (appKey.key !== '') && (appKey.id !== ''); | ||
return (appKey.key !== undefined) && (appKey.key !== ''); | ||
}; | ||
exports.appKeyValid = appKeyValid; | ||
const appKeyMatch = (app1, app2) => { | ||
return app1 && app2 && (app1.key === app2.key) && (app1.mode === app2.mode) && (app1.id === app2.id); | ||
return app1 && app2 && (app1.key === app2.key); | ||
}; | ||
@@ -33,8 +37,2 @@ exports.appKeyMatch = appKeyMatch; | ||
exports.sleep = sleep; | ||
const extractDomain = (baseUrl) => { | ||
if (!baseUrl) | ||
return undefined; | ||
return baseUrl.substring(baseUrl.indexOf('.') + 1); | ||
}; | ||
exports.extractDomain = extractDomain; | ||
const print = (object) => { | ||
@@ -41,0 +39,0 @@ return (0, util_1.inspect)(object, { |
@@ -10,3 +10,3 @@ import Configstore from 'configstore'; | ||
mode: ApiMode; | ||
id: string; | ||
id?: string; | ||
alias?: string; | ||
@@ -31,4 +31,4 @@ } | ||
declare const createConfigDir: (config: Config.IConfig) => void; | ||
declare const configFilePath: (config: Config.IConfig, { key, mode, id }: AppKey) => string; | ||
declare const tokenFilePath: (config: Config.IConfig, { key, mode, id }: AppKey) => string; | ||
declare const configFilePath: (config: Config.IConfig, { key }: AppKey) => string; | ||
declare const tokenFilePath: (config: Config.IConfig, { key }: AppKey) => string; | ||
declare const configFileExists: (config: Config.IConfig, app: AppKey) => boolean; | ||
@@ -45,3 +45,2 @@ declare const tokenFileExists: (config: Config.IConfig, app: AppKey) => boolean; | ||
mode?: string; | ||
id?: string; | ||
}) => AppInfo[]; | ||
@@ -54,4 +53,3 @@ export { createConfigDir }; | ||
declare const currentOrganization: () => string | undefined; | ||
declare const currentModeLive: () => boolean; | ||
export { currentApplication, currentOrganization, currentModeLive }; | ||
export { currentApplication, currentOrganization }; | ||
declare enum ConfigParams { | ||
@@ -58,0 +56,0 @@ currentApplication = "currentApplication", |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.paramDefault = exports.paramExists = exports.paramEditable = exports.configParam = exports.ConfigParamsEditable = exports.ConfigParams = exports.currentModeLive = exports.currentOrganization = exports.currentApplication = exports.readConfigDir = exports.deleteTokenFile = exports.readTokenFile = exports.writeTokenFile = exports.tokenFileExists = exports.tokenFilePath = exports.deleteConfigFile = exports.readConfigFile = exports.writeConfigFile = exports.configFileExists = exports.configFilePath = exports.createConfigDir = void 0; | ||
exports.paramDefault = exports.paramExists = exports.paramEditable = exports.configParam = exports.ConfigParamsEditable = exports.ConfigParams = exports.currentOrganization = exports.currentApplication = exports.readConfigDir = exports.deleteTokenFile = exports.readTokenFile = exports.writeTokenFile = exports.tokenFileExists = exports.tokenFilePath = exports.deleteConfigFile = exports.readConfigFile = exports.writeConfigFile = exports.configFileExists = exports.configFilePath = exports.createConfigDir = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -15,8 +15,8 @@ const configstore_1 = (0, tslib_1.__importDefault)(require("configstore")); | ||
exports.createConfigDir = createConfigDir; | ||
const configFilePath = (config, { key, mode, id }) => { | ||
return path_1.default.join(config.configDir, `${key}.${id}.${mode}.config.json`); | ||
const configFilePath = (config, { key }) => { | ||
return path_1.default.join(config.configDir, `${key}.config.json`); | ||
}; | ||
exports.configFilePath = configFilePath; | ||
const tokenFilePath = (config, { key, mode, id }) => { | ||
return path_1.default.join(config.configDir, `${key}.${id}.${mode}.token.json`); | ||
const tokenFilePath = (config, { key }) => { | ||
return path_1.default.join(config.configDir, `${key}.token.json`); | ||
}; | ||
@@ -71,20 +71,12 @@ exports.tokenFilePath = tokenFilePath; | ||
const fc = f.split('.'); | ||
const key = fc[0]; | ||
const id = fc[1]; | ||
const mode = fc[2]; | ||
const type = fc[3]; | ||
const ext = fc[4]; | ||
if (fc.length < 5) | ||
if (fc.length < 3) | ||
return undefined; | ||
if (filter.key && (key !== filter.key)) | ||
if (fc[fc.length - 2] !== 'config') | ||
return undefined; | ||
if (filter.id && (id !== filter.id)) | ||
if (fc[fc.length - 1] !== 'json') | ||
return undefined; | ||
if (filter.mode && (mode !== filter.mode)) | ||
const key = fc[0]; | ||
if (filter.key && (key !== filter.key)) | ||
return undefined; | ||
if (type !== 'config') | ||
return undefined; | ||
if (ext !== 'json') | ||
return undefined; | ||
return { key, id, mode }; | ||
return { key }; | ||
}).filter(f => f); | ||
@@ -105,7 +97,2 @@ return files.map(f => { | ||
exports.currentOrganization = currentOrganization; | ||
const currentModeLive = () => { | ||
const current = clicfg.get(ConfigParams.currentApplication); | ||
return (current === null || current === void 0 ? void 0 : current.mode) === 'live'; | ||
}; | ||
exports.currentModeLive = currentModeLive; | ||
var ConfigParams; | ||
@@ -112,0 +99,0 @@ (function (ConfigParams) { |
@@ -33,13 +33,12 @@ "use strict"; | ||
const flagConfig = { | ||
organization: command_1.flags.string({ char: 'o', hidden: true }), | ||
live: command_1.flags.boolean({ hidden: true /* , dependsOn: ['organization'] */ }), | ||
domain: command_1.flags.string({ char: 'd', hidden: true, dependsOn: ['organization'] }), | ||
// organization: flagUtil.string({ char: 'o', hidden: true }), | ||
appkey: command_1.flags.string({ hidden: true }), | ||
// live: flagUtil.boolean({ hidden: true/* , dependsOn: ['organization'] */ }), | ||
// domain: flagUtil.string({ char: 'd', hidden: true, dependsOn: ['organization'] }), | ||
accessToken: command_1.flags.string({ hidden: true }), | ||
id: command_1.flags.string({ char: 'k', hidden: true, dependsOn: ['organization'] }), | ||
}; | ||
const { flags } = (0, parser_1.parse)(opts.argv, { strict: false, flags: flagConfig }); | ||
const app = { | ||
key: (0, common_1.appKey)(flags.organization || '', flags.domain), | ||
mode: (0, common_1.execMode)(flags.live), | ||
id: flags.id || '', | ||
key: flags.appkey || '', | ||
mode: 'test', // execMode(flags.live), | ||
}; | ||
@@ -64,3 +63,3 @@ let configData; | ||
else if (!(0, config_1.configFileExists)(this.config, app)) | ||
this.error(`Unable to find ${chalk_1.default.italic.bold(app.mode)} configuration file for application ${chalk_1.default.italic.bold(app.key)}`); | ||
this.error('Unable to find configuration file for application'); | ||
// No current application saved in configuration | ||
@@ -101,6 +100,6 @@ if (!(0, common_1.appKeyValid)(app)) | ||
opts.argv.splice(opts.argv.indexOf('--live'), 1); | ||
// If present remove application id flag option | ||
if (opts.argv.includes('--id')) | ||
opts.argv.splice(opts.argv.indexOf('--id'), 2); | ||
// If present remove application key flag option | ||
if (opts.argv.includes('--appkey')) | ||
opts.argv.splice(opts.argv.indexOf('--appkey'), 2); | ||
}; | ||
exports.default = hook; |
@@ -1,1 +0,1 @@ | ||
{"version":"3.0.0-alpha.0","commands":{"noc":{"id":"noc","pluginName":"@commercelayer/cli","pluginType":"core","hidden":true,"aliases":[],"flags":{"organization":{"name":"organization","type":"option","hidden":true,"required":false},"accessToken":{"name":"accessToken","type":"option","hidden":true,"required":false}},"args":[]},"applications:add":{"id":"applications:add","description":"add a new Commerce Layer application to CLI config","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:add"],"examples":["$ commercelayer applications:add -o <organizationSlug> -i <clientId> -s <clientSecret> -a <applicationAlias>"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"organization slug","required":true},"clientId":{"name":"clientId","type":"option","char":"i","description":"application client_id","required":true},"clientSecret":{"name":"clientSecret","type":"option","char":"s","description":"application client_secret","required":false},"domain":{"name":"domain","type":"option","char":"d","description":"api domain","hidden":true,"required":false},"scope":{"name":"scope","type":"option","char":"S","description":"access token scope (market, stock location)","required":false},"email":{"name":"email","type":"option","char":"e","description":"customer email"},"password":{"name":"password","type":"option","char":"p","description":"customer secret password"},"alias":{"name":"alias","type":"option","char":"a","description":"the alias you want to associate to the application","required":true}},"args":[]},"applications:current":{"id":"applications:current","description":"show the current application","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:current"],"examples":["$ commercelayer applications:current","$ commercelayer app:current --info"],"flags":{"info":{"name":"info","type":"boolean","hidden":true,"allowNo":false},"json":{"name":"json","type":"boolean","char":"j","allowNo":false}},"args":[]},"applications":{"id":"applications","description":"show a list of all (logged in) available CLI applications","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:list","applications:list","app:available","applications:available","apps"],"examples":["$ commercelayer applications","$ cl applications"],"flags":{"kind":{"name":"kind","type":"option","char":"k","description":"application kind","options":["cli","sales_channel","integration"]},"mode":{"name":"mode","type":"option","char":"m","description":"execution mode","options":["test","live"]}},"args":[]},"applications:info":{"id":"applications:info","description":"show application details","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:info"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"organization slug","required":false},"domain":{"name":"domain","type":"option","char":"d","description":"api domain","hidden":true,"required":false},"id":{"name":"id","type":"option","description":"application id","required":true},"json":{"name":"json","type":"boolean","char":"j","allowNo":false}},"args":[]},"applications:login":{"id":"applications:login","description":"execute login to a Commerce Layer application","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:login"],"examples":["$ commercelayer applications:login -o <organizationSlug> -i <clientId> -s <clientSecret> -a <applicationAlias>"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"organization slug","required":true},"clientId":{"name":"clientId","type":"option","char":"i","description":"application client_id","required":true},"clientSecret":{"name":"clientSecret","type":"option","char":"s","description":"application client_secret","required":false},"domain":{"name":"domain","type":"option","char":"d","description":"api domain","hidden":true,"required":false},"scope":{"name":"scope","type":"option","char":"S","description":"access token scope (market, stock location)","required":false},"email":{"name":"email","type":"option","char":"e","description":"customer email"},"password":{"name":"password","type":"option","char":"p","description":"customer secret password"},"alias":{"name":"alias","type":"option","char":"a","description":"the alias you want to associate to the application","required":true}},"args":[]},"applications:logout":{"id":"applications:logout","description":"remove an application from CLI local configuration","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:logout","app:remove","applications:remove"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"organization slug","required":true},"live":{"name":"live","type":"boolean","description":"live execution mode","allowNo":false},"domain":{"name":"domain","type":"option","char":"d","description":"api domain","hidden":true,"required":false},"id":{"name":"id","type":"option","description":"application id","required":true},"revoke":{"name":"revoke","type":"boolean","char":"r","description":"revoke current access token","allowNo":false}},"args":[]},"applications:switch":{"id":"applications:switch","description":"switch applications","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:switch"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"organization slug","required":false},"live":{"name":"live","type":"boolean","description":"live execution mode","allowNo":false},"mode":{"name":"mode","type":"option","char":"m","description":"execution mode","options":["test","live"]},"domain":{"name":"domain","type":"option","char":"d","description":"api domain","hidden":true,"required":false},"id":{"name":"id","type":"option","description":"application id"},"kind":{"name":"kind","type":"option","char":"k","description":"application kind","options":["cli","sales_channel","integration"]},"alias":{"name":"alias","type":"option","char":"a","description":"the alias associated to the application"}},"args":[]},"applications:token":{"id":"applications:token","description":"get a new access token from Commerce Layer API","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:token"],"examples":["$ commercelayer applications:token","$ commercelayer app:token -o <organizationSlug> --live --save"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"organization slug","required":false},"live":{"name":"live","type":"boolean","description":"live execution mode","allowNo":false},"domain":{"name":"domain","type":"option","char":"d","description":"api domain","hidden":true,"required":false},"id":{"name":"id","type":"option","char":"k","description":"application id"},"save":{"name":"save","type":"boolean","char":"s","description":"save access token","allowNo":false},"info":{"name":"info","type":"boolean","char":"i","description":"show token info","allowNo":false},"shared":{"name":"shared","type":"option","char":"S","description":"organization shared secret","hidden":true},"minutes":{"name":"minutes","type":"option","char":"M","description":"minutes to token expiration [2, 120]","hidden":true}},"args":[]},"config:default":{"id":"config:default","description":"reset CLI configuration to default values","pluginName":"@commercelayer/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"F","description":"mandatory flag to avoid unintentional config changes","hidden":true,"required":false,"allowNo":false}},"args":[]},"config:del":{"id":"config:del","description":"delete a CLI configuration parameter","pluginName":"@commercelayer/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"F","description":"mandatory flag to avoid unintentional config changes","hidden":true,"required":false,"allowNo":false}},"args":[{"name":"param","description":"configuration parameter name","required":true}]},"config:get":{"id":"config:get","description":"get a CLI configuration parameter","pluginName":"@commercelayer/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"param","description":"configuration parameter name","required":true}]},"config:set":{"id":"config:set","description":"set a CLI configuration parameter","pluginName":"@commercelayer/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"F","description":"mandatory flag to avoid unintentional config changes","hidden":true,"required":false,"allowNo":false}},"args":[{"name":"param","description":"configuration parameter name","required":true},{"name":"value","description":"value to be saved in configuration file","required":true}]},"config:show":{"id":"config:show","description":"show current CLI configuration","pluginName":"@commercelayer/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"plugins:available":{"id":"plugins:available","description":"show all available Commerce Layer CLI plugins","pluginName":"@commercelayer/cli","pluginType":"core","aliases":[],"examples":["$ commercelayer plugins:available"],"flags":{"hidden":{"name":"hidden","type":"boolean","char":"H","description":"show also enabled but hidden plugins","hidden":true,"allowNo":false}},"args":[]},"util:jwt":{"id":"util:jwt","description":"decode a Commerce Layer JWT","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["jwt"],"flags":{},"args":[{"name":"token","description":"the token to decode","required":true}]}}} | ||
{"version":"3.0.0-alpha.1","commands":{"noc":{"id":"noc","pluginName":"@commercelayer/cli","pluginType":"core","hidden":true,"aliases":[],"flags":{"organization":{"name":"organization","type":"option","hidden":true,"required":false},"accessToken":{"name":"accessToken","type":"option","hidden":true,"required":false}},"args":[]},"applications:add":{"id":"applications:add","description":"add a new Commerce Layer application to CLI config","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:add"],"examples":["$ commercelayer applications:add -o <organizationSlug> -i <clientId> -s <clientSecret> -a <applicationAlias>"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"organization slug","required":true},"clientId":{"name":"clientId","type":"option","char":"i","description":"application client_id","required":true},"clientSecret":{"name":"clientSecret","type":"option","char":"s","description":"application client_secret","required":false},"domain":{"name":"domain","type":"option","char":"d","description":"api domain","hidden":true,"required":false},"scope":{"name":"scope","type":"option","char":"S","description":"access token scope (market, stock location)","required":false},"email":{"name":"email","type":"option","char":"e","description":"customer email"},"password":{"name":"password","type":"option","char":"p","description":"customer secret password"},"alias":{"name":"alias","type":"option","char":"a","description":"the alias you want to associate to the application","required":true}},"args":[]},"applications:current":{"id":"applications:current","description":"show the current application","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:current"],"examples":["$ commercelayer applications:current","$ commercelayer app:current --info"],"flags":{"info":{"name":"info","type":"boolean","hidden":true,"allowNo":false},"json":{"name":"json","type":"boolean","char":"j","description":"show info in JSON format","allowNo":false}},"args":[]},"applications":{"id":"applications","description":"show a list of all (logged in) available CLI applications","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:list","applications:list","app:available","applications:available","apps"],"examples":["$ commercelayer applications","$ cl applications"],"flags":{"kind":{"name":"kind","type":"option","char":"k","description":"application kind","options":["cli","sales_channel","integration"]},"mode":{"name":"mode","type":"option","char":"m","description":"execution mode","options":["test","live"]},"appkey":{"name":"appkey","type":"boolean","description":"show CLI appkey","hidden":true,"allowNo":false}},"args":[]},"applications:info":{"id":"applications:info","description":"show application details","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:info"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"organization slug","required":false},"domain":{"name":"domain","type":"option","char":"d","description":"api domain","hidden":true,"required":false},"mode":{"name":"mode","type":"option","char":"m","description":"execution mode","options":["test","live"]},"id":{"name":"id","type":"option","description":"application id"},"alias":{"name":"alias","type":"option","char":"a","description":"application alias"},"json":{"name":"json","type":"boolean","char":"j","description":"show info in JSON format","allowNo":false}},"args":[]},"applications:login":{"id":"applications:login","description":"execute login to a Commerce Layer application","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:login"],"examples":["$ commercelayer applications:login -o <organizationSlug> -i <clientId> -s <clientSecret> -a <applicationAlias>"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"organization slug","required":true},"clientId":{"name":"clientId","type":"option","char":"i","description":"application client_id","required":true},"clientSecret":{"name":"clientSecret","type":"option","char":"s","description":"application client_secret","required":false},"domain":{"name":"domain","type":"option","char":"d","description":"api domain","hidden":true,"required":false},"scope":{"name":"scope","type":"option","char":"S","description":"access token scope (market, stock location)","required":false},"email":{"name":"email","type":"option","char":"e","description":"customer email"},"password":{"name":"password","type":"option","char":"p","description":"customer secret password"},"alias":{"name":"alias","type":"option","char":"a","description":"the alias you want to associate to the application","required":true}},"args":[]},"applications:logout":{"id":"applications:logout","description":"remove an application from CLI local configuration","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:logout","app:remove","applications:remove"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"organization slug"},"live":{"name":"live","type":"boolean","description":"live execution mode","allowNo":false},"domain":{"name":"domain","type":"option","char":"d","description":"api domain","hidden":true,"required":false},"id":{"name":"id","type":"option","description":"application id"},"appkey":{"name":"appkey","type":"option","description":"application appkey","hidden":true},"revoke":{"name":"revoke","type":"boolean","char":"r","description":"revoke current access token","allowNo":false}},"args":[]},"applications:switch":{"id":"applications:switch","description":"switch applications","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:switch"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"organization slug","required":false},"live":{"name":"live","type":"boolean","description":"live execution mode","allowNo":false},"mode":{"name":"mode","type":"option","char":"m","description":"execution mode","options":["test","live"]},"domain":{"name":"domain","type":"option","char":"d","description":"api domain","hidden":true,"required":false},"id":{"name":"id","type":"option","description":"application id"},"kind":{"name":"kind","type":"option","char":"k","description":"application kind","options":["cli","sales_channel","integration"]},"alias":{"name":"alias","type":"option","char":"a","description":"the alias associated to the application"}},"args":[]},"applications:token":{"id":"applications:token","description":"get a new access token from Commerce Layer API","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["app:token"],"examples":["$ commercelayer applications:token","$ commercelayer app:token -o <organizationSlug> --live --save"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"organization slug","required":false},"live":{"name":"live","type":"boolean","description":"live execution mode","allowNo":false},"domain":{"name":"domain","type":"option","char":"d","description":"api domain","hidden":true,"required":false},"id":{"name":"id","type":"option","char":"k","description":"application id"},"save":{"name":"save","type":"boolean","char":"s","description":"save access token","allowNo":false},"info":{"name":"info","type":"boolean","char":"i","description":"show token info","allowNo":false},"shared":{"name":"shared","type":"option","char":"S","description":"organization shared secret","hidden":true},"minutes":{"name":"minutes","type":"option","char":"M","description":"minutes to token expiration [2, 120]","hidden":true}},"args":[]},"config:default":{"id":"config:default","description":"reset CLI configuration to default values","pluginName":"@commercelayer/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"F","description":"mandatory flag to avoid unintentional config changes","hidden":true,"required":false,"allowNo":false}},"args":[]},"config:del":{"id":"config:del","description":"delete a CLI configuration parameter","pluginName":"@commercelayer/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"F","description":"mandatory flag to avoid unintentional config changes","hidden":true,"required":false,"allowNo":false}},"args":[{"name":"param","description":"configuration parameter name","required":true}]},"config:get":{"id":"config:get","description":"get a CLI configuration parameter","pluginName":"@commercelayer/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"param","description":"configuration parameter name","required":true}]},"config:set":{"id":"config:set","description":"set a CLI configuration parameter","pluginName":"@commercelayer/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"F","description":"mandatory flag to avoid unintentional config changes","hidden":true,"required":false,"allowNo":false}},"args":[{"name":"param","description":"configuration parameter name","required":true},{"name":"value","description":"value to be saved in configuration file","required":true}]},"config:show":{"id":"config:show","description":"show current CLI configuration","pluginName":"@commercelayer/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"plugins:available":{"id":"plugins:available","description":"show all available Commerce Layer CLI plugins","pluginName":"@commercelayer/cli","pluginType":"core","aliases":[],"examples":["$ commercelayer plugins:available"],"flags":{"hidden":{"name":"hidden","type":"boolean","char":"H","description":"show also enabled but hidden plugins","hidden":true,"allowNo":false}},"args":[]},"util:jwt":{"id":"util:jwt","description":"decode a Commerce Layer JWT","pluginName":"@commercelayer/cli","pluginType":"core","aliases":["jwt"],"flags":{},"args":[{"name":"token","description":"the token to decode","required":true}]}}} |
{ | ||
"name": "@commercelayer/cli", | ||
"description": "Commerce Layer CLI", | ||
"version": "3.0.0-alpha.0", | ||
"version": "3.0.0-alpha.1", | ||
"author": "Pierluigi Viti <pierluigi@commercelayer.io>", | ||
@@ -6,0 +6,0 @@ "bin": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4
99471
1918