mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Fleet] Do not ignore coreMigrationVersion and typeMigrationVersion when importing saved object (#161969)
This commit is contained in:
parent
235eac899b
commit
2d7311a5c9
1 changed files with 19 additions and 3 deletions
|
@ -45,7 +45,12 @@ type SavedObjectToBe = Required<Pick<SavedObjectsBulkCreateObject, keyof Archive
|
|||
};
|
||||
export type ArchiveAsset = Pick<
|
||||
SavedObject,
|
||||
'id' | 'attributes' | 'migrationVersion' | 'references'
|
||||
| 'id'
|
||||
| 'attributes'
|
||||
| 'migrationVersion'
|
||||
| 'references'
|
||||
| 'coreMigrationVersion'
|
||||
| 'typeMigrationVersion'
|
||||
> & {
|
||||
type: KibanaSavedObjectType;
|
||||
};
|
||||
|
@ -81,13 +86,24 @@ export async function getKibanaAsset(key: string): Promise<ArchiveAsset> {
|
|||
|
||||
export function createSavedObjectKibanaAsset(asset: ArchiveAsset): SavedObjectToBe {
|
||||
// convert that to an object
|
||||
return {
|
||||
const so: Partial<SavedObjectToBe> = {
|
||||
type: asset.type,
|
||||
id: asset.id,
|
||||
attributes: asset.attributes,
|
||||
references: asset.references || [],
|
||||
migrationVersion: asset.migrationVersion || {},
|
||||
};
|
||||
|
||||
if (asset.migrationVersion) {
|
||||
so.migrationVersion = asset.migrationVersion;
|
||||
} else {
|
||||
if (asset.coreMigrationVersion) {
|
||||
so.coreMigrationVersion = asset.coreMigrationVersion;
|
||||
}
|
||||
if (asset.typeMigrationVersion) {
|
||||
so.typeMigrationVersion = asset.typeMigrationVersion;
|
||||
}
|
||||
}
|
||||
return so as SavedObjectToBe;
|
||||
}
|
||||
|
||||
export async function installKibanaAssets(options: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue