New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@uql/sqlite

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uql/sqlite - npm Package Compare versions

Comparing version 0.4.62 to 0.4.63

8

package.json

@@ -6,3 +6,3 @@ {

"license": "MIT",
"version": "0.4.62",
"version": "0.4.63",
"main": "index.js",

@@ -21,8 +21,8 @@ "types": "index.d.ts",

"peerDependencies": {
"@uql/core": "^0.4.59"
"@uql/core": "^0.4.62"
},
"devDependencies": {
"@types/node": "^16.4.3",
"@types/node": "^16.4.7",
"@types/sqlite3": "^3.1.7",
"@uql/core": "^0.4.62",
"@uql/core": "^0.4.63",
"copyfiles": "^2.4.1",

@@ -29,0 +29,0 @@ "rimraf": "^3.0.2",

@@ -19,3 +19,3 @@ # [uql](https://uql.io) · [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/impensables/uql/blob/master/LICENSE) [![tests](https://github.com/impensables/uql/actions/workflows/tests.yml/badge.svg)](https://github.com/impensables/uql) [![coverage status](https://coveralls.io/repos/impensables/uql/badge.svg?branch=master)](https://coveralls.io/r/impensables/uql?branch=master) [![npm version](https://badge.fury.io/js/%40uql%2Fcore.svg)](https://badge.fury.io/js/%40uql%2Fcore)

- `$project`, `$filter`, `$sort`, `$limit` works at multiple levels (including deep relations and their fields).
- declarative and programmatic `transactions`.
- declarative and imperative `transactions`.
- `soft-delete`, `virtual fields`, `repositories`, `connection pooling`.

@@ -33,3 +33,3 @@ - different kinds of `relations` between entities.

4. [Declarative Transactions](#declarative-transactions)
5. [Programmatic Transactions](#programmatic-transactions)
5. [Imperative Transactions](#imperative-transactions)
6. [Generate REST APIs with Express](#express)

@@ -203,3 +203,3 @@ 7. [Consume REST APIs from the Frontend](#client)

Both, _declarative_ and _programmatic_ transactions are supported, with the former you can just describe the scope of your transactions, with the later you have more flexibility (hence more responsibility).
Both, _declarative_ and _imperative_ transactions are supported, with the former you can just describe the scope of your transactions, with the later you have more flexibility (hence more responsibility).

@@ -241,15 +241,11 @@ To use Declarative Transactions (using the `@Transactional` decorator):

## <a name="programmatic-transactions"></a> Programmatic Transactions
## <a name="imperative-transactions"></a> Imperative Transactions
`uql` supports both, _declarative_ and _programmatic_ transactions, with the former you can just describe the scope of your transactions, with the later you have more flexibility (hence more responsibility).
`uql` supports both, _declarative_ and _imperative_ transactions, with the former you can just describe the scope of your transactions, with the later you have more flexibility (hence more responsibility).
To use Programmatic Transactions:
To use Imperative Transactions:
1. obtain the `querier` object with `await getQuerier()`.
2. open a `try/catch/finally` block.
3. start the transaction with `await querier.beginTransaction()`.
4. perform the different operations using the `querier` or `repositories`.
5. commit the transaction with `await querier.commitTransaction()`.
6. in the `catch` block, add `await querier.rollbackTransaction()`.
7. release the `querier` back to the pool with `await querier.release()` in the `finally` block.
2. run the transaction with `await querier.transaction(callback)`.
3. perform the different operations using the same `querier` (or `repositories`) inside your `callback` function.

@@ -261,2 +257,24 @@ ```ts

const querier = await getQuerier();
await querier.transaction(async () => {
if (confirmation.action === 'signup') {
await querier.insertOne(User, {
name: confirmation.name,
email: confirmation.email,
password: confirmation.password,
});
} else {
await querier.updateOneById(User, confirmation.creatorId, { password: confirmation.password });
}
await querier.updateOneById(Confirmation, confirmation.id, { status: 1 });
});
}
```
---
The above code could also be implemented as below (even more granular control):
```ts
async function confirmAction(confirmation: Confirmation): Promise<void> {
const querier = await getQuerier();
try {

@@ -263,0 +281,0 @@ await querier.beginTransaction();

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc