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

Expose saved object import/export from core #42022

Merged
merged 10 commits into from
Aug 1, 2019

Conversation

legrego
Copy link
Member

@legrego legrego commented Jul 25, 2019

Summary

This is an extraction of the core changes from #38014 for easier review.

Exposes the saved object import/export functionality to the public saved objects service for plugins to use. In my case, the spaces plugin for the Copy-to-Space functionality.

This also tweaks the import/export code to accept an optional namespace parameter, so that we can dictate which namespace to perform the import/export operation against.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@legrego legrego added release_note:skip Skip the PR/issue when compiling release notes v7.4.0 v8.0.0 labels Jul 30, 2019
@legrego legrego marked this pull request as ready for review July 30, 2019 20:45
@legrego legrego requested a review from a team as a code owner July 30, 2019 20:45
@legrego legrego requested a review from rudolf July 30, 2019 20:46
@legrego legrego added the review label Jul 30, 2019
@legrego
Copy link
Member Author

legrego commented Jul 30, 2019

@rudolf this PR looks big, but a lot of it is .md and snapshot updates. Let me know if you have any questions!

SavedObjectsImportResponse,
SavedObjectsImportRetry,
SavedObjectsResolveImportErrorsOptions,
getSortedObjectsForExport,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only want to export types from src/core/server/index.ts since the functionality will get exposed through core.savedObjects (next up on my todo list).

To prevent you from being blocked by my work, you can remove getSortedObjectsForExport, importSavedObjects & resolveImportErrors from this file and then in saved_objects_mixin.js import them from src/core/server/saved_objects/export and add a ts-lint ignore comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, I'll make this change

@@ -515,6 +532,14 @@ export class SavedObjectsClient {
// @public
export type SavedObjectsClientContract = Pick<SavedObjectsClient, keyof SavedObjectsClient>;

// Warning: (ae-missing-release-tag) "SavedObjectsClientProviderOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a doc comment block above every exported type like:

/**
 * @public
 */

Bonus points for adding a one liner to explain what the type does 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You got it!

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@legrego
Copy link
Member Author

legrego commented Jul 31, 2019

@rudolf ready for another review whenever you get a chance

Copy link
Contributor

@rudolf rudolf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the docs! 😍Happy for you to merge if you can expose the missing type.

@@ -752,5 +872,6 @@ export interface SessionStorageFactory<T> {
//
// src/core/server/plugins/plugin_context.ts:34:10 - (ae-forgotten-export) The symbol "EnvironmentMode" needs to be exported by the entry point index.d.ts
// src/core/server/plugins/plugins_service.ts:37:5 - (ae-forgotten-export) The symbol "DiscoveredPluginInternal" needs to be exported by the entry point index.d.ts
// src/core/server/saved_objects/service/index.ts:47:5 - (ae-forgotten-export) The symbol "ExportObjectsOptions" needs to be exported by the entry point index.d.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you missed this type.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops! good catch

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@legrego legrego merged commit f36cc0b into elastic:master Aug 1, 2019
@legrego legrego deleted the cts/core-changes branch August 1, 2019 16:43
legrego added a commit to legrego/kibana that referenced this pull request Aug 1, 2019
* expose saved object import/export from core

* additional tests

* removing unused mock

* updater snapshots

* add objectLimit to saved objects service

* don't export the import/export functionality from core; only types

* documenting exported types

* export missing type
legrego added a commit that referenced this pull request Aug 1, 2019
* expose saved object import/export from core

* additional tests

* removing unused mock

* updater snapshots

* add objectLimit to saved objects service

* don't export the import/export functionality from core; only types

* documenting exported types

* export missing type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes review v7.4.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants