@@ -27,7 +27,7 @@ import {
2727} from '../../encrypted_saved_objects/server' ;
2828import { TaskManagerSetupContract , TaskManagerStartContract } from '../../task_manager/server' ;
2929import { LicensingPluginSetup , LicensingPluginStart } from '../../licensing/server' ;
30- import { SpacesPluginSetup , SpacesServiceSetup } from '../../spaces/server' ;
30+ import { SpacesPluginStart } from '../../spaces/server' ;
3131import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server' ;
3232import { SecurityPluginSetup } from '../../security/server' ;
3333
@@ -109,7 +109,6 @@ export interface ActionsPluginsSetup {
109109 taskManager : TaskManagerSetupContract ;
110110 encryptedSavedObjects : EncryptedSavedObjectsPluginSetup ;
111111 licensing : LicensingPluginSetup ;
112- spaces ?: SpacesPluginSetup ;
113112 eventLog : IEventLogService ;
114113 usageCollection ?: UsageCollectionSetup ;
115114 security ?: SecurityPluginSetup ;
@@ -119,6 +118,7 @@ export interface ActionsPluginsStart {
119118 encryptedSavedObjects : EncryptedSavedObjectsPluginStart ;
120119 taskManager : TaskManagerStartContract ;
121120 licensing : LicensingPluginStart ;
121+ spaces ?: SpacesPluginStart ;
122122}
123123
124124const includedHiddenTypes = [
@@ -133,12 +133,10 @@ export class ActionsPlugin implements Plugin<Promise<PluginSetupContract>, Plugi
133133
134134 private readonly logger : Logger ;
135135 private actionsConfig ?: ActionsConfig ;
136- private serverBasePath ?: string ;
137136 private taskRunnerFactory ?: TaskRunnerFactory ;
138137 private actionTypeRegistry ?: ActionTypeRegistry ;
139138 private actionExecutor ?: ActionExecutor ;
140139 private licenseState : ILicenseState | null = null ;
141- private spaces ?: SpacesServiceSetup ;
142140 private security ?: SecurityPluginSetup ;
143141 private eventLogService ?: IEventLogService ;
144142 private eventLogger ?: IEventLogger ;
@@ -211,9 +209,7 @@ export class ActionsPlugin implements Plugin<Promise<PluginSetupContract>, Plugi
211209 } ) ;
212210 this . taskRunnerFactory = taskRunnerFactory ;
213211 this . actionTypeRegistry = actionTypeRegistry ;
214- this . serverBasePath = core . http . basePath . serverBasePath ;
215212 this . actionExecutor = actionExecutor ;
216- this . spaces = plugins . spaces ?. spacesService ;
217213 this . security = plugins . security ;
218214
219215 registerBuiltInActionTypes ( {
@@ -339,7 +335,7 @@ export class ActionsPlugin implements Plugin<Promise<PluginSetupContract>, Plugi
339335 actionExecutor ! . initialize ( {
340336 logger,
341337 eventLogger : this . eventLogger ! ,
342- spaces : this . spaces ,
338+ spaces : plugins . spaces ?. spacesService ,
343339 getActionsClientWithRequest,
344340 getServices : this . getServicesFactory (
345341 getScopedSavedObjectsClientWithoutAccessToActions ,
@@ -359,12 +355,18 @@ export class ActionsPlugin implements Plugin<Promise<PluginSetupContract>, Plugi
359355 : undefined ,
360356 } ) ;
361357
358+ const spaceIdToNamespace = ( spaceId ?: string ) => {
359+ return plugins . spaces && spaceId
360+ ? plugins . spaces . spacesService . spaceIdToNamespace ( spaceId )
361+ : undefined ;
362+ } ;
363+
362364 taskRunnerFactory ! . initialize ( {
363365 logger,
364366 actionTypeRegistry : actionTypeRegistry ! ,
365367 encryptedSavedObjectsClient,
366- getBasePath : this . getBasePath ,
367- spaceIdToNamespace : this . spaceIdToNamespace ,
368+ basePathService : core . http . basePath ,
369+ spaceIdToNamespace,
368370 getUnsecuredSavedObjectsClient : ( request : KibanaRequest ) =>
369371 this . getUnsecuredSavedObjectsClient ( core . savedObjects , request ) ,
370372 } ) ;
@@ -474,14 +476,6 @@ export class ActionsPlugin implements Plugin<Promise<PluginSetupContract>, Plugi
474476 } ;
475477 } ;
476478
477- private spaceIdToNamespace = ( spaceId ?: string ) : string | undefined => {
478- return this . spaces && spaceId ? this . spaces . spaceIdToNamespace ( spaceId ) : undefined ;
479- } ;
480-
481- private getBasePath = ( spaceId ?: string ) : string => {
482- return this . spaces && spaceId ? this . spaces . getBasePath ( spaceId ) : this . serverBasePath ! ;
483- } ;
484-
485479 public stop ( ) {
486480 if ( this . licenseState ) {
487481 this . licenseState . clean ( ) ;
0 commit comments