Comparing version 33.1.1 to 33.2.0
@@ -50,2 +50,8 @@ import type { DbDict } from 'kmore-types'; | ||
constructor(options: KmoreFactoryOpts<D, Context>); | ||
/** | ||
* Start a transaction. | ||
*/ | ||
transaction(id?: PropertyKey): Promise<Knex.Transaction & { | ||
kmoreTrxId: symbol; | ||
}>; | ||
protected createRefTables<P extends string>(prefix: P, caseConvert: CaseType): DbQueryBuilder<Context, D, P, CaseType>; | ||
@@ -52,0 +58,0 @@ protected extRefTableFnProperty(refName: string, caseConvert: CaseType, ctx: Context | undefined): Knex.QueryBuilder; |
@@ -97,2 +97,17 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
} | ||
/** | ||
* Start a transaction. | ||
*/ | ||
async transaction(id) { | ||
const kmoreTrxId = typeof id === 'symbol' | ||
? id | ||
: id ? Symbol(id) : Symbol(Date.now().toString()); | ||
const trx = await this.dbh.transaction(); | ||
Object.defineProperty(trx, 'kmoreTrxId', { | ||
...defaultPropDescriptor, | ||
enumerable: false, | ||
value: kmoreTrxId, | ||
}); | ||
return trx; | ||
} | ||
createRefTables(prefix, caseConvert) { | ||
@@ -99,0 +114,0 @@ const rb = {}; |
{ | ||
"name": "kmore", | ||
"author": "waiting", | ||
"version": "33.1.1", | ||
"version": "33.2.0", | ||
"description": "A SQL query builder based on knex with powerful TypeScript type support", | ||
@@ -76,3 +76,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "0f6b852cb9b3e4413a829ec4e6164bae046d7260" | ||
"gitHead": "f35ed527c92e95627ff13e47c273bb5b6da6bc84" | ||
} |
@@ -137,3 +137,21 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
/** | ||
* Start a transaction. | ||
*/ | ||
async transaction(id?: PropertyKey): Promise<Knex.Transaction & { kmoreTrxId: symbol }> { | ||
const kmoreTrxId = typeof id === 'symbol' | ||
? id | ||
: id ? Symbol(id) : Symbol(Date.now().toString()) | ||
const trx = await this.dbh.transaction() | ||
Object.defineProperty(trx, 'kmoreTrxId', { | ||
...defaultPropDescriptor, | ||
enumerable: false, | ||
value: kmoreTrxId, | ||
}) | ||
return trx as Knex.Transaction & { kmoreTrxId: symbol } | ||
} | ||
protected createRefTables<P extends string>( | ||
@@ -140,0 +158,0 @@ prefix: P, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
130444
2100