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 = {
1717
1818export interface BaseAPIParams {
1919 singleClusterMode ?: boolean ;
20+ proxyMeta ?: boolean ;
2021}
2122
2223export class BaseYdbAPI extends AxiosWrapper {
Original file line number Diff line number Diff line change @@ -34,15 +34,17 @@ export class YdbEmbeddedAPI {
3434 singleClusterMode,
3535 csrfTokenGetter = ( ) => undefined ,
3636 defaults = { } ,
37+ proxyMeta = false ,
3738 } : {
3839 webVersion ?: boolean ;
3940 withCredentials ?: boolean ;
4041 singleClusterMode ?: boolean ;
4142 csrfTokenGetter ?: ( ) => string | undefined ;
4243 defaults ?: AxiosRequestConfig ;
44+ proxyMeta ?: boolean ;
4345 } = { } ) {
4446 const axiosParams : AxiosWrapperOptions = { config : { withCredentials, ...defaults } } ;
45- const baseApiParams = { singleClusterMode} ;
47+ const baseApiParams = { singleClusterMode, proxyMeta } ;
4648
4749 this . auth = new AuthAPI ( axiosParams , baseApiParams ) ;
4850 if ( webVersion ) {
Original file line number Diff line number Diff line change 1+ import type { AxiosWrapperOptions } from '@gravity-ui/axios-wrapper' ;
2+
13import { metaBackend as META_BACKEND } from '../../store' ;
24import type { MetaCapabilitiesResponse } from '../../types/api/capabilities' ;
35import type {
@@ -8,11 +10,20 @@ import type {
810} from '../../types/api/meta' ;
911import { parseMetaTenants } from '../parsers/parseMetaTenants' ;
1012
11- import type { AxiosOptions } from './base' ;
13+ import type { AxiosOptions , BaseAPIParams } from './base' ;
1214import { BaseYdbAPI } from './base' ;
1315
1416export 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+ }
1627 return `${ META_BACKEND ?? '' } ${ path } ` ;
1728 }
1829
You can’t perform that action at this time.
0 commit comments