File tree Expand file tree Collapse file tree 3 files changed +5
-29
lines changed
packages/cubejs-client-core Expand file tree Collapse file tree 3 files changed +5
-29
lines changed Original file line number Diff line number Diff line change @@ -50,10 +50,6 @@ export type LoadMethodOptions = {
5050 * AbortSignal to cancel requests
5151 */
5252 signal ?: AbortSignal ;
53- /**
54- * Cache mode for query execution
55- */
56- cache ?: CacheMode ;
5753} ;
5854
5955export type DeeplyReadonly < T > = {
@@ -112,6 +108,10 @@ export type CubeSqlOptions = LoadMethodOptions & {
112108 * Query timeout in milliseconds
113109 */
114110 timeout ?: number ;
111+ /**
112+ * Cache mode for query execution
113+ */
114+ cache ?: CacheMode ;
115115} ;
116116
117117export type CubeSqlSchemaColumn = {
@@ -574,7 +574,6 @@ class CubeApi {
574574 ( ) => this . request ( 'load' , {
575575 query,
576576 queryType : 'multi' ,
577- cache : options ?. cache ,
578577 signal : options ?. signal ,
579578 } ) ,
580579 ( response : any ) => this . loadResponseInternal ( response , options ) ,
Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ export interface Query {
115115 timezone ?: string ;
116116 // @deprecated
117117 renewQuery ?: boolean ;
118+ cache ?: CacheMode ;
118119 ungrouped ?: boolean ;
119120 responseFormat ?: 'compact' | 'default' ;
120121 total ?: boolean ;
Original file line number Diff line number Diff line change @@ -217,30 +217,6 @@ describe('CubeApi with Abort Signal', () => {
217217 expect ( requestSpy . mock . calls [ 0 ] ?. [ 1 ] ?. signal ) . toBe ( signal ) ;
218218 } ) ;
219219
220- test ( 'should pass cache from options to request' , async ( ) => {
221- // Mock for this specific test
222- const requestSpy = jest . spyOn ( HttpTransport . prototype , 'request' ) . mockImplementation ( ( ) => ( {
223- subscribe : ( cb ) => Promise . resolve ( cb ( {
224- status : 200 ,
225- text : ( ) => Promise . resolve ( '{"results":[]}' ) ,
226- json : ( ) => Promise . resolve ( { results : [ ] } )
227- } as any ,
228- async ( ) => undefined as any ) )
229- } ) ) ;
230-
231- const cubeApi = new CubeApi ( 'token' , {
232- apiUrl : 'http://localhost:4000/cubejs-api/v1'
233- } ) ;
234-
235- await cubeApi . load (
236- { measures : [ 'Orders.count' ] } ,
237- { cache : 'stale-if-slow' }
238- ) ;
239-
240- expect ( requestSpy ) . toHaveBeenCalled ( ) ;
241- expect ( requestSpy . mock . calls [ 0 ] ?. [ 1 ] ?. cache ) . toBe ( 'stale-if-slow' ) ;
242- } ) ;
243-
244220 test ( 'options signal should override constructor signal' , async ( ) => {
245221 const constructorController = new AbortController ( ) ;
246222 const optionsController = new AbortController ( ) ;
You can’t perform that action at this time.
0 commit comments