A @Transactional method decorator for Sequelize (v4-6) inspired by Spring's @Transactional annotation. Version 1.0.1 is the latest stable; released 2021. Provides declarative transaction management, various propagation behaviors (REQUIRED, REQUIRES_NEW, etc.), isolation levels, and easy NestJS integration via SequelizeTransactionalModule. Combines multiple service calls under one transaction using CLS (continuation-local-storage).
npm install sequelize-transactional-decoratorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize CLS, define a Sequelize model, and use @Transactional decorator on a method to wrap database operations in a transaction.
Call initSequelizeCLS() at the very beginning of your application, before creating any Sequelize instances.
Use Node.js >= 8.2 or polyfill async_hooks.
Consider using sequelize's built-in transaction support or test thoroughly with Sequelize v6.
Install a compatible version: npm install cls-hooked@2.0.1
Ensure initSequelizeCLS() is called at the top of your entry file, before any Sequelize operations.
Mock the @Transactional decorator in tests or ensure CLS is initialized.