@@ -38,6 +38,12 @@ export class DocumentSessionRevisions extends DocumentSessionRevisionsBase imple
3838 const operation = new GetRevisionOperation ( this . _session , id , options . start , options . pageSize ) ;
3939
4040 const command = operation . createRequest ( ) ;
41+ if ( ! command ) {
42+ return operation . getRevisionsFor ( options . documentType ) ;
43+ }
44+ if ( this . _sessionInfo ) {
45+ this . _sessionInfo . incrementRequestCount ( ) ;
46+ }
4147 await this . _requestExecutor . execute ( command , this . _sessionInfo ) ;
4248 operation . result = command . result ;
4349 return operation . getRevisionsFor ( options . documentType ) ;
@@ -52,12 +58,19 @@ export class DocumentSessionRevisions extends DocumentSessionRevisionsBase imple
5258 } as SessionRevisionsMetadataOptions , options || { } ) ;
5359 const operation = new GetRevisionOperation ( this . _session , id , options . start , options . pageSize , true ) ;
5460 const command = operation . createRequest ( ) ;
61+ if ( ! command ) {
62+ return operation . getRevisionsMetadataFor ( ) ;
63+ }
64+ if ( this . _sessionInfo ) {
65+ this . _sessionInfo . incrementRequestCount ( ) ;
66+ }
5567 await this . _requestExecutor . execute ( command , this . _sessionInfo ) ;
5668 operation . result = command . result ;
5769 return operation . getRevisionsMetadataFor ( ) ;
5870 }
5971
6072 public async get < TEntity extends object > ( id : string , date : Date ) : Promise < TEntity | null > ;
73+ public async get < TEntity extends object > ( id : string , date : Date , documentType : DocumentType < TEntity > ) : Promise < TEntity | null > ;
6174 public async get < TEntity extends object > ( changeVector : string ) : Promise < TEntity | null > ;
6275 public async get < TEntity extends object > ( changeVector : string ,
6376 documentType : DocumentType < TEntity > ) : Promise < TEntity | null > ;
@@ -67,7 +80,8 @@ export class DocumentSessionRevisions extends DocumentSessionRevisionsBase imple
6780 : Promise < RevisionsCollectionObject < TEntity > > ;
6881 public async get < TEntity extends object > (
6982 changeVectorOrVectorsOrId : string | string [ ] ,
70- documentTypeOrDate ?: DocumentType < TEntity > | Date )
83+ documentTypeOrDate ?: DocumentType < TEntity > | Date ,
84+ documentTypeForDateOverload ?: DocumentType < TEntity > )
7185 : Promise < RevisionsCollectionObject < TEntity > | TEntity > {
7286
7387 const documentType = TypeUtil . isDocumentType ( documentTypeOrDate )
@@ -76,7 +90,7 @@ export class DocumentSessionRevisions extends DocumentSessionRevisionsBase imple
7690
7791 if ( TypeUtil . isDate ( documentTypeOrDate ) ) {
7892 return this . _getByIdAndDate (
79- changeVectorOrVectorsOrId as string , documentTypeOrDate ) ;
93+ changeVectorOrVectorsOrId as string , documentTypeOrDate , documentTypeForDateOverload ) ;
8094 } else {
8195 return this . _get ( changeVectorOrVectorsOrId , documentType ) ;
8296 }
@@ -86,6 +100,12 @@ export class DocumentSessionRevisions extends DocumentSessionRevisionsBase imple
86100 id : string , date : Date , clazz ?: DocumentType < TEntity > ) {
87101 const operation = new GetRevisionOperation ( this . _session , id , date ) ;
88102 const command = operation . createRequest ( ) ;
103+ if ( ! command ) {
104+ return operation . getRevision ( clazz ) ;
105+ }
106+ if ( this . _sessionInfo ) {
107+ this . _sessionInfo . incrementRequestCount ( ) ;
108+ }
89109 await this . _requestExecutor . execute ( command , this . _sessionInfo ) ;
90110 operation . result = command . result ;
91111 return operation . getRevision ( clazz ) ;
@@ -97,6 +117,14 @@ export class DocumentSessionRevisions extends DocumentSessionRevisionsBase imple
97117 const operation = new GetRevisionOperation ( this . _session , changeVectorOrVectors as any ) ;
98118
99119 const command = operation . createRequest ( ) ;
120+ if ( ! command ) {
121+ return TypeUtil . isArray ( changeVectorOrVectors )
122+ ? operation . getRevisions ( documentType )
123+ : operation . getRevision ( documentType ) ;
124+ }
125+ if ( this . _sessionInfo ) {
126+ this . _sessionInfo . incrementRequestCount ( ) ;
127+ }
100128 await this . _requestExecutor . execute ( command , this . _sessionInfo ) ;
101129 operation . result = command . result ;
102130 return TypeUtil . isArray ( changeVectorOrVectors )
@@ -107,6 +135,9 @@ export class DocumentSessionRevisions extends DocumentSessionRevisionsBase imple
107135 public async getCountFor ( id : string ) : Promise < number > {
108136 const operation = new GetRevisionsCountOperation ( id ) ;
109137 const command = operation . createRequest ( ) ;
138+ if ( this . _sessionInfo ) {
139+ this . _sessionInfo . incrementRequestCount ( ) ;
140+ }
110141 await this . _requestExecutor . execute ( command , this . _sessionInfo ) ;
111142 return command . result ;
112143 }
0 commit comments