Skip to content

Commit

Permalink
Fix circular dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeelmers committed Aug 18, 2020
1 parent f3d16ce commit ae56af4
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import { i18n } from '@kbn/i18n';
import { memoize, noop } from 'lodash';
import moment, { Moment } from 'moment';
import { FieldFormat, FIELD_FORMAT_IDS, KBN_FIELD_TYPES, TextContextTypeConvert } from '../../';
import { FieldFormat, FIELD_FORMAT_IDS, KBN_FIELD_TYPES } from '../../';
import { TextContextTypeConvert } from '../types';

/**
* Analyse the given moment.js format pattern for the fractional sec part (S,SS,SSS...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
import { baseFormatters } from './constants/base_formatters';
import { FieldFormat } from './field_format';
import { SerializedFieldFormat } from '../../../expressions/common/types';
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '../types';
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '../kbn_field_types/types';
import { UI_SETTINGS } from '../constants';

export class FieldFormatsRegistry {
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/data/common/field_formats/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/

import { GetConfigFn } from '../types';
import { FieldFormat } from './field_format';
import { FieldFormatsRegistry } from './field_formats_registry';

Expand Down Expand Up @@ -73,7 +74,7 @@ export interface FieldFormatConfig {
es?: boolean;
}

export type FieldFormatsGetConfigFn = <T = any>(key: string, defaultOverride?: T) => T;
export type FieldFormatsGetConfigFn = GetConfigFn;

export type IFieldFormat = PublicMethodsOf<FieldFormat>;

Expand Down
5 changes: 1 addition & 4 deletions src/plugins/data/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
* under the License.
*/

import { FieldFormatsGetConfigFn } from './field_formats/types';

export * from './query/types';
export * from './kbn_field_types/types';
export * from './index_patterns/types';
export { TextContextTypeConvert, IFieldFormatMetaParams } from './field_formats/types';

/**
* If a service is being shared on both the client and the server, and
Expand All @@ -34,4 +31,4 @@ export { TextContextTypeConvert, IFieldFormatMetaParams } from './field_formats/
* should only be used in scenarios where async access to uiSettings is
* not possible.
*/
export type GetConfigFn = FieldFormatsGetConfigFn;
export type GetConfigFn = <T = any>(key: string, defaultOverride?: T) => T;
8 changes: 2 additions & 6 deletions src/plugins/data/public/field_formats/converters/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@
import { i18n } from '@kbn/i18n';
import { memoize, noop } from 'lodash';
import moment from 'moment';
import {
FieldFormat,
KBN_FIELD_TYPES,
TextContextTypeConvert,
FIELD_FORMAT_IDS,
} from '../../../common';
import { FieldFormat, KBN_FIELD_TYPES, FIELD_FORMAT_IDS } from '../../../common';
import { TextContextTypeConvert } from '../../../common/field_formats/types';

export class DateFormat extends FieldFormat {
static id = FIELD_FORMAT_IDS.DATE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
DateNanosFormat,
formatWithNanos,
} from '../../../common/field_formats/converters/date_nanos_shared';
import { TextContextTypeConvert } from '../../../common';
import { TextContextTypeConvert } from '../../../common/field_formats/types';

class DateNanosFormatServer extends DateNanosFormat {
textConvert: TextContextTypeConvert = (val) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ import moment from 'moment-timezone';
import {
FieldFormat,
KBN_FIELD_TYPES,
TextContextTypeConvert,
FIELD_FORMAT_IDS,
FieldFormatsGetConfigFn,
IFieldFormatMetaParams,
} from '../../../common';
import {
IFieldFormatMetaParams,
TextContextTypeConvert,
} from '../../../common/field_formats/types';

export class DateFormat extends FieldFormat {
static id = FIELD_FORMAT_IDS.DATE;
Expand Down

0 comments on commit ae56af4

Please sign in to comment.