import { EntityTarget } from '@typedorm/common' ; import { ProjectionKeys } from '../expression/projection-keys-options-type' ; import { Transaction } from './transaction' ; interface ReadTransactionGetItemOptions < Entity > { default select ? : ProjectionKeys < Entity > ; } export interface ReadTransactionGet < Entity , PrimaryKeyAttributes = Partial < Entity > > { get : { item : EntityTarget < Entity > ; primaryKey : PrimaryKeyAttributes ; options ? : ReadTransactionGetItemOptions < Entity > ; } ; } export type ReadTransactionItem < Entity , PrimaryKey > = ReadTransactionGet < Entity , PrimaryKey > ; export class ReadTransaction extends Transaction < ReadTransactionItem < any , any > > { constructor ( ) { super ( ) ; } add ( transactionItems ) { this . items . push ( ... transactionItems ) ; return this ; } addGetItem < Entity , PrimaryKeyAttributes = Partial < Entity > > ( item , primaryKey , options ? ) { this . items . push ( { get : { item , primaryKey , options , } , } ) ; return this ; } }