Skip to content

Commit

Permalink
add getImportExportObjectLimit to so setup
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Feb 28, 2020
1 parent 8a8af5a commit 5a7e2fb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/server/legacy/legacy_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ export class LegacyService implements CoreService {
setClientFactoryProvider: setupDeps.core.savedObjects.setClientFactoryProvider,
addClientWrapper: setupDeps.core.savedObjects.addClientWrapper,
registerType: setupDeps.core.savedObjects.registerType,
getImportExportObjectLimit: setupDeps.core.savedObjects.getImportExportObjectLimit,
},
uiSettings: {
register: setupDeps.core.uiSettings.register,
Expand Down
1 change: 1 addition & 0 deletions src/core/server/plugins/plugin_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export function createPluginSetupContext<TPlugin, TPluginDependencies>(
setClientFactoryProvider: deps.savedObjects.setClientFactoryProvider,
addClientWrapper: deps.savedObjects.addClientWrapper,
registerType: deps.savedObjects.registerType,
getImportExportObjectLimit: deps.savedObjects.getImportExportObjectLimit,
},
uiSettings: {
register: deps.uiSettings.register,
Expand Down
3 changes: 3 additions & 0 deletions src/core/server/saved_objects/saved_objects_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ const createSetupContractMock = () => {
setClientFactoryProvider: jest.fn(),
addClientWrapper: jest.fn(),
registerType: jest.fn(),
getImportExportObjectLimit: jest.fn(),
};

setupContract.getImportExportObjectLimit.mockReturnValue(100);

return setupContract;
};

Expand Down
6 changes: 6 additions & 0 deletions src/core/server/saved_objects/saved_objects_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ export interface SavedObjectsServiceSetup {
* This API is the single entry point to register saved object types in the new platform.
*/
registerType: (type: SavedObjectsType) => void;

/**
* Returns the maximum number of objects allowed for import or export operations.
*/
getImportExportObjectLimit: () => number;
}

/**
Expand Down Expand Up @@ -331,6 +336,7 @@ export class SavedObjectsService
registerType: type => {
this.typeRegistry.registerType(type);
},
getImportExportObjectLimit: () => this.config!.maxImportExportSize,
};
}

Expand Down

0 comments on commit 5a7e2fb

Please sign in to comment.