Skip to content

Commit

Permalink
Update config-server imports
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Nov 13, 2023
1 parent 207cdee commit e51c81c
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 27 deletions.
2 changes: 1 addition & 1 deletion packages/kbn-generate-csv/src/get_export_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -148,5 +148,3 @@ export const ConfigSchema = schema.object({
export_types: ExportTypeSchema,
statefulSettings: SettingsSchema,
});

export type ReportingConfigType = TypeOf<typeof ConfigSchema>;
4 changes: 2 additions & 2 deletions packages/kbn-reporting/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
7 changes: 6 additions & 1 deletion packages/kbn-reporting/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -43,3 +46,5 @@ export interface TimeRangeParams {
min?: Date | string | number | null;
max?: Date | string | number | null;
}

export type ReportingConfigType = TypeOf<typeof ConfigSchema>;
14 changes: 14 additions & 0 deletions x-pack/plugins/reporting/common/types.ts
Original file line number Diff line number Diff line change
@@ -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];
2 changes: 1 addition & 1 deletion x-pack/plugins/reporting/server/config/create_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/reporting/server/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,3 @@ export const config: PluginConfigDescriptor<ReportingConfigType> = {
export { createConfig } from './create_config';
export { registerUiSettings } from './ui_settings';
export { ConfigSchema };
export type { ReportingConfigType };
7 changes: 4 additions & 3 deletions x-pack/plugins/reporting/server/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/reporting/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
7 changes: 5 additions & 2 deletions x-pack/plugins/reporting/server/lib/tasks/monitor_reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 '.';

Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/reporting/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/reporting/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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';

Expand Down

0 comments on commit e51c81c

Please sign in to comment.