1- /*
2- import color from '@heroku-cli/color'
1+ import { color } from '@heroku-cli/color'
32import { APIClient } from '@heroku-cli/command'
43import { ux } from '@oclif/core'
5- import heredoc from 'tsheredoc'
4+ import tsheredoc from 'tsheredoc'
65import { utils } from '@heroku/heroku-cli-util'
7- import type {BackupTransfer} from './types'
6+ import type { BackupTransfer } from './types.js '
87import bytes = require( 'bytes' )
98
9+ const heredoc = tsheredoc . default
10+
1011function 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 ( / ^ [ a b c r ] ( \d + ) $ / )
6970 if ( m ) return Number . parseInt ( m [ 1 ] , 10 )
7071 m = name . match ( / ^ o [ a b ] \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
173174export default factory
174- */
0 commit comments