mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-27 01:19:00 +02:00
Make it a wrapper
This commit is contained in:
parent
5c340721d1
commit
f41e943bbe
@ -42,7 +42,7 @@ export type WithTransactional<S> = S & {
|
|||||||
transactional: <R>(fn: (service: S) => R) => Promise<R>;
|
transactional: <R>(fn: (service: S) => R) => Promise<R>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WithTrackedTransactional<S> = S & {
|
export type withContextualTransactional<S> = S & {
|
||||||
trackedTransactional: <R>(
|
trackedTransactional: <R>(
|
||||||
fn: (transactionContext: TransactionContext) => R,
|
fn: (transactionContext: TransactionContext) => R,
|
||||||
) => Promise<R>;
|
) => Promise<R>;
|
||||||
@ -96,8 +96,8 @@ export function withTransactional<S>(
|
|||||||
export function withContextualTransactional<S>(
|
export function withContextualTransactional<S>(
|
||||||
serviceFactory: (db: Knex) => S,
|
serviceFactory: (db: Knex) => S,
|
||||||
db: Knex,
|
db: Knex,
|
||||||
): WithTrackedTransactional<S> {
|
): withContextualTransactional<S> {
|
||||||
const service = serviceFactory(db) as WithTrackedTransactional<S>;
|
const service = serviceFactory(db) as withContextualTransactional<S>;
|
||||||
|
|
||||||
service.trackedTransactional = async <R>(
|
service.trackedTransactional = async <R>(
|
||||||
fn: (transactionContext: TransactionContext) => R,
|
fn: (transactionContext: TransactionContext) => R,
|
||||||
|
Loading…
Reference in New Issue
Block a user