Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const response = await this.webhooksClient.post(`${path}/webhooks`, {
body: {
include: flags.include.split(',').map(s => s.trim()),
level: flags.level,
secret: flags.secret,
url: flags.url,
authorization: flags.authorization,
},
})
const secret = response.headers && response.headers['heroku-webhook-secret'] as string
cli.action.stop()
if (secret) {
cli.styledHeader('Webhooks Signing Secret')
this.log(secret)
} else {
cli.warn('no secret found')
}
}
}
cli.action.start(`Updating ${color.cyan(args.id)}`)
const {body: client} = await this.heroku.post(
`/oauth/clients/${encodeURIComponent(args.id)}/actions/rotate-credentials`,
)
cli.action.stop()
if (flags.json) {
cli.styledJSON(client)
} else if (flags.shell) {
cli.log(`HEROKU_OAUTH_ID=${client.id}`)
cli.log(`HEROKU_OAUTH_SECRET=${client.secret}`)
} else {
cli.styledHeader(`${client.name}`)
cli.styledObject(client)
}
}
}
async run() {
let {flags} = this.parse(Index)
let buildpacksCommand = new BuildpackCommand(this.heroku)
let buildpacks = await buildpacksCommand.fetch(flags.app)
if (buildpacks.length === 0) {
this.log(`${flags.app} has no Buildpack URL set.`)
} else {
cli.styledHeader(`${flags.app} Buildpack URL${buildpacks.length > 1 ? 's' : ''}`)
buildpacksCommand.display(buildpacks, '')
}
}
}
Created: delivery.created_at,
Event: delivery.event.id,
Webhook: delivery.webhook.id,
Status: delivery.status,
Include: delivery.event.include,
Level: delivery.webhook.level,
Attempts: delivery.num_attempts,
Code: delivery.last_attempt && delivery.last_attempt.code,
Error: delivery.last_attempt && delivery.last_attempt.error_class,
'Next Attempt': delivery.next_attempt_at
}
cli.styledHeader(delivery.id)
cli.styledObject(obj)
cli.styledHeader('Event Payload')
cli.styledJSON(event.payload)
}
}
async run() {
const {flags, args} = this.parse(Info)
const {path} = this.webhookType(flags)
cli.warn('heroku webhooks:event:info is deprecated, please use heroku webhooks:deliveries:info')
const {body: webhookEvent} = await this.webhooksClient.get(`${path}/webhook-events/${args.id}`)
const obj = {
payload: JSON.stringify(webhookEvent.payload, null, 2),
}
cli.styledHeader(webhookEvent.id)
cli.styledObject(obj)
}
}
Ok: buildpack => {
cli.styledHeader(args.buildpack)
cli.styledObject(buildpack, ['description', 'category', 'license', 'support', 'source', 'readme'])
},
Err: err => {
async run() {
const {args, flags} = this.parse(ClientsInfo)
const {body: client} = await this.heroku.get(`/oauth/clients/${args.id}`)
if (flags.json) {
cli.styledJSON(client)
} else if (flags.shell) {
cli.log(`HEROKU_OAUTH_ID=${client.id}`)
cli.log(`HEROKU_OAUTH_SECRET=${client.secret}`)
} else {
cli.styledHeader(`${client.name}`)
cli.styledObject(client)
}
}
}
const {body: event} = await this.webhooksClient.get(`${path}/webhook-events/${delivery.event.id}`)
const obj = {
Created: delivery.created_at,
Event: delivery.event.id,
Webhook: delivery.webhook.id,
Status: delivery.status,
Include: delivery.event.include,
Level: delivery.webhook.level,
Attempts: delivery.num_attempts,
Code: delivery.last_attempt && delivery.last_attempt.code,
Error: delivery.last_attempt && delivery.last_attempt.error_class,
'Next Attempt': delivery.next_attempt_at
}
cli.styledHeader(delivery.id)
cli.styledObject(obj)
cli.styledHeader('Event Payload')
cli.styledJSON(event.payload)
}
}
async run() {
const {flags, args} = this.parse(WebhooksInfo)
const {path} = this.webhookType(flags)
const {body: webhook} = await this.webhooksClient.get(`${path}/webhooks/${args.id}`)
const obj = {
'Webhook ID': webhook.id,
URL: webhook.url,
Include: webhook.include.join(','),
Level: webhook.level,
}
cli.styledHeader(webhook.id)
cli.styledObject(obj)
}
}