@@ -12,9 +12,9 @@ import {Logger} from './logging';
1212import DiscoveryService , { Endpoint } from './discovery' ;
1313import { retryable } from "./retries" ;
1414import { ISslCredentials } from './ssl-credentials' ;
15+ import { OperationParamsSettings } from './table' ;
1516
1617import SchemeServiceAPI = Ydb . Scheme . V1 . SchemeService ;
17- import IOperationParams = Ydb . Operations . IOperationParams ;
1818import ListDirectoryResult = Ydb . Scheme . ListDirectoryResult ;
1919import DescribePathResult = Ydb . Scheme . DescribePathResult ;
2020import IPermissionsAction = Ydb . Scheme . IPermissionsAction ;
@@ -46,6 +46,21 @@ function preparePermissionAction(action: IPermissionsAction) {
4646 }
4747}
4848
49+ export class MakeDirectorySettings extends OperationParamsSettings {
50+ }
51+
52+ export class RemoveDirectorySettings extends OperationParamsSettings {
53+ }
54+
55+ export class ListDirectorySettings extends OperationParamsSettings {
56+ }
57+
58+ export class DescribePathSettings extends OperationParamsSettings {
59+ }
60+
61+ export class ModifyPermissionsSettings extends OperationParamsSettings {
62+ }
63+
4964interface ISchemeClientSettings {
5065 database : string ;
5166 authService : IAuthService ;
@@ -73,29 +88,29 @@ export default class SchemeClient extends EventEmitter {
7388 return this . schemeServices . get ( endpoint ) as SchemeService ;
7489 }
7590
76- public async makeDirectory ( path : string , operationParams ?: IOperationParams ) : Promise < void > {
91+ public async makeDirectory ( path : string , settings ?: MakeDirectorySettings ) : Promise < void > {
7792 const service = await this . getSchemeService ( ) ;
78- return await service . makeDirectory ( path , operationParams ) ;
93+ return await service . makeDirectory ( path , settings ) ;
7994 }
8095
81- public async removeDirectory ( path : string , operationParams ?: IOperationParams ) : Promise < void > {
96+ public async removeDirectory ( path : string , settings ?: RemoveDirectorySettings ) : Promise < void > {
8297 const service = await this . getSchemeService ( ) ;
83- return await service . removeDirectory ( path , operationParams ) ;
98+ return await service . removeDirectory ( path , settings ) ;
8499 }
85100
86- public async listDirectory ( path : string , operationParams ?: IOperationParams ) : Promise < ListDirectoryResult > {
101+ public async listDirectory ( path : string , settings ?: ListDirectorySettings ) : Promise < ListDirectoryResult > {
87102 const service = await this . getSchemeService ( ) ;
88- return await service . listDirectory ( path , operationParams ) ;
103+ return await service . listDirectory ( path , settings ) ;
89104 }
90105
91- public async describePath ( path : string , operationParams ?: IOperationParams ) : Promise < DescribePathResult > {
106+ public async describePath ( path : string , settings ?: DescribePathSettings ) : Promise < DescribePathResult > {
92107 const service = await this . getSchemeService ( ) ;
93- return await service . describePath ( path , operationParams ) ;
108+ return await service . describePath ( path , settings ) ;
94109 }
95110
96- public async modifyPermissions ( path : string , permissionActions : IPermissionsAction [ ] , clearPermissions ?: boolean , operationParams ?: IOperationParams ) {
111+ public async modifyPermissions ( path : string , permissionActions : IPermissionsAction [ ] , clearPermissions ?: boolean , settings ?: ModifyPermissionsSettings ) {
97112 const service = await this . getSchemeService ( ) ;
98- return await service . modifyPermissions ( path , permissionActions , clearPermissions , operationParams ) ;
113+ return await service . modifyPermissions ( path , permissionActions , clearPermissions , settings ) ;
99114 }
100115
101116 public async destroy ( ) {
@@ -124,33 +139,33 @@ class SchemeService extends AuthenticatedService<SchemeServiceAPI> {
124139 this . logger = logger ;
125140 }
126141
127- prepareRequest ( path : string , operationParams ?: IOperationParams ) : IMakeDirectoryRequest {
142+ prepareRequest ( path : string , settings ?: OperationParamsSettings ) : IMakeDirectoryRequest {
128143 return {
129144 path : `${ this . database } /${ path } ` ,
130- operationParams
145+ operationParams : settings ?. operationParams ,
131146 } ;
132147 }
133148
134149 @retryable ( )
135150 @pessimizable
136- public async makeDirectory ( path : string , operationParams ?: IOperationParams ) : Promise < void > {
137- const request = this . prepareRequest ( path , operationParams ) ;
151+ public async makeDirectory ( path : string , settings ?: MakeDirectorySettings ) : Promise < void > {
152+ const request = this . prepareRequest ( path , settings ) ;
138153 this . logger . debug ( `Making directory ${ request . path } ` ) ;
139154 ensureOperationSucceeded ( await this . api . makeDirectory ( request ) ) ;
140155 }
141156
142157 @retryable ( )
143158 @pessimizable
144- public async removeDirectory ( path : string , operationParams ?: IOperationParams ) : Promise < void > {
145- const request = this . prepareRequest ( path , operationParams ) ;
159+ public async removeDirectory ( path : string , settings ?: RemoveDirectorySettings ) : Promise < void > {
160+ const request = this . prepareRequest ( path , settings ) ;
146161 this . logger . debug ( `Removing directory ${ request . path } ` ) ;
147162 ensureOperationSucceeded ( await this . api . removeDirectory ( request ) ) ;
148163 }
149164
150165 @retryable ( )
151166 @pessimizable
152- public async listDirectory ( path : string , operationParams ?: IOperationParams ) : Promise < ListDirectoryResult > {
153- const request = this . prepareRequest ( path , operationParams ) ;
167+ public async listDirectory ( path : string , settings ?: ListDirectorySettings ) : Promise < ListDirectoryResult > {
168+ const request = this . prepareRequest ( path , settings ) ;
154169 this . logger . debug ( `Listing directory ${ request . path } contents` ) ;
155170 const response = await this . api . listDirectory ( request ) ;
156171 const payload = getOperationPayload ( response ) ;
@@ -159,8 +174,8 @@ class SchemeService extends AuthenticatedService<SchemeServiceAPI> {
159174
160175 @retryable ( )
161176 @pessimizable
162- public async describePath ( path : string , operationParams ?: IOperationParams ) : Promise < DescribePathResult > {
163- const request = this . prepareRequest ( path , operationParams ) ;
177+ public async describePath ( path : string , settings ?: DescribePathSettings ) : Promise < DescribePathResult > {
178+ const request = this . prepareRequest ( path , settings ) ;
164179 this . logger . debug ( `Describing path ${ request . path } ` ) ;
165180 const response = await this . api . describePath ( request ) ;
166181 const payload = getOperationPayload ( response ) ;
@@ -169,9 +184,9 @@ class SchemeService extends AuthenticatedService<SchemeServiceAPI> {
169184
170185 @retryable ( )
171186 @pessimizable
172- public async modifyPermissions ( path : string , permissionActions : IPermissionsAction [ ] , clearPermissions ?: boolean , operationParams ?: IOperationParams ) {
187+ public async modifyPermissions ( path : string , permissionActions : IPermissionsAction [ ] , clearPermissions ?: boolean , settings ?: ModifyPermissionsSettings ) {
173188 const request = {
174- ...this . prepareRequest ( path , operationParams ) ,
189+ ...this . prepareRequest ( path , settings ) ,
175190 actions : permissionActions . map ( preparePermissionAction ) ,
176191 clearPermissions
177192 } ;
0 commit comments