-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Clean up data plugin #39554
Clean up data plugin #39554
Conversation
Pinging @elastic/kibana-app-arch |
This comment has been minimized.
This comment has been minimized.
042641b
to
4145526
Compare
This comment has been minimized.
This comment has been minimized.
4145526
to
0cf6e19
Compare
This comment has been minimized.
This comment has been minimized.
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I love the separation between index \ plugin \ setup
I think that this should be applied immediately to the vis_markdown plugin as well, to see how it works.
And also to make sure that EPAM work with correct references.
getInterpreter: InterpreterGetter; | ||
}; | ||
interface InterpreterGetter { | ||
getInterpreter: () => Promise<{ interpreter: Interpreter }>; | ||
} | ||
|
||
/** | ||
* Expressions Service | ||
* @internal | ||
*/ | ||
export class ExpressionsService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit unrelated but shouldn't we have registerFunction
here?
I saw @ppisljar added it to expressions on markdown vis.
const coreSetup: CoreSetup = npSetup.core; | ||
|
||
// plugin dependency shims | ||
const pluginsSetup: DataSetupPlugins = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. :)
Going to go ahead and close this now that we've aligned on various conventions -- we can do the cleanup over the course of other refactorings that are in progress |
Summary
Working to make a clear separation between shim code & "new platform" code, so that at the end of the migration process we can just delete the shims. Also trying to make everything consistent based on the most recent conventions we have had, so that the data plugin can serve as an example for future plugins and we can point other teams to it as the recommended way of doing things.
Proposed Conventions
These changes imply a few conventions I'd like to propose (which could ultimately be added to #39542 that @joshdover started, once we get a consensus here):
server/
andpublic/
directory has:index.ts
which exports a function namedplugin
(already required by NP)plugin.ts
in a separate file which contains the plugin definition (already a recommended convention for NP).NameSetup
, andNameStart
, and would define interfaces for it's own plugin dependencies, named asNameSetupPlugins
andNameStartPlugins
Plugin
type as wellDataPublicPlugin
(server would beDataServerPlugin
). Stole this idea from @streamich 😉setup.ts
, which was originally added by @lizozom. This file would serve exclusively as a shim that gets imported by other plugins.plugin.ts
file can remain a "clean" representation of how it will look in the new platform. In a perfect world, these shim files can simply be deleted when things move to new platform and everything Just Works(TM).setup.ts
shim files!) to get the setup contract for our shim plugin.start.ts
shim file would get created.npSetup
fromui/new_platform
to inject core dependencies.I'm working on a proposed set of conventions for static code & type exports, but the more I've experimented, the more trade-offs I run into. So for the sake of keeping this PR small (and not breaking a bunch of downstream imports), I'll branch that off into a separate PR & discussion thread.
Tasks
plugin.ts
file and export aplugin
function fromindex.ts
, per recommended new platform conventionsindex.ts
[ ] Add shims for each individual service, since there will be legacy/shim code in those service definitions as wellNot necessary yet as there aren't currently shim codes in top-level service definitions