diff --git a/packages/kbn-generate-csv/src/get_export_settings.ts b/packages/kbn-generate-csv/src/get_export_settings.ts index f6804b5d17572..faef6fdc60f87 100644 --- a/packages/kbn-generate-csv/src/get_export_settings.ts +++ b/packages/kbn-generate-csv/src/get_export_settings.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { ByteSizeValue } from '@kbn/config-schema'; +import type { ByteSizeValue } from '@kbn/config-schema'; import type { IUiSettingsClient, Logger } from '@kbn/core/server'; import { createEscapeValue } from '@kbn/data-plugin/common'; import type { ReportingConfigType } from '@kbn/reporting-server'; diff --git a/packages/kbn-reporting/server/config.ts b/packages/kbn-reporting/server/config_schema.ts similarity index 97% rename from packages/kbn-reporting/server/config.ts rename to packages/kbn-reporting/server/config_schema.ts index f7c910d9c425b..3aab7be6e660c 100644 --- a/packages/kbn-reporting/server/config.ts +++ b/packages/kbn-reporting/server/config_schema.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { ByteSizeValue, offeringBasedSchema, schema, TypeOf } from '@kbn/config-schema'; +import { ByteSizeValue, offeringBasedSchema, schema } from '@kbn/config-schema'; import ipaddr from 'ipaddr.js'; import { sum } from 'lodash'; import moment from 'moment'; @@ -148,5 +148,3 @@ export const ConfigSchema = schema.object({ export_types: ExportTypeSchema, statefulSettings: SettingsSchema, }); - -export type ReportingConfigType = TypeOf; diff --git a/packages/kbn-reporting/server/index.ts b/packages/kbn-reporting/server/index.ts index b177c953085b4..407eae4d8ce1e 100644 --- a/packages/kbn-reporting/server/index.ts +++ b/packages/kbn-reporting/server/index.ts @@ -21,6 +21,6 @@ export { getFieldFormats, setFieldFormats } from './services'; export { validateUrls } from './validate_urls'; export type { BaseExportTypeSetupDeps, BaseExportTypeStartDeps } from './export_type'; -export * from './types'; +export { ConfigSchema } from './config_schema'; -export { ConfigSchema, ReportingConfigType } from './config'; +export * from './types'; diff --git a/packages/kbn-reporting/server/types.ts b/packages/kbn-reporting/server/types.ts index 007333de214e7..94ad1e34a19d3 100644 --- a/packages/kbn-reporting/server/types.ts +++ b/packages/kbn-reporting/server/types.ts @@ -8,11 +8,14 @@ import { Writable } from 'stream'; +import type { TypeOf } from '@kbn/config-schema'; import type { CustomRequestHandlerContext } from '@kbn/core-http-request-handler-context-server'; import type { KibanaRequest } from '@kbn/core-http-server'; import type { CancellationToken } from '@kbn/reporting-common'; import type { BaseParams, BasePayload, TaskRunResult } from '@kbn/reporting-common/types'; -import { ExportType } from './export_type'; + +import { ConfigSchema } from './config_schema'; +import type { ExportType } from './export_type'; export interface ReportingServerPluginSetup { registerExportTypes: (item: ExportType) => void; @@ -43,3 +46,5 @@ export interface TimeRangeParams { min?: Date | string | number | null; max?: Date | string | number | null; } + +export type ReportingConfigType = TypeOf; diff --git a/x-pack/plugins/reporting/common/types.ts b/x-pack/plugins/reporting/common/types.ts new file mode 100644 index 0000000000000..09d1dc8f43e31 --- /dev/null +++ b/x-pack/plugins/reporting/common/types.ts @@ -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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { jobTypes, reportTypes } from './constants'; + +type ReportTypeDeclaration = typeof reportTypes; +export type ReportTypes = ReportTypeDeclaration[keyof ReportTypeDeclaration]; + +type JobTypeDeclaration = typeof jobTypes; +export type JobTypes = JobTypeDeclaration[keyof JobTypeDeclaration]; diff --git a/x-pack/plugins/reporting/server/config/create_config.ts b/x-pack/plugins/reporting/server/config/create_config.ts index d0a7770237195..3841b2920a8eb 100644 --- a/x-pack/plugins/reporting/server/config/create_config.ts +++ b/x-pack/plugins/reporting/server/config/create_config.ts @@ -10,7 +10,7 @@ import ipaddr from 'ipaddr.js'; import { sum } from 'lodash'; import type { CoreSetup, Logger } from '@kbn/core/server'; -import { ReportingConfigType } from '.'; +import type { ReportingConfigType } from '@kbn/reporting-server'; /* * Set up dynamic config defaults diff --git a/x-pack/plugins/reporting/server/config/index.ts b/x-pack/plugins/reporting/server/config/index.ts index bb47bb9658412..5965693e37c13 100644 --- a/x-pack/plugins/reporting/server/config/index.ts +++ b/x-pack/plugins/reporting/server/config/index.ts @@ -72,4 +72,3 @@ export const config: PluginConfigDescriptor = { export { createConfig } from './create_config'; export { registerUiSettings } from './ui_settings'; export { ConfigSchema }; -export type { ReportingConfigType }; diff --git a/x-pack/plugins/reporting/server/core.ts b/x-pack/plugins/reporting/server/core.ts index dd046b2daef22..03d6a1138e385 100644 --- a/x-pack/plugins/reporting/server/core.ts +++ b/x-pack/plugins/reporting/server/core.ts @@ -33,9 +33,10 @@ import { CsvSearchSourceImmediateExportType, CsvV2ExportType, } from '@kbn/reporting-export-types-csv'; -import { ExportType } from '@kbn/reporting-server'; -import { PdfV1ExportType, PdfExportType } from '@kbn/reporting-export-types-pdf'; +import { PdfExportType, PdfV1ExportType } from '@kbn/reporting-export-types-pdf'; import { PngExportType } from '@kbn/reporting-export-types-png'; +import type { ReportingConfigType } from '@kbn/reporting-server'; +import { ExportType } from '@kbn/reporting-server'; import { PdfScreenshotResult, PngScreenshotResult, @@ -52,7 +53,7 @@ import type { import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import type { ReportingSetup } from '.'; -import { ReportingConfigType, createConfig } from './config'; +import { createConfig } from './config'; import { ExportTypesRegistry, checkLicense } from './lib'; import { reportingEventLoggerFactory } from './lib/event_logger/logger'; import type { IReport, ReportingStore } from './lib/store'; diff --git a/x-pack/plugins/reporting/server/index.ts b/x-pack/plugins/reporting/server/index.ts index 1089331ccd110..e9c9ec69fecc5 100644 --- a/x-pack/plugins/reporting/server/index.ts +++ b/x-pack/plugins/reporting/server/index.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { PluginInitializerContext } from '@kbn/core/server'; -import { ReportingConfigType } from './config'; +import type { PluginInitializerContext } from '@kbn/core/server'; +import type { ReportingConfigType } from '@kbn/reporting-server'; import { ReportingPlugin } from './plugin'; export { config } from './config'; diff --git a/x-pack/plugins/reporting/server/lib/tasks/execute_report.test.ts b/x-pack/plugins/reporting/server/lib/tasks/execute_report.test.ts index a091a23bcc1f1..90b1daacc9f0c 100644 --- a/x-pack/plugins/reporting/server/lib/tasks/execute_report.test.ts +++ b/x-pack/plugins/reporting/server/lib/tasks/execute_report.test.ts @@ -8,13 +8,12 @@ import { loggingSystemMock } from '@kbn/core/server/mocks'; import { KibanaShuttingDownError } from '@kbn/reporting-common'; import { createMockConfigSchema } from '@kbn/reporting-mocks-server'; -import type { ExportType } from '@kbn/reporting-server'; +import type { ExportType, ReportingConfigType } from '@kbn/reporting-server'; import type { RunContext } from '@kbn/task-manager-plugin/server'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; import { ExecuteReportTask } from '.'; import type { ReportingCore } from '../..'; -import type { ReportingConfigType } from '../../config'; import { createMockReportingCore } from '../../test_helpers'; import type { SavedReport } from '../store'; diff --git a/x-pack/plugins/reporting/server/lib/tasks/execute_report.ts b/x-pack/plugins/reporting/server/lib/tasks/execute_report.ts index 32aee34caa0de..62c31c8cb185a 100644 --- a/x-pack/plugins/reporting/server/lib/tasks/execute_report.ts +++ b/x-pack/plugins/reporting/server/lib/tasks/execute_report.ts @@ -23,6 +23,7 @@ import { numberToDuration, } from '@kbn/reporting-common'; import type { ReportOutput, TaskRunResult } from '@kbn/reporting-common/types'; +import type { ReportingConfigType } from '@kbn/reporting-server'; import type { RunContext, TaskManagerStartContract, @@ -33,7 +34,6 @@ import { REPORTING_EXECUTE_TYPE, ReportTaskParams, ReportingTask, ReportingTaskS import { ExportTypesRegistry, getContentStream } from '..'; import type { ReportingCore } from '../..'; import { mapToReportingError } from '../../../common/errors/map_to_reporting_error'; -import type { ReportingConfigType } from '../../config'; import type { ReportDocument, ReportingStore } from '../store'; import { Report, SavedReport } from '../store'; import type { ReportFailedFields, ReportProcessingFields } from '../store/store'; diff --git a/x-pack/plugins/reporting/server/lib/tasks/monitor_report.test.ts b/x-pack/plugins/reporting/server/lib/tasks/monitor_report.test.ts index 77d7204abe069..cf17fd2c65221 100644 --- a/x-pack/plugins/reporting/server/lib/tasks/monitor_report.test.ts +++ b/x-pack/plugins/reporting/server/lib/tasks/monitor_report.test.ts @@ -7,11 +7,11 @@ import { loggingSystemMock } from '@kbn/core/server/mocks'; import { createMockConfigSchema } from '@kbn/reporting-mocks-server'; -import { RunContext } from '@kbn/task-manager-plugin/server'; +import type { RunContext } from '@kbn/task-manager-plugin/server'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; +import type { ReportingConfigType } from '@kbn/reporting-server'; import { MonitorReportsTask } from '.'; -import { ReportingCore } from '../..'; -import { ReportingConfigType } from '../../config'; +import type { ReportingCore } from '../..'; import { createMockReportingCore } from '../../test_helpers'; const logger = loggingSystemMock.createLogger(); diff --git a/x-pack/plugins/reporting/server/lib/tasks/monitor_reports.ts b/x-pack/plugins/reporting/server/lib/tasks/monitor_reports.ts index 867adf3617248..c42e2f8afa5b2 100644 --- a/x-pack/plugins/reporting/server/lib/tasks/monitor_reports.ts +++ b/x-pack/plugins/reporting/server/lib/tasks/monitor_reports.ts @@ -7,11 +7,14 @@ import type { Logger } from '@kbn/core/server'; import moment from 'moment'; -import { TaskManagerStartContract, TaskRunCreatorFunction } from '@kbn/task-manager-plugin/server'; +import type { + TaskManagerStartContract, + TaskRunCreatorFunction, +} from '@kbn/task-manager-plugin/server'; import { JOB_STATUS, numberToDuration } from '@kbn/reporting-common'; +import type { ReportingConfigType } from '@kbn/reporting-server'; import { ReportingStore } from '..'; import { ReportingCore } from '../..'; -import { ReportingConfigType } from '../../config'; import { SavedReport } from '../store'; import { ReportingTask, ReportingTaskStatus, REPORTING_MONITOR_TYPE, ReportTaskParams } from '.'; diff --git a/x-pack/plugins/reporting/server/plugin.ts b/x-pack/plugins/reporting/server/plugin.ts index db653917cb401..b05430200c2e1 100644 --- a/x-pack/plugins/reporting/server/plugin.ts +++ b/x-pack/plugins/reporting/server/plugin.ts @@ -13,9 +13,10 @@ import type { PluginInitializerContext, } from '@kbn/core/server'; import { PLUGIN_ID } from '@kbn/reporting-common'; +import type { ReportingConfigType } from '@kbn/reporting-server'; import { setFieldFormats } from '@kbn/reporting-server'; import { ReportingCore } from '.'; -import { ReportingConfigType, registerUiSettings } from './config'; +import { registerUiSettings } from './config'; import { registerDeprecations } from './deprecations'; import { ReportingStore } from './lib'; import { registerRoutes } from './routes'; diff --git a/x-pack/plugins/reporting/server/test_helpers/create_mock_reportingplugin.ts b/x-pack/plugins/reporting/server/test_helpers/create_mock_reportingplugin.ts index d92174d3d71cd..eb308d9cf0e15 100644 --- a/x-pack/plugins/reporting/server/test_helpers/create_mock_reportingplugin.ts +++ b/x-pack/plugins/reporting/server/test_helpers/create_mock_reportingplugin.ts @@ -24,13 +24,13 @@ import { FieldFormatsRegistry } from '@kbn/field-formats-plugin/common'; import { fieldFormatsMock } from '@kbn/field-formats-plugin/common/mocks'; import { licensingMock } from '@kbn/licensing-plugin/server/mocks'; import { createMockConfigSchema } from '@kbn/reporting-mocks-server'; +import type { ReportingConfigType } from '@kbn/reporting-server'; import { setFieldFormats } from '@kbn/reporting-server'; import { createMockScreenshottingStart } from '@kbn/screenshotting-plugin/server/mock'; import { securityMock } from '@kbn/security-plugin/server/mocks'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; - import { ReportingCore } from '..'; -import { ReportingConfigType } from '../config'; + import { ReportingInternalSetup, ReportingInternalStart } from '../core'; import { ReportingStore } from '../lib'; diff --git a/x-pack/plugins/reporting/server/types.ts b/x-pack/plugins/reporting/server/types.ts index f0573af0651f1..8acfaeb8dd41b 100644 --- a/x-pack/plugins/reporting/server/types.ts +++ b/x-pack/plugins/reporting/server/types.ts @@ -13,7 +13,8 @@ import type { PluginSetupContract as FeaturesPluginSetup } from '@kbn/features-p import type { FieldFormatsStart } from '@kbn/field-formats-plugin/server'; import type { LicensingPluginStart } from '@kbn/licensing-plugin/server'; import type { UrlOrUrlLocatorTuple } from '@kbn/reporting-common/types'; -import { ReportApiJSON } from '@kbn/reporting-common/types'; +import type { ReportApiJSON } from '@kbn/reporting-common/types'; +import type { ReportingConfigType } from '@kbn/reporting-server'; import type { ScreenshotModePluginSetup } from '@kbn/screenshot-mode-plugin/server'; import type { PdfScreenshotOptions as BasePdfScreenshotOptions, @@ -32,7 +33,6 @@ import type { } from '@kbn/task-manager-plugin/server'; import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; -import type { ReportingConfigType } from './config'; import { ReportingCore } from './core'; import { ExportTypesRegistry } from './lib';