@sqb/connect
Advanced tools
Comparing version 4.0.1-beta.47 to 4.0.1-beta.48
@@ -22,2 +22,5 @@ import { classes } from '@sqb/builder'; | ||
startTransaction: () => Promise<void>; | ||
setSavepoint?: (savepoint: string) => Promise<void>; | ||
releaseSavepoint?: (savepoint: string) => Promise<void>; | ||
rollbackSavepoint?: (savepoint: string) => Promise<void>; | ||
commit: () => Promise<void>; | ||
@@ -28,2 +31,3 @@ rollback: () => Promise<void>; | ||
onGenerateQuery?: (request: QueryRequest, query: classes.Query) => void; | ||
getInTransaction?: () => boolean; | ||
} | ||
@@ -30,0 +34,0 @@ interface Cursor { |
@@ -15,2 +15,5 @@ import { classes } from '@sqb/builder'; | ||
'start-transaction': () => void; | ||
'set-savepoint': () => void; | ||
'release-savepoint': () => void; | ||
'rollback-savepoint': () => void; | ||
commit: () => void; | ||
@@ -66,2 +69,5 @@ rollback: () => void; | ||
rollback(): Promise<void>; | ||
setSavepoint(savepoint: string): Promise<void>; | ||
releaseSavepoint(savepoint: string): Promise<void>; | ||
rollbackSavepoint(savepoint: string): Promise<void>; | ||
test(): Promise<void>; | ||
@@ -68,0 +74,0 @@ private _prepareQueryRequest; |
@@ -44,2 +44,5 @@ "use strict"; | ||
get inTransaction() { | ||
if (this._intlcon && typeof this._intlcon.getInTransaction === 'function') { | ||
this._inTransaction = this._intlcon.getInTransaction(); | ||
} | ||
return this._inTransaction; | ||
@@ -189,2 +192,28 @@ } | ||
} | ||
async setSavepoint(savepoint) { | ||
if (!this._intlcon) | ||
throw new Error('Can not call setSavepoint() on a released connection'); | ||
if (typeof this._intlcon.setSavepoint !== 'function') | ||
throw new Error(this.client.driver + ' does not support setSavepoint method'); | ||
if (!this.inTransaction) | ||
await this.startTransaction(); | ||
await this._intlcon.setSavepoint(savepoint); | ||
this.emit('set-savepoint'); | ||
} | ||
async releaseSavepoint(savepoint) { | ||
if (!this._intlcon) | ||
throw new Error('Can not call releaseSavepoint() on a released connection'); | ||
if (typeof this._intlcon.releaseSavepoint !== 'function') | ||
throw new Error(this.client.driver + ' does not support releaseSavepoint method'); | ||
await this._intlcon.releaseSavepoint(savepoint); | ||
this.emit('release-savepoint'); | ||
} | ||
async rollbackSavepoint(savepoint) { | ||
if (!this._intlcon) | ||
throw new Error('Can not call rollbackSavepoint() on a released connection'); | ||
if (typeof this._intlcon.rollbackSavepoint !== 'function') | ||
throw new Error(this.client.driver + ' does not support rollbackSavepoint method'); | ||
await this._intlcon.rollbackSavepoint(savepoint); | ||
this.emit('rollback-savepoint'); | ||
} | ||
async test() { | ||
@@ -191,0 +220,0 @@ if (!this._intlcon) |
@@ -214,3 +214,7 @@ "use strict"; | ||
const current = this.get(ctor); | ||
const entity = ctor[orm_const_1.ENTITY_DEFINITION_KEY] = new EntityModel(ctor); | ||
const entity = new EntityModel(ctor); | ||
Object.defineProperty(ctor, orm_const_1.ENTITY_DEFINITION_KEY, { | ||
value: entity, | ||
enumerable: false | ||
}); | ||
// Merge base entity columns into this one | ||
@@ -217,0 +221,0 @@ if (current) { |
{ | ||
"name": "@sqb/connect", | ||
"description": "Multi-dialect database connection framework written with TypeScript", | ||
"version": "4.0.1-beta.47", | ||
"version": "4.0.1-beta.48", | ||
"author": "Panates Ltd.", | ||
@@ -48,3 +48,3 @@ "contributors": [ | ||
"peerDependencies": { | ||
"@sqb/builder": "^4.0.1-beta.46" | ||
"@sqb/builder": "^4.0.1-beta.48" | ||
}, | ||
@@ -75,2 +75,2 @@ "main": "dist/index.js", | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
188509
4703
10