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

[Inventory][ECO] Use type derived from entityLatestSchema #198758

Closed
crespocarlos opened this issue Nov 4, 2024 · 1 comment · Fixed by #198760
Closed

[Inventory][ECO] Use type derived from entityLatestSchema #198758

crespocarlos opened this issue Nov 4, 2024 · 1 comment · Fixed by #198760
Assignees
Labels
Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team technical debt Improvement of the software architecture and operational architecture

Comments

@crespocarlos
Copy link
Contributor

Summary

Inventory's Entity type is defined as index signature type, using dynamic set of keys. While it provides flexibility it has a number of drawbacks, eg: reduced intellisense and autocompletition, potential misuse, prone to errors.

There is a entityLatestSchema defined with zod that could be used to represent the inventory entity latest type. Ideally, it could be used as a common interface between EEM and the UI.

AC

  • Entity type is replaced in favor of entityLatestSchema
@crespocarlos crespocarlos self-assigned this Nov 4, 2024
@crespocarlos crespocarlos added technical debt Improvement of the software architecture and operational architecture Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team labels Nov 4, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

crespocarlos added a commit that referenced this issue Nov 12, 2024
…198760)

closes [#198758](#198758)

## Summary

This PR removes the Entity type used across the Inventory and replaces
it with `InventoryEntityLatest`, which provides strong typing for the
latest entity object. This change makes the code leverage TypeScript’s
intellisense and autocompletion in the editor, making the code easier to
work with and more maintainable across the codebase.

`InventoryEntityLatest` is the interface that the API returns and what
the UI consumes. Note that this is distinct from the index mapping
defined by `entityLatestSchema`, creating a separation layer between
Elasticsearch and the UI.

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
crespocarlos added a commit to crespocarlos/kibana that referenced this issue Nov 13, 2024
…lastic#198760)

closes [elastic#198758](elastic#198758)

## Summary

This PR removes the Entity type used across the Inventory and replaces
it with `InventoryEntityLatest`, which provides strong typing for the
latest entity object. This change makes the code leverage TypeScript’s
intellisense and autocompletion in the editor, making the code easier to
work with and more maintainable across the codebase.

`InventoryEntityLatest` is the interface that the API returns and what
the UI consumes. Note that this is distinct from the index mapping
defined by `entityLatestSchema`, creating a separation layer between
Elasticsearch and the UI.

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit c4d3de8)

# Conflicts:
#	x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/transaction_details/transaction_details.cy.ts
crespocarlos added a commit that referenced this issue Nov 13, 2024
…type (#198760) (#199967)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Inventory][ECO] Replace `Entity` with `InventoryEntityLatest` type
(#198760)](#198760)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Carlos
Crespo","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-12T17:47:00Z","message":"[Inventory][ECO]
Replace `Entity` with `InventoryEntityLatest` type (#198760)\n\ncloses
[#198758](https://github.com/elastic/kibana/issues/198758)\r\n\r\n##
Summary\r\n\r\nThis PR removes the Entity type used across the Inventory
and replaces\r\nit with `InventoryEntityLatest`, which provides strong
typing for the\r\nlatest entity object. This change makes the code
leverage TypeScript’s\r\nintellisense and autocompletion in the editor,
making the code easier to\r\nwork with and more maintainable across the
codebase.\r\n\r\n`InventoryEntityLatest` is the interface that the API
returns and what\r\nthe UI consumes. Note that this is distinct from the
index mapping\r\ndefined by `entityLatestSchema`, creating a separation
layer between\r\nElasticsearch and the
UI.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"c4d3de83162904d3db19e82720b2dd747dcfc5e6","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services"],"number":198760,"url":"https://github.com/elastic/kibana/pull/198760","mergeCommit":{"message":"[Inventory][ECO]
Replace `Entity` with `InventoryEntityLatest` type (#198760)\n\ncloses
[#198758](https://github.com/elastic/kibana/issues/198758)\r\n\r\n##
Summary\r\n\r\nThis PR removes the Entity type used across the Inventory
and replaces\r\nit with `InventoryEntityLatest`, which provides strong
typing for the\r\nlatest entity object. This change makes the code
leverage TypeScript’s\r\nintellisense and autocompletion in the editor,
making the code easier to\r\nwork with and more maintainable across the
codebase.\r\n\r\n`InventoryEntityLatest` is the interface that the API
returns and what\r\nthe UI consumes. Note that this is distinct from the
index mapping\r\ndefined by `entityLatestSchema`, creating a separation
layer between\r\nElasticsearch and the
UI.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"c4d3de83162904d3db19e82720b2dd747dcfc5e6"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198760","number":198760,"mergeCommit":{"message":"[Inventory][ECO]
Replace `Entity` with `InventoryEntityLatest` type (#198760)\n\ncloses
[#198758](https://github.com/elastic/kibana/issues/198758)\r\n\r\n##
Summary\r\n\r\nThis PR removes the Entity type used across the Inventory
and replaces\r\nit with `InventoryEntityLatest`, which provides strong
typing for the\r\nlatest entity object. This change makes the code
leverage TypeScript’s\r\nintellisense and autocompletion in the editor,
making the code easier to\r\nwork with and more maintainable across the
codebase.\r\n\r\n`InventoryEntityLatest` is the interface that the API
returns and what\r\nthe UI consumes. Note that this is distinct from the
index mapping\r\ndefined by `entityLatestSchema`, creating a separation
layer between\r\nElasticsearch and the
UI.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"c4d3de83162904d3db19e82720b2dd747dcfc5e6"}}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team technical debt Improvement of the software architecture and operational architecture
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants