@@ -18,17 +18,20 @@ export type AxiosOptions = {
1818export interface BaseAPIParams {
1919 singleClusterMode : undefined | boolean ;
2020 proxyMeta : undefined | boolean ;
21+ useRelativePath : undefined | boolean ;
2122}
2223
2324export class BaseYdbAPI extends AxiosWrapper {
2425 DEFAULT_RETRIES_COUNT = 0 ;
2526
2627 singleClusterMode : BaseAPIParams [ 'singleClusterMode' ] ;
28+ useRelativePath : BaseAPIParams [ 'useRelativePath' ] ;
2729
2830 constructor ( axiosOptions : AxiosWrapperOptions , baseApiParams : BaseAPIParams ) {
2931 super ( axiosOptions ) ;
3032
3133 this . singleClusterMode = baseApiParams . singleClusterMode ;
34+ this . useRelativePath = baseApiParams . useRelativePath ;
3235
3336 axiosRetry ( this . _axios , {
3437 retries : this . DEFAULT_RETRIES_COUNT ,
@@ -91,8 +94,19 @@ export class BaseYdbAPI extends AxiosWrapper {
9194 return `${ BACKEND ?? '' } ${ path } ` ;
9295 }
9396
94- getSchemaPath ( props : { path ?: string ; database ?: string } ) {
95- return props . path ;
97+ getSchemaPath ( { path, database} : { path ?: string ; database ?: string } ) {
98+ if ( ! this . useRelativePath || ! path || ! database ) {
99+ return path ;
100+ }
101+
102+ if ( path === database ) {
103+ return '' ;
104+ }
105+
106+ if ( path . startsWith ( database + '/' ) ) {
107+ return path . slice ( database . length + 1 ) ;
108+ }
109+ return path ;
96110 }
97111
98112 prepareArrayRequestParam ( arr : ( string | number ) [ ] ) {
0 commit comments