[Move @kbn/config-schema to server] @kbn/content-management-utils (#191521)

This commit is contained in:
Alejandro Fernández Haro 2024-08-28 15:56:40 +02:00 committed by GitHub
parent 02a3992edb
commit 15deafa4ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 67 additions and 51 deletions

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-server",
"id": "@kbn/content-management-utils",
"owner": "@elastic/kibana-data-discovery"
}

View file

@ -13,10 +13,3 @@ export type {
DashboardAttributes,
SavedDashboardPanel,
} from './types';
export {
serviceDefinition,
dashboardSavedObjectSchema,
controlGroupInputSchema,
dashboardAttributesSchema,
} from './cm_services';

View file

@ -6,11 +6,5 @@
* Side Public License, v 1.
*/
export {
serviceDefinition,
dashboardSavedObjectSchema,
dashboardAttributesSchema,
} from './cm_services';
export type { GridData, DashboardItem, SavedDashboardPanel } from '../v1/types'; // no changes made to types from v1 to v2
export type { DashboardCrudTypes, DashboardAttributes } from './types';

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import {
import type {
ContentManagementCrudTypes,
SavedObjectCreateOptions,
SavedObjectUpdateOptions,

View file

@ -11,7 +11,7 @@ import { SavedObjectsFindOptions } from '@kbn/core-saved-objects-api-server';
import type { Logger } from '@kbn/logging';
import { CONTENT_ID } from '../../common/content_management';
import { cmServicesDefinition } from '../../common/content_management/cm_services';
import { cmServicesDefinition } from './schema/cm_services';
import type { DashboardCrudTypes } from '../../common/content_management';
const searchArgsToSOFindOptions = (

View file

@ -0,0 +1,14 @@
/*
* 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.
*/
export {
serviceDefinition,
dashboardSavedObjectSchema,
controlGroupInputSchema,
dashboardAttributesSchema,
} from './cm_services';

View file

@ -0,0 +1,13 @@
/*
* 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.
*/
export {
serviceDefinition,
dashboardSavedObjectSchema,
dashboardAttributesSchema,
} from './cm_services';

View file

@ -9,8 +9,8 @@
import { ANALYTICS_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server';
import { SavedObjectsType } from '@kbn/core/server';
import { dashboardAttributesSchema as dashboardAttributesSchemaV1 } from '../../common/content_management/v1';
import { dashboardAttributesSchema as dashboardAttributesSchemaV2 } from '../../common/content_management/v2';
import { dashboardAttributesSchema as dashboardAttributesSchemaV1 } from '../content_management/schema/v1';
import { dashboardAttributesSchema as dashboardAttributesSchemaV2 } from '../content_management/schema/v2';
import {
createDashboardSavedObjectTypeMigrations,
DashboardSavedObjectTypeMigrationsDeps,

View file

@ -11,7 +11,7 @@ import type { Logger } from '@kbn/logging';
import type { DataViewCrudTypes } from '../../common/content_management';
import { DataViewSOType } from '../../common/content_management';
import { cmServicesDefinition } from '../../common/content_management/cm_services';
import { cmServicesDefinition } from './schema/cm_services';
export class DataViewsStorage extends SOContentStorage<DataViewCrudTypes> {
constructor({

View file

@ -16,9 +16,9 @@ import {
createResultSchema,
searchOptionsSchemas,
} from '@kbn/content-management-utils';
import { DataViewType } from '../..';
import { MAX_DATA_VIEW_FIELD_DESCRIPTION_LENGTH } from '../../constants';
import { serializedFieldFormatSchema, fieldSpecSchema } from '../../schemas';
import { DataViewType } from '../../../../common';
import { MAX_DATA_VIEW_FIELD_DESCRIPTION_LENGTH } from '../../../../common/constants';
import { serializedFieldFormatSchema, fieldSpecSchema } from '../../../schemas';
const dataViewAttributesSchema = schema.object(
{

View file

@ -12,7 +12,7 @@ import { IRouter, StartServicesAccessor } from '@kbn/core/server';
import { SerializedFieldFormat } from '@kbn/field-formats-plugin/common';
import { DataViewsService } from '../../../../common';
import { handleErrors } from '../util/handle_errors';
import { serializedFieldFormatSchema } from '../../../../common/schemas';
import { serializedFieldFormatSchema } from '../../../schemas';
import { MAX_DATA_VIEW_FIELD_DESCRIPTION_LENGTH } from '../../../../common/constants';
import { dataViewSpecSchema } from '../../schema';
import { DataViewSpecRestResponse } from '../../route_types';

View file

@ -12,7 +12,7 @@ import { IRouter, StartServicesAccessor } from '@kbn/core/server';
import { DataViewsService } from '../../../../common/data_views';
import { RuntimeField } from '../../../../common/types';
import { handleErrors } from '../util/handle_errors';
import { runtimeFieldSchema } from '../../../../common/schemas';
import { runtimeFieldSchema } from '../../../schemas';
import type {
DataViewsServerPluginStart,
DataViewsServerPluginStartDependencies,

View file

@ -12,7 +12,7 @@ import { IRouter, StartServicesAccessor } from '@kbn/core/server';
import { DataViewsService } from '../../../../common/data_views';
import { RuntimeField } from '../../../../common/types';
import { handleErrors } from '../util/handle_errors';
import { runtimeFieldSchema } from '../../../../common/schemas';
import { runtimeFieldSchema } from '../../../schemas';
import type {
DataViewsServerPluginStart,
DataViewsServerPluginStartDependencies,

View file

@ -13,7 +13,7 @@ import { DataViewsService } from '../../../../common/data_views';
import { RuntimeField } from '../../../../common/types';
import { ErrorIndexPatternFieldNotFound } from '../../../error';
import { handleErrors } from '../util/handle_errors';
import { runtimeFieldSchemaUpdate } from '../../../../common/schemas';
import { runtimeFieldSchemaUpdate } from '../../../schemas';
import type {
DataViewsServerPluginStart,
DataViewsServerPluginStartDependencies,

View file

@ -9,7 +9,7 @@
import { schema } from '@kbn/config-schema';
import { IRouter, StartServicesAccessor } from '@kbn/core/server';
import { handleErrors } from '../util/handle_errors';
import { fieldSpecSchema } from '../../../../common/schemas';
import { fieldSpecSchema } from '../../../schemas';
import type {
DataViewsServerPluginStart,
DataViewsServerPluginStartDependencies,

View file

@ -15,7 +15,7 @@ import type {
DataViewsServerPluginStartDependencies,
} from '../../../types';
import { INITIAL_REST_VERSION } from '../../../constants';
import { fieldSpecSchemaFields } from '../../../../common/schemas';
import { fieldSpecSchemaFields } from '../../../schemas';
import { FieldSpecRestResponse } from '../../route_types';
export const registerGetScriptedFieldRoute = (

View file

@ -9,7 +9,7 @@
import { schema } from '@kbn/config-schema';
import { IRouter, StartServicesAccessor } from '@kbn/core/server';
import { handleErrors } from '../util/handle_errors';
import { fieldSpecSchema } from '../../../../common/schemas';
import { fieldSpecSchema } from '../../../schemas';
import type {
DataViewsServerPluginStart,
DataViewsServerPluginStartDependencies,

View file

@ -11,7 +11,7 @@ import { IRouter, StartServicesAccessor } from '@kbn/core/server';
import { FieldSpec } from '../../../../common';
import { ErrorIndexPatternFieldNotFound } from '../../../error';
import { handleErrors } from '../util/handle_errors';
import { fieldSpecSchemaFields } from '../../../../common/schemas';
import { fieldSpecSchemaFields } from '../../../schemas';
import type {
DataViewsServerPluginStart,
DataViewsServerPluginStartDependencies,

View file

@ -13,11 +13,7 @@ import { DataViewSpecRestResponse } from '../route_types';
import { DataViewsService } from '../../../common/data_views';
import { DataViewSpec } from '../../../common/types';
import { handleErrors } from './util/handle_errors';
import {
fieldSpecSchema,
runtimeFieldSchema,
serializedFieldFormatSchema,
} from '../../../common/schemas';
import { fieldSpecSchema, runtimeFieldSchema, serializedFieldFormatSchema } from '../../schemas';
import { dataViewSpecSchema } from '../schema';
import type {
DataViewsServerPluginStartDependencies,

View file

@ -14,7 +14,7 @@ import {
runtimeFieldSchema,
serializedFieldFormatSchema,
fieldSpecSchemaFields,
} from '../../common/schemas';
} from '../schemas';
import { MAX_DATA_VIEW_FIELD_DESCRIPTION_LENGTH } from '../../common/constants';
export const dataViewSpecSchema = schema.object({

View file

@ -7,8 +7,8 @@
*/
import { schema, Type } from '@kbn/config-schema';
import { MAX_DATA_VIEW_FIELD_DESCRIPTION_LENGTH } from './constants';
import { RuntimeType } from '.';
import { MAX_DATA_VIEW_FIELD_DESCRIPTION_LENGTH } from '../common/constants';
import { RuntimeType } from '../common';
export const serializedFieldFormatSchema = schema.object({
id: schema.maybe(schema.string()),

View file

@ -18,7 +18,7 @@ import {
CreateResult,
UpdateResult,
} from '@kbn/content-management-plugin/common';
import { ContentManagementCrudTypes } from '@kbn/content-management-utils';
import type { ContentManagementCrudTypes } from '@kbn/content-management-utils';
import type { DataViewSpec } from '@kbn/data-views-plugin/common';
import type { EventAnnotationConfig } from '@kbn/event-annotation-common';

View file

@ -9,7 +9,7 @@ import { SOContentStorage } from '@kbn/content-management-utils';
import { EVENT_ANNOTATION_GROUP_TYPE } from '@kbn/event-annotation-common';
import { Logger } from '@kbn/logging';
import { cmServicesDefinition } from '../../common/content_management/cm_services';
import { cmServicesDefinition } from './schema/cm_services';
import type { EventAnnotationGroupCrudTypes } from '../../common/content_management';
export class EventAnnotationGroupStorage extends SOContentStorage<EventAnnotationGroupCrudTypes> {

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { Reference } from '@kbn/content-management-utils';
import type { Reference } from '@kbn/content-management-utils';
import { omit } from 'lodash';
import { DASHBOARD_LINK_TYPE, LinksAttributes } from '../content_management';

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { SOWithMetadata } from '@kbn/content-management-utils';
import type { SOWithMetadata } from '@kbn/content-management-utils';
import { LinksAttributes } from '../../common/content_management';
import { injectReferences } from '../../common/persistable_state';
import { LinksByReferenceSerializedState, LinksRuntimeState, LinksSerializedState } from '../types';

View file

@ -10,7 +10,7 @@ import type { Logger } from '@kbn/logging';
import { SOContentStorage } from '@kbn/content-management-utils';
import { CONTENT_ID } from '../../common';
import type { LinksCrudTypes } from '../../common/content_management';
import { cmServicesDefinition } from '../../common/content_management/cm_services';
import { cmServicesDefinition } from './schema/cm_services';
export class LinksStorage extends SOContentStorage<LinksCrudTypes> {
constructor({

View file

@ -15,8 +15,11 @@ import {
createOptionsSchemas,
objectTypeToGetResultSchema,
} from '@kbn/content-management-utils';
import { DASHBOARD_LINK_TYPE, EXTERNAL_LINK_TYPE } from '.';
import { LINKS_HORIZONTAL_LAYOUT, LINKS_VERTICAL_LAYOUT } from './constants';
import { DASHBOARD_LINK_TYPE, EXTERNAL_LINK_TYPE } from '../../../../common/content_management/v1';
import {
LINKS_HORIZONTAL_LAYOUT,
LINKS_VERTICAL_LAYOUT,
} from '../../../../common/content_management/v1/constants';
const baseLinkSchema = {
id: schema.string(),

View file

@ -11,7 +11,7 @@ import type { Logger } from '@kbn/logging';
import type { SavedSearchCrudTypes } from '../../common/content_management';
import { SavedSearchType } from '../../common/content_management';
import { cmServicesDefinition } from '../../common/content_management/cm_services';
import { cmServicesDefinition } from './schema/cm_services';
export class SavedSearchStorage extends SOContentStorage<SavedSearchCrudTypes> {
constructor({

View file

@ -15,7 +15,10 @@ import {
updateOptionsSchema,
createResultSchema,
} from '@kbn/content-management-utils';
import { MIN_SAVED_SEARCH_SAMPLE_SIZE, MAX_SAVED_SEARCH_SAMPLE_SIZE } from '../../constants';
import {
MIN_SAVED_SEARCH_SAMPLE_SIZE,
MAX_SAVED_SEARCH_SAMPLE_SIZE,
} from '../../../../common/constants';
const sortSchema = schema.arrayOf(schema.string(), { maxSize: 2 });

View file

@ -18,7 +18,7 @@ import {
CreateResult,
UpdateResult,
} from '@kbn/content-management-plugin/common';
import { ContentManagementCrudTypes } from '@kbn/content-management-utils';
import type { ContentManagementCrudTypes } from '@kbn/content-management-utils';
import { VisualizationContentType } from '../types';

View file

@ -8,7 +8,7 @@
import { SearchQuery } from '@kbn/content-management-plugin/common';
import { ContentManagementPublicStart } from '@kbn/content-management-plugin/public';
import {
import type {
ContentManagementCrudTypes,
SavedObjectCreateOptions,
SavedObjectUpdateOptions,

View file

@ -17,7 +17,7 @@ import {
CreateResult,
UpdateResult,
} from '@kbn/content-management-plugin/common';
import { ContentManagementCrudTypes } from '@kbn/content-management-utils';
import type { ContentManagementCrudTypes } from '@kbn/content-management-utils';
import { GraphContentType } from '../types';

View file

@ -9,7 +9,7 @@ import { SOContentStorage, tagsToFindOptions } from '@kbn/content-management-uti
import { SavedObjectsFindOptions } from '@kbn/core-saved-objects-api-server';
import type { Logger } from '@kbn/logging';
import { CONTENT_ID } from '../../common/content_management';
import { cmServicesDefinition } from '../../common/content_management/cm_services';
import { cmServicesDefinition } from './schema/cm_services';
import type { MapCrudTypes } from '../../common/content_management';
const searchArgsToSOFindOptions = (args: MapCrudTypes['SearchIn']): SavedObjectsFindOptions => {