diff --git a/src/plugins/data_views/common/content_management/v1/constants.ts b/src/plugins/data_views/common/content_management/constants.ts similarity index 98% rename from src/plugins/data_views/common/content_management/v1/constants.ts rename to src/plugins/data_views/common/content_management/constants.ts index bf6634e90d9c..0775a8aab89b 100644 --- a/src/plugins/data_views/common/content_management/v1/constants.ts +++ b/src/plugins/data_views/common/content_management/constants.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { DATA_VIEW_SAVED_OBJECT_TYPE as DataViewSOType } from '../..'; +import { DATA_VIEW_SAVED_OBJECT_TYPE as DataViewSOType } from '..'; export { DataViewSOType }; /** diff --git a/src/plugins/data_views/common/content_management/index.ts b/src/plugins/data_views/common/content_management/index.ts index e9c79f0f50f9..d8bb2875a456 100644 --- a/src/plugins/data_views/common/content_management/index.ts +++ b/src/plugins/data_views/common/content_management/index.ts @@ -6,4 +6,10 @@ * Side Public License, v 1. */ -export * from './v1'; +export { LATEST_VERSION } from './constants'; + +export type { DataViewCrudTypes } from '../../server/content_management/schemas/v1/types'; + +export type { DataViewContentType } from './constants'; + +export { DataViewSOType } from './constants'; diff --git a/src/plugins/data_views/common/index.ts b/src/plugins/data_views/common/index.ts index faf6ad490f3a..2b45cc31ccac 100644 --- a/src/plugins/data_views/common/index.ts +++ b/src/plugins/data_views/common/index.ts @@ -14,7 +14,7 @@ export { MAX_DATA_VIEW_FIELD_DESCRIPTION_LENGTH, } from './constants'; -export { LATEST_VERSION } from './content_management/v1/constants'; +export { LATEST_VERSION } from './content_management/constants'; export type { ToSpecConfig } from './fields'; export type { IIndexPatternFieldList } from './fields'; diff --git a/src/plugins/data_views/public/content_management_wrapper.ts b/src/plugins/data_views/public/content_management_wrapper.ts index d4fde2910399..96fdaa5ce1b5 100644 --- a/src/plugins/data_views/public/content_management_wrapper.ts +++ b/src/plugins/data_views/public/content_management_wrapper.ts @@ -16,7 +16,7 @@ import { SavedObjectsClientCommonFindArgs, } from '../common/types'; -import type { DataViewCrudTypes } from '../common/content_management'; +import type { DataViewCrudTypes } from '../server/content_management/schemas'; import { DataViewSOType } from '../common/content_management'; diff --git a/src/plugins/data_views/public/plugin.ts b/src/plugins/data_views/public/plugin.ts index 3a847ce93998..c242edc98c2e 100644 --- a/src/plugins/data_views/public/plugin.ts +++ b/src/plugins/data_views/public/plugin.ts @@ -28,7 +28,7 @@ import { getIndices, HasData } from './services'; import { debounceByKey } from './debounce_by_key'; import { DATA_VIEW_SAVED_OBJECT_TYPE } from '../common/constants'; -import { LATEST_VERSION } from '../common/content_management/v1/constants'; +import { LATEST_VERSION } from '../common/content_management/constants'; export class DataViewsPublicPlugin implements diff --git a/src/plugins/data_views/server/content_management/data_views_storage.ts b/src/plugins/data_views/server/content_management/data_views_storage.ts index bb01064d5995..da4b3bfadf48 100644 --- a/src/plugins/data_views/server/content_management/data_views_storage.ts +++ b/src/plugins/data_views/server/content_management/data_views_storage.ts @@ -9,9 +9,9 @@ import { SOContentStorage } from '@kbn/content-management-utils'; 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 './schemas/cm_services'; +import type { DataViewCrudTypes } from './schemas'; +import { DataViewSOType } from './schemas'; export class DataViewsStorage extends SOContentStorage { constructor({ diff --git a/src/plugins/data_views/common/content_management/cm_services.ts b/src/plugins/data_views/server/content_management/schemas/cm_services.ts similarity index 87% rename from src/plugins/data_views/common/content_management/cm_services.ts rename to src/plugins/data_views/server/content_management/schemas/cm_services.ts index af32d57e0437..fa050138b35f 100644 --- a/src/plugins/data_views/common/content_management/cm_services.ts +++ b/src/plugins/data_views/server/content_management/schemas/cm_services.ts @@ -11,7 +11,7 @@ import type { Version, } from '@kbn/object-versioning'; -// We export the versionned service definition from this file and not the barrel to avoid adding +// We export the versioned service definition from this file and not the barrel to avoid adding // the schemas in the "public" js bundle import { serviceDefinition as v1 } from './v1/cm_services'; diff --git a/src/plugins/data_views/server/content_management/schemas/index.ts b/src/plugins/data_views/server/content_management/schemas/index.ts new file mode 100644 index 000000000000..e9c79f0f50f9 --- /dev/null +++ b/src/plugins/data_views/server/content_management/schemas/index.ts @@ -0,0 +1,9 @@ +/* + * 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 * from './v1'; diff --git a/src/plugins/data_views/common/content_management/v1/cm_services.ts b/src/plugins/data_views/server/content_management/schemas/v1/cm_services.ts similarity index 95% rename from src/plugins/data_views/common/content_management/v1/cm_services.ts rename to src/plugins/data_views/server/content_management/schemas/v1/cm_services.ts index 7b70a4c10345..0a9a4a9dcbff 100644 --- a/src/plugins/data_views/common/content_management/v1/cm_services.ts +++ b/src/plugins/data_views/server/content_management/schemas/v1/cm_services.ts @@ -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 '../../../rest_api_routes/schemas'; const dataViewAttributesSchema = schema.object( { diff --git a/src/plugins/data_views/server/content_management/schemas/v1/constants.ts b/src/plugins/data_views/server/content_management/schemas/v1/constants.ts new file mode 100644 index 000000000000..78b8ed0cac39 --- /dev/null +++ b/src/plugins/data_views/server/content_management/schemas/v1/constants.ts @@ -0,0 +1,17 @@ +/* + * 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 { DATA_VIEW_SAVED_OBJECT_TYPE as DataViewSOType } from '../../../../common'; +export { DataViewSOType }; + +/** + * Data view saved object version. + */ +export const LATEST_VERSION = 1; + +export type DataViewContentType = typeof DataViewSOType; diff --git a/src/plugins/data_views/common/content_management/v1/index.ts b/src/plugins/data_views/server/content_management/schemas/v1/index.ts similarity index 100% rename from src/plugins/data_views/common/content_management/v1/index.ts rename to src/plugins/data_views/server/content_management/schemas/v1/index.ts diff --git a/src/plugins/data_views/common/content_management/v1/types.ts b/src/plugins/data_views/server/content_management/schemas/v1/types.ts similarity index 95% rename from src/plugins/data_views/common/content_management/v1/types.ts rename to src/plugins/data_views/server/content_management/schemas/v1/types.ts index 19637bb17e8c..7a24805dbef8 100644 --- a/src/plugins/data_views/common/content_management/v1/types.ts +++ b/src/plugins/data_views/server/content_management/schemas/v1/types.ts @@ -12,7 +12,7 @@ import type { SavedObjectSearchOptions, SavedObjectUpdateOptions, } from '@kbn/content-management-utils'; -import { DataViewAttributes } from '../../types'; +import { DataViewAttributes } from '../../../../common/types'; import { DataViewContentType } from './constants'; interface DataViewCreateOptions { diff --git a/src/plugins/data_views/server/rest_api_routes/public/fields/update_fields.ts b/src/plugins/data_views/server/rest_api_routes/public/fields/update_fields.ts index a8d2e7d0a524..7be46ad605ac 100644 --- a/src/plugins/data_views/server/rest_api_routes/public/fields/update_fields.ts +++ b/src/plugins/data_views/server/rest_api_routes/public/fields/update_fields.ts @@ -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'; diff --git a/src/plugins/data_views/server/rest_api_routes/public/runtime_fields/create_runtime_field.ts b/src/plugins/data_views/server/rest_api_routes/public/runtime_fields/create_runtime_field.ts index ff446f76c885..0b678f844d4f 100644 --- a/src/plugins/data_views/server/rest_api_routes/public/runtime_fields/create_runtime_field.ts +++ b/src/plugins/data_views/server/rest_api_routes/public/runtime_fields/create_runtime_field.ts @@ -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, diff --git a/src/plugins/data_views/server/rest_api_routes/public/runtime_fields/put_runtime_field.ts b/src/plugins/data_views/server/rest_api_routes/public/runtime_fields/put_runtime_field.ts index 7105d8ea8413..170b07dc1ddf 100644 --- a/src/plugins/data_views/server/rest_api_routes/public/runtime_fields/put_runtime_field.ts +++ b/src/plugins/data_views/server/rest_api_routes/public/runtime_fields/put_runtime_field.ts @@ -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, diff --git a/src/plugins/data_views/server/rest_api_routes/public/runtime_fields/update_runtime_field.ts b/src/plugins/data_views/server/rest_api_routes/public/runtime_fields/update_runtime_field.ts index 485551c866ee..8e4a035495f8 100644 --- a/src/plugins/data_views/server/rest_api_routes/public/runtime_fields/update_runtime_field.ts +++ b/src/plugins/data_views/server/rest_api_routes/public/runtime_fields/update_runtime_field.ts @@ -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, diff --git a/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/create_scripted_field.ts b/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/create_scripted_field.ts index ed6716b1684b..19d5dcd5d8ca 100644 --- a/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/create_scripted_field.ts +++ b/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/create_scripted_field.ts @@ -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, diff --git a/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/get_scripted_field.ts b/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/get_scripted_field.ts index 7023fba31b58..db0448f7d892 100644 --- a/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/get_scripted_field.ts +++ b/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/get_scripted_field.ts @@ -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 = ( diff --git a/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/put_scripted_field.ts b/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/put_scripted_field.ts index 20e828009f2a..eaa5783d2555 100644 --- a/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/put_scripted_field.ts +++ b/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/put_scripted_field.ts @@ -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, diff --git a/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/update_scripted_field.ts b/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/update_scripted_field.ts index 53e9d165814b..60988f2ebb69 100644 --- a/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/update_scripted_field.ts +++ b/src/plugins/data_views/server/rest_api_routes/public/scripted_fields/update_scripted_field.ts @@ -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, diff --git a/src/plugins/data_views/server/rest_api_routes/public/update_data_view.ts b/src/plugins/data_views/server/rest_api_routes/public/update_data_view.ts index 0c7c66a0a1fe..f19a99a6edec 100644 --- a/src/plugins/data_views/server/rest_api_routes/public/update_data_view.ts +++ b/src/plugins/data_views/server/rest_api_routes/public/update_data_view.ts @@ -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, diff --git a/src/plugins/data_views/server/rest_api_routes/schema.ts b/src/plugins/data_views/server/rest_api_routes/schema.ts index c4f4a4c70b82..f6e56d31263c 100644 --- a/src/plugins/data_views/server/rest_api_routes/schema.ts +++ b/src/plugins/data_views/server/rest_api_routes/schema.ts @@ -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({ diff --git a/src/plugins/data_views/common/schemas.ts b/src/plugins/data_views/server/rest_api_routes/schemas.ts similarity index 97% rename from src/plugins/data_views/common/schemas.ts rename to src/plugins/data_views/server/rest_api_routes/schemas.ts index b78011841404..205287b5adae 100644 --- a/src/plugins/data_views/common/schemas.ts +++ b/src/plugins/data_views/server/rest_api_routes/schemas.ts @@ -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()),