mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -04:00
[Migrations] Add migrationVersion
property to the Saved Objects API output (#154364)
This commit is contained in:
parent
42a893db40
commit
768fe1af31
40 changed files with 353 additions and 106 deletions
|
@ -44,6 +44,7 @@ export type {
|
|||
ISavedObjectsPointInTimeFinder,
|
||||
SavedObjectsCreatePointInTimeFinderDependencies,
|
||||
SavedObjectsPitParams,
|
||||
SavedObjectsResolveOptions,
|
||||
SavedObjectsResolveResponse,
|
||||
SavedObjectsCollectMultiNamespaceReferencesObject,
|
||||
SavedObjectsUpdateObjectsSpacesResponseObject,
|
||||
|
@ -54,6 +55,7 @@ export type {
|
|||
SavedObjectsClosePointInTimeOptions,
|
||||
SavedObjectsCreatePointInTimeFinderOptions,
|
||||
SavedObjectsFindOptions,
|
||||
SavedObjectsGetOptions,
|
||||
SavedObjectsPointInTimeFinderClient,
|
||||
SavedObjectsBulkDeleteObject,
|
||||
SavedObjectsBulkDeleteOptions,
|
||||
|
|
|
@ -61,4 +61,6 @@ export interface SavedObjectsCreateOptions extends SavedObjectsBaseOptions {
|
|||
* * For global object types (registered with `namespaceType: 'agnostic'`): this option cannot be used.
|
||||
*/
|
||||
initialNamespaces?: string[];
|
||||
/** {@link SavedObjectsRawDocParseOptions.migrationVersionCompatibility} */
|
||||
migrationVersionCompatibility?: 'compatible' | 'raw';
|
||||
}
|
||||
|
|
|
@ -136,6 +136,8 @@ export interface SavedObjectsFindOptions {
|
|||
* Search against a specific Point In Time (PIT) that you've opened with {@link SavedObjectsClient.openPointInTimeForType}.
|
||||
*/
|
||||
pit?: SavedObjectsPitParams;
|
||||
/** {@link SavedObjectsRawDocParseOptions.migrationVersionCompatibility} */
|
||||
migrationVersionCompatibility?: 'compatible' | 'raw';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { SavedObjectsBaseOptions } from './base';
|
||||
|
||||
/**
|
||||
* Options for the saved objects get operation
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface SavedObjectsGetOptions extends SavedObjectsBaseOptions {
|
||||
/** {@link SavedObjectsRawDocParseOptions.migrationVersionCompatibility} */
|
||||
migrationVersionCompatibility?: 'compatible' | 'raw';
|
||||
}
|
|
@ -52,6 +52,7 @@ export type {
|
|||
SavedObjectsFindResult,
|
||||
SavedObjectsPitParams,
|
||||
} from './find';
|
||||
export type { SavedObjectsGetOptions } from './get';
|
||||
export type {
|
||||
SavedObjectsIncrementCounterField,
|
||||
SavedObjectsIncrementCounterOptions,
|
||||
|
@ -64,7 +65,7 @@ export type {
|
|||
SavedObjectsRemoveReferencesToOptions,
|
||||
SavedObjectsRemoveReferencesToResponse,
|
||||
} from './remove_references_to';
|
||||
export type { SavedObjectsResolveResponse } from './resolve';
|
||||
export type { SavedObjectsResolveOptions, SavedObjectsResolveResponse } from './resolve';
|
||||
export type { SavedObjectsUpdateResponse, SavedObjectsUpdateOptions } from './update';
|
||||
export type {
|
||||
SavedObjectsUpdateObjectsSpacesObject,
|
||||
|
|
|
@ -6,8 +6,19 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { SavedObjectsBaseOptions } from './base';
|
||||
import type { SavedObject } from '../..';
|
||||
|
||||
/**
|
||||
* Options for the saved objects get operation
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface SavedObjectsResolveOptions extends SavedObjectsBaseOptions {
|
||||
/** {@link SavedObjectsRawDocParseOptions.migrationVersionCompatibility} */
|
||||
migrationVersionCompatibility?: 'compatible' | 'raw';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @public
|
||||
|
|
|
@ -10,6 +10,7 @@ import type { SavedObject } from '..';
|
|||
import type {
|
||||
SavedObjectsBaseOptions,
|
||||
SavedObjectsFindOptions,
|
||||
SavedObjectsGetOptions,
|
||||
SavedObjectsClosePointInTimeOptions,
|
||||
SavedObjectsOpenPointInTimeOptions,
|
||||
SavedObjectsCreatePointInTimeFinderOptions,
|
||||
|
@ -19,6 +20,7 @@ import type {
|
|||
SavedObjectsUpdateObjectsSpacesOptions,
|
||||
SavedObjectsCollectMultiNamespaceReferencesObject,
|
||||
SavedObjectsUpdateObjectsSpacesResponse,
|
||||
SavedObjectsResolveOptions,
|
||||
SavedObjectsResolveResponse,
|
||||
ISavedObjectsPointInTimeFinder,
|
||||
SavedObjectsRemoveReferencesToOptions,
|
||||
|
@ -182,7 +184,7 @@ export interface SavedObjectsClientContract {
|
|||
* Returns an array of objects by id
|
||||
*
|
||||
* @param objects - array of objects to get (contains id, type, and optional fields)
|
||||
* @param options {@link SavedObjectsBaseOptions} - options for the bulk get operation
|
||||
* @param options {@link SavedObjectsGetOptions} - options for the bulk get operation
|
||||
* @returns the {@link SavedObjectsBulkResponse}
|
||||
* @example
|
||||
*
|
||||
|
@ -193,7 +195,7 @@ export interface SavedObjectsClientContract {
|
|||
*/
|
||||
bulkGet<T = unknown>(
|
||||
objects: SavedObjectsBulkGetObject[],
|
||||
options?: SavedObjectsBaseOptions
|
||||
options?: SavedObjectsGetOptions
|
||||
): Promise<SavedObjectsBulkResponse<T>>;
|
||||
|
||||
/**
|
||||
|
@ -201,12 +203,12 @@ export interface SavedObjectsClientContract {
|
|||
*
|
||||
* @param type - The type of the object to retrieve
|
||||
* @param id - The ID of the object to retrieve
|
||||
* @param options {@link SavedObjectsBaseOptions} - options for the get operation
|
||||
* @param options {@link SavedObjectsGetOptions} - options for the get operation
|
||||
*/
|
||||
get<T = unknown>(
|
||||
type: string,
|
||||
id: string,
|
||||
options?: SavedObjectsBaseOptions
|
||||
options?: SavedObjectsGetOptions
|
||||
): Promise<SavedObject<T>>;
|
||||
|
||||
/**
|
||||
|
@ -215,7 +217,7 @@ export interface SavedObjectsClientContract {
|
|||
* See documentation for `.resolve`.
|
||||
*
|
||||
* @param objects - an array of objects to resolve (contains id and type)
|
||||
* @param options {@link SavedObjectsBaseOptions} - options for the bulk resolve operation
|
||||
* @param options {@link SavedObjectsResolveOptions} - options for the bulk resolve operation
|
||||
* @returns the {@link SavedObjectsBulkResolveResponse}
|
||||
* @example
|
||||
*
|
||||
|
@ -230,7 +232,7 @@ export interface SavedObjectsClientContract {
|
|||
*/
|
||||
bulkResolve<T = unknown>(
|
||||
objects: SavedObjectsBulkResolveObject[],
|
||||
options?: SavedObjectsBaseOptions
|
||||
options?: SavedObjectsResolveOptions
|
||||
): Promise<SavedObjectsBulkResolveResponse<T>>;
|
||||
|
||||
/**
|
||||
|
@ -246,13 +248,13 @@ export interface SavedObjectsClientContract {
|
|||
*
|
||||
* @param type - The type of SavedObject to retrieve
|
||||
* @param id - The ID of the SavedObject to retrieve
|
||||
* @param options {@link SavedObjectsBaseOptions} - options for the resolve operation
|
||||
* @param options {@link SavedObjectsResolveOptions} - options for the resolve operation
|
||||
* @returns the {@link SavedObjectsResolveResponse}
|
||||
*/
|
||||
resolve<T = unknown>(
|
||||
type: string,
|
||||
id: string,
|
||||
options?: SavedObjectsBaseOptions
|
||||
options?: SavedObjectsResolveOptions
|
||||
): Promise<SavedObjectsResolveResponse<T>>;
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,6 +10,7 @@ import type { SavedObject } from '@kbn/core-saved-objects-common';
|
|||
import type {
|
||||
SavedObjectsBaseOptions,
|
||||
SavedObjectsFindOptions,
|
||||
SavedObjectsGetOptions,
|
||||
SavedObjectsClosePointInTimeOptions,
|
||||
SavedObjectsOpenPointInTimeOptions,
|
||||
SavedObjectsCreatePointInTimeFinderOptions,
|
||||
|
@ -19,6 +20,7 @@ import type {
|
|||
SavedObjectsUpdateObjectsSpacesOptions,
|
||||
SavedObjectsCollectMultiNamespaceReferencesObject,
|
||||
SavedObjectsUpdateObjectsSpacesResponse,
|
||||
SavedObjectsResolveOptions,
|
||||
SavedObjectsResolveResponse,
|
||||
ISavedObjectsPointInTimeFinder,
|
||||
SavedObjectsRemoveReferencesToOptions,
|
||||
|
@ -78,6 +80,7 @@ export interface ISavedObjectsRepository {
|
|||
* @property {boolean} [options.overwrite=false]
|
||||
* @property {string} [options.namespace]
|
||||
* @property {array} [options.references=[]] - [{ name, type, id }]
|
||||
* @property {string} [options.migrationVersionCompatibility]
|
||||
* @returns {promise} the created saved object { id, type, version, attributes }
|
||||
*/
|
||||
create<T = unknown>(
|
||||
|
@ -93,6 +96,7 @@ export interface ISavedObjectsRepository {
|
|||
* @param {object} [options={}] {@link SavedObjectsCreateOptions} - options for the bulk create operation
|
||||
* @property {boolean} [options.overwrite=false] - overwrites existing documents
|
||||
* @property {string} [options.namespace]
|
||||
* @property {string} [options.migrationVersionCompatibility]
|
||||
* @returns {promise} - {saved_objects: [[{ id, type, version, references, attributes, error: { message } }]}
|
||||
*/
|
||||
bulkCreate<T = unknown>(
|
||||
|
@ -177,7 +181,8 @@ export interface ISavedObjectsRepository {
|
|||
* Returns an array of objects by id
|
||||
*
|
||||
* @param {array} objects - an array of objects containing id, type and optionally fields
|
||||
* @param {object} [options={}] {@link SavedObjectsBaseOptions} - options for the bulk get operation
|
||||
* @param {object} [options={}] {@link SavedObjectsGetOptions} - options for the bulk get operation
|
||||
* @property {string} [options.migrationVersionCompatibility]
|
||||
* @property {string} [options.namespace]
|
||||
* @returns {promise} - { saved_objects: [{ id, type, version, attributes }] }
|
||||
* @example
|
||||
|
@ -189,14 +194,15 @@ export interface ISavedObjectsRepository {
|
|||
*/
|
||||
bulkGet<T = unknown>(
|
||||
objects: SavedObjectsBulkGetObject[],
|
||||
options?: SavedObjectsBaseOptions
|
||||
options?: SavedObjectsGetOptions
|
||||
): Promise<SavedObjectsBulkResponse<T>>;
|
||||
|
||||
/**
|
||||
* Resolves an array of objects by id, using any legacy URL aliases if they exist
|
||||
*
|
||||
* @param {array} objects - an array of objects containing id, type
|
||||
* @param {object} [options={}] {@link SavedObjectsBaseOptions} - options for the bulk resolve operation
|
||||
* @param {object} [options={}] {@link SavedObjectsResolveOptions} - options for the bulk resolve operation
|
||||
* @property {string} [options.migrationVersionCompatibility]
|
||||
* @property {string} [options.namespace]
|
||||
* @returns {promise} - { resolved_objects: [{ saved_object, outcome }] }
|
||||
* @example
|
||||
|
@ -208,7 +214,7 @@ export interface ISavedObjectsRepository {
|
|||
*/
|
||||
bulkResolve<T = unknown>(
|
||||
objects: SavedObjectsBulkResolveObject[],
|
||||
options?: SavedObjectsBaseOptions
|
||||
options?: SavedObjectsResolveOptions
|
||||
): Promise<SavedObjectsBulkResolveResponse<T>>;
|
||||
|
||||
/**
|
||||
|
@ -216,14 +222,15 @@ export interface ISavedObjectsRepository {
|
|||
*
|
||||
* @param {string} type - the type of the object to get
|
||||
* @param {string} id - the ID of the object to get
|
||||
* @param {object} [options={}] {@link SavedObjectsBaseOptions} - options for the get operation
|
||||
* @param {object} [options={}] {@link SavedObjectsGetOptions} - options for the get operation
|
||||
* @property {string} [options.migrationVersionCompatibility]
|
||||
* @property {string} [options.namespace]
|
||||
* @returns {promise} - { id, type, version, attributes }
|
||||
*/
|
||||
get<T = unknown>(
|
||||
type: string,
|
||||
id: string,
|
||||
options?: SavedObjectsBaseOptions
|
||||
options?: SavedObjectsGetOptions
|
||||
): Promise<SavedObject<T>>;
|
||||
|
||||
/**
|
||||
|
@ -231,14 +238,15 @@ export interface ISavedObjectsRepository {
|
|||
*
|
||||
* @param {string} type - the type of the object to resolve
|
||||
* @param {string} id - the id of the object to resolve
|
||||
* @param {object} [options={}] {@link SavedObjectsBaseOptions} - options for the resolve operation
|
||||
* @param {object} [options={}] {@link SavedObjectsResolveOptions} - options for the resolve operation
|
||||
* @property {string} [options.migrationVersionCompatibility]
|
||||
* @property {string} [options.namespace]
|
||||
* @returns {promise} - { saved_object, outcome }
|
||||
*/
|
||||
resolve<T = unknown>(
|
||||
type: string,
|
||||
id: string,
|
||||
options?: SavedObjectsBaseOptions
|
||||
options?: SavedObjectsResolveOptions
|
||||
): Promise<SavedObjectsResolveResponse<T>>;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue