Skip to content

Commit

Permalink
Address the rest of incorrect imports
Browse files Browse the repository at this point in the history
  • Loading branch information
gsoldevila committed Oct 24, 2024
1 parent 57b232c commit c49366f
Show file tree
Hide file tree
Showing 38 changed files with 91 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* 2.0.
*/

import { SavedObject, SavedObjectReference } from '@kbn/core/types';
import { Tag, TagAttributes } from '../types';
import { TagsCapabilities } from '../capabilities';
import { AssignableObject } from '../assignments';
import type { SavedObject, SavedObjectReference } from '@kbn/core/types';
import type { Tag, TagAttributes } from '../types';
import type { TagsCapabilities } from '../capabilities';
import type { AssignableObject } from '../assignments';

export const createReference = (type: string, id: string): SavedObjectReference => ({
type,
Expand Down
10 changes: 10 additions & 0 deletions x-pack/plugins/saved_objects_tagging/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@ export type TagWithRelations = Tag & {
*/
relationCount: number;
};

// re-export types from oss definition
export type {
Tag,
CreateTagOptions,
TagAttributes,
TagWithOptionalId,
GetAllTagsOptions,
ITagsClient,
} from '@kbn/saved-objects-tagging-oss-plugin/common';
2 changes: 1 addition & 1 deletion x-pack/plugins/saved_objects_tagging/common/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { i18n } from '@kbn/i18n';
import { Tag } from './types';
import type { Tag } from './types';

export const tagNameMinLength = 2;
export const tagNameMaxLength = 50;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* 2.0.
*/

import React, { ReactElement } from 'react';
import React, { type ReactElement } from 'react';
import { EuiBadge } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { TagAttributes } from '../../../common/types';
import type { TagAttributes } from '../../../common/types';

export interface TagBadgeProps<T> {
tag: T;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* 2.0.
*/

import React, { FC } from 'react';
import React, { type FC } from 'react';
import { EuiBadgeGroup } from '@elastic/eui';
import { TagWithOptionalId } from '../../../common/types';
import type { TagWithOptionalId } from '../../../common/types';
import { TagBadge } from './tag_badge';

export interface TagListProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* 2.0.
*/

import React, { FC } from 'react';
import React, { type FC } from 'react';
import { EuiHealth, EuiText } from '@elastic/eui';
import { Tag } from '../../../common';
import type { Tag } from '../../../common/types';
import { testSubjFriendly } from '../../utils';

export interface TagSearchBarOptionProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import React, { FC, useMemo, useCallback, useState } from 'react';
import React, { type FC, useMemo, useCallback, useState } from 'react';
import {
EuiComboBox,
EuiHealth,
Expand All @@ -17,9 +17,9 @@ import {
EuiComboBoxProps,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { Tag } from '../../../common';
import type { Tag } from '../../../common/types';
import { testSubjFriendly } from '../../utils';
import { CreateModalOpener } from '../edition_modal';
import type { CreateModalOpener } from '../edition_modal';

interface CreateOption {
type: '__create_option__';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
* 2.0.
*/

import React, { FC, useMemo } from 'react';
import React, { type FC, useMemo } from 'react';
import useObservable from 'react-use/lib/useObservable';
import { SavedObjectReference } from '@kbn/core/types';
import { TagListComponentProps } from '@kbn/saved-objects-tagging-oss-plugin/public';
import { Tag, TagWithOptionalId } from '../../../common/types';
import type { SavedObjectReference } from '@kbn/core/types';
import type { TagListComponentProps } from '@kbn/saved-objects-tagging-oss-plugin/public';
import type { Tag, TagWithOptionalId } from '../../../common/types';
import { getObjectTags } from '../../utils';
import { TagList } from '../base';
import { ITagsCache } from '../../services';
import type { ITagsCache } from '../../services';
import { byNameTagSorter } from '../../utils';

interface SavedObjectTagListProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* 2.0.
*/

import React, { FC } from 'react';
import React, { type FC } from 'react';
import useObservable from 'react-use/lib/useObservable';
import { TagSelectorComponentProps } from '@kbn/saved-objects-tagging-oss-plugin/public';
import { TagsCapabilities } from '../../../common';
import type { TagSelectorComponentProps } from '@kbn/saved-objects-tagging-oss-plugin/public';
import type { TagsCapabilities } from '../../../common';
import { TagSelector } from '../base';
import { ITagsCache } from '../../services';
import { CreateModalOpener } from '../edition_modal';
import type { ITagsCache } from '../../services';
import type { CreateModalOpener } from '../edition_modal';

interface GetConnectedTagSelectorOptions {
cache: ITagsCache;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React from 'react';
import { render, screen } from '@testing-library/react';
import { CreateTagModal } from './create_modal';
import type { IToasts, NotificationsStart } from '@kbn/core-notifications-browser';
import type { ITagsClient, Tag } from '@kbn/saved-objects-tagging-oss-plugin/common';
import type { ITagsClient, Tag } from '../../../common/types';
import { I18nProvider } from '@kbn/i18n-react';
import userEvent from '@testing-library/user-event';
import { duplicateTagNameErrorMessage, managedTagConflictMessage } from './utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* 2.0.
*/

import React, { FC, useState, useCallback } from 'react';
import React, { type FC, useState, useCallback } from 'react';
import { first, lastValueFrom } from 'rxjs';
import { i18n } from '@kbn/i18n';
import type { NotificationsStart } from '@kbn/core/public';

import { ITagsClient, Tag, TagAttributes } from '../../../common/types';
import type { ITagsClient, Tag, TagAttributes } from '../../../common/types';
import { isServerValidationError } from '../../services/tags';
import { getRandomColor, validateTag } from './utils';
import { CreateOrEditModal } from './create_or_edit_modal';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import React, { FC, useState, useCallback, useMemo, useRef } from 'react';
import React, { type FC, useState, useCallback, useMemo, useRef } from 'react';
import {
EuiButtonEmpty,
EuiButton,
Expand All @@ -28,9 +28,9 @@ import {
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import useDebounce from 'react-use/lib/useDebounce';
import type { TagAttributes } from '../../../common/types';
import {
TagAttributes,
TagValidation,
type TagValidation,
validateTagColor,
tagNameMaxLength,
tagDescriptionMaxLength,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* 2.0.
*/

import React, { FC, useState, useCallback } from 'react';
import React, { type FC, useState, useCallback } from 'react';
import { i18n } from '@kbn/i18n';
import type { NotificationsStart } from '@kbn/core/public';
import { first, lastValueFrom } from 'rxjs';
import { ITagsClient, Tag, TagAttributes } from '../../../common/types';
import type { ITagsClient, Tag, TagAttributes } from '../../../common/types';
import { isServerValidationError } from '../../services/tags';
import { CreateOrEditModal } from './create_or_edit_modal';
import { validateTag } from './utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import React from 'react';
import { EuiDelayRender, EuiLoadingSpinner } from '@elastic/eui';
import type { OverlayRef } from '@kbn/core/public';
import { toMountPoint } from '@kbn/react-kibana-mount';
import { Tag, TagAttributes } from '../../../common/types';
import { ITagInternalClient } from '../../services';
import { StartServices } from '../../types';
import type { Tag, TagAttributes } from '../../../common/types';
import type { ITagInternalClient } from '../../services';
import type { StartServices } from '../../types';

interface GetModalOpenerOptions extends StartServices {
tagClient: ITagInternalClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { BehaviorSubject } from 'rxjs';
import useObservable from 'react-use/lib/useObservable';

import { type TagValidation, validateTagName } from '../../../common';
import type { ITagsClient, TagAttributes } from '../../../common/types';
import { type TagValidation, validateTagName } from '../../../common';
import { duplicateTagNameErrorMessage, managedTagConflictMessage, validateTag } from './utils';

const initialValidation: TagValidation = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import { useCallback, useEffect, useRef } from 'react';
import { i18n } from '@kbn/i18n';

import type { TagAttributes } from '../../../common/types';
import {
TagAttributes,
TagValidation,
type TagValidation,
validateTagColor,
validateTagName,
validateTagDescription,
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/saved_objects_tagging/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { PluginInitializerContext } from '@kbn/core/public';
import { SavedObjectTaggingPlugin } from './plugin';

export type { SavedObjectTaggingPluginStart } from './types';
export type { Tag } from '../common';

export const plugin = (initializerContext: PluginInitializerContext) =>
new SavedObjectTaggingPlugin(initializerContext);
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { httpServiceMock } from '@kbn/core/public/mocks';
import { getTagConnectionsUrl } from './get_tag_connections_url';
import { TagWithRelations } from '../../../common/types';
import type { TagWithRelations } from '../../../common/types';

const createTag = (name: string): TagWithRelations => ({
id: 'tag-id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* 2.0.
*/

import { IBasePath } from '@kbn/core/public';
import { TagWithRelations } from '../../../common/types';
import type { IBasePath } from '@kbn/core/public';
import type { TagWithRelations } from '../../../common/types';

/**
* Returns the url to use to redirect to the SavedObject management section with given tag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

import moment from 'moment';
import { Tag, TagAttributes } from '../../../common/types';
import { TagsCache, CacheRefreshHandler } from './tags_cache';
import type { Tag, TagAttributes } from '../../../common/types';
import { TagsCache, type CacheRefreshHandler } from './tags_cache';

const createTag = (parts: Partial<Tag>): Tag => ({
id: 'tag-id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* 2.0.
*/

import { Duration } from 'moment';
import { Observable, BehaviorSubject, Subject } from 'rxjs';
import type { Duration } from 'moment';
import { type Observable, BehaviorSubject, Subject } from 'rxjs';
import { takeUntil, first, mergeMap } from 'rxjs';
import { ITagsCache } from '@kbn/saved-objects-tagging-oss-plugin/public';
import { Tag, TagAttributes } from '../../../common/types';
import type { ITagsCache } from '@kbn/saved-objects-tagging-oss-plugin/public';
import type { Tag, TagAttributes } from '../../../common/types';

export type { ITagsCache };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*/

import { httpServiceMock } from '@kbn/core/public/mocks';
import { Tag } from '../../../common/types';
import type { Tag } from '../../../common/types';
import { createTag, createTagAttributes } from '../../../common/test_utils';
import { tagsCacheMock } from './tags_cache.mock';
import { TagsClient, FindTagsOptions } from './tags_client';
import { TagsClient, type FindTagsOptions } from './tags_client';
import { coreMock } from '@kbn/core/public/mocks';

describe('TagsClient', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
* 2.0.
*/

import { HttpSetup, AnalyticsServiceStart } from '@kbn/core/public';
import type { HttpSetup, AnalyticsServiceStart } from '@kbn/core/public';
import { reportPerformanceMetricEvent } from '@kbn/ebt-tools';
import {
import type {
Tag,
TagAttributes,
GetAllTagsOptions,
ITagsClient,
TagWithRelations,
} from '../../../common/types';
import { ITagsChangeListener } from './tags_cache';
import type { ITagsChangeListener } from './tags_cache';

const BULK_DELETE_TAG_EVENT = 'bulkDeleteTag';
const CREATE_TAG_EVENT = 'createTag';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* 2.0.
*/

import { SavedObjectsTaggingApiUi } from '@kbn/saved-objects-tagging-oss-plugin/public';
import type { SavedObjectsTaggingApiUi } from '@kbn/saved-objects-tagging-oss-plugin/public';
import { tagsCacheMock } from '../services/tags/tags_cache.mock';
import { Tag } from '../../common/types';
import type { Tag } from '../../common/types';
import { createTag } from '../../common/test_utils';
import { buildGetSearchBarFilter } from './get_search_bar_filter';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import React from 'react';
import { i18n } from '@kbn/i18n';
import {
import type {
SavedObjectsTaggingApiUi,
GetSearchBarFilterOptions,
} from '@kbn/saved-objects-tagging-oss-plugin/public';

import { Tag } from '../../common';
import type { Tag } from '../../common/types';
import { TagSearchBarOption } from '../components';

export interface BuildGetSearchBarFilterOptions {
Expand Down
7 changes: 4 additions & 3 deletions x-pack/plugins/saved_objects_tagging/public/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
* 2.0.
*/

import { SavedObject, SavedObjectReference } from '@kbn/core/types';
import { SavedObjectsFindOptionsReference } from '@kbn/core/public';
import { Tag, tagSavedObjectTypeName } from '../common';
import type { SavedObject, SavedObjectReference } from '@kbn/core/types';
import type { SavedObjectsFindOptionsReference } from '@kbn/core/public';
import type { Tag } from '../common/types';
import { tagSavedObjectTypeName } from '../common';

type SavedObjectReferenceLike = SavedObjectReference | SavedObjectsFindOptionsReference;

Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/saved_objects_tagging/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { PluginInitializerContext } from '@kbn/core/server';
import type { PluginInitializerContext } from '@kbn/core/server';

export { config } from './config';
export type {
Expand All @@ -14,7 +14,6 @@ export type {
CreateTagClientOptions,
} from './types';
export type { IAssignmentService } from './services';
export type { ITagsClient } from '../common';

export const plugin = async (initializerContext: PluginInitializerContext) => {
const { SavedObjectTaggingPlugin } = await import('./plugin');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*/

import type { CoreRequestHandlerContext, KibanaRequest } from '@kbn/core/server';
import { SecurityPluginSetup } from '@kbn/security-plugin/server';
import { ITagsClient } from '../common/types';
import { ITagsRequestHandlerContext } from './types';
import { TagsClient, IAssignmentService, AssignmentService } from './services';
import type { SecurityPluginSetup } from '@kbn/security-plugin/server';
import type { ITagsClient } from '../common/types';
import type { ITagsRequestHandlerContext } from './types';
import { TagsClient, type IAssignmentService, AssignmentService } from './services';

export class TagsRequestHandlerContext implements ITagsRequestHandlerContext {
#client?: ITagsClient;
Expand Down
Loading

0 comments on commit c49366f

Please sign in to comment.