Skip to content

Commit c548ce0

Browse files
Merge branch '7.x' into backport/7.x/pr-64879
2 parents 6edf50f + 445d703 commit c548ce0

1,042 files changed

Lines changed: 13930 additions & 9152 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/development/core/server/kibana-plugin-core-server.savedobjectmigrationfn.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,36 @@ A migration function for a [saved object type](./kibana-plugin-core-server.saved
99
<b>Signature:</b>
1010

1111
```typescript
12-
export declare type SavedObjectMigrationFn = (doc: SavedObjectUnsanitizedDoc, context: SavedObjectMigrationContext) => SavedObjectUnsanitizedDoc;
12+
export declare type SavedObjectMigrationFn<InputAttributes = unknown, MigratedAttributes = unknown> = (doc: SavedObjectUnsanitizedDoc<InputAttributes>, context: SavedObjectMigrationContext) => SavedObjectUnsanitizedDoc<MigratedAttributes>;
1313
```
1414

1515
## Example
1616

1717

1818
```typescript
19-
const migrateProperty: SavedObjectMigrationFn = (doc, { log }) => {
20-
if(doc.attributes.someProp === null) {
21-
log.warn('Skipping migration');
22-
} else {
23-
doc.attributes.someProp = migrateProperty(doc.attributes.someProp);
24-
}
25-
26-
return doc;
19+
interface TypeV1Attributes {
20+
someKey: string;
21+
obsoleteProperty: number;
2722
}
2823

24+
interface TypeV2Attributes {
25+
someKey: string;
26+
newProperty: string;
27+
}
28+
29+
const migrateToV2: SavedObjectMigrationFn<TypeV1Attributes, TypeV2Attributes> = (doc, { log }) => {
30+
const { obsoleteProperty, ...otherAttributes } = doc.attributes;
31+
// instead of mutating `doc` we make a shallow copy so that we can use separate types for the input
32+
// and output attributes. We don't need to make a deep copy, we just need to ensure that obsolete
33+
// attributes are not present on the returned doc.
34+
return {
35+
...doc,
36+
attributes: {
37+
...otherAttributes,
38+
newProperty: migrate(obsoleteProperty),
39+
},
40+
};
41+
};
42+
2943
```
3044

docs/development/core/server/kibana-plugin-core-server.savedobjectsanitizeddoc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ Describes Saved Object documents that have passed through the migration framewor
99
<b>Signature:</b>
1010

1111
```typescript
12-
export declare type SavedObjectSanitizedDoc = SavedObjectDoc & Referencable;
12+
export declare type SavedObjectSanitizedDoc<T = unknown> = SavedObjectDoc<T> & Referencable;
1313
```

docs/development/core/server/kibana-plugin-core-server.savedobjectunsanitizeddoc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ Describes Saved Object documents from Kibana &lt; 7.0.0 which don't have a `refe
99
<b>Signature:</b>
1010

1111
```typescript
12-
export declare type SavedObjectUnsanitizedDoc = SavedObjectDoc & Partial<Referencable>;
12+
export declare type SavedObjectUnsanitizedDoc<T = unknown> = SavedObjectDoc<T> & Partial<Referencable>;
1313
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [AggGroupLabels](./kibana-plugin-plugins-data-public.agggrouplabels.md)
4+
5+
## AggGroupLabels variable
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
AggGroupLabels: {
11+
[AggGroupNames.Buckets]: string;
12+
[AggGroupNames.Metrics]: string;
13+
[AggGroupNames.None]: string;
14+
}
15+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [AggGroupName](./kibana-plugin-plugins-data-public.agggroupname.md)
4+
5+
## AggGroupName type
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
export declare type AggGroupName = $Values<typeof AggGroupNames>;
11+
```

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggtypefieldfilters.addfilter.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggtypefieldfilters.filter.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggtypefieldfilters.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggtypefilters.addfilter.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.aggtypefilters.filter.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)