Skip to content

Commit

Permalink
move field_mapping code from kibana_utils to data
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkime committed Jun 9, 2020
1 parent d8b1999 commit 6c30c28
Show file tree
Hide file tree
Showing 19 changed files with 107 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [expandShorthand](./kibana-plugin-plugins-data-public.expandshorthand.md)

## expandShorthand variable


<b>Signature:</b>

```typescript
expandShorthand: (sh: Record<string, ShorthandFieldMapObject>) => Record<string, FieldMappingSpec>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [FieldMappingSpec](./kibana-plugin-plugins-data-public.fieldmappingspec.md) &gt; [\_deserialize](./kibana-plugin-plugins-data-public.fieldmappingspec._deserialize.md)

## FieldMappingSpec.\_deserialize property

<b>Signature:</b>

```typescript
_deserialize?: (mapping: string) => any | undefined;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [FieldMappingSpec](./kibana-plugin-plugins-data-public.fieldmappingspec.md) &gt; [\_serialize](./kibana-plugin-plugins-data-public.fieldmappingspec._serialize.md)

## FieldMappingSpec.\_serialize property

<b>Signature:</b>

```typescript
_serialize?: (mapping: any) => string | undefined;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [FieldMappingSpec](./kibana-plugin-plugins-data-public.fieldmappingspec.md)

## FieldMappingSpec interface


<b>Signature:</b>

```typescript
export interface FieldMappingSpec
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [\_deserialize](./kibana-plugin-plugins-data-public.fieldmappingspec._deserialize.md) | <code>(mapping: string) =&gt; any &#124; undefined</code> | |
| [\_serialize](./kibana-plugin-plugins-data-public.fieldmappingspec._serialize.md) | <code>(mapping: any) =&gt; string &#124; undefined</code> | |
| [type](./kibana-plugin-plugins-data-public.fieldmappingspec.type.md) | <code>ES_FIELD_TYPES</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [FieldMappingSpec](./kibana-plugin-plugins-data-public.fieldmappingspec.md) &gt; [type](./kibana-plugin-plugins-data-public.fieldmappingspec.type.md)

## FieldMappingSpec.type property

<b>Signature:</b>

```typescript
type: ES_FIELD_TYPES;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [MappingObject](./kibana-plugin-plugins-data-public.mappingobject.md)

## MappingObject type


<b>Signature:</b>

```typescript
export declare type MappingObject = Record<string, FieldMappingSpec>;
```
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
| [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) | |
| [FetchOptions](./kibana-plugin-plugins-data-public.fetchoptions.md) | |
| [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) | |
| [FieldMappingSpec](./kibana-plugin-plugins-data-public.fieldmappingspec.md) | |
| [Filter](./kibana-plugin-plugins-data-public.filter.md) | |
| [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) | |
| [IEsSearchRequest](./kibana-plugin-plugins-data-public.iessearchrequest.md) | |
Expand Down Expand Up @@ -100,6 +101,7 @@
| [esFilters](./kibana-plugin-plugins-data-public.esfilters.md) | |
| [esKuery](./kibana-plugin-plugins-data-public.eskuery.md) | |
| [esQuery](./kibana-plugin-plugins-data-public.esquery.md) | |
| [expandShorthand](./kibana-plugin-plugins-data-public.expandshorthand.md) | |
| [extractSearchSourceReferences](./kibana-plugin-plugins-data-public.extractsearchsourcereferences.md) | |
| [fieldFormats](./kibana-plugin-plugins-data-public.fieldformats.md) | |
| [FilterBar](./kibana-plugin-plugins-data-public.filterbar.md) | |
Expand Down Expand Up @@ -140,6 +142,7 @@
| [ISearch](./kibana-plugin-plugins-data-public.isearch.md) | |
| [ISearchGeneric](./kibana-plugin-plugins-data-public.isearchgeneric.md) | |
| [ISearchSource](./kibana-plugin-plugins-data-public.isearchsource.md) | \* |
| [MappingObject](./kibana-plugin-plugins-data-public.mappingobject.md) | |
| [MatchAllFilter](./kibana-plugin-plugins-data-public.matchallfilter.md) | |
| [ParsedInterval](./kibana-plugin-plugins-data-public.parsedinterval.md) | |
| [PhraseFilter](./kibana-plugin-plugins-data-public.phrasefilter.md) | |
Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ export * from './search';
export * from './search/aggs';
export * from './types';
export * from './utils';
export * from './field_mapping';
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,7 @@
import _, { each, reject } from 'lodash';
import { i18n } from '@kbn/i18n';
import { SavedObjectsClientContract } from 'src/core/public';
import {
DuplicateField,
SavedObjectNotFound,
expandShorthand,
FieldMappingSpec,
MappingObject,
} from '../../../../kibana_utils/common';
import { DuplicateField, SavedObjectNotFound } from '../../../../kibana_utils/common';

import {
ES_FIELD_TYPES,
Expand All @@ -46,6 +40,7 @@ import { TypeMeta } from '.';
import { OnNotification, OnError } from '../types';
import { FieldFormatsStartCommon } from '../../field_formats';
import { PatternCache } from './_pattern_cache';
import { expandShorthand, FieldMappingSpec, MappingObject } from '../../field_mapping';

const MAX_ATTEMPTS_TO_RESOLVE_CONFLICTS = 3;
const type = 'index-pattern';
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ export {
getKbnTypeNames,
} from '../common';

export * from '../common/field_mapping';

/*
* Plugin setup
*/
Expand Down
18 changes: 18 additions & 0 deletions src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,11 @@ export type ExistsFilter = Filter & {
exists?: FilterExistsProperty;
};

// Warning: (ae-forgotten-export) The symbol "ShorthandFieldMapObject" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const expandShorthand: (sh: Record<string, ShorthandFieldMapObject>) => Record<string, FieldMappingSpec>;

// Warning: (ae-forgotten-export) The symbol "SavedObjectReference" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "extractReferences" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
Expand Down Expand Up @@ -548,6 +553,16 @@ export type FieldFormatsContentType = 'html' | 'text';
// @public (undocumented)
export type FieldFormatsGetConfigFn = <T = any>(key: string, defaultOverride?: T) => T;

// @public (undocumented)
export interface FieldMappingSpec {
// (undocumented)
_deserialize?: (mapping: string) => any | undefined;
// (undocumented)
_serialize?: (mapping: any) => string | undefined;
// (undocumented)
type: ES_FIELD_TYPES;
}

// Warning: (ae-missing-release-tag) "Filter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down Expand Up @@ -1201,6 +1216,9 @@ export interface KueryNode {
type: keyof NodeTypes;
}

// @public (undocumented)
export type MappingObject = Record<string, FieldMappingSpec>;

// Warning: (ae-missing-release-tag) "MatchAllFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down
1 change: 0 additions & 1 deletion src/plugins/kibana_utils/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ export { url } from './url';
export { now } from './now';
export { calculateObjectHash } from './calculate_object_hash';
export { defaultFeedbackMessage } from './default_feedback_message';
export * from './field_mapping';
1 change: 0 additions & 1 deletion src/plugins/kibana_utils/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export {
} from '../common';
export * from './core';
export * from '../common/errors';
export * from '../common/field_mapping';
export * from './field_wildcard';
export * from './parse';
export * from './render_complete';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
*/
import _ from 'lodash';
import { EsResponse, SavedObject, SavedObjectConfig, SavedObjectKibanaServices } from '../../types';
import { expandShorthand, SavedObjectNotFound } from '../../../../kibana_utils/public';
import { SavedObjectNotFound } from '../../../../kibana_utils/public';
import {
IndexPattern,
injectSearchSourceReferences,
parseSearchSourceJSON,
expandShorthand,
} from '../../../../data/public';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
*/
import _ from 'lodash';
import { SavedObject, SavedObjectConfig } from '../../types';
import { expandShorthand } from '../../../../kibana_utils/public';
import { extractSearchSourceReferences } from '../../../../data/public';
import { extractSearchSourceReferences, expandShorthand } from '../../../../data/public';

export function serializeSavedObject(savedObject: SavedObject, config: SavedObjectConfig) {
// mapping definition for the fields that this object will expose
Expand Down

0 comments on commit 6c30c28

Please sign in to comment.