Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Public saved objects client #39891

Merged
merged 35 commits into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8522e1d
Move SavedObjectClient files to core/public
rudolf Jun 26, 2019
2a33592
Initial SavedObjectsService in public Core
rudolf Jun 27, 2019
4a2cdb4
Public SavedObjectsClient tests
rudolf Jun 28, 2019
228715f
Import SimpleSavedObject from src/core/public
rudolf Jun 28, 2019
dbffac2
Use types from source files for kibana.d.ts
rudolf Jul 1, 2019
ed45d7a
Add html raw loader to x-pack/jest
rudolf Jul 2, 2019
bf96e60
Cleanup
rudolf Jul 2, 2019
411aeb3
Drop case utilities and improve test coverage
rudolf Jul 2, 2019
5623353
Update types and documentation
rudolf Jul 4, 2019
84284e4
Fix build breaking when importing directly from /server in /public
rudolf Jul 6, 2019
ef42149
Ensure that all option paramaters are picked and renamed
rudolf Jul 17, 2019
9b2dc27
Fix option mapping and introduce stronger types
rudolf Jul 18, 2019
66ebe87
Eslint: allow imports from src/core/*/types
rudolf Jul 18, 2019
dc1fc9b
Add compatibility layer for kfetch vs http.fetch error responses
rudolf Jul 19, 2019
c8a6aa3
Merge branch 'master' into core-saved-objects-service
rudolf Jul 29, 2019
40ffbc0
Improve documentation
rudolf Jul 29, 2019
75f837a
Expose SavedObjectsMigrationLogger
rudolf Jul 29, 2019
73e601f
Documentation and type tweaks
rudolf Jul 29, 2019
b64666d
Revert type changes from 73e601f and update api docs
rudolf Jul 29, 2019
18f3f36
Refactor request into savedObjectFetch + test
rudolf Jul 31, 2019
a1e8858
Make legacy SavedObject compatible with http.fetch exceptions
rudolf Jul 31, 2019
55ec87e
Merge branch 'master' into core-saved-objects-service
rudolf Aug 1, 2019
6011cbd
Fix types and tests
rudolf Aug 1, 2019
6119a33
simple_saved_object import from src/core/server
rudolf Aug 1, 2019
fc3bfa6
server imports from root instead of server/types
rudolf Aug 1, 2019
7444889
Merge branch 'master' into core-saved-objects-service
rudolf Aug 2, 2019
ba1c85b
Merge branch 'master' into core-saved-objects-service
rudolf Aug 5, 2019
ed9a17c
Make SavedObjectsService a class
rudolf Aug 5, 2019
f783b78
Don't pick unkown keys from server response
rudolf Aug 5, 2019
53f6800
Rename SavedObjectsFindResponse to SavedObjectsFindResponsePublic
rudolf Aug 5, 2019
61705ca
Remove err.response from SavedObjects fetch errors
rudolf Aug 5, 2019
2f3976b
Revert "Remove err.response from SavedObjects fetch errors"
rudolf Aug 5, 2019
92582b9
Don't introduce err.response until we deprecate err.res
rudolf Aug 5, 2019
2640aae
Merge branch 'master' into core-saved-objects-service
rudolf Aug 6, 2019
4bbc80f
Merge branch 'master' into core-saved-objects-service
rudolf Aug 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ export interface CoreStart
| [i18n](./kibana-plugin-public.corestart.i18n.md) | <code>I18nStart</code> | [I18nStart](./kibana-plugin-public.i18nstart.md) |
| [notifications](./kibana-plugin-public.corestart.notifications.md) | <code>NotificationsStart</code> | [NotificationsStart](./kibana-plugin-public.notificationsstart.md) |
| [overlays](./kibana-plugin-public.corestart.overlays.md) | <code>OverlayStart</code> | [OverlayStart](./kibana-plugin-public.overlaystart.md) |
| [savedObjects](./kibana-plugin-public.corestart.savedobjects.md) | <code>SavedObjectsStart</code> | [SavedObjectsStart](./kibana-plugin-public.savedobjectsstart.md) |
| [uiSettings](./kibana-plugin-public.corestart.uisettings.md) | <code>UiSettingsClientContract</code> | [UiSettingsClient](./kibana-plugin-public.uisettingsclient.md) |

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) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [CoreStart](./kibana-plugin-public.corestart.md) &gt; [savedObjects](./kibana-plugin-public.corestart.savedobjects.md)

## CoreStart.savedObjects property

[SavedObjectsStart](./kibana-plugin-public.savedobjectsstart.md)

<b>Signature:</b>

```typescript
savedObjects: SavedObjectsStart;
```
17 changes: 17 additions & 0 deletions docs/development/core/public/kibana-plugin-public.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->

| Class | Description |
| --- | --- |
| [SavedObjectsClient](./kibana-plugin-public.savedobjectsclient.md) | Saved Objects is Kibana's data persisentence mechanism allowing plugins to use Elasticsearch for storing plugin state. The client-side SavedObjectsClient is a thin convenience library around the SavedObjects HTTP API for interacting with Saved Objects. |
| [SimpleSavedObject](./kibana-plugin-public.simplesavedobject.md) | This class is a very simple wrapper for SavedObjects loaded from the server with the [SavedObjectsClient](./kibana-plugin-public.savedobjectsclient.md)<!-- -->.<!-- -->It provides basic functionality for creating/saving/deleting saved objects, but doesn't include any type-specific implementations. |
| [ToastsApi](./kibana-plugin-public.toastsapi.md) | |
| [UiSettingsClient](./kibana-plugin-public.uisettingsclient.md) | |

Expand Down Expand Up @@ -59,6 +61,19 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [OverlayStart](./kibana-plugin-public.overlaystart.md) | |
| [Plugin](./kibana-plugin-public.plugin.md) | The interface that should be returned by a <code>PluginInitializer</code>. |
| [PluginInitializerContext](./kibana-plugin-public.plugininitializercontext.md) | The available core services passed to a <code>PluginInitializer</code> |
| [SavedObject](./kibana-plugin-public.savedobject.md) | |
| [SavedObjectAttributes](./kibana-plugin-public.savedobjectattributes.md) | The data for a Saved Object is stored in the <code>attributes</code> key as either an object or an array of objects. |
| [SavedObjectReference](./kibana-plugin-public.savedobjectreference.md) | A reference to another saved object. |
| [SavedObjectsBaseOptions](./kibana-plugin-public.savedobjectsbaseoptions.md) | |
| [SavedObjectsBatchResponse](./kibana-plugin-public.savedobjectsbatchresponse.md) | |
| [SavedObjectsBulkCreateObject](./kibana-plugin-public.savedobjectsbulkcreateobject.md) | |
| [SavedObjectsBulkCreateOptions](./kibana-plugin-public.savedobjectsbulkcreateoptions.md) | |
| [SavedObjectsCreateOptions](./kibana-plugin-public.savedobjectscreateoptions.md) | |
| [SavedObjectsFindOptions](./kibana-plugin-public.savedobjectsfindoptions.md) | |
| [SavedObjectsFindResponsePublic](./kibana-plugin-public.savedobjectsfindresponsepublic.md) | Return type of the Saved Objects <code>find()</code> method.<!-- -->\*Note\*: this type is different between the Public and Server Saved Objects clients. |
| [SavedObjectsMigrationVersion](./kibana-plugin-public.savedobjectsmigrationversion.md) | Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. |
| [SavedObjectsStart](./kibana-plugin-public.savedobjectsstart.md) | |
| [SavedObjectsUpdateOptions](./kibana-plugin-public.savedobjectsupdateoptions.md) | |
| [UiSettingsState](./kibana-plugin-public.uisettingsstate.md) | |

## Type Aliases
Expand All @@ -75,6 +90,8 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [IContextProvider](./kibana-plugin-public.icontextprovider.md) | A function that returns a context value for a specific key of given context type. |
| [PluginInitializer](./kibana-plugin-public.plugininitializer.md) | The <code>plugin</code> export at the root of a plugin's <code>public</code> directory should conform to this interface. |
| [RecursiveReadonly](./kibana-plugin-public.recursivereadonly.md) | |
| [SavedObjectAttribute](./kibana-plugin-public.savedobjectattribute.md) | |
| [SavedObjectsClientContract](./kibana-plugin-public.savedobjectsclientcontract.md) | SavedObjectsClientContract as implemented by the [SavedObjectsClient](./kibana-plugin-public.savedobjectsclient.md) |
| [ToastInput](./kibana-plugin-public.toastinput.md) | |
| [UiSettingsClientContract](./kibana-plugin-public.uisettingsclientcontract.md) | [UiSettingsClient](./kibana-plugin-public.uisettingsclient.md) |

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) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObject](./kibana-plugin-public.savedobject.md) &gt; [attributes](./kibana-plugin-public.savedobject.attributes.md)

## SavedObject.attributes property

The data for a Saved Object is stored in the `attributes` key as either an object or an array of objects.

<b>Signature:</b>

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

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObject](./kibana-plugin-public.savedobject.md) &gt; [error](./kibana-plugin-public.savedobject.error.md)

## SavedObject.error property

<b>Signature:</b>

```typescript
error?: {
message: string;
statusCode: number;
};
```
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) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObject](./kibana-plugin-public.savedobject.md) &gt; [id](./kibana-plugin-public.savedobject.id.md)

## SavedObject.id property

The ID of this Saved Object, guaranteed to be unique for all objects of the same `type`

<b>Signature:</b>

```typescript
id: string;
```
26 changes: 26 additions & 0 deletions docs/development/core/public/kibana-plugin-public.savedobject.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObject](./kibana-plugin-public.savedobject.md)

## SavedObject interface


<b>Signature:</b>

```typescript
export interface SavedObject<T extends SavedObjectAttributes = any>
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [attributes](./kibana-plugin-public.savedobject.attributes.md) | <code>T</code> | The data for a Saved Object is stored in the <code>attributes</code> key as either an object or an array of objects. |
| [error](./kibana-plugin-public.savedobject.error.md) | <code>{</code><br/><code> message: string;</code><br/><code> statusCode: number;</code><br/><code> }</code> | |
| [id](./kibana-plugin-public.savedobject.id.md) | <code>string</code> | The ID of this Saved Object, guaranteed to be unique for all objects of the same <code>type</code> |
| [migrationVersion](./kibana-plugin-public.savedobject.migrationversion.md) | <code>SavedObjectsMigrationVersion</code> | Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. |
| [references](./kibana-plugin-public.savedobject.references.md) | <code>SavedObjectReference[]</code> | A reference to another saved object. |
| [type](./kibana-plugin-public.savedobject.type.md) | <code>string</code> | The type of Saved Object. Each plugin can define it's own custom Saved Object types. |
| [updated\_at](./kibana-plugin-public.savedobject.updated_at.md) | <code>string</code> | Timestamp of the last time this document had been updated. |
| [version](./kibana-plugin-public.savedobject.version.md) | <code>string</code> | An opaque version number which changes on each successful write operation. Can be used for implementing optimistic concurrency control. |

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) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObject](./kibana-plugin-public.savedobject.md) &gt; [migrationVersion](./kibana-plugin-public.savedobject.migrationversion.md)

## SavedObject.migrationVersion property

Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value.

<b>Signature:</b>

```typescript
migrationVersion?: SavedObjectsMigrationVersion;
```
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) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObject](./kibana-plugin-public.savedobject.md) &gt; [references](./kibana-plugin-public.savedobject.references.md)

## SavedObject.references property

A reference to another saved object.

<b>Signature:</b>

```typescript
references: SavedObjectReference[];
```
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) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObject](./kibana-plugin-public.savedobject.md) &gt; [type](./kibana-plugin-public.savedobject.type.md)

## SavedObject.type property

The type of Saved Object. Each plugin can define it's own custom Saved Object types.

<b>Signature:</b>

```typescript
type: string;
```
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) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObject](./kibana-plugin-public.savedobject.md) &gt; [updated\_at](./kibana-plugin-public.savedobject.updated_at.md)

## SavedObject.updated\_at property

Timestamp of the last time this document had been updated.

<b>Signature:</b>

```typescript
updated_at?: string;
```
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) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObject](./kibana-plugin-public.savedobject.md) &gt; [version](./kibana-plugin-public.savedobject.version.md)

## SavedObject.version property

An opaque version number which changes on each successful write operation. Can be used for implementing optimistic concurrency control.

<b>Signature:</b>

```typescript
version?: string;
```
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-public](./kibana-plugin-public.md) &gt; [SavedObjectAttribute](./kibana-plugin-public.savedobjectattribute.md)

## SavedObjectAttribute type


<b>Signature:</b>

```typescript
export declare type SavedObjectAttribute = string | number | boolean | null | undefined | SavedObjectAttributes | SavedObjectAttributes[];
```
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) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObjectAttributes](./kibana-plugin-public.savedobjectattributes.md)

## SavedObjectAttributes interface

The data for a Saved Object is stored in the `attributes` key as either an object or an array of objects.

<b>Signature:</b>

```typescript
export interface SavedObjectAttributes
```
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-public](./kibana-plugin-public.md) &gt; [SavedObjectReference](./kibana-plugin-public.savedobjectreference.md) &gt; [id](./kibana-plugin-public.savedobjectreference.id.md)

## SavedObjectReference.id property

<b>Signature:</b>

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

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObjectReference](./kibana-plugin-public.savedobjectreference.md)

## SavedObjectReference interface

A reference to another saved object.

<b>Signature:</b>

```typescript
export interface SavedObjectReference
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [id](./kibana-plugin-public.savedobjectreference.id.md) | <code>string</code> | |
| [name](./kibana-plugin-public.savedobjectreference.name.md) | <code>string</code> | |
| [type](./kibana-plugin-public.savedobjectreference.type.md) | <code>string</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-public](./kibana-plugin-public.md) &gt; [SavedObjectReference](./kibana-plugin-public.savedobjectreference.md) &gt; [name](./kibana-plugin-public.savedobjectreference.name.md)

## SavedObjectReference.name property

<b>Signature:</b>

```typescript
name: string;
```
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-public](./kibana-plugin-public.md) &gt; [SavedObjectReference](./kibana-plugin-public.savedobjectreference.md) &gt; [type](./kibana-plugin-public.savedobjectreference.type.md)

## SavedObjectReference.type property

<b>Signature:</b>

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

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObjectsBaseOptions](./kibana-plugin-public.savedobjectsbaseoptions.md)

## SavedObjectsBaseOptions interface


<b>Signature:</b>

```typescript
export interface SavedObjectsBaseOptions
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [namespace](./kibana-plugin-public.savedobjectsbaseoptions.namespace.md) | <code>string</code> | Specify the namespace for this operation |

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) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObjectsBaseOptions](./kibana-plugin-public.savedobjectsbaseoptions.md) &gt; [namespace](./kibana-plugin-public.savedobjectsbaseoptions.namespace.md)

## SavedObjectsBaseOptions.namespace property

Specify the namespace for this operation

<b>Signature:</b>

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

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObjectsBatchResponse](./kibana-plugin-public.savedobjectsbatchresponse.md)

## SavedObjectsBatchResponse interface


<b>Signature:</b>

```typescript
export interface SavedObjectsBatchResponse<T extends SavedObjectAttributes = SavedObjectAttributes>
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [savedObjects](./kibana-plugin-public.savedobjectsbatchresponse.savedobjects.md) | <code>Array&lt;SimpleSavedObject&lt;T&gt;&gt;</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-public](./kibana-plugin-public.md) &gt; [SavedObjectsBatchResponse](./kibana-plugin-public.savedobjectsbatchresponse.md) &gt; [savedObjects](./kibana-plugin-public.savedobjectsbatchresponse.savedobjects.md)

## SavedObjectsBatchResponse.savedObjects property

<b>Signature:</b>

```typescript
savedObjects: Array<SimpleSavedObject<T>>;
```
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-public](./kibana-plugin-public.md) &gt; [SavedObjectsBulkCreateObject](./kibana-plugin-public.savedobjectsbulkcreateobject.md) &gt; [attributes](./kibana-plugin-public.savedobjectsbulkcreateobject.attributes.md)

## SavedObjectsBulkCreateObject.attributes property

<b>Signature:</b>

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

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [SavedObjectsBulkCreateObject](./kibana-plugin-public.savedobjectsbulkcreateobject.md)

## SavedObjectsBulkCreateObject interface

<b>Signature:</b>

```typescript
export interface SavedObjectsBulkCreateObject<T extends SavedObjectAttributes = SavedObjectAttributes> extends SavedObjectsCreateOptions
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [attributes](./kibana-plugin-public.savedobjectsbulkcreateobject.attributes.md) | <code>T</code> | |
| [type](./kibana-plugin-public.savedobjectsbulkcreateobject.type.md) | <code>string</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-public](./kibana-plugin-public.md) &gt; [SavedObjectsBulkCreateObject](./kibana-plugin-public.savedobjectsbulkcreateobject.md) &gt; [type](./kibana-plugin-public.savedobjectsbulkcreateobject.type.md)

## SavedObjectsBulkCreateObject.type property

<b>Signature:</b>

```typescript
type: string;
```
Loading