kinvey-cli
Advanced tools
Comparing version 4.0.0-beta.2 to 4.0.0-beta.3
# Changelog | ||
## 4.0.0-beta.3 | ||
* Rename the `env` namespace to `appenv` | ||
* Add `org` option to `app create` | ||
## 4.0.0-beta.2 | ||
@@ -4,0 +8,0 @@ * Prompt for 2FA token on 'profile login' if required |
@@ -20,3 +20,3 @@ /** | ||
const CommandResult = require('../CommandResult'); | ||
const { ActiveItemType, AppOptionsName, CommonOptionsNames, EntityType, Mapping, OperationType } = require('../Constants'); | ||
const { ActiveItemType, AppOptionsName, CommonOptionsNames, EntityType, Mapping, OperationType, OrgOptionsName } = require('../Constants'); | ||
const KinveyError = require('../KinveyError'); | ||
@@ -29,10 +29,35 @@ const { isNullOrUndefined, getItemError, mapFromSource, sortList } = require('../Utils'); | ||
this.applicationsService = options.applicationsService; | ||
this.organizationsService = options.organizationsService; | ||
} | ||
create(options, done) { | ||
const payload = { | ||
name: options.name | ||
}; | ||
let orgId; | ||
this.applicationsService.create(payload, (err, data) => { | ||
async.series([ | ||
(next) => { | ||
if (isNullOrUndefined(options[OrgOptionsName.ORG])) { | ||
return setImmediate(next); | ||
} | ||
this.organizationsService.getByIdOrName(options[OrgOptionsName.ORG], (err, data) => { | ||
if (err) { | ||
return next(err); | ||
} | ||
orgId = data.id; | ||
next(); | ||
}); | ||
}, | ||
(next) => { | ||
const payload = { | ||
name: options.name | ||
}; | ||
if (!isNullOrUndefined(orgId)) { | ||
payload.organizationId = orgId; | ||
} | ||
this.applicationsService.create(payload, next); | ||
} | ||
], (err, results) => { | ||
if (err) { | ||
@@ -42,5 +67,6 @@ return done(err); | ||
const result = results.pop(); | ||
const cmdResult = new CommandResult() | ||
.setRawData({ id: data.id }) | ||
.setBasicMsg(OperationType.CREATE, EntityType.APP, data.id); | ||
.setRawData({ id: result.id }) | ||
.setBasicMsg(OperationType.CREATE, EntityType.APP, result.id); | ||
done(null, cmdResult); | ||
@@ -47,0 +73,0 @@ }); |
@@ -16,3 +16,4 @@ /** | ||
const { AppOptions, AppOptionsName, CommandRequirement, CommonOptions, CommonOptionsNames, Namespace } = require('./../Constants'); | ||
const { AppOptions, AppOptionsName, CommandRequirement, CommonOptions, CommonOptionsNames, Namespace, | ||
OrgOptions, OrgOptionsName } = require('./../Constants'); | ||
@@ -25,3 +26,4 @@ const cmdDefinitions = [ | ||
commandsManager | ||
.positional('name', { describe: 'App name' }); | ||
.positional('name', { describe: 'App name' }) | ||
.option(OrgOptionsName.ORG, OrgOptions[OrgOptionsName.ORG]); | ||
}, | ||
@@ -28,0 +30,0 @@ handlerName: 'create', |
@@ -88,3 +88,3 @@ /** | ||
this._controllers[Namespace.ORG] = new OrganizationsController({ cliManager: this, organizationsService }); | ||
this._controllers[Namespace.APP] = new ApplicationsController({ cliManager: this, applicationsService }); | ||
this._controllers[Namespace.APP] = new ApplicationsController({ cliManager: this, applicationsService, organizationsService }); | ||
const environmentsService = new EnvironmentsService(this); | ||
@@ -91,0 +91,0 @@ this._controllers[Namespace.ENV] = new EnvironmentsController({ cliManager: this, environmentsService, applicationsService }); |
@@ -21,3 +21,3 @@ /** | ||
COLL: 'coll', | ||
ENV: 'env', | ||
ENV: 'appenv', | ||
FLEX: 'flex', | ||
@@ -24,0 +24,0 @@ ORG: 'org', |
{ | ||
"name": "kinvey-cli", | ||
"version": "4.0.0-beta.2", | ||
"version": "4.0.0-beta.3", | ||
"description": "Utility for deploying and managing FlexServices on Kinvey's FlexService Runtime", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -76,4 +76,8 @@ | LINTING | UNIT | INTEGRATION | | ||
Creates an application. | ||
Creates an application. You can specify an organization ID or name if you want to create the app within the context of an organization. | ||
* `--org <organization>` | ||
Organization ID/name. | ||
* `app list` | ||
@@ -99,3 +103,3 @@ | ||
* `env create <name>` | ||
* `appenv create <name>` | ||
@@ -108,3 +112,3 @@ Creates an environment within the active application. To use a different application, specify it using `--app`. | ||
* `env show [env]` | ||
* `appenv show [env]` | ||
@@ -117,3 +121,3 @@ Shows detailed information about the specified environment or about the active one if you don't specify an environment. You can specify an environment by ID or name. By default, the command searches inside the active application but you can specify a different application using `--app`. | ||
* `env use <env>` | ||
* `appenv use <env>` | ||
@@ -126,3 +130,3 @@ Sets the specified environment as active. By default, the command searches inside the active application but you can specify a different application using `--app`. | ||
* `env delete [env]` | ||
* `appenv delete [env]` | ||
@@ -129,0 +133,0 @@ Deletes the specified environment or the active one if you don't specify an environment. You can specify an environment by ID or name. By default, the command searches inside the active application but you can specify a different application using `--app`. You will be prompted for confirmation unless you set the `--no-prompt` flag. |
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
258330
5014
498