heroku 11.0.1-alpha.3 → 11.0.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -15
- package/bin/run +13 -35
- package/dist/commands/access/add.js +1 -1
- package/dist/commands/access/index.js +44 -44
- package/dist/commands/access/remove.js +2 -2
- package/dist/commands/access/update.js +1 -1
- package/dist/commands/accounts/add.js +1 -1
- package/dist/commands/accounts/current.js +2 -2
- package/dist/commands/accounts/index.js +2 -2
- package/dist/commands/accounts/remove.js +1 -1
- package/dist/commands/accounts/set.js +1 -1
- package/dist/commands/addons/attach.js +1 -1
- package/dist/commands/addons/create.js +33 -33
- package/dist/commands/addons/detach.js +1 -1
- package/dist/commands/addons/docs.js +1 -1
- package/dist/commands/addons/index.js +1 -1
- package/dist/commands/addons/open.d.ts +14 -14
- package/dist/commands/addons/open.js +2 -2
- package/dist/commands/addons/rename.js +1 -1
- package/dist/commands/addons/services.js +2 -2
- package/dist/commands/addons/upgrade.js +1 -1
- package/dist/commands/addons/wait.js +2 -2
- package/dist/commands/apps/destroy.js +1 -1
- package/dist/commands/apps/errors.js +2 -2
- package/dist/commands/apps/favorites/add.js +2 -2
- package/dist/commands/apps/favorites/index.js +2 -2
- package/dist/commands/apps/favorites/remove.js +2 -2
- package/dist/commands/apps/index.js +59 -59
- package/dist/commands/apps/join.js +2 -2
- package/dist/commands/apps/leave.js +2 -2
- package/dist/commands/apps/lock.js +2 -2
- package/dist/commands/apps/open.js +1 -1
- package/dist/commands/apps/rename.js +1 -1
- package/dist/commands/apps/stacks/index.js +8 -8
- package/dist/commands/apps/stacks/set.js +4 -4
- package/dist/commands/apps/transfer.js +1 -1
- package/dist/commands/apps/unlock.js +2 -2
- package/dist/commands/auth/2fa/disable.js +2 -2
- package/dist/commands/auth/2fa/index.js +2 -2
- package/dist/commands/auth/login.js +1 -1
- package/dist/commands/auth/logout.js +1 -1
- package/dist/commands/auth/token.js +2 -2
- package/dist/commands/authorizations/create.d.ts +2 -2
- package/dist/commands/authorizations/create.js +6 -6
- package/dist/commands/authorizations/index.js +2 -2
- package/dist/commands/authorizations/revoke.js +1 -1
- package/dist/commands/autocomplete/index.js +1 -1
- package/dist/commands/buildpacks/remove.js +1 -1
- package/dist/commands/buildpacks/versions.js +1 -1
- package/dist/commands/certs/auto/disable.js +2 -2
- package/dist/commands/certs/auto/enable.js +2 -2
- package/dist/commands/certs/auto/index.js +1 -1
- package/dist/commands/certs/auto/refresh.d.ts +1 -1
- package/dist/commands/certs/auto/refresh.js +2 -2
- package/dist/commands/certs/index.js +2 -2
- package/dist/commands/certs/info.js +2 -2
- package/dist/commands/certs/remove.js +2 -2
- package/dist/commands/certs/update.js +1 -1
- package/dist/commands/ci/config/get.js +1 -1
- package/dist/commands/ci/config/index.js +2 -2
- package/dist/commands/ci/config/set.js +8 -8
- package/dist/commands/ci/config/unset.js +2 -2
- package/dist/commands/ci/debug.js +1 -1
- package/dist/commands/ci/index.js +1 -1
- package/dist/commands/ci/info.d.ts +4 -4
- package/dist/commands/ci/info.js +5 -5
- package/dist/commands/ci/last.js +2 -2
- package/dist/commands/ci/migrate-manifest.js +2 -2
- package/dist/commands/ci/open.js +1 -1
- package/dist/commands/ci/rerun.js +2 -3
- package/dist/commands/ci/run.js +2 -2
- package/dist/commands/clients/create.d.ts +4 -4
- package/dist/commands/clients/create.js +7 -7
- package/dist/commands/clients/destroy.js +1 -1
- package/dist/commands/clients/index.js +2 -2
- package/dist/commands/clients/update.js +1 -1
- package/dist/commands/config/get.js +1 -1
- package/dist/commands/config/index.js +2 -2
- package/dist/commands/config/set.js +2 -2
- package/dist/commands/config/unset.js +2 -2
- package/dist/commands/container/login.js +1 -1
- package/dist/commands/container/logout.js +1 -1
- package/dist/commands/container/push.js +2 -2
- package/dist/commands/container/release.js +2 -2
- package/dist/commands/container/rm.js +2 -2
- package/dist/commands/container/run.js +2 -2
- package/dist/commands/dashboard.js +1 -1
- package/dist/commands/data/maintenances/index.js +2 -4
- package/dist/commands/data/maintenances/info.js +1 -1
- package/dist/commands/data/maintenances/run.js +1 -1
- package/dist/commands/data/maintenances/schedule.js +1 -1
- package/dist/commands/data/maintenances/wait.js +1 -1
- package/dist/commands/data/maintenances/window/index.js +1 -1
- package/dist/commands/data/maintenances/window/update.js +1 -1
- package/dist/commands/data/pg/create.js +1 -1
- package/dist/commands/domains/clear.js +2 -2
- package/dist/commands/domains/index.js +1 -1
- package/dist/commands/domains/info.d.ts +3 -3
- package/dist/commands/domains/info.js +5 -5
- package/dist/commands/domains/remove.js +1 -1
- package/dist/commands/domains/update.js +1 -1
- package/dist/commands/drains/add.js +1 -1
- package/dist/commands/drains/index.js +8 -8
- package/dist/commands/drains/remove.js +1 -1
- package/dist/commands/features/disable.js +1 -1
- package/dist/commands/features/enable.js +1 -1
- package/dist/commands/features/index.js +1 -1
- package/dist/commands/git/clone.js +1 -1
- package/dist/commands/git/remote.js +1 -1
- package/dist/commands/keys/clear.js +1 -1
- package/dist/commands/keys/index.js +6 -6
- package/dist/commands/keys/remove.js +1 -1
- package/dist/commands/labs/enable.js +6 -6
- package/dist/commands/labs/index.js +16 -16
- package/dist/commands/local/index.js +1 -1
- package/dist/commands/local/run.js +1 -1
- package/dist/commands/logs.js +2 -2
- package/dist/commands/maintenance/index.d.ts +1 -1
- package/dist/commands/maintenance/index.js +2 -2
- package/dist/commands/maintenance/off.js +2 -2
- package/dist/commands/maintenance/on.js +2 -2
- package/dist/commands/members/index.js +2 -2
- package/dist/commands/members/remove.js +2 -2
- package/dist/commands/notifications/index.js +1 -1
- package/dist/commands/orgs/open.d.ts +1 -1
- package/dist/commands/orgs/open.js +3 -3
- package/dist/commands/pg/backups/index.js +2 -4
- package/dist/commands/pg/backups/schedules.js +2 -2
- package/dist/commands/pipelines/add.js +1 -1
- package/dist/commands/pipelines/connect.d.ts +3 -3
- package/dist/commands/pipelines/connect.js +8 -8
- package/dist/commands/pipelines/create.js +1 -1
- package/dist/commands/pipelines/destroy.js +1 -1
- package/dist/commands/pipelines/diff.js +51 -51
- package/dist/commands/pipelines/index.js +2 -2
- package/dist/commands/pipelines/open.js +1 -1
- package/dist/commands/pipelines/promote.js +105 -105
- package/dist/commands/pipelines/remove.js +2 -2
- package/dist/commands/pipelines/rename.js +1 -1
- package/dist/commands/pipelines/setup.js +1 -1
- package/dist/commands/pipelines/update.js +2 -2
- package/dist/commands/ps/autoscale/disable.d.ts +1 -1
- package/dist/commands/ps/autoscale/disable.js +4 -4
- package/dist/commands/ps/autoscale/enable.d.ts +4 -4
- package/dist/commands/ps/autoscale/enable.js +14 -16
- package/dist/commands/ps/copy.js +1 -1
- package/dist/commands/ps/exec.js +2 -2
- package/dist/commands/ps/forward.js +2 -2
- package/dist/commands/ps/index.js +1 -1
- package/dist/commands/ps/restart.js +1 -1
- package/dist/commands/ps/scale.js +3 -3
- package/dist/commands/ps/socks.js +1 -1
- package/dist/commands/ps/stop.js +1 -1
- package/dist/commands/ps/type.js +22 -22
- package/dist/commands/ps/wait.js +2 -2
- package/dist/commands/rake.d.ts +5 -5
- package/dist/commands/rake.js +11 -11
- package/dist/commands/redis/stats-reset.js +1 -1
- package/dist/commands/redis/upgrade.js +1 -1
- package/dist/commands/redis/wait.js +1 -1
- package/dist/commands/releases/index.js +3 -3
- package/dist/commands/releases/retry.js +2 -2
- package/dist/commands/releases/rollback.js +1 -1
- package/dist/commands/repl.js +1 -1
- package/dist/commands/reviewapps/disable.js +2 -2
- package/dist/commands/reviewapps/enable.js +2 -2
- package/dist/commands/run/detached.js +2 -2
- package/dist/commands/run/index.js +2 -2
- package/dist/commands/run/inside.js +1 -1
- package/dist/commands/sessions/destroy.js +1 -1
- package/dist/commands/sessions/index.js +2 -2
- package/dist/commands/spaces/destroy.js +1 -1
- package/dist/commands/spaces/drains/get.js +2 -2
- package/dist/commands/spaces/drains/set.js +1 -1
- package/dist/commands/spaces/index.js +3 -4
- package/dist/commands/spaces/info.js +1 -1
- package/dist/commands/spaces/peerings/accept.js +1 -1
- package/dist/commands/spaces/peerings/destroy.js +1 -1
- package/dist/commands/spaces/peerings/info.js +1 -1
- package/dist/commands/spaces/rename.js +2 -2
- package/dist/commands/spaces/transfer.js +2 -2
- package/dist/commands/spaces/trusted-ips/add.js +1 -1
- package/dist/commands/spaces/trusted-ips/remove.js +1 -1
- package/dist/commands/spaces/vpn/connect.js +1 -1
- package/dist/commands/spaces/vpn/connections.js +1 -1
- package/dist/commands/spaces/vpn/destroy.js +1 -1
- package/dist/commands/spaces/vpn/update.js +1 -1
- package/dist/commands/spaces/vpn/wait.d.ts +6 -6
- package/dist/commands/spaces/vpn/wait.js +14 -14
- package/dist/commands/spaces/wait.js +1 -1
- package/dist/commands/telemetry/add.js +2 -2
- package/dist/commands/telemetry/index.js +2 -2
- package/dist/commands/telemetry/info.js +1 -1
- package/dist/commands/telemetry/update.js +1 -1
- package/dist/commands/usage/addons.js +3 -3
- package/dist/commands/version/info.js +1 -1
- package/dist/commands/webhooks/add.d.ts +3 -3
- package/dist/commands/webhooks/add.js +6 -6
- package/dist/commands/webhooks/events/index.js +2 -3
- package/dist/commands/webhooks/index.d.ts +1 -1
- package/dist/commands/webhooks/index.js +4 -6
- package/dist/commands/webhooks/remove.d.ts +4 -4
- package/dist/commands/webhooks/remove.js +7 -7
- package/dist/commands/webhooks/update.d.ts +6 -6
- package/dist/commands/webhooks/update.js +9 -9
- package/dist/global_telemetry.d.ts +35 -35
- package/dist/global_telemetry.js +107 -131
- package/dist/hooks/command_not_found/performance_analytics.d.ts +1 -1
- package/dist/hooks/command_not_found/performance_analytics.js +1 -5
- package/dist/hooks/init/performance_analytics.d.ts +1 -1
- package/dist/hooks/init/performance_analytics.js +1 -5
- package/dist/hooks/init/terms-of-service.d.ts +1 -1
- package/dist/hooks/init/terms-of-service.js +1 -1
- package/dist/hooks/init/version.d.ts +1 -1
- package/dist/hooks/init/version.js +2 -4
- package/dist/hooks/postrun/performance_analytics.d.ts +1 -1
- package/dist/hooks/postrun/performance_analytics.js +4 -9
- package/dist/hooks/prerun/analytics.d.ts +1 -1
- package/dist/hooks/prerun/analytics.js +4 -9
- package/dist/hooks/preupdate/check-npm-auth.d.ts +1 -1
- package/dist/hooks/preupdate/check-npm-auth.js +2 -2
- package/dist/hooks/update/brew.d.ts +1 -1
- package/dist/hooks/update/brew.js +1 -1
- package/dist/hooks/update/completions.d.ts +1 -1
- package/dist/hooks/update/show-version-info.d.ts +1 -1
- package/dist/hooks/update/show-version-info.js +2 -2
- package/dist/hooks/update/tidy.d.ts +1 -1
- package/dist/hooks/update/tidy.js +1 -1
- package/dist/lib/addons/addons_wait.js +2 -2
- package/dist/lib/addons/create_addon.js +1 -1
- package/dist/lib/addons/destroy_addon.js +1 -1
- package/dist/lib/addons/util.js +1 -1
- package/dist/lib/apps/app-transfer.js +2 -2
- package/dist/lib/buildpacks/buildpacks.d.ts +1 -1
- package/dist/lib/buildpacks/buildpacks.js +13 -13
- package/dist/lib/certs/certificate_details.js +1 -1
- package/dist/lib/certs/domains.js +12 -12
- package/dist/lib/ci/pipelines.js +1 -1
- package/dist/lib/ci/test-run.d.ts +2 -2
- package/dist/lib/ci/test-run.js +106 -106
- package/dist/lib/ci/validate.js +1 -1
- package/dist/lib/confirmCommand.js +1 -1
- package/dist/lib/container/docker_helper.js +1 -1
- package/dist/lib/container/helpers.js +2 -2
- package/dist/lib/data/poolConfig.js +2 -2
- package/dist/lib/domains/domains.d.ts +1 -1
- package/dist/lib/domains/domains.js +31 -31
- package/dist/lib/domains/wait-for-domain.js +1 -1
- package/dist/lib/git/git.js +1 -1
- package/dist/lib/local/env-file-validator.js +1 -1
- package/dist/lib/local/fork-foreman.js +12 -12
- package/dist/lib/members/util.js +2 -2
- package/dist/lib/notify.js +1 -1
- package/dist/lib/npm-auth.d.ts +2 -2
- package/dist/lib/npm-auth.js +16 -16
- package/dist/lib/orgs/utils.js +1 -1
- package/dist/lib/pg/backups.js +1 -1
- package/dist/lib/pg/psql.d.ts +5 -5
- package/dist/lib/pg/psql.js +19 -19
- package/dist/lib/pg/push_pull.js +1 -1
- package/dist/lib/pg/setter.js +1 -1
- package/dist/lib/pipelines/ownership.d.ts +1 -1
- package/dist/lib/pipelines/ownership.js +13 -13
- package/dist/lib/pipelines/render-pipeline.js +1 -1
- package/dist/lib/pipelines/setup/create-apps.js +18 -18
- package/dist/lib/pipelines/setup/get-name-and-repo.js +1 -1
- package/dist/lib/pipelines/setup/poll-app-setups.js +6 -6
- package/dist/lib/pipelines/setup/setup-pipeline.js +1 -1
- package/dist/lib/ps-exec/exec.js +1 -1
- package/dist/lib/ps-exec/ssh.d.ts +4 -4
- package/dist/lib/ps-exec/ssh.js +60 -60
- package/dist/lib/redis/api.d.ts +24 -24
- package/dist/lib/redis/api.js +1 -1
- package/dist/lib/run/colorize.js +107 -113
- package/dist/lib/run/dyno.d.ts +9 -9
- package/dist/lib/run/dyno.js +31 -29
- package/dist/lib/run/helpers.d.ts +7 -7
- package/dist/lib/run/helpers.js +43 -43
- package/dist/lib/run/log-displayer.js +2 -2
- package/dist/lib/spaces/format.d.ts +1 -1
- package/dist/lib/spaces/format.js +22 -22
- package/dist/lib/spaces/hosts.js +1 -1
- package/dist/lib/spaces/peering.js +1 -1
- package/dist/lib/spaces/spaces.d.ts +1 -1
- package/dist/lib/spaces/spaces.js +5 -8
- package/dist/lib/telemetry/util.d.ts +1 -1
- package/dist/lib/telemetry/util.js +13 -13
- package/dist/lib/utils/packageParser.d.ts +2 -0
- package/dist/lib/utils/packageParser.js +14 -0
- package/dist/lib/utils/tableUtils.js +1 -1
- package/dist/lib/webhooks/base.js +1 -1
- package/npm-shrinkwrap.json +865 -460
- package/oclif.manifest.json +361 -361
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,26 +4,13 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
## [11.0.
|
|
7
|
+
## [11.0.2-alpha.0](https://github.com/heroku/cli/compare/v11.0.0...v11.0.2-alpha.0) (2026-03-25)
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
### Bug Fixes
|
|
11
11
|
|
|
12
12
|
* address UI issues with confirmation prompts on multiple commands (W-21649376) ([#3602](https://github.com/heroku/cli/issues/3602)) ([7e96152](https://github.com/heroku/cli/commit/7e96152f8789d4580cd30b0e501866d6f01c9079))
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Performance Improvements
|
|
16
|
-
|
|
17
|
-
* avoid redundant package.json read in init/version hook ([6f2ab44](https://github.com/heroku/cli/commit/6f2ab444189e6cfcc080903f487471d91bda5780))
|
|
18
|
-
* implement lazy initialization in colorize.ts ([991577b](https://github.com/heroku/cli/commit/991577b1f2cb9709f222264f82f678451e5d4156))
|
|
19
|
-
* implement lazy initialization in global_telemetry.ts ([25d684f](https://github.com/heroku/cli/commit/25d684fd0baf668c89688e69688a10a54ef684cf))
|
|
20
|
-
* make SIGINT/SIGTERM telemetry fire-and-forget ([652a369](https://github.com/heroku/cli/commit/652a36985fb00851dc6e6b46e8fddf4f97b045e4))
|
|
21
|
-
* optimize Windows startup time by skipping telemetry by default ([b3e2279](https://github.com/heroku/cli/commit/b3e227992f0f00ab9be213564d574910e59e266b))
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
### Miscellaneous Chores
|
|
25
|
-
|
|
26
|
-
* remove unused packageParser.ts ([a561a1f](https://github.com/heroku/cli/commit/a561a1f065bd63fb5d84ecdbfd976e51ed3ac426))
|
|
13
|
+
* resolve addons across data maintenances commands ([#3609](https://github.com/heroku/cli/issues/3609)) ([84eb648](https://github.com/heroku/cli/commit/84eb64866d1204cb393bae80ae8b4c58eabcb1cc))
|
|
27
14
|
|
|
28
15
|
## [11.0.0](https://github.com/heroku/cli/compare/v10.17.0...v11.0.0) (2026-03-18)
|
|
29
16
|
|
package/bin/run
CHANGED
|
@@ -2,30 +2,16 @@
|
|
|
2
2
|
/* eslint-disable n/no-process-exit */
|
|
3
3
|
/* eslint-disable n/no-unpublished-bin */
|
|
4
4
|
|
|
5
|
-
import {execute
|
|
5
|
+
import {execute} from '@oclif/core'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
if (process.env.DEBUG?.includes('oclif:perf') || process.env.DEBUG === '*') {
|
|
9
|
-
settings.performanceEnabled = true
|
|
10
|
-
}
|
|
7
|
+
import * as globalTelemetry from '../dist/global_telemetry.js'
|
|
11
8
|
|
|
12
9
|
process.env.HEROKU_UPDATE_INSTRUCTIONS = process.env.HEROKU_UPDATE_INSTRUCTIONS || 'update with: "npm update -g heroku"'
|
|
13
10
|
|
|
14
11
|
const now = new Date()
|
|
15
12
|
const cliStartTime = now.getTime()
|
|
16
13
|
|
|
17
|
-
// Skip telemetry entirely on Windows for performance (unless explicitly enabled)
|
|
18
|
-
const enableTelemetry = process.platform !== 'win32' || process.env.ENABLE_WINDOWS_TELEMETRY === 'true'
|
|
19
|
-
let globalTelemetry
|
|
20
|
-
|
|
21
|
-
if (enableTelemetry) {
|
|
22
|
-
// Dynamically import telemetry only when needed
|
|
23
|
-
globalTelemetry = await import('../dist/global_telemetry.js')
|
|
24
|
-
}
|
|
25
|
-
|
|
26
14
|
process.once('beforeExit', async code => {
|
|
27
|
-
if (!enableTelemetry) return
|
|
28
|
-
|
|
29
15
|
// capture as successful exit
|
|
30
16
|
if (global.cliTelemetry) {
|
|
31
17
|
if (global.cliTelemetry.isVersionOrHelp) {
|
|
@@ -40,30 +26,22 @@ process.once('beforeExit', async code => {
|
|
|
40
26
|
}
|
|
41
27
|
})
|
|
42
28
|
|
|
43
|
-
process.on('SIGINT', () => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
globalTelemetry.sendTelemetry(error).catch(() => {})
|
|
49
|
-
}
|
|
50
|
-
|
|
29
|
+
process.on('SIGINT', async () => {
|
|
30
|
+
// capture as unsuccessful exit
|
|
31
|
+
const error = new Error('Received SIGINT')
|
|
32
|
+
error.cliRunDuration = globalTelemetry.computeDuration(cliStartTime)
|
|
33
|
+
await globalTelemetry.sendTelemetry(error)
|
|
51
34
|
process.exit(1)
|
|
52
35
|
})
|
|
53
36
|
|
|
54
|
-
process.on('SIGTERM', () => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
globalTelemetry.sendTelemetry(error).catch(() => {})
|
|
60
|
-
}
|
|
61
|
-
|
|
37
|
+
process.on('SIGTERM', async () => {
|
|
38
|
+
// capture as unsuccessful exit
|
|
39
|
+
const error = new Error('Received SIGTERM')
|
|
40
|
+
error.cliRunDuration = globalTelemetry.computeDuration(cliStartTime)
|
|
41
|
+
await globalTelemetry.sendTelemetry(error)
|
|
62
42
|
process.exit(1)
|
|
63
43
|
})
|
|
64
44
|
|
|
65
|
-
|
|
66
|
-
globalTelemetry.initializeInstrumentation()
|
|
67
|
-
}
|
|
45
|
+
globalTelemetry.initializeInstrumentation()
|
|
68
46
|
|
|
69
47
|
await execute({dir: import.meta.url})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command, flags } from '@heroku-cli/command';
|
|
2
|
-
import * as color from '@heroku/heroku-cli-util/color';
|
|
3
3
|
import { Args, ux } from '@oclif/core';
|
|
4
4
|
import { getOwner, isTeamApp } from '../../lib/teamUtils.js';
|
|
5
5
|
export default class AccessAdd extends Command {
|
|
@@ -1,49 +1,11 @@
|
|
|
1
|
+
import { color, hux } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command, flags } from '@heroku-cli/command';
|
|
2
3
|
import { HerokuAPIError } from '@heroku-cli/command/lib/api-client.js';
|
|
3
|
-
import {
|
|
4
|
-
import { ux } from '@oclif/core/ux';
|
|
4
|
+
import { ux } from '@oclif/core';
|
|
5
5
|
import _ from 'lodash';
|
|
6
6
|
import { getOwner, isTeamApp } from '../../lib/teamUtils.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
static flags = {
|
|
10
|
-
app: flags.app({ required: true }),
|
|
11
|
-
json: flags.boolean({ description: 'output in json format' }),
|
|
12
|
-
remote: flags.remote({ char: 'r' }),
|
|
13
|
-
};
|
|
14
|
-
static topic = 'access';
|
|
15
|
-
async run() {
|
|
16
|
-
const { flags } = await this.parse(AccessIndex);
|
|
17
|
-
const { app: appName, json } = flags;
|
|
18
|
-
const { body: app } = await this.heroku.get(`/apps/${appName}`);
|
|
19
|
-
let { body: collaborators } = await this.heroku.get(`/apps/${appName}/collaborators`);
|
|
20
|
-
if (isTeamApp(app.owner?.email)) {
|
|
21
|
-
const teamName = getOwner(app.owner?.email);
|
|
22
|
-
try {
|
|
23
|
-
const { body: members } = await this.heroku.get(`/teams/${teamName}/members`);
|
|
24
|
-
let admins = members.filter(member => member.role === 'admin');
|
|
25
|
-
const { body: adminPermissions } = await this.heroku.get('/teams/permissions');
|
|
26
|
-
admins = _.forEach(admins, admin => {
|
|
27
|
-
admin.user = { email: admin.email };
|
|
28
|
-
admin.permissions = adminPermissions;
|
|
29
|
-
return admin;
|
|
30
|
-
});
|
|
31
|
-
collaborators = buildCollaboratorsArray(collaborators, admins);
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
if (!(error instanceof HerokuAPIError && error.http.statusCode === 403))
|
|
35
|
-
throw error;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (json)
|
|
39
|
-
printJSON(collaborators);
|
|
40
|
-
else
|
|
41
|
-
printAccess(app, collaborators);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function buildCollaboratorsArray(collaboratorsRaw, admins) {
|
|
45
|
-
const collaboratorsNoAdmins = _.reject(collaboratorsRaw, { role: 'admin' });
|
|
46
|
-
return _.union(collaboratorsNoAdmins, admins);
|
|
7
|
+
function printJSON(collaborators) {
|
|
8
|
+
ux.stdout(JSON.stringify(collaborators, null, 2));
|
|
47
9
|
}
|
|
48
10
|
function buildTableColumns(showPermissions) {
|
|
49
11
|
const baseColumns = {
|
|
@@ -80,6 +42,44 @@ function printAccess(app, collaborators) {
|
|
|
80
42
|
const tableColumns = buildTableColumns(showPermissions);
|
|
81
43
|
hux.table(collaborators, tableColumns);
|
|
82
44
|
}
|
|
83
|
-
function
|
|
84
|
-
|
|
45
|
+
function buildCollaboratorsArray(collaboratorsRaw, admins) {
|
|
46
|
+
const collaboratorsNoAdmins = _.reject(collaboratorsRaw, { role: 'admin' });
|
|
47
|
+
return _.union(collaboratorsNoAdmins, admins);
|
|
48
|
+
}
|
|
49
|
+
export default class AccessIndex extends Command {
|
|
50
|
+
static description = 'list who has access to an app';
|
|
51
|
+
static flags = {
|
|
52
|
+
app: flags.app({ required: true }),
|
|
53
|
+
json: flags.boolean({ description: 'output in json format' }),
|
|
54
|
+
remote: flags.remote({ char: 'r' }),
|
|
55
|
+
};
|
|
56
|
+
static topic = 'access';
|
|
57
|
+
async run() {
|
|
58
|
+
const { flags } = await this.parse(AccessIndex);
|
|
59
|
+
const { app: appName, json } = flags;
|
|
60
|
+
const { body: app } = await this.heroku.get(`/apps/${appName}`);
|
|
61
|
+
let { body: collaborators } = await this.heroku.get(`/apps/${appName}/collaborators`);
|
|
62
|
+
if (isTeamApp(app.owner?.email)) {
|
|
63
|
+
const teamName = getOwner(app.owner?.email);
|
|
64
|
+
try {
|
|
65
|
+
const { body: members } = await this.heroku.get(`/teams/${teamName}/members`);
|
|
66
|
+
let admins = members.filter(member => member.role === 'admin');
|
|
67
|
+
const { body: adminPermissions } = await this.heroku.get('/teams/permissions');
|
|
68
|
+
admins = _.forEach(admins, admin => {
|
|
69
|
+
admin.user = { email: admin.email };
|
|
70
|
+
admin.permissions = adminPermissions;
|
|
71
|
+
return admin;
|
|
72
|
+
});
|
|
73
|
+
collaborators = buildCollaboratorsArray(collaborators, admins);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
if (!(error instanceof HerokuAPIError && error.http.statusCode === 403))
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (json)
|
|
81
|
+
printJSON(collaborators);
|
|
82
|
+
else
|
|
83
|
+
printAccess(app, collaborators);
|
|
84
|
+
}
|
|
85
85
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command, flags } from '@heroku-cli/command';
|
|
2
|
-
import
|
|
3
|
-
import { ux } from '@oclif/core/ux';
|
|
3
|
+
import { ux } from '@oclif/core';
|
|
4
4
|
export default class AccessRemove extends Command {
|
|
5
5
|
static description = 'remove users from a team app';
|
|
6
6
|
static example = `${color.command('heroku access:remove user@email.com --app APP')}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command, flags } from '@heroku-cli/command';
|
|
2
|
-
import * as color from '@heroku/heroku-cli-util/color';
|
|
3
3
|
import { Args, ux } from '@oclif/core';
|
|
4
4
|
import { isTeamApp } from '../../lib/teamUtils.js';
|
|
5
5
|
export default class Update extends Command {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command } from '@heroku-cli/command';
|
|
2
|
-
import * as color from '@heroku/heroku-cli-util/color';
|
|
3
3
|
import { Args, ux } from '@oclif/core';
|
|
4
4
|
import AccountsModule from '../../lib/accounts/accounts.js';
|
|
5
5
|
export default class Add extends Command {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Command } from '@heroku-cli/command';
|
|
2
1
|
import { color, hux } from '@heroku/heroku-cli-util';
|
|
3
|
-
import {
|
|
2
|
+
import { Command } from '@heroku-cli/command';
|
|
3
|
+
import { ux } from '@oclif/core';
|
|
4
4
|
import AccountsModule from '../../lib/accounts/accounts.js';
|
|
5
5
|
export default class Current extends Command {
|
|
6
6
|
static baseFlags = Command.baseFlagsWithoutPrompt();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command } from '@heroku-cli/command';
|
|
2
|
-
import
|
|
3
|
-
import { ux } from '@oclif/core/ux';
|
|
3
|
+
import { ux } from '@oclif/core';
|
|
4
4
|
import accountsModule from '../../lib/accounts/accounts.js';
|
|
5
5
|
export default class AccountsIndex extends Command {
|
|
6
6
|
static baseFlags = Command.baseFlagsWithoutPrompt();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command } from '@heroku-cli/command';
|
|
2
|
-
import * as color from '@heroku/heroku-cli-util/color';
|
|
3
3
|
import { Args, ux } from '@oclif/core';
|
|
4
4
|
import AccountsModule from '../../lib/accounts/accounts.js';
|
|
5
5
|
export default class Remove extends Command {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command } from '@heroku-cli/command';
|
|
2
|
-
import * as color from '@heroku/heroku-cli-util/color';
|
|
3
3
|
import { Args, ux } from '@oclif/core';
|
|
4
4
|
import AccountsModule from '../../lib/accounts/accounts.js';
|
|
5
5
|
export default class Set extends Command {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command, flags } from '@heroku-cli/command';
|
|
2
|
-
import
|
|
2
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
3
3
|
import { Args, ux } from '@oclif/core';
|
|
4
4
|
import { trapConfirmationRequired } from '../../lib/addons/util.js';
|
|
5
5
|
export default class Attach extends Command {
|
|
@@ -1,10 +1,42 @@
|
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command, flags } from '@heroku-cli/command';
|
|
2
|
-
import * as color from '@heroku/heroku-cli-util/color';
|
|
3
3
|
import { Args, ux } from '@oclif/core';
|
|
4
4
|
import tsheredoc from 'tsheredoc';
|
|
5
5
|
import createAddon from '../../lib/addons/create_addon.js';
|
|
6
6
|
import notify from '../../lib/notify.js';
|
|
7
7
|
const heredoc = tsheredoc.default;
|
|
8
|
+
function parseConfig(args) {
|
|
9
|
+
const config = {};
|
|
10
|
+
while (args.length > 0) {
|
|
11
|
+
let key = args.shift();
|
|
12
|
+
if (!key.startsWith('--'))
|
|
13
|
+
throw new Error(`Unexpected argument ${key}`);
|
|
14
|
+
key = key.replace(/^--/, '');
|
|
15
|
+
let val;
|
|
16
|
+
if (key.includes('=')) {
|
|
17
|
+
[key, ...val] = key.split('=');
|
|
18
|
+
val = val.join('=');
|
|
19
|
+
if (val === 'true') {
|
|
20
|
+
val = true;
|
|
21
|
+
}
|
|
22
|
+
config[key] = val;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
val = args.shift();
|
|
26
|
+
if (!val) {
|
|
27
|
+
config[key] = true;
|
|
28
|
+
}
|
|
29
|
+
else if (val.startsWith('--')) {
|
|
30
|
+
config[key] = true;
|
|
31
|
+
args.unshift(val);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
config[key] = val;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return config;
|
|
39
|
+
}
|
|
8
40
|
export default class Create extends Command {
|
|
9
41
|
static args = {
|
|
10
42
|
'service:plan': Args.string({ description: 'unique identifier or unique name of the add-on service plan', required: true }),
|
|
@@ -66,35 +98,3 @@ export default class Create extends Command {
|
|
|
66
98
|
ux.stdout(`Run ${color.code('heroku addons:docs ' + addon?.addon_service?.name || '')} to view documentation.`);
|
|
67
99
|
}
|
|
68
100
|
}
|
|
69
|
-
function parseConfig(args) {
|
|
70
|
-
const config = {};
|
|
71
|
-
while (args.length > 0) {
|
|
72
|
-
let key = args.shift();
|
|
73
|
-
if (!key.startsWith('--'))
|
|
74
|
-
throw new Error(`Unexpected argument ${key}`);
|
|
75
|
-
key = key.replace(/^--/, '');
|
|
76
|
-
let val;
|
|
77
|
-
if (key.includes('=')) {
|
|
78
|
-
[key, ...val] = key.split('=');
|
|
79
|
-
val = val.join('=');
|
|
80
|
-
if (val === 'true') {
|
|
81
|
-
val = true;
|
|
82
|
-
}
|
|
83
|
-
config[key] = val;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
val = args.shift();
|
|
87
|
-
if (!val) {
|
|
88
|
-
config[key] = true;
|
|
89
|
-
}
|
|
90
|
-
else if (val.startsWith('--')) {
|
|
91
|
-
config[key] = true;
|
|
92
|
-
args.unshift(val);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
config[key] = val;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return config;
|
|
100
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command, flags } from '@heroku-cli/command';
|
|
2
|
-
import * as color from '@heroku/heroku-cli-util/color';
|
|
3
3
|
import { Args, ux } from '@oclif/core';
|
|
4
4
|
export default class Detach extends Command {
|
|
5
5
|
static args = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { color, hux } from '@heroku/heroku-cli-util';
|
|
2
2
|
import { Command, flags } from '@heroku-cli/command';
|
|
3
|
-
import { ux } from '@oclif/core
|
|
3
|
+
import { ux } from '@oclif/core';
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
import { formatPrice, formatState, grandfatheredPrice } from '../../lib/addons/util.js';
|
|
6
6
|
const topic = 'addons';
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
import { Command } from '@heroku-cli/command';
|
|
2
|
-
export interface AddonSso {
|
|
3
|
-
/**
|
|
4
|
-
* URL of the SSO request
|
|
5
|
-
*/
|
|
6
|
-
action: string;
|
|
7
|
-
/**
|
|
8
|
-
* SSO request method
|
|
9
|
-
*/
|
|
10
|
-
method: 'get' | 'post';
|
|
11
|
-
/**
|
|
12
|
-
* SSO params for POST request
|
|
13
|
-
*/
|
|
14
|
-
params?: SsoParams;
|
|
15
|
-
}
|
|
16
2
|
export interface SsoParams {
|
|
17
3
|
/**
|
|
18
4
|
* billing app name
|
|
@@ -55,6 +41,20 @@ export interface SsoParams {
|
|
|
55
41
|
*/
|
|
56
42
|
user_id: string;
|
|
57
43
|
}
|
|
44
|
+
export interface AddonSso {
|
|
45
|
+
/**
|
|
46
|
+
* URL of the SSO request
|
|
47
|
+
*/
|
|
48
|
+
action: string;
|
|
49
|
+
/**
|
|
50
|
+
* SSO request method
|
|
51
|
+
*/
|
|
52
|
+
method: 'get' | 'post';
|
|
53
|
+
/**
|
|
54
|
+
* SSO params for POST request
|
|
55
|
+
*/
|
|
56
|
+
params?: SsoParams;
|
|
57
|
+
}
|
|
58
58
|
export default class Open extends Command {
|
|
59
59
|
static args: {
|
|
60
60
|
addon: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as color from '@heroku/heroku-cli-util/color';
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
3
2
|
import { HTTPError } from '@heroku/http-call';
|
|
3
|
+
import { Command, flags } from '@heroku-cli/command';
|
|
4
4
|
import { Args, ux } from '@oclif/core';
|
|
5
5
|
import fs from 'node:fs/promises';
|
|
6
6
|
import os from 'node:os';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Command, flags } from '@heroku-cli/command';
|
|
2
1
|
import { color, hux } from '@heroku/heroku-cli-util';
|
|
3
|
-
import {
|
|
2
|
+
import { Command, flags } from '@heroku-cli/command';
|
|
3
|
+
import { ux } from '@oclif/core';
|
|
4
4
|
export default class Services extends Command {
|
|
5
5
|
static description = 'list all available add-on services';
|
|
6
6
|
static flags = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command, flags } from '@heroku-cli/command';
|
|
2
3
|
import { HerokuAPIError } from '@heroku-cli/command/lib/api-client.js';
|
|
3
|
-
import * as color from '@heroku/heroku-cli-util/color';
|
|
4
4
|
import { Args, ux } from '@oclif/core';
|
|
5
5
|
import { addonResolver } from '../../lib/addons/resolve.js';
|
|
6
6
|
import { formatPriceText } from '../../lib/addons/util.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command, flags } from '@heroku-cli/command';
|
|
2
|
-
import * as color from '@heroku/heroku-cli-util/color';
|
|
3
3
|
import { Args, ux } from '@oclif/core';
|
|
4
|
-
import {
|
|
4
|
+
import { waitForAddonProvisioning, waitForAddonDeprovisioning } from '../../lib/addons/addons_wait.js';
|
|
5
5
|
import { resolveAddon } from '../../lib/addons/resolve.js';
|
|
6
6
|
import notify from '../../lib/notify.js';
|
|
7
7
|
export default class Wait extends Command {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command, flags } from '@heroku-cli/command';
|
|
2
|
-
import * as color from '@heroku/heroku-cli-util/color';
|
|
3
3
|
import { Args, ux } from '@oclif/core';
|
|
4
4
|
import * as git from '../../lib/ci/git.js';
|
|
5
5
|
import ConfirmCommand from '../../lib/confirmCommand.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Command, flags } from '@heroku-cli/command';
|
|
2
1
|
import { color, hux } from '@heroku/heroku-cli-util';
|
|
3
|
-
import {
|
|
2
|
+
import { Command, flags } from '@heroku-cli/command';
|
|
3
|
+
import { ux } from '@oclif/core';
|
|
4
4
|
import errorInfo from '../../lib/apps/error_info.js';
|
|
5
5
|
const colorize = (level, s) => {
|
|
6
6
|
switch (level) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command, flags } from '@heroku-cli/command';
|
|
2
|
-
import
|
|
3
|
-
import { ux } from '@oclif/core/ux';
|
|
3
|
+
import { ux } from '@oclif/core';
|
|
4
4
|
export default class Add extends Command {
|
|
5
5
|
static description = 'favorites an app';
|
|
6
6
|
static flags = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Command, flags } from '@heroku-cli/command';
|
|
2
1
|
import { color, hux } from '@heroku/heroku-cli-util';
|
|
3
|
-
import {
|
|
2
|
+
import { Command, flags } from '@heroku-cli/command';
|
|
3
|
+
import { ux } from '@oclif/core';
|
|
4
4
|
export default class Index extends Command {
|
|
5
5
|
static description = 'list favorited apps';
|
|
6
6
|
static flags = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { color } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command, flags } from '@heroku-cli/command';
|
|
2
|
-
import
|
|
3
|
-
import { ux } from '@oclif/core/ux';
|
|
3
|
+
import { ux } from '@oclif/core';
|
|
4
4
|
export default class Remove extends Command {
|
|
5
5
|
static description = 'unfavorites an app';
|
|
6
6
|
static flags = {
|
|
@@ -1,8 +1,65 @@
|
|
|
1
|
+
import { color, hux } from '@heroku/heroku-cli-util';
|
|
1
2
|
import { Command, flags } from '@heroku-cli/command';
|
|
2
3
|
import { SpaceCompletion } from '@heroku-cli/command/lib/completions.js';
|
|
3
|
-
import {
|
|
4
|
-
import { ux } from '@oclif/core/ux';
|
|
4
|
+
import { ux } from '@oclif/core';
|
|
5
5
|
import _ from 'lodash';
|
|
6
|
+
function annotateAppName(app) {
|
|
7
|
+
let name = color.app(app.name);
|
|
8
|
+
if (app.locked && app.internal_routing) {
|
|
9
|
+
name = `${color.app(app.name)} [internal/locked]`;
|
|
10
|
+
}
|
|
11
|
+
else if (app.locked) {
|
|
12
|
+
name = `${color.app(app.name)} [locked]`;
|
|
13
|
+
}
|
|
14
|
+
else if (app.internal_routing) {
|
|
15
|
+
name = `${color.app(app.name)} [internal]`;
|
|
16
|
+
}
|
|
17
|
+
return name;
|
|
18
|
+
}
|
|
19
|
+
function regionizeAppName(app) {
|
|
20
|
+
const name = annotateAppName(app);
|
|
21
|
+
if (app.region && app.region.name !== 'us') {
|
|
22
|
+
return `${name} (${color.info(app.region.name)})`;
|
|
23
|
+
}
|
|
24
|
+
return name;
|
|
25
|
+
}
|
|
26
|
+
function listApps(apps) {
|
|
27
|
+
apps.forEach((app) => ux.stdout(regionizeAppName(app)));
|
|
28
|
+
}
|
|
29
|
+
function print(apps, user, space, team) {
|
|
30
|
+
if (apps.length === 0) {
|
|
31
|
+
if (space)
|
|
32
|
+
ux.stdout(`There are no apps in space ${color.space(space)}.`);
|
|
33
|
+
else if (team)
|
|
34
|
+
ux.stdout(`There are no apps in team ${color.team(team)}.`);
|
|
35
|
+
else
|
|
36
|
+
ux.stdout('You have no apps.');
|
|
37
|
+
}
|
|
38
|
+
else if (space) {
|
|
39
|
+
hux.styledHeader(`Apps in space ${color.space(space)}`);
|
|
40
|
+
listApps(apps);
|
|
41
|
+
}
|
|
42
|
+
else if (team) {
|
|
43
|
+
hux.styledHeader(`Apps in team ${color.team(team)}`);
|
|
44
|
+
listApps(apps);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
apps = _.partition(apps, (app) => app.owner.email === user.email);
|
|
48
|
+
if (apps[0].length > 0) {
|
|
49
|
+
hux.styledHeader(`${color.user(user.email)} Apps`);
|
|
50
|
+
listApps(apps[0]);
|
|
51
|
+
}
|
|
52
|
+
const columns = {
|
|
53
|
+
Name: { get: regionizeAppName },
|
|
54
|
+
// eslint-disable-next-line perfectionist/sort-objects
|
|
55
|
+
Email: { get: ({ owner }) => color.user(owner.email) },
|
|
56
|
+
};
|
|
57
|
+
if (apps[1].length > 0) {
|
|
58
|
+
ux.stdout();
|
|
59
|
+
hux.table(apps[1], columns, { title: 'Collaborated Apps\n', titleOptions: { bold: true } });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
6
63
|
export default class AppsIndex extends Command {
|
|
7
64
|
static description = 'list your apps';
|
|
8
65
|
static examples = [
|
|
@@ -58,60 +115,3 @@ export default class AppsIndex extends Command {
|
|
|
58
115
|
}
|
|
59
116
|
}
|
|
60
117
|
}
|
|
61
|
-
function annotateAppName(app) {
|
|
62
|
-
let name = color.app(app.name);
|
|
63
|
-
if (app.locked && app.internal_routing) {
|
|
64
|
-
name = `${color.app(app.name)} [internal/locked]`;
|
|
65
|
-
}
|
|
66
|
-
else if (app.locked) {
|
|
67
|
-
name = `${color.app(app.name)} [locked]`;
|
|
68
|
-
}
|
|
69
|
-
else if (app.internal_routing) {
|
|
70
|
-
name = `${color.app(app.name)} [internal]`;
|
|
71
|
-
}
|
|
72
|
-
return name;
|
|
73
|
-
}
|
|
74
|
-
function listApps(apps) {
|
|
75
|
-
apps.forEach((app) => ux.stdout(regionizeAppName(app)));
|
|
76
|
-
}
|
|
77
|
-
function print(apps, user, space, team) {
|
|
78
|
-
if (apps.length === 0) {
|
|
79
|
-
if (space)
|
|
80
|
-
ux.stdout(`There are no apps in space ${color.space(space)}.`);
|
|
81
|
-
else if (team)
|
|
82
|
-
ux.stdout(`There are no apps in team ${color.team(team)}.`);
|
|
83
|
-
else
|
|
84
|
-
ux.stdout('You have no apps.');
|
|
85
|
-
}
|
|
86
|
-
else if (space) {
|
|
87
|
-
hux.styledHeader(`Apps in space ${color.space(space)}`);
|
|
88
|
-
listApps(apps);
|
|
89
|
-
}
|
|
90
|
-
else if (team) {
|
|
91
|
-
hux.styledHeader(`Apps in team ${color.team(team)}`);
|
|
92
|
-
listApps(apps);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
apps = _.partition(apps, (app) => app.owner.email === user.email);
|
|
96
|
-
if (apps[0].length > 0) {
|
|
97
|
-
hux.styledHeader(`${color.user(user.email)} Apps`);
|
|
98
|
-
listApps(apps[0]);
|
|
99
|
-
}
|
|
100
|
-
const columns = {
|
|
101
|
-
Name: { get: regionizeAppName },
|
|
102
|
-
// eslint-disable-next-line perfectionist/sort-objects
|
|
103
|
-
Email: { get: ({ owner }) => color.user(owner.email) },
|
|
104
|
-
};
|
|
105
|
-
if (apps[1].length > 0) {
|
|
106
|
-
ux.stdout();
|
|
107
|
-
hux.table(apps[1], columns, { title: 'Collaborated Apps\n', titleOptions: { bold: true } });
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
function regionizeAppName(app) {
|
|
112
|
-
const name = annotateAppName(app);
|
|
113
|
-
if (app.region && app.region.name !== 'us') {
|
|
114
|
-
return `${name} (${color.info(app.region.name)})`;
|
|
115
|
-
}
|
|
116
|
-
return name;
|
|
117
|
-
}
|