Skip to content

Commit

Permalink
[Index patterns] Deprecate scripted field API functions (#100907)
Browse files Browse the repository at this point in the history
* deprecate scripted field functions in index patterns api
  • Loading branch information
mattkime authored Jun 1, 2021
1 parent 6759977 commit 9734d1c
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## IndexPattern.addScriptedField() method

> Warning: This API is now obsolete.
>
>
Add scripted field to field list

<b>Signature:</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## IndexPattern.getNonScriptedFields() method

> Warning: This API is now obsolete.
>
>
<b>Signature:</b>

```typescript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## IndexPattern.getScriptedFields() method

> Warning: This API is now obsolete.
>
>
<b>Signature:</b>

```typescript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## IndexPattern.removeScriptedField() method

> Warning: This API is now obsolete.
>
>
Remove scripted field from field list

<b>Signature:</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## IndexPattern.addScriptedField() method

> Warning: This API is now obsolete.
>
>
Add scripted field to field list

<b>Signature:</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## IndexPattern.getNonScriptedFields() method

> Warning: This API is now obsolete.
>
>
<b>Signature:</b>

```typescript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## IndexPattern.getScriptedFields() method

> Warning: This API is now obsolete.
>
>
<b>Signature:</b>

```typescript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## IndexPattern.removeScriptedField() method

> Warning: This API is now obsolete.
>
>
Remove scripted field from field list

<b>Signature:</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export class IndexPattern implements IIndexPattern {
* @param script script code
* @param fieldType
* @param lang
* @deprecated use runtime field instead
*/
async addScriptedField(name: string, script: string, fieldType: string = 'string') {
const scriptedFields = this.getScriptedFields();
Expand All @@ -265,6 +266,7 @@ export class IndexPattern implements IIndexPattern {
/**
* Remove scripted field from field list
* @param fieldName
* @deprecated use runtime field instead
*/

removeScriptedField(fieldName: string) {
Expand All @@ -274,10 +276,18 @@ export class IndexPattern implements IIndexPattern {
}
}

/**
*
* @deprecated use runtime field instead
*/
getNonScriptedFields() {
return [...this.fields.getAll().filter((field) => !field.scripted)];
}

/**
*
* @deprecated use runtime field instead
*/
getScriptedFields() {
return [...this.fields.getAll().filter((field) => field.scripted)];
}
Expand Down
6 changes: 4 additions & 2 deletions src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,7 @@ export class IndexPattern implements IIndexPattern {
// Warning: (ae-forgotten-export) The symbol "IndexPatternDeps" needs to be exported by the entry point index.d.ts
constructor({ spec, fieldFormats, shortDotsEnable, metaFields, }: IndexPatternDeps);
addRuntimeField(name: string, runtimeField: RuntimeField): void;
// @deprecated
addScriptedField(name: string, script: string, fieldType?: string): Promise<void>;
readonly allowNoIndex: boolean;
// (undocumented)
Expand Down Expand Up @@ -1366,7 +1367,7 @@ export class IndexPattern implements IIndexPattern {
getFieldByName(name: string): IndexPatternField | undefined;
getFormatterForField(field: IndexPatternField | IndexPatternField['spec'] | IFieldType): FieldFormat;
getFormatterForFieldNoDefault(fieldname: string): FieldFormat | undefined;
// (undocumented)
// @deprecated (undocumented)
getNonScriptedFields(): IndexPatternField[];
getOriginalSavedObjectBody: () => {
fieldAttrs?: string | undefined;
Expand All @@ -1379,7 +1380,7 @@ export class IndexPattern implements IIndexPattern {
typeMeta?: string | undefined;
type?: string | undefined;
};
// (undocumented)
// @deprecated (undocumented)
getScriptedFields(): IndexPatternField[];
getSourceFiltering(): {
excludes: any[];
Expand All @@ -1397,6 +1398,7 @@ export class IndexPattern implements IIndexPattern {
// (undocumented)
metaFields: string[];
removeRuntimeField(name: string): void;
// @deprecated
removeScriptedField(fieldName: string): void;
resetOriginalSavedObjectBody: () => void;
// (undocumented)
Expand Down
6 changes: 4 additions & 2 deletions src/plugins/data/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ export class IndexPattern implements IIndexPattern {
// Warning: (ae-forgotten-export) The symbol "IndexPatternDeps" needs to be exported by the entry point index.d.ts
constructor({ spec, fieldFormats, shortDotsEnable, metaFields, }: IndexPatternDeps);
addRuntimeField(name: string, runtimeField: RuntimeField): void;
// @deprecated
addScriptedField(name: string, script: string, fieldType?: string): Promise<void>;
readonly allowNoIndex: boolean;
// (undocumented)
Expand Down Expand Up @@ -812,7 +813,7 @@ export class IndexPattern implements IIndexPattern {
getFormatterForFieldNoDefault(fieldname: string): FieldFormat | undefined;
// Warning: (ae-forgotten-export) The symbol "IndexPatternField" needs to be exported by the entry point index.d.ts
//
// (undocumented)
// @deprecated (undocumented)
getNonScriptedFields(): IndexPatternField[];
getOriginalSavedObjectBody: () => {
fieldAttrs?: string | undefined;
Expand All @@ -825,7 +826,7 @@ export class IndexPattern implements IIndexPattern {
typeMeta?: string | undefined;
type?: string | undefined;
};
// (undocumented)
// @deprecated (undocumented)
getScriptedFields(): IndexPatternField[];
getSourceFiltering(): {
excludes: any[];
Expand All @@ -843,6 +844,7 @@ export class IndexPattern implements IIndexPattern {
// (undocumented)
metaFields: string[];
removeRuntimeField(name: string): void;
// @deprecated
removeScriptedField(fieldName: string): void;
resetOriginalSavedObjectBody: () => void;
// (undocumented)
Expand Down

0 comments on commit 9734d1c

Please sign in to comment.