Skip to content

Commit

Permalink
Increase the maximum number of saved objects that could be installed …
Browse files Browse the repository at this point in the history
…with a Fleet package (#148441)

**Resolves: #148175
  • Loading branch information
xcrzx authored Jan 13, 2023
1 parent ca93cb6 commit 47d1a0e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ export class SavedObjectsService
exportSizeLimit: this.config!.maxImportExportSize,
logger: this.logger.get('exporter'),
}),
createImporter: (savedObjectsClient) =>
createImporter: (savedObjectsClient, options) =>
new SavedObjectsImporter({
savedObjectsClient,
typeRegistry: this.typeRegistry,
importSizeLimit: this.config!.maxImportExportSize,
importSizeLimit: options?.importSizeLimit ?? this.config!.maxImportExportSize,
}),
getTypeRegistry: () => this.typeRegistry,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import type {
import type { SavedObjectsType } from './saved_objects_type';
import type { ISavedObjectTypeRegistry } from './type_registry';
import type { ISavedObjectsExporter } from './export';
import type { ISavedObjectsImporter } from './import';
import type { ISavedObjectsImporter, SavedObjectsImporterOptions } from './import';
import type { SavedObjectsExtensions } from './extensions/extensions';

/**
Expand Down Expand Up @@ -200,7 +200,10 @@ export interface SavedObjectsServiceStart {
/**
* Creates an {@link ISavedObjectsImporter | importer} bound to given client.
*/
createImporter: (client: SavedObjectsClientContract) => ISavedObjectsImporter;
createImporter: (
client: SavedObjectsClientContract,
options?: SavedObjectsImporterOptions
) => ISavedObjectsImporter;
/**
* Returns the {@link ISavedObjectTypeRegistry | registry} containing all registered
* {@link SavedObjectsType | saved object types}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ export interface ISavedObjectsImporter {
): Promise<SavedObjectsImportResponse>;
}

/**
* Options to control the importer
*
* @public
*/
export interface SavedObjectsImporterOptions {
/** Overwrites the maximum number of saved objects that could be imported */
importSizeLimit?: number;
}

/**
* Options to control the import operation.
* @public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ async function installPackageFromRegistry({

const savedObjectsImporter = appContextService
.getSavedObjects()
.createImporter(savedObjectsClient);
.createImporter(savedObjectsClient, { importSizeLimit: 15_000 });

const savedObjectTagAssignmentService = appContextService
.getSavedObjectsTagging()
Expand Down

0 comments on commit 47d1a0e

Please sign in to comment.