-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df1eb4d
commit 3887dbd
Showing
19 changed files
with
245 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...t/core/server/kibana-plugin-core-server.savedobjectexportbaseoptions.request.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectExportBaseOptions](./kibana-plugin-core-server.savedobjectexportbaseoptions.md) > [request](./kibana-plugin-core-server.savedobjectexportbaseoptions.request.md) | ||
|
||
## SavedObjectExportBaseOptions.request property | ||
|
||
The http request initiating the export. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
request: KibanaRequest; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...rver/kibana-plugin-core-server.savedobjectsexporterror.invalidtransformerror.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsExportError](./kibana-plugin-core-server.savedobjectsexporterror.md) > [invalidTransformError](./kibana-plugin-core-server.savedobjectsexporterror.invalidtransformerror.md) | ||
|
||
## SavedObjectsExportError.invalidTransformError() method | ||
|
||
Error returned when a [export tranform](./kibana-plugin-core-server.savedobjectsexporttransform.md) performed an invalid operation during the transform, such as removing objects from the export, or changing an object's type or id. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
static invalidTransformError(objectKeys: string[]): SavedObjectsExportError; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| objectKeys | <code>string[]</code> | | | ||
|
||
<b>Returns:</b> | ||
|
||
`SavedObjectsExportError` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...erver/kibana-plugin-core-server.savedobjectsexporterror.objecttransformerror.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsExportError](./kibana-plugin-core-server.savedobjectsexporterror.md) > [objectTransformError](./kibana-plugin-core-server.savedobjectsexporterror.objecttransformerror.md) | ||
|
||
## SavedObjectsExportError.objectTransformError() method | ||
|
||
Error returned when a [export tranform](./kibana-plugin-core-server.savedobjectsexporttransform.md) threw an error | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
static objectTransformError(objects: SavedObject[], cause: Error): SavedObjectsExportError; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| objects | <code>SavedObject[]</code> | | | ||
| cause | <code>Error</code> | | | ||
|
||
<b>Returns:</b> | ||
|
||
`SavedObjectsExportError` | ||
|
84 changes: 84 additions & 0 deletions
84
...evelopment/core/server/kibana-plugin-core-server.savedobjectsexporttransform.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsExportTransform](./kibana-plugin-core-server.savedobjectsexporttransform.md) | ||
|
||
## SavedObjectsExportTransform type | ||
|
||
Transformation function used to mutate the exported objects of the associated type. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type SavedObjectsExportTransform = <T = unknown>(context: SavedObjectsExportTransformContext, objects: Array<SavedObject<T>>) => SavedObject[] | Promise<SavedObject[]>; | ||
``` | ||
|
||
## Remarks | ||
|
||
Trying to change an object's id or type during the transform will result in a runtime error during the export process. | ||
|
||
## Example 1 | ||
|
||
Registering a transform function changing the object's attributes during the export | ||
|
||
```ts | ||
// src/plugins/my_plugin/server/plugin.ts | ||
import { myType } from './saved_objects'; | ||
|
||
export class Plugin() { | ||
setup: (core: CoreSetup) => { | ||
core.savedObjects.registerType({ | ||
...myType, | ||
management: { | ||
...myType.management, | ||
onExport: (ctx, objects) => { | ||
return objects.map((obj) => ({ | ||
...obj, | ||
attributes: { | ||
...obj.attributes, | ||
enabled: false, | ||
} | ||
}) | ||
} | ||
}, | ||
}); | ||
} | ||
} | ||
|
||
``` | ||
## Example 2 | ||
Registering a transform function adding additional objects to the export | ||
```ts | ||
// src/plugins/my_plugin/server/plugin.ts | ||
import { myType } from './saved_objects'; | ||
|
||
export class Plugin() { | ||
setup: (core: CoreSetup) => { | ||
const savedObjectStartContractPromise = getStartServices().then( | ||
([{ savedObjects: savedObjectsStart }]) => savedObjectsStart | ||
); | ||
|
||
core.savedObjects.registerType({ | ||
...myType, | ||
management: { | ||
...myType.management, | ||
onExport: async (ctx, objects) => { | ||
const { getScopedClient } = await savedObjectStartContractPromise; | ||
const client = getScopedClient(ctx.request); | ||
|
||
const depResponse = await client.find({ | ||
type: 'my-nested-object', | ||
hasReference: objs.map(({ id, type }) => ({ id, type })), | ||
}); | ||
|
||
return [...objs, ...depResponse.saved_objects]; | ||
} | ||
}, | ||
}); | ||
} | ||
} | ||
|
||
``` | ||
20 changes: 20 additions & 0 deletions
20
...ent/core/server/kibana-plugin-core-server.savedobjectsexporttransformcontext.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsExportTransformContext](./kibana-plugin-core-server.savedobjectsexporttransformcontext.md) | ||
|
||
## SavedObjectsExportTransformContext interface | ||
|
||
Context passed down to a [export transform function](./kibana-plugin-core-server.savedobjectsexporttransform.md) | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface SavedObjectsExportTransformContext | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [request](./kibana-plugin-core-server.savedobjectsexporttransformcontext.request.md) | <code>KibanaRequest</code> | The request that initiated the export request. Can be used to create scoped services or client inside the [transformation](./kibana-plugin-core-server.savedobjectsexporttransform.md) | | ||
|
13 changes: 13 additions & 0 deletions
13
.../server/kibana-plugin-core-server.savedobjectsexporttransformcontext.request.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsExportTransformContext](./kibana-plugin-core-server.savedobjectsexporttransformcontext.md) > [request](./kibana-plugin-core-server.savedobjectsexporttransformcontext.request.md) | ||
|
||
## SavedObjectsExportTransformContext.request property | ||
|
||
The request that initiated the export request. Can be used to create scoped services or client inside the [transformation](./kibana-plugin-core-server.savedobjectsexporttransform.md) | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
request: KibanaRequest; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...rver/kibana-plugin-core-server.savedobjectstypemanagementdefinition.onexport.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsTypeManagementDefinition](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.md) > [onExport](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.onexport.md) | ||
|
||
## SavedObjectsTypeManagementDefinition.onExport property | ||
|
||
An optional export transform function that can be used transform the objects of the registered type during the export process. | ||
|
||
It can be used to either mutates the exported objects, or add new objects to the export list. | ||
|
||
See [the transform type documentation](./kibana-plugin-core-server.savedobjectsexporttransform.md) for more info and examples. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
onExport?: SavedObjectsExportTransform; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.