import { dalSelectEntitlementForUpdate } from "../data-access/runtime/entitlements.js";

//#region src/auth/entitlement-lock.ts
async function withEntitlementLock(db, orgId, resourceType, fn) {
	return db.transaction(async (tx) => {
		return fn(await dalSelectEntitlementForUpdate(tx, orgId, resourceType), tx);
	});
}

//#endregion
export { withEntitlementLock };