🧐 Improve inspectTypebot script abort process
This commit is contained in:
@ -1,21 +1,26 @@
|
|||||||
import { PrismaClient } from '@typebot.io/prisma'
|
import { PrismaClient } from '@typebot.io/prisma'
|
||||||
import { promptAndSetEnvironment } from './utils'
|
import { promptAndSetEnvironment } from './utils'
|
||||||
import * as p from '@clack/prompts'
|
import * as p from '@clack/prompts'
|
||||||
|
import { isCancel } from '@clack/prompts'
|
||||||
|
|
||||||
const inspectTypebot = async () => {
|
const inspectTypebot = async () => {
|
||||||
await promptAndSetEnvironment('production')
|
await promptAndSetEnvironment('production')
|
||||||
|
|
||||||
const type = (await p.select({
|
const type = await p.select<any, 'id' | 'publicId'>({
|
||||||
message: 'Select way',
|
message: 'Select way',
|
||||||
options: [
|
options: [
|
||||||
{ label: 'ID', value: 'id' },
|
{ label: 'ID', value: 'id' },
|
||||||
{ label: 'Public ID', value: 'publicId' },
|
{ label: 'Public ID', value: 'publicId' },
|
||||||
],
|
],
|
||||||
})) as 'id' | 'publicId'
|
})
|
||||||
|
|
||||||
const val = (await p.text({
|
if (!type || isCancel(type)) process.exit()
|
||||||
|
|
||||||
|
const val = await p.text({
|
||||||
message: 'Enter value',
|
message: 'Enter value',
|
||||||
})) as string
|
})
|
||||||
|
|
||||||
|
if (!val || isCancel(val)) process.exit()
|
||||||
|
|
||||||
const prisma = new PrismaClient({
|
const prisma = new PrismaClient({
|
||||||
log: [{ emit: 'event', level: 'query' }, 'info', 'warn', 'error'],
|
log: [{ emit: 'event', level: 'query' }, 'info', 'warn', 'error'],
|
||||||
|
Reference in New Issue
Block a user