2
0

🧐 Add inspectWorkspace script

This commit is contained in:
Baptiste Arnaud
2024-01-10 11:11:12 +01:00
parent c1c053b0d1
commit 2b2e7c72f3
3 changed files with 52 additions and 0 deletions

View File

@ -29,6 +29,8 @@ const inspectTypebot = async () => {
id: true,
name: true,
riskLevel: true,
publicId: true,
customDomain: true,
workspace: {
select: {
id: true,

View File

@ -0,0 +1,49 @@
import { PrismaClient } from '@typebot.io/prisma'
import { promptAndSetEnvironment } from './utils'
import * as p from '@clack/prompts'
const inspectWorkspace = async () => {
await promptAndSetEnvironment('production')
const id = await p.text({
message: 'Workspace ID?',
})
if (!id || typeof id !== 'string') {
console.log('No ID provided')
return
}
const prisma = new PrismaClient({
log: [{ emit: 'event', level: 'query' }, 'info', 'warn', 'error'],
})
const workspace = await prisma.workspace.findFirst({
where: {
id,
},
include: {
typebots: {
select: {
id: true,
name: true,
},
},
members: {
select: {
user: { select: { email: true } },
role: true,
},
},
},
})
if (!workspace) {
console.log('Workspace not found')
return
}
console.log(JSON.stringify(workspace, null, 2))
}
inspectWorkspace()

View File

@ -24,6 +24,7 @@
"updateTypebot": "tsx updateTypebot.ts",
"updateWorkspace": "tsx updateWorkspace.ts",
"inspectTypebot": "tsx inspectTypebot.ts",
"inspectWorkspace": "tsx inspectWorkspace.ts",
"getCoupon": "tsx getCoupon.ts"
},
"devDependencies": {