1.0.6 • Published 12 months ago
trace-prisma v1.0.6
• The application is intended to log certain transactions in the mongodb database, each transaction has a name, status and a trace(optional), a trace has a name, status, body(json). • Each time your code runs and has the "transaction.start" method, a new transaction will be created • When using one of the methods that will update the transaction, only the most current transaction will be changed. • The transaction has five methods: - start: creates a transaction (with pending status) - alert: sets the status to alert - rejected: sets the status to rejected - error: sets the status to error - success: sets the status to success - trace: create a trace
npm i trace-prisma
const { Transection } = require('trace-prisma')
const transaction = new Transection('646faf02b716b92a81bfc181') //Job id
async function test() {
await transaction.start('Transaction_name')
await transaction.trace('Transaction_name', {body: {name: 'Jhon', age: 20}}, 'success', 'traceName')
if (true){
await transaction.success('Transaction_name')
}
}
test()