* added page to reporting example app that contains the capture tests
* first version of PNG capture for test A
* added types file to common
* added data-shared-item attr to image, also added capture menu items
* fix image CSS by providing a fixed width and height
* explicitly add layout for print, does not seem to do anything though?
* added magic numbers of image sizes
* added reporting examples test folder
* first version of capture test for generating and comparing PNGs
* added PNG service and PNG baseline fixture
* added pdf-to-img dev dependency
* refactor compare_pngs to accept a buffer
* added comment to interface
* png service -> compare images service
* export image compare service
* added test for pdf export
* clean up log
* minor fixes and added pdf print optimized test
* added pdf and pdf print fixtures
* refactor lib function name
* Update difference thresholds
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* added new data-render-error attribute, read it and store it on job object
* added data-render-error to the example app
* added jest test
* address pr feedback
- make renderErrors optional in interfaces
- create separate selectors for data render error selector/attr
- Tidy up mergeMap behaviour
* fix observable.test.ts snapshots and browser driver mock
* updated jest snapshots
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* very wip
* - Reached first iteration of reporting body value being saved with
the report for **PDF**
- Removed v2 of the reporting since it looks like we may be able
to make a backwards compatible change on existing PDF/PNG
exports
* reintroduced pdfv2 export type, see https://github.com/elastic/kibana/issues/99890\#issuecomment-851527878
* fix a whol bunch of imports
* mapped out a working version for pdf
* refactor to tuples
* added v2 pdf to export type registry
* a lot of hackery to get reports generated in v2
* added png v2, png reports with locator state
* wip: refactored for loading the saved object on the redirect app URL
* major wip: initial stages of reporting redirect app, need to add a way to generate v2 reports!
* added a way to generate a v2 pdf from the example reporting plugin
* updated reporting example app to read and accept forwarded app state
* added reporting locator and updated server-side route to not use Boom
* removed reporting locator for now, first iteration of reports being generated using the reporting redirect app
* version with PNG working
* moved png/v2 -> png_v2
* moved printable_pdf/v2 -> printable_pdf_v2
* updated share public setup and start mocks
* fix types after merging master
* locator -> locatorParams AND added a new endpoint for getting locator params to client
* fix type import
* fix types
* clean up bad imports
* forceNow required on v2 payloads
* reworked create job interface for PNG task payload and updated consumer code report example for forcenow
* put locatorparams[] back onto the reportsource interface because on baseparams it conflicts with the different export type params
* move getCustomLogo and generatePng to common for export types
* additional import fixes
* urls -> url
* chore: fix and update types and fix jest import mocks
* - refactored v2 behaviour to avoid client-side request for locator
instead this value is injected pre-page-load so that the
redirect app can use it
- refactored the interface for the getScreenshot observable
factory. specifically we now expect 'urlsOrUrlTuples' to be
passed in. tested with new and old report types.
* updated the reporting example app to use locator migration for v2 report types
* added functionality for setting forceNow
* added forceNow to job payload for v2 report types and fixed shared components for v2
* write the output of v2 reports to stream
* fix types for forceNow
* added tests for execute job
* added comments, organized imports, removed selectors from report params
* fix some type issues
* feedback: removed duplicated PDF code, cleaned screenshot observable function and other minor tweaks
* use variable (not destructured values) and remove unused import
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* [build_ts_refs] improve caches, allow building a subset of projects
* cleanup project def script and update refs in type check script
* rename browser_bazel config to avoid kebab-case
* remove execInProjects() helper
* list references for tsconfig.types.json for api-extractor workload
* disable composite features of tsconfig.types.json for api-extractor
* set declaration: true to avoid weird debug error
* fix jest tests
Co-authored-by: spalger <spalger@users.noreply.github.com>
* Use Serializable from package
* Rename to align with core
* fix
* more replacements
* docssss
* fix
* Move it to @kbn/utility-types and remove core export
* buildy build
* tests
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* add version to csv params
* fix ts
* fix api tests
* use kibana version from packageInfo
* use kibana version from packageInfo
* clean up ide warnings
* utility to log and set a default params version
* fix baseparams ts
* update snapshot
* check version in enqueue job
* add temporary ts-ignore for canvas
* clarify comment
* fix hardcoded version in png_pdf_panel
* clarify the UNVERSIONED_VERSION variable with a comment
* fix canvas jest test
* fix ts in example app
* fix types
* send version param to canvas util for job params
* update jest snapshot
* Update utils.test.ts
* fix snapshot
* remove browserTimezone and version from integration boilerplate
* wip ensure version is always populated in job params inside of the service
* wip2
* wip3
* wip4
* wip5
* wip6
* update note
* update example plugin
* wip7
* improve tests
* fix dynamic job params
* better testing
* improve enqueue_job test
* more tests
* fix types
* fix types
* fix example ts
* simplify props
* fix test
* --wip-- [skip ci]
* consolidate baseparams back into one interface
* fix rison encoding of apiClient param
* clean up
* reorganize imports
* back out functional change
* fix 400 error in download csv
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Adding function hooks into rule type definition and call extract fn on rule create
* Adding hooks for extracting and injecting saved object references. Adding extractReferences to create and update workflow
* Adding type template for extracted params
* Adding type template for extracted params
* Adding type template for extracted params
* Adding type template for extracted params
* Calling injectReferences function if defined. Finishing unit tests for create and update
* Adding tests for get
* Adding tests for find
* Cleanup
* Fixing types check
* Fixing functional tests
* Fixing functional tests
* Fixing tests
* Updating README
* Throwing boom error instead of normal error
* Adding framework level prefix to extracted saved object reference names
* Fixing types
* Fixing types
* PR fixes
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Removing feature flag changes
* Adding isExportable flag to rule type definition
* Adding isExportable flag to rule type definition
* Adding isExportable flag to rule type definition
* Filtering rule on export by rule type isExportable flag
* Fixing types
* Adding docs
* Fix condition when exportCount is 0
* Unit test for fix condition when exportCount is 0
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* WIP - creating alerting authorization client factory and exposing authorization client on plugin start contract
* Updating alerting feature privilege builder to handle different alerting types
* Passing in alerting authorization type to AlertingActions class string builder
* Passing in authorization type in each function call
* Passing in exempt consumer ids. Adding authorization type to audit logger
* Changing alertType to ruleType
* Changing alertType to ruleType
* Updating unit tests
* Updating unit tests
* Passing field names into authorization query builder. Adding kql/es dsl option
* Converting to es query if requested
* Fixing functional tests
* Removing ability to specify feature privilege name in constructor
* Fixing some types and tests
* Consolidating alerting authorization kuery filter options
* Cleanup and tests
* Cleanup and tests
* Initial commit with changes needed for subfeature privilege
* Throwing error when AlertingAuthorizationClientFactory is not defined
* Renaming authorizationType to entity
* Renaming AlertsAuthorization to AlertingAuthorization
* Fixing unit tests
* Changing schema of alerting feature privilege
* Changing schema of alerting feature privilege
* Updating feature privilege iterator
* Updating feature privilege builder
* Fixing types check
* Updating privilege string terminology
* Updating privilege string terminology
* Wip
* Fixing unit tests
* Unit tests
* Updating README and removing stack subfeature privilege changes
* Fixing README
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* initial version of the screenshot mode service
* First iteration of client side of screenshot mode plugin
Also hooked it up to the chromium browser imitating the preload
functionality of electron to set up the environment before
code runs.
* First implementation of server-side logic for detecting
screenshot mode
* fix some type issues and do a small refactor
* fix size limits, docs and ts issues
* fixed types issues and made sure screenshot mode is correctly detected on the client
* Moved the screenshot mode header definition to common
Added a server-side example for screenshot mode
Export the screenshot mode header in both public and server
* move require() to screenshotMode plugin
* Update chromium_driver.ts
* cleaned up some comments, minor refactor in ReportingCore and
changed the screenshotmode detection function to check for a
specific value.
* fix export
* Expanded server-side screenshot mode contract with function that
checks a kibana request to determine whether we in screenshot
mode
* added comments to explain use of literal value rather than external reference
* updated comment
* update reporting example
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Timothy Sullivan <tsullivan@elastic.co>
Co-authored-by: Tim Sullivan <tsullivan@users.noreply.github.com>
* Move current alert HTTP APIs to legacy folder (#93943)
* Move current HTTP APIs to legacy folder
* Rename BASE_ALERT_API_PATH to LEGACY_BASE_ALERT_API_PATH
* Fix failing tests and extra files
* Create new rule HTTP APIs (#93980)
* Move current HTTP APIs to legacy folder
* Rename BASE_ALERT_API_PATH to LEGACY_BASE_ALERT_API_PATH
* Fix failing tests and extra files
* Move current alert HTTP APIs to legacy folder (#93943)
* Move current HTTP APIs to legacy folder
* Rename BASE_ALERT_API_PATH to LEGACY_BASE_ALERT_API_PATH
* Fix failing tests and extra files
* Add necessary files
* Create rule route
* Get rule API
* Update rule API
* Delete rule route
* Aggregate rules API
* Disable rule API
* Enable rule API
* Find rules API
* Fix Update API
* Get rule alert summary API
* Get rule state API
* Health API
* Rule types API
* Mute all API
* Mute alert API
* Unmute all API
* Unmute alert route
* Update API key API
* corrected tpye by making it much more complicated
* removed unneeded cocde
* Fixes
* Add back health route
* mutedInstanceIds -> mutedAlertIds
* lastRun -> last_run
* alert_type_state -> rule_type_state & alert_instances -> alerts
Co-authored-by: Gidi Meir Morris <github@gidi.io>
* Create docs for new rule HTTP APIs, deprecate old docs (#94745)
* Create docs for new APIs, deprecate old docs
* Remove connector_type_id
* Update docs
* Add link to legacy APIs from rules API docs
* Remove connector_type_id references
* [DOCS] Add legacy APIs to index.asciidoc
* Fix camel case
Co-authored-by: lcawl <lcawley@elastic.co>
* Make alerting tests use new rules APIs (#95159)
* Make API integration tests use new HTTP APIs
* Fix end to end tests
* Fix test failures
* Fix more test failures
* Rename some files
* Add tests for legacy APIs (#95333)
* Initial commit (#95457)
* Move some new alerting APIs to /internal (#95461)
* Initial commit
* Update README.md
* Use internal API
* Merge deprecated warning w/ alternative solution
* Update API docs
Co-authored-by: Gidi Meir Morris <github@gidi.io>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: lcawl <lcawley@elastic.co>
* merge all the typings at root level
* merge x-pack/tsconfig into tsconfig.json
* fix tsconfig after changes in master
* remove unnecessary typings
* update paths to the global typings
* update paths to the global elaticsearch typings
* fix import
* fix path to typings/elasticsearch in fleet plugin
* remove file deleted from master
* fix lint errors
* Rename alerts plugin to alerting
* Deprecate old config values
* Few more renames
* Update plugin list
* Rename xpack.alerts -> xpack.alerting
* Fix some ESLint rules
* Fix typecheck
* Fix some test failures
* Some more renames
* Fix ESLint
* Fix some test failures
* Fix failing jest test
* Undo exclusive test
* Fix APM deps
* Fix docs
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This PR tightens the typing on the Alerting framework's `AlertType` and its deeper typing around `AlertServices ` and `AlertExecutorOptions`.
This ensures the following:
1. It's now impossible<sup>✴</sup> to schedule actions on any ActionGroup other than the groups specified on the AlertType (including the Recovery group)
2. It's now impossible<sup>✴</sup> to schedule actions with incorrect `InstanceState` or `InstanceContext`
✴ Unless they bypass the Typescript typing, which is an explicit choice to bypass type safety
* Add developer example for Reporting
Refactor Reporting plugin to have shareable services
* Update plugin.ts
* use constant
* add more description to using reporting as a service
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This PR encourages type safe usage of the Alerting framework by replacing the current default Params/State/InstanceState/InstanceContext types (which are `AlertTypeParams`/`AlertTypeState`/etc.) with `never`.
This means that code can continue to omit the specific types for these fields, as long as they aren't referenced.
Once an alert developer wishes to actually reference the parameters (or state/context), then they have to specify the type.
This PR also changed the typing of the `AlertTypeParams` and `AlertTypeState` from `Record<string, any>` to `Record<string, unknown>`, to ensure that where these catch-all types are used they will at least enforce `unknown` rather than `any`.
This change broke some usage in both @elastic/kibana-alerting-services plugins, but also other plugins in the Stack/Solutions. I tried to fix these where I could, but some of these require new types and refactoring in other teams' code, which I decided is best done by the team who own and maintain that code - I've added explicit `TODO` comments in all of these places, describing the required fix.
This PR also introduced a Generics based typing for the `Alert` type so that the `params` field can be typed as something other than `AlertTypeParams`.
* Removed a possibility to define two different names for Alert types on API and UI level
* fixed typechecks
* fixed typechecks
* fixed due to comments
* fixed typechecks
* fixed jest tests
* fixed typechecks