mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-01 17:24:57 +00:00
- Implemented unit tests for the WorkflowEngine, covering various scenarios including simple workflows, condition handling, and error cases. - Created a test coverage report generator to identify untested functions and provide actionable recommendations. - Added a symlink for vite 2 configuration to streamline build processes.
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
#!/usr/bin/env node
|
|
import { PrismaClient } from '@prisma/client'
|
|
import { dirname } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
const prisma = new PrismaClient()
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
|
|
const readStdin = async () => {
|
|
const chunks = []
|
|
for await (const chunk of process.stdin) {
|
|
chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk)
|
|
}
|
|
return Buffer.concat(chunks).toString('utf-8')
|
|
}
|
|
|
|
const main = async () => {
|
|
try {
|
|
await prisma.$connect()
|
|
|
|
const input = await readStdin()
|
|
let payload = {}
|
|
try {
|
|
payload = input ? JSON.parse(input) : {}
|
|
} catch {
|
|
// ignore parse errors
|
|
}
|
|
|
|
if (payload?.action === 'status') {
|
|
console.log(JSON.stringify({ status: 'ok', version: 'native-prisma-bridge' }))
|
|
return
|
|
}
|
|
|
|
console.log(JSON.stringify({ status: 'ok', message: 'Native Prisma bridge ready', payload }))
|
|
} catch (error) {
|
|
console.error(JSON.stringify({ status: 'error', error: error instanceof Error ? error.message : 'unknown' }))
|
|
process.exit(1)
|
|
} finally {
|
|
await prisma.$disconnect()
|
|
}
|
|
}
|
|
|
|
void main()
|