mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -04:00
This PR implements a new internal API to return the information relating to all the connectors used throughout a case's lifespan. Fixes: https://github.com/elastic/kibana/issues/134346 ``` GET http://localhost:5601/internal/cases/<case id>/_connectors Response { "my-jira": { "name": "preconfigured-jira", "type": ".jira", "fields": { "issueType": "10001", "parent": null, "priority": null }, "id": "my-jira", "needsToBePushed": true, "hasBeenPushed": false } } ``` <details><summary>cURL example</summary> ``` curl --location --request GET 'http://localhost:5601/internal/cases/ae038370-91d9-11ed-97ce-c35961718f7b/_connectors' \ --header 'kbn-xsrf: hello' \ --header 'Authorization: Basic <token>' \ --data-raw '' ``` Response ``` { "my-jira": { "name": "preconfigured-jira", "type": ".jira", "fields": { "issueType": "10001", "parent": null, "priority": null }, "id": "my-jira", "needsToBePushed": true, "hasBeenPushed": false } } ``` </details> Notable changes: - Refactored the user actions service to move the functions that create user actions (builders etc) to its own class `UserActionPersister` - Refactored the `CaseUserActionService` class to pull the saved object client, logger, and other fields passed to each function via parameters to be wrapped in a `context` member field within the class - Plumbed in `savedObjectsService.createSerializer` to transform a raw elasticsearch document into the saved object representation - Added new internal `_connectors` route and `getConnectors` client function - Refactored the integration tests by extracting the connector related utility functions into their own file ## Needs to be pushed algorithm To determine whether a case needs to be pushed for a certain connector we follow this algorithm: - Get all unique connectors - For each connector - Find the most recent user action contain the connector's fields, this will be in the most recent `connector` user action or if the connector was configured only once when the case was initially created it'll be on the `create_case` user action - Grab the most recent push user action if it exists - For each push search for the connector fields that were used in that push - Get the most recent user action that would cause a push to occur (title, description, tags, or comment change) - For each connector - If a push does not exist, we need to push - If a push exists but the fields do not match the field of the most recent connector fields, we need to push because the fields changed - If the timestamp of the most recent user action is more recent than that of the last push (aka the user changed something since we last pushed) we need to push Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
---|---|---|
.. | ||
src | ||
index.ts | ||
jest.config.js | ||
kibana.jsonc | ||
package.json | ||
README.md | ||
tsconfig.json |
@kbn/core-saved-objects-api-server-internal
This package contains the internal implementation of core's server-side savedObjects client and repository.