File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ export type AxiosOptions = {
17
17
18
18
export interface BaseAPIParams {
19
19
singleClusterMode ?: boolean ;
20
+ proxyMeta ?: boolean ;
20
21
}
21
22
22
23
export class BaseYdbAPI extends AxiosWrapper {
Original file line number Diff line number Diff line change @@ -34,15 +34,17 @@ export class YdbEmbeddedAPI {
34
34
singleClusterMode,
35
35
csrfTokenGetter = ( ) => undefined ,
36
36
defaults = { } ,
37
+ proxyMeta = false ,
37
38
} : {
38
39
webVersion ?: boolean ;
39
40
withCredentials ?: boolean ;
40
41
singleClusterMode ?: boolean ;
41
42
csrfTokenGetter ?: ( ) => string | undefined ;
42
43
defaults ?: AxiosRequestConfig ;
44
+ proxyMeta ?: boolean ;
43
45
} = { } ) {
44
46
const axiosParams : AxiosWrapperOptions = { config : { withCredentials, ...defaults } } ;
45
- const baseApiParams = { singleClusterMode} ;
47
+ const baseApiParams = { singleClusterMode, proxyMeta } ;
46
48
47
49
this . auth = new AuthAPI ( axiosParams , baseApiParams ) ;
48
50
if ( webVersion ) {
Original file line number Diff line number Diff line change
1
+ import type { AxiosWrapperOptions } from '@gravity-ui/axios-wrapper' ;
2
+
1
3
import { metaBackend as META_BACKEND } from '../../store' ;
2
4
import type { MetaCapabilitiesResponse } from '../../types/api/capabilities' ;
3
5
import type {
@@ -8,11 +10,20 @@ import type {
8
10
} from '../../types/api/meta' ;
9
11
import { parseMetaTenants } from '../parsers/parseMetaTenants' ;
10
12
11
- import type { AxiosOptions } from './base' ;
13
+ import type { AxiosOptions , BaseAPIParams } from './base' ;
12
14
import { BaseYdbAPI } from './base' ;
13
15
14
16
export class MetaAPI extends BaseYdbAPI {
15
- getPath ( path : string , _clusterName ?: string ) {
17
+ proxyMeta ?: boolean ;
18
+ constructor ( axiosOptions ?: AxiosWrapperOptions , { proxyMeta} : BaseAPIParams = { } ) {
19
+ super ( axiosOptions ) ;
20
+
21
+ this . proxyMeta = proxyMeta ;
22
+ }
23
+ getPath ( path : string , clusterName ?: string ) {
24
+ if ( this . proxyMeta && clusterName ) {
25
+ return `${ META_BACKEND } /proxy/cluster/${ clusterName } ${ path } ` ;
26
+ }
16
27
return `${ META_BACKEND ?? '' } ${ path } ` ;
17
28
}
18
29
You can’t perform that action at this time.
0 commit comments