Fix imports from restricted paths (#130102)

* Fix imports from restricted paths

* Re-export EmbeddableRegistryDefinition from embedabble server and fix some imports

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Diana Derevyankina 2022-05-03 15:00:18 +03:00 committed by GitHub
parent 0558903e43
commit 235550112e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 41 additions and 44 deletions

View file

@ -12,6 +12,7 @@ export type {
EmbeddableStateWithType,
PanelState,
EmbeddablePersistableStateService,
EmbeddableRegistryDefinition,
} from './types';
export { ViewMode } from './types';
export type { SavedObjectEmbeddableInput } from './lib';

View file

@ -8,7 +8,11 @@
import type { SerializableRecord } from '@kbn/utility-types';
import type { KibanaExecutionContext } from '@kbn/core/public';
import { PersistableStateService, PersistableState } from '@kbn/kibana-utils-plugin/common';
import type {
PersistableStateService,
PersistableState,
PersistableStateDefinition,
} from '@kbn/kibana-utils-plugin/common';
export enum ViewMode {
EDIT = 'edit',
@ -74,6 +78,12 @@ export interface PanelState<E extends EmbeddableInput & { id: string } = { id: s
export type EmbeddableStateWithType = EmbeddableInput & { type: string };
export interface EmbeddableRegistryDefinition<
P extends EmbeddableStateWithType = EmbeddableStateWithType
> extends PersistableStateDefinition<P> {
id: string;
}
export type EmbeddablePersistableStateService = PersistableStateService<EmbeddableStateWithType>;
export interface CommonEmbeddableStartContract {

View file

@ -10,6 +10,8 @@ import { EmbeddableServerPlugin, EmbeddableSetup, EmbeddableStart } from './plug
export type { EmbeddableSetup, EmbeddableStart };
export type { EnhancementRegistryDefinition, EmbeddableRegistryDefinition } from './types';
export type { EnhancementRegistryDefinition } from './types';
export type { EmbeddableRegistryDefinition } from '../common';
export const plugin = () => new EmbeddableServerPlugin();

View file

@ -19,7 +19,6 @@ import {
EnhancementsRegistry,
EnhancementRegistryDefinition,
EnhancementRegistryItem,
EmbeddableRegistryDefinition,
} from './types';
import {
getExtractFunction,
@ -27,7 +26,11 @@ import {
getMigrateFunction,
getTelemetryFunction,
} from '../common/lib';
import { EmbeddableStateWithType, CommonEmbeddableStartContract } from '../common/types';
import {
EmbeddableStateWithType,
CommonEmbeddableStartContract,
EmbeddableRegistryDefinition,
} from '../common/types';
import { getAllMigrations } from '../common/lib/get_all_migrations';
export interface EmbeddableSetup extends PersistableStateService<EmbeddableStateWithType> {

View file

@ -23,12 +23,6 @@ export interface EnhancementRegistryItem<P extends SerializableRecord = Serializ
id: string;
}
export interface EmbeddableRegistryDefinition<
P extends EmbeddableStateWithType = EmbeddableStateWithType
> extends PersistableStateDefinition<P> {
id: string;
}
export interface EmbeddableRegistryItem<P extends EmbeddableStateWithType = EmbeddableStateWithType>
extends PersistableState<P> {
id: string;

View file

@ -6,10 +6,9 @@
* Side Public License, v 1.
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { SavedObjectAttributes } from '@kbn/core/server';
import type { SerializableRecord } from '@kbn/utility-types';
import { AggConfigSerialized, SerializedSearchSourceFields } from '@kbn/data-plugin/common';
import type { AggConfigSerialized, SerializedSearchSourceFields } from '@kbn/data-plugin/common';
import type { SavedObjectAttributes } from '@kbn/core/types';
export interface VisParams {
[key: string]: any;

View file

@ -9,9 +9,8 @@
import semverGte from 'semver/functions/gte';
import { makeVisualizeEmbeddableFactory } from './make_visualize_embeddable_factory';
import { getAllMigrations } from '../migrations/visualization_saved_object_migrations';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { SerializedSearchSourceFields } from '@kbn/data-plugin/public';
import { GetMigrationFunctionObjectFn } from '@kbn/kibana-utils-plugin/common';
import type { SerializedSearchSourceFields } from '@kbn/data-plugin/common';
import type { GetMigrationFunctionObjectFn } from '@kbn/kibana-utils-plugin/common';
describe('embeddable migrations', () => {
test('should have same versions registered as saved object migrations versions (>7.13.0)', () => {

View file

@ -7,10 +7,9 @@
*/
import { flow, mapValues } from 'lodash';
import { EmbeddableRegistryDefinition } from '@kbn/embeddable-plugin/server';
import type { EmbeddableRegistryDefinition } from '@kbn/embeddable-plugin/server';
import type { SerializableRecord } from '@kbn/utility-types';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { SerializedSearchSourceFields } from '@kbn/data-plugin/public';
import type { SerializedSearchSourceFields } from '@kbn/data-plugin/common';
import {
mergeMigrationFunctionMaps,
MigrateFunctionsObject,

View file

@ -7,9 +7,10 @@
import { SerializableRecord, Serializable } from '@kbn/utility-types';
import { SavedObjectReference } from '@kbn/core/types';
import { EmbeddableStateWithType } from '@kbn/embeddable-plugin/common';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { EmbeddableRegistryDefinition } from '@kbn/embeddable-plugin/server';
import type {
EmbeddableStateWithType,
EmbeddableRegistryDefinition,
} from '@kbn/embeddable-plugin/common';
export type LensEmbeddablePersistableState = EmbeddableStateWithType & {
attributes: SerializableRecord;

View file

@ -7,8 +7,7 @@
import { counterRate, CounterRateArgs } from '.';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { Datatable } from '@kbn/expressions-plugin/public';
import { Datatable } from '@kbn/expressions-plugin/common';
import { functionWrapper } from '@kbn/expressions-plugin/common/expression_functions/specs/tests/utils';
describe('lens_counter_rate', () => {

View file

@ -5,8 +5,7 @@
* 2.0.
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { Datatable, DatatableColumn } from '@kbn/expressions-plugin/public';
import type { Datatable, DatatableColumn } from '@kbn/expressions-plugin/common';
import { functionWrapper } from '@kbn/expressions-plugin/common/expression_functions/specs/tests/utils';
import { formatColumn } from '.';

View file

@ -7,8 +7,7 @@
import moment from 'moment';
import { mergeTables } from '.';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { ExpressionValueSearchContext } from '@kbn/data-plugin/public';
import type { ExpressionValueSearchContext } from '@kbn/data-plugin/common';
import {
Datatable,
ExecutionContext,

View file

@ -6,10 +6,8 @@
*/
import moment from 'moment';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import type { Datatable } from '@kbn/expressions-plugin/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import type { TimeRange } from '@kbn/data-plugin/public';
import type { Datatable } from '@kbn/expressions-plugin/common';
import type { TimeRange } from '@kbn/data-plugin/common';
import { functionWrapper } from '@kbn/expressions-plugin/common/expression_functions/specs/tests/utils';
// mock the specific inner variable:

View file

@ -13,9 +13,7 @@ import {
SavedObjectReference,
SavedObjectUnsanitizedDoc,
} from '@kbn/core/server';
import { Filter } from '@kbn/es-query';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { Query } from '@kbn/data-plugin/public';
import type { Query, Filter } from '@kbn/es-query';
import { mergeSavedObjectMigrationMaps } from '@kbn/core/server';
import { MigrateFunctionsObject } from '@kbn/kibana-utils-plugin/common';
import { PersistableFilter } from '../../common';

View file

@ -6,9 +6,7 @@
*/
import type { PaletteOutput, CustomPaletteParams } from '@kbn/coloring';
import { Filter } from '@kbn/es-query';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { Query } from '@kbn/data-plugin/public';
import type { Query, Filter } from '@kbn/es-query';
import type { MigrateFunctionsObject } from '@kbn/kibana-utils-plugin/common';
import type { LayerType, PersistableFilter } from '../../common';

View file

@ -5,8 +5,7 @@
* 2.0.
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { EmbeddableRegistryDefinition } from '@kbn/embeddable-plugin/server';
import { EmbeddableRegistryDefinition } from '@kbn/embeddable-plugin/common';
import { MapEmbeddablePersistableState } from './types';
import { MapSavedObjectAttributes } from '../map_saved_object_type';
import { extractReferences } from '../migrations/references';

View file

@ -5,10 +5,9 @@
* 2.0.
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { EmbeddableRegistryDefinition } from '@kbn/embeddable-plugin/server';
import { MapEmbeddablePersistableState } from './types';
import { MapSavedObjectAttributes } from '../map_saved_object_type';
import type { EmbeddableRegistryDefinition } from '@kbn/embeddable-plugin/common';
import type { MapEmbeddablePersistableState } from './types';
import type { MapSavedObjectAttributes } from '../map_saved_object_type';
import { extractReferences, injectReferences } from '../migrations/references';
export const inject: EmbeddableRegistryDefinition['inject'] = (state, references) => {