@@ -47,6 +47,7 @@ export type UResulState = ECLResultEx & WsDfu.DFULogicalFile;
4747export type IResulState = ECLResultEx | WsDfu . DFULogicalFile ;
4848export class Result extends StateObject < UResulState , IResulState > implements ECLResultEx {
4949 protected connection : WorkunitsService ;
50+ protected _bypassCache : boolean = false ;
5051 get BaseUrl ( ) { return this . connection . baseUrl ; }
5152 protected xsdSchema : XSDSchema ;
5253
@@ -145,6 +146,12 @@ export class Result extends StateObject<UResulState, IResulState> implements ECL
145146 return this . Total !== - 1 ;
146147 }
147148
149+ bypassCache ( bypass ?: boolean ) : boolean | this {
150+ if ( bypass === undefined ) return this . _bypassCache ;
151+ this . _bypassCache = bypass ;
152+ return this ;
153+ }
154+
148155 private _fetchXMLSchemaPromise : Promise < XSDSchema | null > ;
149156 fetchXMLSchema ( refresh = false ) : Promise < XSDSchema | null > {
150157 if ( ! this . _fetchXMLSchemaPromise || refresh ) {
@@ -164,8 +171,9 @@ export class Result extends StateObject<UResulState, IResulState> implements ECL
164171 return this ;
165172 }
166173
167- fetchRows ( from : number = 0 , count : number = - 1 , includeSchema : boolean = false , filter : ResultFilter = { } , abortSignal ?: AbortSignal ) : Promise < any [ ] > {
168- return this . WUResult ( from , count , ! includeSchema , filter , abortSignal ) . then ( ( response ) => {
174+ fetchRows ( from : number = 0 , count : number = - 1 , includeSchema : boolean = false , filter : ResultFilter = { } , abortSignal ?: AbortSignal , bypassCache ?: boolean ) : Promise < any [ ] > {
175+ const shouldBypassCache = bypassCache ?? this . _bypassCache ;
176+ return this . WUResult ( from , count , ! includeSchema , filter , abortSignal , shouldBypassCache ) . then ( ( response ) => {
169177 const result : any = response . Result ;
170178 delete response . Result ; // Do not want it in "set"
171179 this . set ( {
@@ -193,7 +201,7 @@ export class Result extends StateObject<UResulState, IResulState> implements ECL
193201 return this . xsdSchema . root . children ( ) ;
194202 }
195203
196- protected WUResult ( start : number = 0 , count : number = 1 , suppressXmlSchema : boolean = false , filter : { [ key : string ] : string | number } = { } , abortSignal ?: AbortSignal ) : Promise < WUResultResponseEx > {
204+ protected WUResult ( start : number = 0 , count : number = 1 , suppressXmlSchema : boolean = false , filter : { [ key : string ] : string | number } = { } , abortSignal ?: AbortSignal , bypassCache : boolean = false ) : Promise < WUResultResponseEx > {
197205 const FilterBy = {
198206 NamedValue : {
199207 itemcount : 0
@@ -221,6 +229,7 @@ export class Result extends StateObject<UResulState, IResulState> implements ECL
221229 request . Start = start ;
222230 request . Count = count ;
223231 request . SuppressXmlSchema = suppressXmlSchema ;
232+ request . BypassCachedResult = bypassCache ;
224233 return this . connection . WUResult ( request , abortSignal ) . then ( ( response : unknown ) => {
225234 return response as WUResultResponseEx ;
226235 } ) ;
0 commit comments