Comparing version 1.0.0-beta1 to 1.0.0-beta2
@@ -1,1 +0,1 @@ | ||
{"version":"1.0.0-beta1","commands":{"demo-store":{"id":"demo-store","description":"Create a demo store using Chec.io and Commerce.js\nThis command will download an example project from GitHub and initialise it on your machine. You will be free to edit the downloaded code and play around with Commerce.js in client code\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"flags":{"env":{"name":"env","type":"option","description":"Extra env variables to set for a .env file in the installed project"},"no-login":{"name":"no-login","type":"boolean","description":"Optionally skip the login requirement. This is likely to be incompatible with example stores that are available for download","allowNo":false},"domain":{"name":"domain","type":"option","description":"The base URL for the Chec API","hidden":true,"default":"chec.io"}},"args":[{"name":"store","description":"The store that you want your example based off of"},{"name":"targetDirectory","description":"The destination directory name to download the example to. The defaults to the store name","default":null}]},"log":{"id":"log","description":"Get full detail about a given log ID\nCommunicates with Chec.io to get full log information for the given log ID\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"flags":{"raw":{"name":"raw","type":"boolean","description":"Display a \"raw\" unformatted JSON blob of the log details","allowNo":false},"utc":{"name":"utc","type":"boolean","description":"Display timestamps in UTC timezone instead of the local timezone","allowNo":false},"domain":{"name":"domain","type":"option","description":"The base URL for the Chec API","hidden":true,"default":"chec.io"}},"args":[{"name":"logId","description":"The log ID for the log entry you want to retrieve","required":true}]},"login":{"id":"login","description":"Log into your Chec.io account\nLog into your Chec.io account to enable commands that require API access.\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"flags":{"email":{"name":"email","type":"option","char":"e","description":"Your accounts email address"},"password":{"name":"password","type":"option","char":"p","description":"The password to login with"},"skip-check":{"name":"skip-check","type":"boolean","description":"Indicate that this command should skip checking if a user is already logged in","allowNo":false},"domain":{"name":"domain","type":"option","description":"The base URL for the Chec API","hidden":true,"default":"chec.io"}},"args":[]},"logout":{"id":"logout","description":"Log out of your account\nLog out of your account and remove the local copy of your API keys.\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"logs":{"id":"logs","description":"Show a summary of your API requests processed by Chec.io\nListens for logs from Chec.io and displays a summary of them to you as they are processed by Chec.\nYou may optionally retrieve prior logs and navigate through shown logs to fetch further details about the log entry from Chec.io.\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"flags":{"tail":{"name":"tail","type":"option","char":"n","description":"Show the last n number of logs before listening for new logs","default":0},"follow":{"name":"follow","type":"boolean","char":"f","description":"\"Follow\" logs from Chec.io. New events that happen are shown live","allowNo":true},"history":{"name":"history","type":"option","char":"h","description":"Keep record of the given number of logs when browsing back.","default":100},"utc":{"name":"utc","type":"boolean","description":"Display timestamps in UTC timezone","allowNo":false},"domain":{"name":"domain","type":"option","description":"The base URL for the Chec API","hidden":true,"default":"chec.io"}},"args":[]},"register":{"id":"register","description":"Register an account with Chec.io\nSign up for a Chec account through your browser\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"flags":{"domain":{"name":"domain","type":"option","description":"The base URL for the Chec API","hidden":true,"default":"chec.io"}},"args":[]},"request":{"id":"request","description":"Run abstract API request\nRuns an arbitrary API request given the HTTP method, endpoint, and input payload.\n\nData should be provided as a JSON object. You may also use `--sandbox` to use\nsandbox API keys.\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"examples":["$ chec request GET /v1/products","$ chec request GET /v1/orders","$ chec request GET /v1/products '{\"limit\":1}'","$ chec request GET /v1/products '{\"limit\":1}' --sandbox","$ chec request POST /v1/assets --file=my-asset-payload.json"],"flags":{"domain":{"name":"domain","type":"option","description":"The base URL for the Chec API","hidden":true,"default":"chec.io"},"sandbox":{"name":"sandbox","type":"boolean","description":"Use sandbox API keys","allowNo":false},"file":{"name":"file","type":"option","description":"Optional: path to JSON encoded file containing request payload","default":null}},"args":[{"name":"method","description":"HTTP method","required":true,"options":["GET","POST","PUT","PATCH","DELETE"]},{"name":"resource","description":"API resource (e.g. /v1/products)","required":true},{"name":"payload","description":"Request payload (JSON encoded)","required":false}]},"whoami":{"id":"whoami","description":"Get information on your user account\nFetches information on your user account, and merchants associated with your account.\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"examples":["$ chec whoami"],"flags":{"domain":{"name":"domain","type":"option","description":"The base URL for the Chec API","hidden":true,"default":"chec.io"}},"args":[]}}} | ||
{"version":"1.0.0-beta2","commands":{"demo-store":{"id":"demo-store","description":"Create a demo store using Chec.io and Commerce.js\nThis command will download an example project from GitHub and initialise it on your machine. You will be free to edit the downloaded code and play around with Commerce.js in client code\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"flags":{"env":{"name":"env","type":"option","description":"Extra env variables to set for a .env file in the installed project"},"no-login":{"name":"no-login","type":"boolean","description":"Optionally skip the login requirement. This is likely to be incompatible with example stores that are available for download","allowNo":false},"domain":{"name":"domain","type":"option","description":"The base URL for the Chec API","hidden":true,"default":"chec.io"}},"args":[{"name":"store","description":"The store that you want your example based off of"},{"name":"targetDirectory","description":"The destination directory name to download the example to. The defaults to the store name","default":null}]},"log":{"id":"log","description":"Get full detail about a given log ID\nCommunicates with Chec.io to get full log information for the given log ID\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"flags":{"raw":{"name":"raw","type":"boolean","description":"Display a \"raw\" unformatted JSON blob of the log details","allowNo":false},"utc":{"name":"utc","type":"boolean","description":"Display timestamps in UTC timezone instead of the local timezone","allowNo":false},"domain":{"name":"domain","type":"option","description":"The base URL for the Chec API","hidden":true,"default":"chec.io"}},"args":[{"name":"logId","description":"The log ID for the log entry you want to retrieve","required":true}]},"login":{"id":"login","description":"Log into your Chec.io account\nLog into your Chec.io account to enable commands that require API access.\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"flags":{"email":{"name":"email","type":"option","char":"e","description":"Your accounts email address"},"password":{"name":"password","type":"option","char":"p","description":"The password to login with"},"skip-check":{"name":"skip-check","type":"boolean","description":"Indicate that this command should skip checking if a user is already logged in","allowNo":false},"domain":{"name":"domain","type":"option","description":"The base URL for the Chec API","hidden":true,"default":"chec.io"}},"args":[]},"logout":{"id":"logout","description":"Log out of your account\nLog out of your account and remove the local copy of your API keys.\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"logs":{"id":"logs","description":"Show a summary of your API requests processed by Chec.io\nListens for logs from Chec.io and displays a summary of them to you as they are processed by Chec.\nYou may optionally retrieve prior logs and navigate through shown logs to fetch further details about the log entry from Chec.io.\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"flags":{"tail":{"name":"tail","type":"option","char":"n","description":"Show the last n number of logs before listening for new logs","default":0},"follow":{"name":"follow","type":"boolean","char":"f","description":"\"Follow\" logs from Chec.io. New events that happen are shown live","allowNo":true},"history":{"name":"history","type":"option","char":"h","description":"Keep record of the given number of logs when browsing back.","default":100},"utc":{"name":"utc","type":"boolean","description":"Display timestamps in UTC timezone","allowNo":false},"domain":{"name":"domain","type":"option","description":"The base URL for the Chec API","hidden":true,"default":"chec.io"}},"args":[]},"register":{"id":"register","description":"Register an account with Chec.io\nSign up for a Chec account through your browser\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"flags":{"domain":{"name":"domain","type":"option","description":"The base URL for the Chec API","hidden":true,"default":"chec.io"}},"args":[]},"request":{"id":"request","description":"Run abstract API request\nRuns an arbitrary API request given the HTTP method, endpoint, and input payload.\n\nData should be provided as a JSON object. You may also use `--sandbox` to use\nsandbox API keys.\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"examples":["$ chec request GET /v1/products","$ chec request GET /v1/orders","$ chec request GET /v1/products '{\"limit\":1}'","$ chec request GET /v1/products '{\"limit\":1}' --sandbox","$ chec request POST /v1/assets --file=my-asset-payload.json"],"flags":{"domain":{"name":"domain","type":"option","description":"The base URL for the Chec API","hidden":true,"default":"chec.io"},"sandbox":{"name":"sandbox","type":"boolean","description":"Use sandbox API keys","allowNo":false},"file":{"name":"file","type":"option","description":"Optional: path to JSON encoded file containing request payload","default":null}},"args":[{"name":"method","description":"HTTP method","required":true,"options":["GET","POST","PUT","PATCH","DELETE"]},{"name":"resource","description":"API resource (e.g. /v1/products)","required":true},{"name":"payload","description":"Request payload (JSON encoded)","required":false}]},"whoami":{"id":"whoami","description":"Get information on your user account\nFetches information on your user account, and merchants associated with your account.\n","pluginName":"@chec/cli","pluginType":"core","aliases":[],"examples":["$ chec whoami"],"flags":{"domain":{"name":"domain","type":"option","description":"The base URL for the Chec API","hidden":true,"default":"chec.io"}},"args":[]}}} |
{ | ||
"name": "@chec/cli", | ||
"description": "A command line interface for using the Chec API", | ||
"version": "1.0.0-beta1", | ||
"version": "1.0.0-beta2", | ||
"author": "Chec Platform", | ||
@@ -6,0 +6,0 @@ "bin": { |
@@ -1,10 +0,9 @@ | ||
chec-cli | ||
Chec CLI | ||
======== | ||
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io) | ||
[![CircleCI](https://circleci.com/gh/chec/cli/tree/master.svg?style=shield)](https://circleci.com/gh/chec/cli/tree/master) | ||
[![Codecov](https://codecov.io/gh/chec/cli/branch/master/graph/badge.svg)](https://codecov.io/gh/chec/chec-cli) | ||
[![License](https://img.shields.io/github/license/chec/cli.svg)](https://github.com/chec/chec-cli/blob/master/LICENSE.md) | ||
<!-- [![Version](https://img.shields.io/npm/v/chec-cli.svg)](https://npmjs.org/package/chec-cli) --> | ||
<!-- [![Downloads/week](https://img.shields.io/npm/dw/chec-cli.svg)](https://npmjs.org/package/chec-cli) --> | ||
[![Codecov](https://codecov.io/gh/chec/cli/branch/master/graph/badge.svg)](https://codecov.io/gh/chec/cli) | ||
[![License](https://img.shields.io/github/license/chec/cli.svg)](https://github.com/chec/cli/blob/master/LICENSE.md) | ||
[![Version](https://img.shields.io/npm/v/@chec/cli.svg)](https://npmjs.org/package/@chec/cli) | ||
[![Downloads/week](https://img.shields.io/npm/dw/@chec/cli.svg)](https://npmjs.org/package/@chec/cli) | ||
@@ -22,3 +21,3 @@ <!-- toc --> | ||
$ chec (-v|--version|version) | ||
@chec/cli/1.0.0-beta1 darwin-x64 node-v10.16.3 | ||
@chec/cli/1.0.0-beta2 darwin-x64 node-v10.16.3 | ||
$ chec --help [COMMAND] | ||
@@ -65,3 +64,3 @@ USAGE | ||
_See code: [src/commands/demo-store.js](https://github.com/chec/cli/blob/v1.0.0-beta1/src/commands/demo-store.js)_ | ||
_See code: [src/commands/demo-store.js](https://github.com/chec/cli/blob/v1.0.0-beta2/src/commands/demo-store.js)_ | ||
@@ -104,3 +103,3 @@ ## `chec help [COMMAND]` | ||
_See code: [src/commands/log.js](https://github.com/chec/cli/blob/v1.0.0-beta1/src/commands/log.js)_ | ||
_See code: [src/commands/log.js](https://github.com/chec/cli/blob/v1.0.0-beta2/src/commands/log.js)_ | ||
@@ -124,3 +123,3 @@ ## `chec login` | ||
_See code: [src/commands/login.js](https://github.com/chec/cli/blob/v1.0.0-beta1/src/commands/login.js)_ | ||
_See code: [src/commands/login.js](https://github.com/chec/cli/blob/v1.0.0-beta2/src/commands/login.js)_ | ||
@@ -139,3 +138,3 @@ ## `chec logout` | ||
_See code: [src/commands/logout.js](https://github.com/chec/cli/blob/v1.0.0-beta1/src/commands/logout.js)_ | ||
_See code: [src/commands/logout.js](https://github.com/chec/cli/blob/v1.0.0-beta2/src/commands/logout.js)_ | ||
@@ -162,3 +161,3 @@ ## `chec logs` | ||
_See code: [src/commands/logs.js](https://github.com/chec/cli/blob/v1.0.0-beta1/src/commands/logs.js)_ | ||
_See code: [src/commands/logs.js](https://github.com/chec/cli/blob/v1.0.0-beta2/src/commands/logs.js)_ | ||
@@ -177,3 +176,3 @@ ## `chec register` | ||
_See code: [src/commands/register.js](https://github.com/chec/cli/blob/v1.0.0-beta1/src/commands/register.js)_ | ||
_See code: [src/commands/register.js](https://github.com/chec/cli/blob/v1.0.0-beta2/src/commands/register.js)_ | ||
@@ -211,3 +210,3 @@ ## `chec request METHOD RESOURCE [PAYLOAD]` | ||
_See code: [src/commands/request.js](https://github.com/chec/cli/blob/v1.0.0-beta1/src/commands/request.js)_ | ||
_See code: [src/commands/request.js](https://github.com/chec/cli/blob/v1.0.0-beta2/src/commands/request.js)_ | ||
@@ -229,3 +228,3 @@ ## `chec whoami` | ||
_See code: [src/commands/whoami.js](https://github.com/chec/cli/blob/v1.0.0-beta1/src/commands/whoami.js)_ | ||
_See code: [src/commands/whoami.js](https://github.com/chec/cli/blob/v1.0.0-beta2/src/commands/whoami.js)_ | ||
<!-- commandsstop --> |
@@ -289,5 +289,6 @@ const {flags} = require('@oclif/command') | ||
// Loop through additional scripts and await their execution | ||
buildScripts.forEach(async script => { | ||
for (const script of buildScripts) { | ||
// eslint-disable-next-line no-await-in-loop | ||
await spawner.create(command, [...baseArgs, 'run', script], {stdio: 'inherit'}).run() | ||
}) | ||
} | ||
} | ||
@@ -294,0 +295,0 @@ |
const Command = require('../base') | ||
const globalFlags = require('../helpers/global-flags') | ||
const authHelper = require('../helpers/auth') | ||
const requestHelper = require('../helpers/request') | ||
const ora = require('ora') | ||
const chalk = require('chalk') | ||
const {cli} = require('cli-ux') | ||
@@ -21,11 +23,24 @@ /** | ||
const {flags: {domain}} = this.parse(WhoamiCommand) | ||
const {flags} = this.parse(WhoamiCommand) | ||
try { | ||
const result = await requestHelper.request('GET', | ||
'/v1/developer/user', {}, {domain}) | ||
'/v1/developer/user', {}, {domain: flags.domain}) | ||
spinner.stop() | ||
// Show email address and merchant name | ||
const data = JSON.parse(result.body) | ||
this.log(`${chalk.green.bold(data.email)}: ${data.merchants.map(merchant => merchant.business_name).join(', ')}`) | ||
// Show API keys | ||
this.log() | ||
cli.table(authHelper.getApiKeys(), { | ||
key: {}, | ||
type: {}, | ||
is_sandbox: {}, // eslint-disable-line camelcase | ||
}, { | ||
printLine: this.log, | ||
...flags, | ||
}) | ||
} catch (error) { | ||
@@ -45,2 +60,3 @@ spinner.fail('Request failed! ' + error.statusCode + ' ' + error.statusMessage) | ||
...globalFlags, | ||
...cli.table.flags, | ||
} | ||
@@ -47,0 +63,0 @@ |
73998
1731
222