diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/actions/update_index_meta.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/actions/update_index_meta.test.ts index 6ed55ccb49ebe..d597e2927663b 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/actions/update_index_meta.test.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/actions/update_index_meta.test.ts @@ -17,8 +17,8 @@ describe('updateIndexMeta', () => { const index = '.kibana_1'; const meta: IndexMappingMeta = { mappingVersions: { - foo: 1, - bar: 1, + foo: '10.1.0', + bar: '10.1.0', }, }; diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/init.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/init.test.ts index d8c176af4be0a..05cb283d378a6 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/init.test.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/init.test.ts @@ -38,7 +38,7 @@ describe('Stage: init', () => { aliases: {}, mappings: { properties: {}, - _meta: { mappingVersions: { foo: 1, bar: 1 } }, + _meta: { mappingVersions: { foo: '10.1.0', bar: '10.1.0' } }, }, settings: {}, }, diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_document_model_version.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_document_model_version.test.ts index c3d3fd67422b9..3595b5fb43cd4 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_document_model_version.test.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_document_model_version.test.ts @@ -49,8 +49,8 @@ describe('Stage: updateDocumentModelVersion', () => { it('updates state.currentIndexMeta when successful', () => { const state = createState({ currentIndexMeta: { - mappingVersions: { foo: 1, bar: 2 }, - docVersions: { foo: 0, bar: 0 }, + mappingVersions: { foo: '10.1.0', bar: '10.2.0' }, + docVersions: { foo: '0.0.0', bar: '0.0.0' }, migrationState: { convertingDocuments: true, }, @@ -63,8 +63,8 @@ describe('Stage: updateDocumentModelVersion', () => { const newState = updateDocumentModelVersion(state, res, context); expect(newState.currentIndexMeta).toEqual({ - mappingVersions: { foo: 1, bar: 2 }, - docVersions: { foo: 1, bar: 2 }, + mappingVersions: { foo: '10.1.0', bar: '10.2.0' }, + docVersions: { foo: '10.1.0', bar: '10.2.0' }, migrationState: { convertingDocuments: false, }, diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_document_model_version.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_document_model_version.ts index ea3ea142cbd19..94c0923df267d 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_document_model_version.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_document_model_version.ts @@ -24,7 +24,7 @@ export const updateDocumentModelVersion: ModelStage< controlState: 'UPDATE_DOCUMENT_MODEL_VERSIONS_WAIT_FOR_INSTANCES', currentIndexMeta: setMetaDocMigrationComplete({ meta: state.currentIndexMeta, - versions: context.typeModelVersions, + versions: context.typeVirtualVersions, }), }; }; diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_mapping_model_version.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_mapping_model_version.test.ts index b21ec69a531f0..ea053570b74e8 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_mapping_model_version.test.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_mapping_model_version.test.ts @@ -42,7 +42,7 @@ describe('Stage: updateMappingModelVersion', () => { expect(newState.currentIndexMeta).toEqual( setMetaMappingMigrationComplete({ meta: state.currentIndexMeta, - versions: context.typeModelVersions, + versions: context.typeVirtualVersions, }) ); }); diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_mapping_model_version.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_mapping_model_version.ts index 946c4a4ab1ef3..54cb5cff6d24a 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_mapping_model_version.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/model/stages/update_mapping_model_version.ts @@ -24,7 +24,7 @@ export const updateMappingModelVersion: ModelStage< controlState: state.aliasActions.length ? 'UPDATE_ALIASES' : 'INDEX_STATE_UPDATE_DONE', currentIndexMeta: setMetaMappingMigrationComplete({ meta: state.currentIndexMeta, - versions: context.typeModelVersions, + versions: context.typeVirtualVersions, }), }; }; diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/next.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/next.test.ts index d9135fff65a3e..00684ec46f85c 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/next.test.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/next.test.ts @@ -85,7 +85,7 @@ describe('actions', () => { expect(setMetaMappingMigrationCompleteMock).toHaveBeenCalledTimes(1); expect(setMetaMappingMigrationCompleteMock).toHaveBeenCalledWith({ meta: state.currentIndexMeta, - versions: context.typeModelVersions, + versions: context.typeVirtualVersions, }); }); @@ -123,7 +123,7 @@ describe('actions', () => { expect(setMetaDocMigrationCompleteMock).toHaveBeenCalledTimes(1); expect(setMetaDocMigrationCompleteMock).toHaveBeenCalledWith({ meta: state.currentIndexMeta, - versions: context.typeModelVersions, + versions: context.typeVirtualVersions, }); }); diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/next.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/next.ts index cb3e1b5b5ad27..2e6a785704b8a 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/next.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/next.ts @@ -84,7 +84,7 @@ export const nextActionMap = (context: MigratorContext) => { index: state.currentIndex, meta: setMetaMappingMigrationComplete({ meta: state.currentIndexMeta, - versions: context.typeModelVersions, + versions: context.typeVirtualVersions, }), }), UPDATE_ALIASES: (state: UpdateAliasesState) => @@ -172,7 +172,7 @@ export const nextActionMap = (context: MigratorContext) => { index: state.currentIndex, meta: setMetaDocMigrationComplete({ meta: state.currentIndexMeta, - versions: context.typeModelVersions, + versions: context.typeVirtualVersions, }), }), UPDATE_DOCUMENT_MODEL_VERSIONS_WAIT_FOR_INSTANCES: ( diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/test_helpers/context.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/test_helpers/context.ts index 0dafc36108b93..6fb5eb180d71e 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/test_helpers/context.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/test_helpers/context.ts @@ -31,9 +31,9 @@ export const createContextMock = ( kibanaVersion: '8.7.0', indexPrefix: '.kibana', types: ['foo', 'bar'], - typeModelVersions: { - foo: 1, - bar: 2, + typeVirtualVersions: { + foo: '10.1.0', + bar: '10.2.0', }, documentMigrator: createDocumentMigrator(), migrationConfig: { diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/build_index_mappings.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/build_index_mappings.test.ts index 35354001f6803..6469ebb7f060a 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/build_index_mappings.test.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/build_index_mappings.test.ts @@ -69,14 +69,14 @@ describe('buildIndexMeta', () => { expect(meta).toEqual({ mappingVersions: { - foo: 2, - bar: 1, - dolly: 3, + foo: '10.2.0', + bar: '10.1.0', + dolly: '10.3.0', }, docVersions: { - foo: 2, - bar: 1, - dolly: 3, + foo: '10.2.0', + bar: '10.1.0', + dolly: '10.3.0', }, migrationState: { convertingDocuments: false, diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/build_index_mappings.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/build_index_mappings.ts index a75ebd4dbdc1e..2157f3798d4db 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/build_index_mappings.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/build_index_mappings.ts @@ -11,7 +11,7 @@ import type { SavedObjectsType } from '@kbn/core-saved-objects-server'; import { type IndexMapping, type IndexMappingMeta, - getModelVersionMapForTypes, + getVirtualVersionMap, } from '@kbn/core-saved-objects-base-server-internal'; import { getBaseMappings, buildTypesMappings } from '../../core'; @@ -48,11 +48,11 @@ interface BuildIndexMetaOpts { * @param types The list of all registered SO types. */ export const buildIndexMeta = ({ types }: BuildIndexMetaOpts): IndexMappingMeta => { - const modelVersions = getModelVersionMapForTypes(types); + const typeVersions = getVirtualVersionMap(types); return { - mappingVersions: modelVersions, - docVersions: modelVersions, + mappingVersions: typeVersions, + docVersions: typeVersions, migrationState: { convertingDocuments: false, }, diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/update_index_meta.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/update_index_meta.test.ts index 4298c6b027072..da9654400bf6f 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/update_index_meta.test.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/update_index_meta.test.ts @@ -8,7 +8,7 @@ import type { IndexMappingMeta, - ModelVersionMap, + VirtualVersionMap, } from '@kbn/core-saved-objects-base-server-internal'; import { setMetaDocMigrationStarted, @@ -18,12 +18,12 @@ import { const getDefaultMeta = (): IndexMappingMeta => ({ mappingVersions: { - foo: 1, - bar: 1, + foo: '10.1.0', + bar: '10.1.0', }, docVersions: { - foo: 1, - bar: 1, + foo: '10.1.0', + bar: '10.1.0', }, migrationState: { convertingDocuments: false, @@ -33,7 +33,7 @@ const getDefaultMeta = (): IndexMappingMeta => ({ describe('setMetaMappingMigrationComplete', () => { it('updates the meta to set the mappingVersions', () => { const meta: IndexMappingMeta = getDefaultMeta(); - const versions: ModelVersionMap = { foo: 3, bar: 2 }; + const versions: VirtualVersionMap = { foo: '10.3.0', bar: '10.2.0' }; const updated = setMetaMappingMigrationComplete({ meta, versions }); @@ -67,7 +67,7 @@ describe('setMetaDocMigrationComplete', () => { convertingDocuments: true, }, }; - const versions: ModelVersionMap = { foo: 3, bar: 2 }; + const versions: VirtualVersionMap = { foo: '10.3.0', bar: '10.2.0' }; const updated = setMetaDocMigrationComplete({ meta, versions }); diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/update_index_meta.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/update_index_meta.ts index 73d693d4a1f1a..2d06f5adcb378 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/update_index_meta.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/zdt/utils/update_index_meta.ts @@ -8,7 +8,7 @@ import type { IndexMappingMeta, - ModelVersionMap, + VirtualVersionMap, } from '@kbn/core-saved-objects-base-server-internal'; export const setMetaMappingMigrationComplete = ({ @@ -16,7 +16,7 @@ export const setMetaMappingMigrationComplete = ({ versions, }: { meta: IndexMappingMeta; - versions: ModelVersionMap; + versions: VirtualVersionMap; }): IndexMappingMeta => { return { ...meta, @@ -44,7 +44,7 @@ export const setMetaDocMigrationComplete = ({ versions, }: { meta: IndexMappingMeta; - versions: ModelVersionMap; + versions: VirtualVersionMap; }): IndexMappingMeta => { return { ...meta,