-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Remove data <--> expressions circular dependencies. #82685
Conversation
* Takes a function spec and passes in default args, | ||
* overriding with any provided args. | ||
*/ | ||
export const functionWrapper = (spec: AnyExpressionFunctionDefinition) => { |
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 was just copied from expressions
. It's simple enough that doesn't feel worth exporting from there, especially as it is only a testing utility.
@@ -77,7 +81,7 @@ type StrategyMap = Record<string, ISearchStrategy<any, any>>; | |||
|
|||
/** @internal */ | |||
export interface SearchServiceSetupDependencies { | |||
registerFunction: AggsSetupDependencies['registerFunction']; | |||
expressions: ExpressionsServerSetup; |
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.
Updated setup dependencies for consistency with the public
search service, and also as we need registerType
from the expressions
contract now.
export interface ExecutionContext<InspectorAdapters extends Adapters = Adapters> { | ||
export interface ExecutionContext< | ||
InspectorAdapters extends Adapters = Adapters, | ||
ExecutionContextSearch extends SerializableState = SerializableState |
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.
I still called this ExecutionContextSearch
, but at this point expressions
only knows that it's something serializable. This means less type safety out of the box (unless you remember to pass the generic type param), however it helps us get rid of a circular type dependency and makes for clearer separation of concerns between the plugins.
@@ -59,7 +58,7 @@ export interface TimelionSuccessResponse { | |||
sheet: Sheet[]; | |||
stats: Stats; | |||
visType: string; | |||
type: KIBANA_CONTEXT_NAME; |
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 was the only place in Kibana this type was used, and you can derive it from KibanaContext
already -- so rather than keeping it in the data
plugin contract, I removed it and updated accordingly.
@@ -51,7 +47,7 @@ export type VegaExpressionFunctionDefinition = ExpressionFunctionDefinition< | |||
Input, | |||
Arguments, | |||
Output, | |||
ExecutionContext<VegaInspectorAdapters> | |||
ExecutionContext<VegaInspectorAdapters, ExecutionContextSearch> |
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.
For plugins registering expression functions which rely on the search execution context and want to maintain the same level of type safety as we had previously, this is how they can go about achieving it.
For this PR I did not comb through every registered expression function to make this change; rather, I only looked for places where a specific ExecutionContext
was already being included.
5dc0bf1
to
aa011ac
Compare
@elasticmachine merge upstream |
Pinging @elastic/kibana-app-arch (Team:AppArch) |
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.
SIEM/Endpoint LGTM
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.
Presentation changes are good 👍
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.
Kibana app changes LGTM, code review only.
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.
LGTM in terms of moving things like AbortError
, 'toPromiseand such. However I would appreciate someone more involved in
expressionsconfirming that it makes sense to move the
kibanaand
kibana_contextfunctions into the
data` plugin.
e53c369
to
2a0d358
Compare
@ppisljar and I discussed |
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Distributable file count
Page load bundle
History
To update your PR or re-run it, just comment with: |
* master: (39 commits) Fix ilm navigation (elastic#81664) [Lens] Distinct icons for XY and pie chart value labels toolbar (elastic#82927) [data.search.aggs] Throw an error when trying to create an agg type that doesn't exist. (elastic#81509) Index patterns api - load field list on server (elastic#82629) New events resolver (elastic#82170) [App Search] Misc naming tech debt (elastic#82770) load empty_kibana in test to have clean starting point (elastic#82772) Remove data <--> expressions circular dependencies. (elastic#82685) Update 8.0 breaking change template to gather information on how to programmatically detect it. (elastic#82905) Add alerting as codeowners to related documentation folder (elastic#82777) Add captions to user and space grid pages (elastic#82713) add alternate path for x-pack/Cloud test for Lens (elastic#82634) Uses asCurrentUser in getClusterUuid (elastic#82908) [Alerting][Connectors] Add new executor subaction to get 3rd party case fields (elastic#82519) Fix test import objects (elastic#82767) [ML] Add option for anomaly charts for metric detector should plot min, mean or max as appropriate (elastic#81662) Update alert type selection layout to rows instead of grid (elastic#73665) Prevent Kerberos and PKI providers from initiating a new session for unauthenticated XHR/API requests. (elastic#82817) Update grunt and related packages (elastic#79327) Allow the repository to search across all namespaces (elastic#82863) ...
Closes #80510
As part of the work to migrate to TS project references in preparation for the new build toolchain, we needed to remove some circular dependencies that exist between the
data
andexpressions
plugins.As explained in the original issue, there were a few areas that were causing problems:
This PR addresses these issues by doing the following:
toPromise
,AbortError
, andgetCombinedSignal
fromdata
tokibana_utils
, as these were used in multiple plugins.abortSignalToPromise
andgetCombinedAbortSignal
for claritykibana
andkibana_context
expression functions to thedata
plugin, and registers them from there instead.kibana_context
expression type todata
.expression
plugin'sExecutionContext
to take an additional generic type parameter forExecutionContextSearch
, and defaults toSerializableState
. Also updates a few places where this was used to pass in the correct param.expressions
that usedExecutionContextSearch
and replaced withSerializableState
, as the search typings should really be determined bydata
anyway.data
from theexpressions
plugin'srequiredBundles
.