Skip to content

Commit

Permalink
Use crypto.randomUUID() instead of cuid() (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina authored Oct 14, 2023
1 parent bb0dea9 commit a44bbd4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 223 deletions.
2 changes: 0 additions & 2 deletions packages/pg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"@databases/shared": "^0.0.0",
"@databases/split-sql-query": "^0.0.0",
"@databases/sql": "^0.0.0",
"@types/cuid": "^1.3.1",
"assert-never": "^1.2.1",
"cuid": "^2.1.8",
"pg": "^8.4.2",
"pg-cursor": "^2.4.2"
},
Expand Down
4 changes: 1 addition & 3 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
"@databases/lock": "^0.0.0",
"@databases/queue": "^0.0.0",
"@databases/split-sql-query": "^0.0.0",
"@databases/sql": "^0.0.0",
"cuid": "^2.1.8"
"@databases/sql": "^0.0.0"
},
"devDependencies": {
"@types/cuid": "^1.3.1"
},
"scripts": {},
"repository": "https://github.com/ForbesLindesay/atdatabases/tree/master/packages/shared",
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/src/BaseTransaction.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import splitSqlQuery from '@databases/split-sql-query';
import type {SQLQuery} from '@databases/sql';
import cuid = require('cuid');
import {randomUUID} from 'crypto';
import {
Disposable,
TransactionFactory,
Expand Down Expand Up @@ -55,7 +55,7 @@ export default class BaseTransaction<
this._throwIfDisposed();
await this._lock.acquireLock();
try {
const savepointName = cuid();
const savepointName = 's' + randomUUID().replace(/-/g, '');
await this._driver.createSavepoint(savepointName);
const subTransaction = this._factories.createTransaction(
this._driver,
Expand Down
Loading

0 comments on commit a44bbd4

Please sign in to comment.