diff --git a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/base.ts b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/base.ts index 74d5223def315..451e2551f08eb 100644 --- a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/base.ts +++ b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/base.ts @@ -12,6 +12,7 @@ import { SimpleSavedObject } from '../simple_saved_object'; * Batch response for simple saved objects * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface SavedObjectsBatchResponse { /** Array of simple saved objects */ diff --git a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_create.ts b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_create.ts index 6d5ce23205ef8..bc925b35647a3 100644 --- a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_create.ts +++ b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_create.ts @@ -12,6 +12,7 @@ import type { SavedObjectsCreateOptions } from './create'; * Per-object parameters for bulk create operation * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface SavedObjectsBulkCreateObject extends SavedObjectsCreateOptions { /** Create a SavedObject of this type. */ @@ -24,6 +25,7 @@ export interface SavedObjectsBulkCreateObject extends SavedObjectsC * Options for bulk create operation * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 * */ export interface SavedObjectsBulkCreateOptions { /** If a document with the given `id` already exists, overwrite its contents (default=false). */ diff --git a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_delete.ts b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_delete.ts index 532e900338d8a..4744cc406e97b 100644 --- a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_delete.ts +++ b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_delete.ts @@ -12,6 +12,7 @@ import { SavedObjectError } from '@kbn/core-saved-objects-common'; * Options for bulk delete operation * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface SavedObjectsBulkDeleteOptions { /** Force deletion of any objects that exist in multiple namespaces (default=false) */ @@ -22,6 +23,7 @@ export interface SavedObjectsBulkDeleteOptions { * Single item within the statuses array of the bulk delete response * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface SavedObjectsBulkDeleteResponseItem { /** saved object id */ @@ -38,6 +40,7 @@ export interface SavedObjectsBulkDeleteResponseItem { * Return type of the Saved Objects `bulkDelete()` method. * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface SavedObjectsBulkDeleteResponse { /** array of statuses per object */ diff --git a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_resolve.ts b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_resolve.ts index c5ba482525298..8b24e32f5791c 100644 --- a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_resolve.ts +++ b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_resolve.ts @@ -12,6 +12,7 @@ import type { ResolvedSimpleSavedObject } from './resolve'; * Return type of the Saved Objects `bulkResolve()` method. * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface SavedObjectsBulkResolveResponse { /** Array of {@link ResolvedSimpleSavedObject} that were resolved */ diff --git a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_update.ts b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_update.ts index c819fb1ac448d..56f516a37e9df 100644 --- a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_update.ts +++ b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/bulk_update.ts @@ -12,6 +12,7 @@ import type { SavedObjectReference } from '@kbn/core-saved-objects-common'; * Per-object parameters for bulk update operation * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface SavedObjectsBulkUpdateObject { /** Type of the saved object to update */ @@ -30,6 +31,7 @@ export interface SavedObjectsBulkUpdateObject { * Options for bulk update operation * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 * */ export interface SavedObjectsBulkUpdateOptions { /** diff --git a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/create.ts b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/create.ts index fb6a18219e5bf..65242b1bda546 100644 --- a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/create.ts +++ b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/create.ts @@ -15,6 +15,7 @@ import type { * Options for creating a saved object. * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface SavedObjectsCreateOptions { /** diff --git a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/delete.ts b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/delete.ts index c43dbec6845b3..e25038acf27cc 100644 --- a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/delete.ts +++ b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/delete.ts @@ -10,6 +10,7 @@ * Options for deleting a saved object. * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface SavedObjectsDeleteOptions { /** Force deletion of an object that exists in multiple namespaces (default=false) */ diff --git a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/find.ts b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/find.ts index 39d99a6ee6e86..9048b2b54308d 100644 --- a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/find.ts +++ b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/find.ts @@ -15,6 +15,7 @@ export type { SavedObjectsFindOptionsReference } from '@kbn/core-saved-objects-a * Browser options for finding saved objects * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export type SavedObjectsFindOptions = Omit< SavedObjectFindOptionsServer, @@ -25,6 +26,7 @@ export type SavedObjectsFindOptions = Omit< * Return type of the Saved Objects `find()` method. * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface SavedObjectsFindResponse extends SavedObjectsBatchResponse { diff --git a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/resolve.ts b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/resolve.ts index d2868ae48ced1..53ffe7782c720 100644 --- a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/resolve.ts +++ b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/resolve.ts @@ -14,6 +14,7 @@ import type { SimpleSavedObject } from '../simple_saved_object'; * with the {@link SavedObjectsClientContract}. * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface ResolvedSimpleSavedObject { /** diff --git a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/update.ts b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/update.ts index f8095e35df1e5..e456c5b9c6ea6 100644 --- a/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/update.ts +++ b/packages/core/saved-objects/core-saved-objects-api-browser/src/apis/update.ts @@ -12,6 +12,7 @@ import type { SavedObjectReference } from '@kbn/core-saved-objects-common'; * Options for updating a saved object * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface SavedObjectsUpdateOptions { /** version of the saved object */ diff --git a/packages/core/saved-objects/core-saved-objects-api-browser/src/saved_objects_client.ts b/packages/core/saved-objects/core-saved-objects-api-browser/src/saved_objects_client.ts index 9ff01104c5ba0..0011b6df7342e 100644 --- a/packages/core/saved-objects/core-saved-objects-api-browser/src/saved_objects_client.ts +++ b/packages/core/saved-objects/core-saved-objects-api-browser/src/saved_objects_client.ts @@ -30,6 +30,7 @@ import type { SimpleSavedObject } from './simple_saved_object'; * HTTP API for interacting with Saved Objects. * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface SavedObjectsClientContract { /** diff --git a/packages/core/saved-objects/core-saved-objects-api-browser/src/simple_saved_object.ts b/packages/core/saved-objects/core-saved-objects-api-browser/src/simple_saved_object.ts index 2932d4f5675a8..57bad2bc1b226 100644 --- a/packages/core/saved-objects/core-saved-objects-api-browser/src/simple_saved_object.ts +++ b/packages/core/saved-objects/core-saved-objects-api-browser/src/simple_saved_object.ts @@ -16,6 +16,7 @@ import type { SavedObject as SavedObjectType } from '@kbn/core-saved-objects-com * but doesn't include any type-specific implementations. * * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface SimpleSavedObject { /** attributes of the object, templated */ diff --git a/packages/core/saved-objects/core-saved-objects-browser-internal/src/saved_objects_client.ts b/packages/core/saved-objects/core-saved-objects-browser-internal/src/saved_objects_client.ts index 1fd111186f551..d7f9b8a8b4d0b 100644 --- a/packages/core/saved-objects/core-saved-objects-browser-internal/src/saved_objects_client.ts +++ b/packages/core/saved-objects/core-saved-objects-browser-internal/src/saved_objects_client.ts @@ -104,6 +104,7 @@ const getObjectsToResolve = (queue: BatchResolveQueueEntry[]) => { * HTTP API for interacting with Saved Objects. * * @internal + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export class SavedObjectsClient implements SavedObjectsClientContract { private http: HttpSetup; diff --git a/packages/core/saved-objects/core-saved-objects-browser-internal/src/saved_objects_service.ts b/packages/core/saved-objects/core-saved-objects-browser-internal/src/saved_objects_service.ts index 111d98bfcc126..7cef8a1c39057 100644 --- a/packages/core/saved-objects/core-saved-objects-browser-internal/src/saved_objects_service.ts +++ b/packages/core/saved-objects/core-saved-objects-browser-internal/src/saved_objects_service.ts @@ -11,6 +11,9 @@ import type { HttpStart } from '@kbn/core-http-browser'; import type { SavedObjectsStart } from '@kbn/core-saved-objects-browser'; import { SavedObjectsClient } from './saved_objects_client'; +/** + * @deprecated See https://github.com/elastic/kibana/issues/149098 + */ export class SavedObjectsService implements CoreService { public async setup() {} diff --git a/packages/core/saved-objects/core-saved-objects-browser-internal/src/simple_saved_object.ts b/packages/core/saved-objects/core-saved-objects-browser-internal/src/simple_saved_object.ts index 414ed5bbf1846..8c5fc18129761 100644 --- a/packages/core/saved-objects/core-saved-objects-browser-internal/src/simple_saved_object.ts +++ b/packages/core/saved-objects/core-saved-objects-browser-internal/src/simple_saved_object.ts @@ -18,6 +18,7 @@ import type { * Core internal implementation of {@link SimpleSavedObject} * * @internal Should use the {@link SimpleSavedObject} interface instead + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export class SimpleSavedObjectImpl implements SimpleSavedObject { public attributes: T; diff --git a/packages/core/saved-objects/core-saved-objects-browser-mocks/src/saved_objects_service.mock.ts b/packages/core/saved-objects/core-saved-objects-browser-mocks/src/saved_objects_service.mock.ts index 2239b94d7e2eb..3b537311d72d9 100644 --- a/packages/core/saved-objects/core-saved-objects-browser-mocks/src/saved_objects_service.mock.ts +++ b/packages/core/saved-objects/core-saved-objects-browser-mocks/src/saved_objects_service.mock.ts @@ -41,6 +41,9 @@ const createMock = () => { return mocked; }; +/** + * @deprecated See https://github.com/elastic/kibana/issues/149098 + */ export const savedObjectsServiceMock = { create: createMock, createStartContract: createStartContractMock, diff --git a/packages/core/saved-objects/core-saved-objects-browser-mocks/src/simple_saved_object.mock.ts b/packages/core/saved-objects/core-saved-objects-browser-mocks/src/simple_saved_object.mock.ts index 2e3c30ac17d9c..8264b5fd6ba87 100644 --- a/packages/core/saved-objects/core-saved-objects-browser-mocks/src/simple_saved_object.mock.ts +++ b/packages/core/saved-objects/core-saved-objects-browser-mocks/src/simple_saved_object.mock.ts @@ -63,6 +63,9 @@ const createSimpleSavedObjectMock = ( return mock; }; +/** + * @deprecated See https://github.com/elastic/kibana/issues/149098 + */ export const simpleSavedObjectMock = { create: (client: SavedObjectsClientContract, savedObject: SavedObject) => createSimpleSavedObjectMock(savedObject), diff --git a/packages/core/saved-objects/core-saved-objects-browser/src/contracts.ts b/packages/core/saved-objects/core-saved-objects-browser/src/contracts.ts index c372f3169ed80..082893e6efc74 100644 --- a/packages/core/saved-objects/core-saved-objects-browser/src/contracts.ts +++ b/packages/core/saved-objects/core-saved-objects-browser/src/contracts.ts @@ -9,6 +9,7 @@ import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-bro /** * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 */ export interface SavedObjectsStart { /** {@link SavedObjectsClientContract} */ diff --git a/packages/core/saved-objects/core-saved-objects-common/src/saved_objects.ts b/packages/core/saved-objects/core-saved-objects-common/src/saved_objects.ts index b9ea336d349bd..12e554cf185c8 100644 --- a/packages/core/saved-objects/core-saved-objects-common/src/saved_objects.ts +++ b/packages/core/saved-objects/core-saved-objects-common/src/saved_objects.ts @@ -6,47 +6,7 @@ * Side Public License, v 1. */ -/** - * Don't use this type, it's simply a helper type for {@link SavedObjectAttribute} - * - * @public - */ -export type SavedObjectAttributeSingle = - | string - | number - | boolean - | null - | undefined - | SavedObjectAttributes; - -/** - * Type definition for a Saved Object attribute value - * - * @public - */ -export type SavedObjectAttribute = SavedObjectAttributeSingle | SavedObjectAttributeSingle[]; - -/** - * The data for a Saved Object is stored as an object in the `attributes` - * property. - * - * @public - * @deprecated This type reduces the type safety of your code. Create an interface for your specific saved object type or use `unknown` instead. - */ -export interface SavedObjectAttributes { - [key: string]: SavedObjectAttribute; -} - -/** - * A reference to another saved object. - * - * @public - */ -export interface SavedObjectReference { - name: string; - type: string; - id: string; -} +import * as serverTypes from './server_types'; /** * Information about the migrations that have been applied to this SavedObject. @@ -68,41 +28,6 @@ export interface SavedObjectsMigrationVersion { [pluginName: string]: string; } -export interface SavedObject { - /** The ID of this Saved Object, guaranteed to be unique for all objects of the same `type` */ - id: string; - /** The type of Saved Object. Each plugin can define it's own custom Saved Object types. */ - type: string; - /** An opaque version number which changes on each successful write operation. Can be used for implementing optimistic concurrency control. */ - version?: string; - /** Timestamp of the time this document had been created. */ - created_at?: string; - /** Timestamp of the last time this document had been updated. */ - updated_at?: string; - /** Error associated with this object, populated if an operation failed for this object. */ - error?: SavedObjectError; - /** The data for a Saved Object is stored as an object in the `attributes` property. **/ - attributes: T; - /** {@inheritdoc SavedObjectReference} */ - references: SavedObjectReference[]; - /** {@inheritdoc SavedObjectsMigrationVersion} */ - migrationVersion?: SavedObjectsMigrationVersion; - /** A semver value that is used when upgrading objects between Kibana versions. */ - coreMigrationVersion?: string; - /** - * Space(s) that this saved object exists in. This attribute is not used for "global" saved object types which are registered with - * `namespaceType: 'agnostic'`. - */ - namespaces?: string[]; - /** - * The ID of the saved object this originated from. This is set if this object's `id` was regenerated; that can happen during migration - * from a legacy single-namespace type, or during import. It is only set during migration or create operations. This is used during import - * to ensure that ID regeneration is deterministic, so saved objects will be overwritten if they are imported multiple times into a given - * space. - */ - originId?: string; -} - /** * The namespace type dictates how a saved object can be interacted in relation to namespaces. Each type is mutually exclusive: * * single (default): This type of saved object is namespace-isolated, e.g., it exists in only one namespace. @@ -123,3 +48,33 @@ export interface SavedObjectError { statusCode: number; metadata?: Record; } + +/** + * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 + */ +export type SavedObjectAttributeSingle = serverTypes.SavedObjectAttributeSingle; + +/** + * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 + */ +export type SavedObjectAttribute = serverTypes.SavedObjectAttribute; + +/** + * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 + */ +export type SavedObjectAttributes = serverTypes.SavedObjectAttributes; + +/** + * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 + */ +export type SavedObjectReference = serverTypes.SavedObjectReference; + +/** + * @public + * @deprecated See https://github.com/elastic/kibana/issues/149098 + */ +export type SavedObject = serverTypes.SavedObject; diff --git a/packages/core/saved-objects/core-saved-objects-common/src/server_types.ts b/packages/core/saved-objects/core-saved-objects-common/src/server_types.ts new file mode 100644 index 0000000000000..8b0ae5c819952 --- /dev/null +++ b/packages/core/saved-objects/core-saved-objects-common/src/server_types.ts @@ -0,0 +1,94 @@ +/* + * 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. + */ + +/** + * Note: this file contains types that are intended for use by server-side code + * only. Once the Saved Objects client is removed from browser code we will + * remove these types as well. + * + * See https://github.com/elastic/kibana/issues/149098. + */ + +import type { SavedObjectsMigrationVersion, SavedObjectError } from './saved_objects'; + +/** + * Don't use this type, it's simply a helper type for {@link SavedObjectAttribute} + * + * @public + */ +export type SavedObjectAttributeSingle = + | string + | number + | boolean + | null + | undefined + | SavedObjectAttributes; + +/** + * Type definition for a Saved Object attribute value + * + * @public + */ +export type SavedObjectAttribute = SavedObjectAttributeSingle | SavedObjectAttributeSingle[]; + +/** + * The data for a Saved Object is stored as an object in the `attributes` + * property. + * + * @public + * @deprecated This type reduces the type safety of your code. Create an interface for your specific saved object type or use `unknown` instead. + */ +export interface SavedObjectAttributes { + [key: string]: SavedObjectAttribute; +} + +/** + * A reference to another saved object. + * + * @public + */ +export interface SavedObjectReference { + name: string; + type: string; + id: string; +} + +export interface SavedObject { + /** The ID of this Saved Object, guaranteed to be unique for all objects of the same `type` */ + id: string; + /** The type of Saved Object. Each plugin can define it's own custom Saved Object types. */ + type: string; + /** An opaque version number which changes on each successful write operation. Can be used for implementing optimistic concurrency control. */ + version?: string; + /** Timestamp of the time this document had been created. */ + created_at?: string; + /** Timestamp of the last time this document had been updated. */ + updated_at?: string; + /** Error associated with this object, populated if an operation failed for this object. */ + error?: SavedObjectError; + /** The data for a Saved Object is stored as an object in the `attributes` property. **/ + attributes: T; + /** {@inheritdoc SavedObjectReference} */ + references: SavedObjectReference[]; + /** {@inheritdoc SavedObjectsMigrationVersion} */ + migrationVersion?: SavedObjectsMigrationVersion; + /** A semver value that is used when upgrading objects between Kibana versions. */ + coreMigrationVersion?: string; + /** + * Space(s) that this saved object exists in. This attribute is not used for "global" saved object types which are registered with + * `namespaceType: 'agnostic'`. + */ + namespaces?: string[]; + /** + * The ID of the saved object this originated from. This is set if this object's `id` was regenerated; that can happen during migration + * from a legacy single-namespace type, or during import. It is only set during migration or create operations. This is used during import + * to ensure that ID regeneration is deterministic, so saved objects will be overwritten if they are imported multiple times into a given + * space. + */ + originId?: string; +} diff --git a/packages/core/saved-objects/core-saved-objects-server/index.ts b/packages/core/saved-objects/core-saved-objects-server/index.ts index f8791a1efbe5a..f99a813d01b7d 100644 --- a/packages/core/saved-objects/core-saved-objects-server/index.ts +++ b/packages/core/saved-objects/core-saved-objects-server/index.ts @@ -89,3 +89,10 @@ export { SECURITY_EXTENSION_ID, SPACES_EXTENSION_ID, } from './src/extensions/extensions'; + +export type { + SavedObject, + SavedObjectAttribute, + SavedObjectAttributeSingle, + SavedObjectReference, +} from '@kbn/core-saved-objects-common/src/server_types';