Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
13 lines
496 B
Plaintext
13 lines
496 B
Plaintext
/**
|
|
* Returns current db transaction instance from req or adapter.drizzle itself
|
|
*
|
|
* If a transaction session doesn't exist (e.g., it was already committed/rolled back),
|
|
* falls back to the default adapter.drizzle instance to prevent errors.
|
|
*/ export const getTransaction = async (adapter, req)=>{
|
|
if (!req?.transactionID) {
|
|
return adapter.drizzle;
|
|
}
|
|
return adapter.sessions[await req.transactionID]?.db || adapter.drizzle;
|
|
};
|
|
|
|
//# sourceMappingURL=getTransaction.js.map |