Skip to content

Commit b992d15

Browse files
Merge branch 'v11.0.0' into tl/pg-fetcher-to-v11
2 parents 55e1898 + 492b111 commit b992d15

File tree

2 files changed

+390
-12
lines changed

2 files changed

+390
-12
lines changed

packages/cli/src/lib/pg/backups.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
/*
2-
import color from '@heroku-cli/color'
1+
import {color} from '@heroku-cli/color'
32
import {APIClient} from '@heroku-cli/command'
43
import {ux} from '@oclif/core'
5-
import heredoc from 'tsheredoc'
4+
import tsheredoc from 'tsheredoc'
65
import {utils} from '@heroku/heroku-cli-util'
7-
import type {BackupTransfer} from './types'
6+
import type {BackupTransfer} from './types.js'
87
import bytes = require('bytes')
98

9+
const heredoc = tsheredoc.default
10+
1011
function prefix(transfer: BackupTransfer) {
1112
if (transfer.from_type === 'pg_dump') {
1213
if (transfer.to_type === 'pg_restore') {
@@ -43,7 +44,7 @@ class Backups {
4344
return bytes(size, opts)
4445
}
4546

46-
public status = (transfer: BackupTransfer): string => {
47+
public status(transfer: BackupTransfer): string {
4748
if (transfer.finished_at && transfer.succeeded) {
4849
const warnings = transfer.warnings
4950
if (warnings > 0) {
@@ -64,7 +65,7 @@ class Backups {
6465
return 'Pending'
6566
}
6667

67-
public num = async (name: string) => {
68+
public async num(name: string): Promise<number | undefined> {
6869
let m = name.match(/^[abcr](\d+)$/)
6970
if (m) return Number.parseInt(m[1], 10)
7071
m = name.match(/^o[ab]\d+$/)
@@ -75,15 +76,15 @@ class Backups {
7576
}
7677
}
7778

78-
public name = (transfer: BackupTransfer) => {
79-
const oldPGBName = transfer.options && transfer.options.pgbackups_name
79+
public name(transfer: BackupTransfer): string {
80+
const oldPGBName = transfer.options?.pgbackups_name
8081
if (oldPGBName) return `o${oldPGBName}`
8182
return `${prefix(transfer)}${(transfer.num || '').toString().padStart(3, '0')}`
8283
}
8384

84-
public wait = async (action: string, transferID: string, interval: number, verbose: boolean, app: string) => {
85+
public async wait(action: string, transferID: string, interval: number, verbose: boolean, app: string): Promise<void> {
8586
if (verbose) {
86-
ux.log(`${action}...`)
87+
ux.stdout(`${action}...`)
8788
}
8889

8990
ux.action.start(action)
@@ -107,7 +108,7 @@ class Backups {
107108
}
108109

109110
this.logsAlreadyShown.add(log.created_at + log.message)
110-
ux.log(`${log.created_at} ${log.message}`)
111+
ux.stdout(`${log.created_at} ${log.message}`)
111112
}
112113
}
113114

@@ -171,4 +172,3 @@ function factory(app: string, heroku: APIClient) {
171172
}
172173

173174
export default factory
174-
*/

0 commit comments

Comments
 (0)