diff --git a/src/commands/deploy-backend.ts b/src/commands/deploy-backend.ts index 50e9c2b..ac89e48 100644 --- a/src/commands/deploy-backend.ts +++ b/src/commands/deploy-backend.ts @@ -17,7 +17,7 @@ export default class DeployBackend extends BaseCommand { ...BaseCommand.commonFlags, region: flags.string({char: 'r', description: 'Region', default: 'us-west-2'}), subdomain: flags.string({char: 's', description: 'Subdomain'}), - 'deployment-mode': flags.string({char: 'm', description: 'Deployment Mode', default: 'graphql'}) + 'deployment-mode': flags.string({char: 'm', description: 'Deployment Mode', default: 'graphql', options: ['readonly', 'graphql', 'flexible']}), } static args = [{name: 'name', description: 'Backend Name', required: true}] @@ -42,7 +42,7 @@ export default class DeployBackend extends BaseCommand { name: opts.args.name, zone: opts.flags.region, subdomain: opts.flags.subdomain, - deploymentMode: opts.flags['deployment-mode'] + deploymentMode: opts.flags['deployment-mode'], }), }) if (response.status !== 200) { diff --git a/src/commands/list-backends.ts b/src/commands/list-backends.ts index 5e64ab2..4e9df5f 100644 --- a/src/commands/list-backends.ts +++ b/src/commands/list-backends.ts @@ -45,6 +45,10 @@ export default class ListBackends extends BaseCommand { get: ({zone}) => zone, extended: true, }, + mode: { + get: ({deploymentMode}) => deploymentMode, + extended: true, + }, endpoint: { get: ({url}) => `https://${url}/graphql`, }, diff --git a/src/commands/update-backend.ts b/src/commands/update-backend.ts index 2753118..55607a9 100644 --- a/src/commands/update-backend.ts +++ b/src/commands/update-backend.ts @@ -15,7 +15,7 @@ export default class UpdateBackend extends BaseCommand { ...BaseCommand.commonFlags, name: flags.string({char: 'n', description: 'Name'}), confirm: flags.boolean({char: 'y', description: 'Skip Confirmation', default: false}), - deploymentMode: flags.string({char: 'm', description: 'Deployment Mode', options: ['readonly', 'graphql', 'flexible'], hidden: true}), + 'deployment-mode': flags.string({char: 'm', description: 'Deployment Mode', options: ['readonly', 'graphql', 'flexible']}), } static args = [{name: 'id', description: 'Backend UID', required: true}] @@ -34,13 +34,13 @@ export default class UpdateBackend extends BaseCommand { this.error('Please login with `slash-graphql` login') } - const updates: Record = {}; - ['name', 'deploymentMode'].forEach(key => { - const flags = opts.flags as any - if (flags[key]) { - updates[key] = flags[key] - } - }) + const updates: Record = {} + if (opts.flags.name) { + updates.name = opts.flags.name + } + if (opts.flags['deployment-mode']) { + updates.deploymentMode = opts.flags['deployment-mode'] + } if (Object.keys(updates).length === 0) { this.error('Please pass in a property to update') diff --git a/src/types.d.ts b/src/types.d.ts index a19bf0a..c057a57 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -5,6 +5,7 @@ interface APIBackend { zone: string; uid: string; owner: string; + deploymentMode: string; } interface AuthConfig {