UNPKG

auto-builder-sdk

Version:

SDK for building Auto Builder workflow plugins

22 lines (21 loc) 638 B
/** * The Auto-Builder engine injects its singleton PrismaClient at boot time so * plugin nodes can share the existing connection pool instead of opening * their own. */ let prisma; /** Engine-side hook – do **not** call this from plugin code. */ export const _injectPrisma = (client) => { prisma = client; }; /** * Obtain the shared Prisma client. * * @throws Error if the engine has not injected the client yet (should never * happen inside Auto-Builder but is useful in unit tests). */ export const getDb = () => { if (!prisma) throw new Error('Prisma client not initialised'); return prisma; };