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

TS of esKuery\node_types #56857

Merged
merged 4 commits into from
Feb 7, 2020

Conversation

lizozom
Copy link
Contributor

@lizozom lizozom commented Feb 5, 2020

Summary

Typescript-ification of esKuery node_types
Part of #56881

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@lizozom lizozom added the release_note:skip Skip the PR/issue when compiling release notes label Feb 5, 2020
@lizozom lizozom requested a review from Bamieh February 5, 2020 15:25
@lizozom lizozom changed the title TS of node types and collector TS of esKuery\node_types Feb 5, 2020
@lizozom lizozom requested review from lukeelmers and removed request for a team and Bamieh February 5, 2020 15:33
Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple questions

type: 'literal';
value: null | boolean | number | string;
}

interface NamedArgType {
buildNode: (name: string, value: any) => NamedArgTypeBuildNode;
toElasticsearchQuery: (node: any) => string;
toElasticsearchQuery: (node: any) => JsonValue;
Copy link
Member

Choose a reason for hiding this comment

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

For each of the toElasticsearchQuery() items in this file, should the node param they are accepting match the returned value of the buildNode() function?

For example here, I would expect the interface to be:

interface NamedArgType {
  buildNode: (name: string, value: any) => NamedArgTypeBuildNode;
  toElasticsearchQuery: (node: NamedArgTypeBuildNode) => JsonValue;
}

...and similar for each of the others as well as the individual node_types definitions themselves.

I don't know enough about the kuery implementation to say with 100% confidence that this should be the case, but it makes sense based on my understanding of the code and would make the typings in this PR much simpler

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with you, but I was trying to stick with the API defined in types.ts as much as possible, to avoid errors.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@lizozom lizozom requested a review from lukeelmers February 6, 2020 10:29
Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

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

Code changes LGTM. I do think we should revisit the toElasticsearchQuery typings as discussed, but there are plenty of other TS areas in esKuery that need attention, so perhaps that could be done as part of a wider refactor to tighten things up in a future PR.

@lizozom lizozom merged commit 31985a3 into elastic:master Feb 7, 2020
lizozom pushed a commit to lizozom/kibana that referenced this pull request Feb 7, 2020
* TS of node types and collector

* Code review
lizozom pushed a commit that referenced this pull request Feb 7, 2020
* TS of node types and collector

* Code review
jloleysens added a commit to jloleysens/kibana that referenced this pull request Feb 7, 2020
…b.com:jloleysens/kibana into console/feature/text-objects-in-saved-objects

* 'console/feature/text-objects-in-saved-objects' of github.com:jloleysens/kibana: (103 commits)
  fix auto closing new vis modal when navigating to lens or when navigating away with browser history (elastic#56998)
  TS of esKuery\node_types  (elastic#56857)
  Kibana app migration: Move static code dependencies into kibana_legacy plugin, part 1 (elastic#56408)
  Retry ES API calls that fail with 410/Gone (elastic#56950)
  [APM] Show missing permissions message to the user on the Services overview (elastic#56374)
  Fixing flaky CI tests for custom appRoutes (elastic#55763)
  [State Management][Docs] State syncing utils docs (elastic#56479)
  [Index management] Remove index mapper setting in tests (elastic#57066)
  Exposed common EuiExpressions to separate components be able to reuse for building new for Alert Types  (elastic#56466)
  [SIEM] update url state between page if date is relative (elastic#56813)
  fix for chart_types test (elastic#57056)
  chore(NA): remove compress from dll minimizer (elastic#57023)
  [File upload] Migrate routing to NP & add route validation (elastic#52313)
  Adding docs for grouped nav advanced setting (elastic#57013)
  Use i18n titles for field formatters, human names for numeral locales (elastic#56348)
  [Maps] Remove EMS catalogue url from docs (elastic#57020)
  [Endpoint] ERT-82 ERT-83 ERT-84: Alert list API with pagination (elastic#56538)
  [DOCS] Adds Apple notarization info to install doc (elastic#57042)
  [ML] New Platform server shim: update results service routes to use new platform router (elastic#56886)
  Fix typo on detection engine rule (elastic#56993)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants