Comparing version 9.0.0 to 9.1.0-beta.0
@@ -39,3 +39,7 @@ import { Command } from '@heroku-cli/command'; | ||
}; | ||
getFilteredDomains: (filterKeyValue: string, domains: Array<Heroku.Domain>) => { | ||
size: number; | ||
filteredDomains: Heroku.Domain[]; | ||
}; | ||
run(): Promise<void>; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const command_1 = require("@heroku-cli/command"); | ||
const color_1 = require("@heroku-cli/color"); | ||
const core_1 = require("@oclif/core"); | ||
const Uri = require("urijs"); | ||
const prompts_1 = require("@inquirer/prompts"); | ||
const paginator_1 = require("../../lib/utils/paginator"); | ||
const keyValueParser_1 = require("../../lib/utils/keyValueParser"); | ||
function isApexDomain(hostname) { | ||
@@ -47,8 +51,40 @@ if (hostname.includes('*')) | ||
}; | ||
this.getFilteredDomains = (filterKeyValue, domains) => { | ||
const filteredInfo = { size: 0, filteredDomains: domains }; | ||
const { key: filterName, value } = (0, keyValueParser_1.default)(filterKeyValue); | ||
if (!value) { | ||
throw new Error('Filter flag has an invalid value'); | ||
} | ||
if (filterName === 'Domain Name') { | ||
filteredInfo.filteredDomains = domains.filter(domain => domain.hostname.includes(value)); | ||
} | ||
if (filterName === 'DNS Record Type') { | ||
filteredInfo.filteredDomains = domains.filter(domain => { | ||
const kind = isApexDomain(domain.hostname) ? 'ALIAS or ANAME' : 'CNAME'; | ||
return kind.includes(value); | ||
}); | ||
} | ||
if (filterName === 'DNS Target') { | ||
filteredInfo.filteredDomains = domains.filter(domain => domain.cname.includes(value)); | ||
} | ||
if (filterName === 'SNI Endpoint') { | ||
filteredInfo.filteredDomains = domains.filter(domain => { | ||
if (!domain.sni_endpoint) | ||
domain.sni_endpoint = ''; | ||
return domain.sni_endpoint.includes(value); | ||
}); | ||
} | ||
filteredInfo.size = filteredInfo.filteredDomains.length; | ||
return filteredInfo; | ||
}; | ||
} | ||
async run() { | ||
const { flags } = await this.parse(DomainsIndex); | ||
const { body: domains } = await this.heroku.get(`/apps/${flags.app}/domains`); | ||
const herokuDomain = domains.find(domain => domain.kind === 'heroku'); | ||
const customDomains = domains.filter(domain => domain.kind === 'custom'); | ||
const domains = await (0, paginator_1.paginateRequest)(this.heroku, `/apps/${flags.app}/domains`, 1000); | ||
const herokuDomain = domains.find((domain) => domain.kind === 'heroku'); | ||
let customDomains = domains.filter((domain) => domain.kind === 'custom'); | ||
let displayTotalDomains = false; | ||
if (flags.filter) { | ||
customDomains = this.getFilteredDomains(flags.filter, domains).filteredDomains; | ||
} | ||
if (flags.json) { | ||
@@ -62,2 +98,10 @@ core_1.ux.styledJSON(domains); | ||
core_1.ux.log(); | ||
if (customDomains.length > 100 && !flags.csv) { | ||
core_1.ux.warn(`This app has over 100 domains. Your terminal may not be configured to display the total amount of domains. You can export all domains into a CSV file with: ${color_1.default.cyan('heroku domains -a example-app --csv > example-file.csv')}`); | ||
displayTotalDomains = await (0, prompts_1.confirm)({ default: false, message: `Display all ${customDomains.length} domains?`, theme: { prefix: '', style: { defaultAnswer: () => '(Y/N)' } } }); | ||
if (!displayTotalDomains) { | ||
return; | ||
} | ||
} | ||
core_1.ux.log(); | ||
core_1.ux.styledHeader(`${flags.app} Custom Domains`); | ||
@@ -64,0 +108,0 @@ core_1.ux.table(customDomains, this.tableConfig(true), Object.assign(Object.assign({}, flags), { 'no-truncate': true })); |
@@ -16,8 +16,11 @@ "use strict"; | ||
function ensureContainerStack(app, cmd) { | ||
var _a, _b, _c; | ||
if (((_a = app.stack) === null || _a === void 0 ? void 0 : _a.name) !== 'container') { | ||
const appLabel = (((_b = app.stack) === null || _b === void 0 ? void 0 : _b.name) && stackLabelMap[app.stack.name]) || ((_c = app.stack) === null || _c === void 0 ? void 0 : _c.name); | ||
var _a, _b; | ||
const buildStack = (_a = app.build_stack) === null || _a === void 0 ? void 0 : _a.name; | ||
const appStack = (_b = app.stack) === null || _b === void 0 ? void 0 : _b.name; | ||
const allowedStack = 'container'; | ||
// either can be container stack and are allowed | ||
if (buildStack !== allowedStack && appStack !== allowedStack) { | ||
let message = 'This command is for Docker apps only.'; | ||
if (['push', 'release'].includes(cmd)) { | ||
message += ` Run ${color_1.default.cyan('git push heroku main')} to deploy your ${color_1.default.cyan(app.name)} ${color_1.default.cyan(appLabel)} app instead.`; | ||
message += ` Switch stacks by running ${color_1.default.cmd('heroku stack:set container')}. Or, to deploy ${color_1.default.app(app.name)} with ${color_1.default.yellow(appStack)}, run ${color_1.default.cmd('git push heroku main')} instead.`; | ||
} | ||
@@ -24,0 +27,0 @@ core_1.ux.error(message, { exit: 1 }); |
@@ -89,3 +89,2 @@ "use strict"; | ||
} | ||
console.log('hi', JSON.stringify(attachments)); | ||
matches = attachments.filter(attachment => config[db] && config[db] === config[(0, util_1.getConfigVarName)(attachment.config_vars)]); | ||
@@ -92,0 +91,0 @@ if (matches.length === 0) { |
{ | ||
"name": "heroku", | ||
"description": "CLI to interact with Heroku", | ||
"version": "9.0.0", | ||
"version": "9.1.0-beta.0", | ||
"author": "Heroku", | ||
@@ -18,2 +18,3 @@ "bin": "./bin/run", | ||
"@heroku/heroku-cli-util": "^8.0.13", | ||
"@inquirer/prompts": "^5.0.5", | ||
"@oclif/core": "^2.16.0", | ||
@@ -392,3 +393,3 @@ "@oclif/plugin-commands": "2.2.28", | ||
"types": "lib/index.d.ts", | ||
"gitHead": "4da724b8d060066189be5d0979a449b65a3e78ff" | ||
"gitHead": "c12640b407703c9d326c8cc6808205ce4646b315" | ||
} |
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1572436
814
41709
75
1
+ Added@inquirer/prompts@^5.0.5
+ Added@inquirer/checkbox@2.5.0(transitive)
+ Added@inquirer/confirm@3.2.0(transitive)
+ Added@inquirer/core@9.2.1(transitive)
+ Added@inquirer/editor@2.2.0(transitive)
+ Added@inquirer/expand@2.3.0(transitive)
+ Added@inquirer/figures@1.0.10(transitive)
+ Added@inquirer/input@2.3.0(transitive)
+ Added@inquirer/number@1.1.0(transitive)
+ Added@inquirer/password@2.2.0(transitive)
+ Added@inquirer/prompts@5.5.0(transitive)
+ Added@inquirer/rawlist@2.3.0(transitive)
+ Added@inquirer/search@1.1.0(transitive)
+ Added@inquirer/select@2.5.0(transitive)
+ Added@inquirer/type@1.5.52.0.0(transitive)
+ Added@types/mute-stream@0.0.4(transitive)
+ Added@types/wrap-ansi@3.0.0(transitive)
+ Addedcli-width@4.1.0(transitive)
+ Addedmute-stream@1.0.0(transitive)
+ Addedyoctocolors-cjs@2.1.2(transitive)