Commit graph

61 commits

Author SHA1 Message Date
Kibana Machine
2135cf0ff9
[8.8] Handles non-existing objects in _copy_saved_objects API call (#158036) (#158399)
# Backport

This will backport the following commits from `main` to `8.8`:
- [Handles non-existing objects in _copy_saved_objects API call
(#158036)](https://github.com/elastic/kibana/pull/158036)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Jeramy
Soucy","email":"jeramy.soucy@elastic.co"},"sourceCommit":{"committedDate":"2023-05-24T16:20:46Z","message":"Handles
non-existing objects in _copy_saved_objects API call (#158036)\n\nCloses
#156791\r\n\r\n## Summary\r\n\r\nThis PR implements catching the error
thrown by the\r\nsaved_objects_exporter when an object is not found, and
responding with\r\na detailed 404 (\"Not Found\") rather than a generic
500 (\"Internal Server\r\nError\") response message.\r\n\r\n### Example
Response:\r\n```\r\n{\r\n \"statusCode\": 404,\r\n \"error\": \"Not
Found\",\r\n \"message\": \"Saved objects not found\",\r\n
\"attributes\": {\r\n \"objects\": [\r\n {\r\n \"id\":
\"7adfa750-4c81-11e8-b3d7-01146121b73d\",\r\n \"type\":
\"dashboard\"\r\n },\r\n {\r\n \"id\":
\"571aaf70-4c88-11e8-b3d7-01146121b73d\",\r\n \"type\": \"search\"\r\n
},\r\n {\r\n \"id\": \"d3d7af60-4c81-11e8-b3d7-01146121b73d\",\r\n
\"type\": \"index-pattern\"\r\n }\r\n ]\r\n }\r\n}\r\n```\r\n\r\n###
Testing\r\n\r\n1. Install sample flight data, find the id of the flights
dashboard SO\r\n2. Create an additional space 'b'\r\n3. Issue a request
to copy saved objects to space b\r\n```\r\nPOST
kbn:/api/spaces/_copy_saved_objects\r\n{\r\n \"spaces\": [\r\n \"b\"\r\n
],\r\n \"objects\": [\r\n {\r\n \"type\": \"dashboard\",\r\n \"id\":
\"7adfa750-4c81-11e8-b3d7-01146121b73e\"\r\n },\r\n {\r\n \"type\":
\"dashboard\",\r\n \"id\": \"7adfa750-4c81-11e8-b3d7-01146121b73f\"\r\n
},\r\n {\r\n \"type\": \"dashboard\",\r\n \"id\":
\"7adfa750-4c81-11e8-b3d7-01146121b73g\"\r\n }\r\n ]\r\n}\r\n```\r\n4.
Verify response\r\n```\r\n{\r\n \"statusCode\": 404,\r\n \"error\":
\"Not Found\",\r\n \"message\": \"Saved objects not found\",\r\n
\"attributes\": {\r\n \"objects\": [\r\n {\r\n \"type\":
\"dashboard\",\r\n \"id\": \"7adfa750-4c81-11e8-b3d7-01146121b73e\"\r\n
},\r\n {\r\n \"type\": \"dashboard\",\r\n \"id\":
\"7adfa750-4c81-11e8-b3d7-01146121b73f\"\r\n },\r\n {\r\n \"type\":
\"dashboard\",\r\n \"id\": \"7adfa750-4c81-11e8-b3d7-01146121b73g\"\r\n
}\r\n ]\r\n }\r\n}\r\n```\r\n5. Issue a request to copy the flights
dashboard SO\r\n6. Verify the usual response (200, missing
references)\r\n7. Issue a malformed request to copy an SO\r\n8. Verify
status 400 response with
details","sha":"1589547b6f143c45c782ed857902026af2e7e38a","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Security","Feature:Saved
Objects","Feature:Security/Spaces","backport:all-open","v8.9.0"],"number":158036,"url":"https://github.com/elastic/kibana/pull/158036","mergeCommit":{"message":"Handles
non-existing objects in _copy_saved_objects API call (#158036)\n\nCloses
#156791\r\n\r\n## Summary\r\n\r\nThis PR implements catching the error
thrown by the\r\nsaved_objects_exporter when an object is not found, and
responding with\r\na detailed 404 (\"Not Found\") rather than a generic
500 (\"Internal Server\r\nError\") response message.\r\n\r\n### Example
Response:\r\n```\r\n{\r\n \"statusCode\": 404,\r\n \"error\": \"Not
Found\",\r\n \"message\": \"Saved objects not found\",\r\n
\"attributes\": {\r\n \"objects\": [\r\n {\r\n \"id\":
\"7adfa750-4c81-11e8-b3d7-01146121b73d\",\r\n \"type\":
\"dashboard\"\r\n },\r\n {\r\n \"id\":
\"571aaf70-4c88-11e8-b3d7-01146121b73d\",\r\n \"type\": \"search\"\r\n
},\r\n {\r\n \"id\": \"d3d7af60-4c81-11e8-b3d7-01146121b73d\",\r\n
\"type\": \"index-pattern\"\r\n }\r\n ]\r\n }\r\n}\r\n```\r\n\r\n###
Testing\r\n\r\n1. Install sample flight data, find the id of the flights
dashboard SO\r\n2. Create an additional space 'b'\r\n3. Issue a request
to copy saved objects to space b\r\n```\r\nPOST
kbn:/api/spaces/_copy_saved_objects\r\n{\r\n \"spaces\": [\r\n \"b\"\r\n
],\r\n \"objects\": [\r\n {\r\n \"type\": \"dashboard\",\r\n \"id\":
\"7adfa750-4c81-11e8-b3d7-01146121b73e\"\r\n },\r\n {\r\n \"type\":
\"dashboard\",\r\n \"id\": \"7adfa750-4c81-11e8-b3d7-01146121b73f\"\r\n
},\r\n {\r\n \"type\": \"dashboard\",\r\n \"id\":
\"7adfa750-4c81-11e8-b3d7-01146121b73g\"\r\n }\r\n ]\r\n}\r\n```\r\n4.
Verify response\r\n```\r\n{\r\n \"statusCode\": 404,\r\n \"error\":
\"Not Found\",\r\n \"message\": \"Saved objects not found\",\r\n
\"attributes\": {\r\n \"objects\": [\r\n {\r\n \"type\":
\"dashboard\",\r\n \"id\": \"7adfa750-4c81-11e8-b3d7-01146121b73e\"\r\n
},\r\n {\r\n \"type\": \"dashboard\",\r\n \"id\":
\"7adfa750-4c81-11e8-b3d7-01146121b73f\"\r\n },\r\n {\r\n \"type\":
\"dashboard\",\r\n \"id\": \"7adfa750-4c81-11e8-b3d7-01146121b73g\"\r\n
}\r\n ]\r\n }\r\n}\r\n```\r\n5. Issue a request to copy the flights
dashboard SO\r\n6. Verify the usual response (200, missing
references)\r\n7. Issue a malformed request to copy an SO\r\n8. Verify
status 400 response with
details","sha":"1589547b6f143c45c782ed857902026af2e7e38a"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/158036","number":158036,"mergeCommit":{"message":"Handles
non-existing objects in _copy_saved_objects API call (#158036)\n\nCloses
#156791\r\n\r\n## Summary\r\n\r\nThis PR implements catching the error
thrown by the\r\nsaved_objects_exporter when an object is not found, and
responding with\r\na detailed 404 (\"Not Found\") rather than a generic
500 (\"Internal Server\r\nError\") response message.\r\n\r\n### Example
Response:\r\n```\r\n{\r\n \"statusCode\": 404,\r\n \"error\": \"Not
Found\",\r\n \"message\": \"Saved objects not found\",\r\n
\"attributes\": {\r\n \"objects\": [\r\n {\r\n \"id\":
\"7adfa750-4c81-11e8-b3d7-01146121b73d\",\r\n \"type\":
\"dashboard\"\r\n },\r\n {\r\n \"id\":
\"571aaf70-4c88-11e8-b3d7-01146121b73d\",\r\n \"type\": \"search\"\r\n
},\r\n {\r\n \"id\": \"d3d7af60-4c81-11e8-b3d7-01146121b73d\",\r\n
\"type\": \"index-pattern\"\r\n }\r\n ]\r\n }\r\n}\r\n```\r\n\r\n###
Testing\r\n\r\n1. Install sample flight data, find the id of the flights
dashboard SO\r\n2. Create an additional space 'b'\r\n3. Issue a request
to copy saved objects to space b\r\n```\r\nPOST
kbn:/api/spaces/_copy_saved_objects\r\n{\r\n \"spaces\": [\r\n \"b\"\r\n
],\r\n \"objects\": [\r\n {\r\n \"type\": \"dashboard\",\r\n \"id\":
\"7adfa750-4c81-11e8-b3d7-01146121b73e\"\r\n },\r\n {\r\n \"type\":
\"dashboard\",\r\n \"id\": \"7adfa750-4c81-11e8-b3d7-01146121b73f\"\r\n
},\r\n {\r\n \"type\": \"dashboard\",\r\n \"id\":
\"7adfa750-4c81-11e8-b3d7-01146121b73g\"\r\n }\r\n ]\r\n}\r\n```\r\n4.
Verify response\r\n```\r\n{\r\n \"statusCode\": 404,\r\n \"error\":
\"Not Found\",\r\n \"message\": \"Saved objects not found\",\r\n
\"attributes\": {\r\n \"objects\": [\r\n {\r\n \"type\":
\"dashboard\",\r\n \"id\": \"7adfa750-4c81-11e8-b3d7-01146121b73e\"\r\n
},\r\n {\r\n \"type\": \"dashboard\",\r\n \"id\":
\"7adfa750-4c81-11e8-b3d7-01146121b73f\"\r\n },\r\n {\r\n \"type\":
\"dashboard\",\r\n \"id\": \"7adfa750-4c81-11e8-b3d7-01146121b73g\"\r\n
}\r\n ]\r\n }\r\n}\r\n```\r\n5. Issue a request to copy the flights
dashboard SO\r\n6. Verify the usual response (200, missing
references)\r\n7. Issue a malformed request to copy an SO\r\n8. Verify
status 400 response with
details","sha":"1589547b6f143c45c782ed857902026af2e7e38a"}}]}]
BACKPORT-->

Co-authored-by: Jeramy Soucy <jeramy.soucy@elastic.co>
2023-05-24 10:32:34 -07:00
Aleh Zasypkin
a1fccfd880
Support generating legacy URL aliases for objects that change IDs during import. (#149021) 2023-04-03 10:54:23 +02:00
Christiane (Tina) Heiligers
ff51407fdf
Saved objects extensions refactor merge (#142878)
Merges the changes of #134395 into the new packages structure.
Resolves #133835

### Description
This PR represents a fully manual merge of the saved objects refactor of
client wrapper system into repository extensions. These changes are
being manually merged due to significant changes of the saved objects
implementation in the main branch, specifically the migration to the new
packages structure.

### Other changes
- Bulk Delete: bulk delete was implemented in parallel to #134395 being
completed and this PR will refactor that API to utilize the new
extensions

Co-authored-by: Jeramy Soucy <jeramy.soucy@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
2022-11-18 08:23:36 +01:00
Pierre Gayvallet
a02c00b8a3
Change ContextContainer to lazily initialize providers (#129896)
* Change ContextContainer to lazily initialize providers

* Introduce CustomRequestHandlerContext, start adapting usages

* adapt IContextProvider's return type

* start fixing violations

* fixing violations - 2

* adapt home routes

* fix remaining core violation

* fix violations on core tests

* fixing more violations

* fixing more violations

* update generated doc...

* fix more violations

* adapt remaining RequestHandlerContext

* fix more violations

* fix non-async method

* more fixes

* fix another await in non async method

* add yet another missing async

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* add yet yet another missing async

* update fleet's endpoints

* fix telemetry endpoints

* fix event_log endpoints

* fix some security unit tests

* adapt canvas routes

* adapt alerting routes

* adapt more so_tagging routes

* fix data_enhanced routes

* fix license_management routes

* fix file_upload routes

* fix index_management routes

* fix lists routes

* fix snapshot_restore routes

* fix rule_registry routes

* fix ingest_pipelines routes

* fix remote_clusters routes

* fix index_lifecycle_management routes

* improve and fix the lazy implementation

* fix triggers_actions_ui endpoints

* start fixing unit tests

* fix cases routes

* fix transform routes

* fix upgrade_assistant routes

* fix uptime route wrapper

* fix uptime route wrapper bis

* update osquery routes

* update cross_cluster_replication routes

* fix some ML routes / wrappers

* adapt maps routes

* adapt rollup routes

* fix some canvas unit tests

* fix more canvas unit tests

* fix observability wrapper

* fix (?) infra type hell

* start fixing monitoring

* fix a few test plugins

* woups

* fix yet more violations

* fixing UA  tests

* fix logstash handlers

* fix fleet unit tests

* lint?

* one more batch

* update security_solution endpoints

* start fixing security_solution mocks

* start fixing security_solution tests

* fix more security_solution tests

* fix more security_solution tests

* just one more

* fix last (?) security_solution tests

* fix timelion javascript file

* fix more test plugins

* fix transforms context type

* fix ml context type

* fix context tests

* fix securitySolution withEndpointAuthz tests

* fix features unit tests

* fix actions unit tests

* fix imports

* fix duplicate import

* fix some merge problems

* fix new usage

* fix new test

* introduces context.resolve

* down the rabbit hole again

* start fixing test type failures

* more test type failures fixes

* move import comment back to correct place

* more test type failures fixes, bis

* use context.resolve for security solution rules routes

* fix new violations due to master merge

* remove comment

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-04-22 13:15:58 +02:00
spalger
3730dd0779 fix all violations 2022-04-16 01:37:30 -05:00
Tyler Smalley
4681a80317
[DX] Upgrade prettier to v2.4.0 (#112359)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2021-09-19 22:34:30 -07:00
Joe Portner
65e04b1380
Remove spacesOss plugin (#109258) 2021-08-23 15:10:09 +02:00
Joe Portner
196531502f
Sharing saved objects phase 3.5 (#100424) 2021-06-28 18:06:54 -04:00
Joe Portner
b2d36b863b
Sharing saved objects phase 3 (#94383) 2021-05-14 14:46:17 -04:00
Joe Portner
8710a81bea
Cleanup spaces plugin (#91976) 2021-03-01 07:56:44 -05:00
Brandon Kobel
4584a8b570
Elastic License 2.0 (#90099)
* Updating everything except the license headers themselves

* Applying ESLint rules

* Manually replacing the stragglers
2021-02-03 18:12:39 -08:00
Mikhail Shustov
b3a9754394
[Core] Explicit typings for request handler context (#88718)
* move context to server part. couple with RequestHandlerContext

Context implementation will be simplified in follow-up.

* adopt core code

* adopt bfetch code

* adopt data code

* adopt search examples

* adopt vis_type_timelion

* adopt vis_type_timeseries

* adopt plugin functional tests

* adopt actions

* adopt alerting plugin

* adopt APM plugin

* adopt beats_management

* adopt case plugin

* adopt cross_cluster_replication

* adopt data_enhanced

* adopt event_log

* adopt global_search

* adopt index_management

* adopt infra

* adopt licensing

* adopt lists

* adopt logstash

* adopt reporting

* adopt observability

* adopt monitoring

* adopt rollup

* adopt so tagging

* adopt security

* adopt security_solutions

* adopt watcher

* adopt uptime

* adopt spaces

* adopt snapshot_restore

* adopt features changes

* mute error when null used to extend context

* update docs

* small cleanup

* add type safety for return type

* refactor registerRouteHandlerContext type

* update docs

* update license header

* update docs

* fix type error. fetch body does not accept array of strings

* fix telemetry test

* remove unnecessary ts-ignore

* address comments

* update docs
2021-01-21 15:20:22 +01:00
Joe Portner
07a3756a62
Create Spaces OSS plugin (#87585) 2021-01-12 12:26:40 -05:00
Pierre Gayvallet
f59711945d
Expose SO import/export APIs from the service's contract instead of exporting static functions (#86264)
* Add user doc for SO tagging

* add link to new page

* handle review feedbacks

* second pass

* create SO exporter class

* adapt spaces code

* typo fix

* adapt tests

* some doc

* update generated doc

* fix spaces tests

* move ALL the import things

* adapt / move types

* create context, adapt core code

* adapt integration tests

* rename for consistency

* adapt spaces usages

* adapt spaces routes usages

* remove unused getImportExportObjectLimit

* fix tsdoc

* update generated doc

* doc nits

* review comments

* add test for fetchByObjects failure

* add custom errors for exporter

* remove `getImportExportObjectLimit` API

* fix IT

* update generated doc

* adapt UT

* forgot one Boom usage

* rename import error to failure

* remove Boom usages from importer

* update generated doc

* fix spaces types
2021-01-07 11:23:28 +01:00
Liza Katz
0a04835ba7
[Search] Session SO polling (#84225)
* Monitor ids

* import fix

* solve circular dep

* eslint

* mock circular dep

* max retries test

* mock circular dep

* test

* jest <(-:C

* jestttttt

* [data.search] Move search method inside session service and add tests

* merge

* Move background session service to data_enhanced plugin

* Better logs
Save IDs only in monitoring loop

* Fix types

* Space aware session service

* ts

* Fix session service saving

* merge fix

* stable stringify

* INMEM_MAX_SESSIONS

* INMEM_MAX_SESSIONS

* Update x-pack/plugins/data_enhanced/server/search/session/session_service.ts

Co-authored-by: Anton Dosov <dosantappdev@gmail.com>

* Update x-pack/plugins/data_enhanced/server/search/session/session_service.ts

Co-authored-by: Anton Dosov <dosantappdev@gmail.com>

* Use setTimeout to schedule monitoring steps

* settimeout

Co-authored-by: Lukas Olson <olson.lukas@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Anton Dosov <dosantappdev@gmail.com>
2020-12-09 14:05:01 +02:00
Joe Portner
c39d14fef4
Disable checking for conflicts when copying saved objects (#83575) 2020-12-03 11:08:25 -05:00
Mikhail Shustov
b3d97764a0
Move streams to kbn/utils (#84033)
* move streams to kbn/std

* import streams from kbn/std

* fix styles

* remove unused shareWeakReplay

* move from kbn/std to kbn/utils

* import from subfolder since test mocks FS module and not compatible with kbn/utils

* remove new line at the end of json file
2020-11-24 15:19:18 +01:00
Larry Gregory
7f962e5839
Removing circular dependency between spaces and security (#81891)
* Removing circular dependency between spaces and security

* Apply suggestions from code review

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>

* Tests refactor

- Reorganize top level describes into 3 space-based blocks into based on spaces:
  - space disabled
  - spaces plugin unavailable
  - space enabled (most previous tests go under this new block) with new beforeEach

- wrote new tests for uncovered lines 58, 66-69

* Review1: address PR feedback

* changing fake requests for alerts/actions

* Fixing tests

* fixing more tests

* Additional testing and refactoring

* Apply suggestions from code review

Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>

* Review 2: Address feedback

* Make ESLint happy again

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
Co-authored-by: Constance Chen <constance.chen.3@gmail.com>
2020-11-19 13:41:13 -05:00
Joe Portner
fb1c7d7048
Fix saved object share UI bugs regarding read-only privileges (#81828) 2020-11-03 23:07:39 -05:00
Thomas Watson
700225061a
Upgrade to hapi version 18 (#80468) 2020-11-02 13:18:00 +01:00
Joe Portner
caa5da26f0
Add support for sharing saved objects to all spaces (#76132) 2020-10-04 23:28:49 -04:00
Joe Portner
52d044c74a
Change saved object bulkUpdate to work across multiple namespaces (#75478) 2020-09-10 22:09:24 -04:00
Mikhail Shustov
cd86b81b82
Move streams utils to the core (#76397)
* move utils/streams to the KP

* allow imports from src/core/server/utils

* ts-ify

* import streams from KP

* remove unnecessary ts-expect-error

* fix kbn-es-archiver build

* lost export

* copy array in createListStream

* remove streams from legacy utils

Co-authored-by: spalger <spalger@users.noreply.github.com>
2020-09-03 10:57:03 +02:00
Joe Portner
6627d7d9af
Sharing saved-objects phase 1.5 (#75444)
Added UI for sharing saved objects, and updated UI for importing and copying too
2020-08-26 16:52:29 -04:00
Tiago Costa
6c62c686cf
chore(NA): upgrade to lodash@4 (#69868)
* chore(NA): upgrade oss to lodash4

chore(NA): migrate cli, cli_plugin, cli_keystore,  dev, test_utils and apm src script to lodash4

chore(NA): missing file for cli plugin

chore(NA): add src core

chore(NA): es archiver and fixtures

chore(NA): try to fix functional test failure

chore(NA): migrate src/legacy entirely to lodash4 except src/legacy/core_plugins

chore(NA): move legacy core plugins to lodash4

chore(NA): upgrade optimize to lodash4

chore(NA): upgrade to lodash4 on advanced_settings, charts, console and dashboard

chore(NA): migrate to lodash4 on dev_tools, discover, embeddable, es_ui)shared, expressions, home plugins

chore(NA): upgrade data plugin to lodash4

chore(NA): upgrade usage_collection, ui_actions, tile_map, telemtry, share, saved_objects, saved_objects_management, region_map and navigation to lodash4

chore(NA): missing data upgrades to lodash4

Revert "chore(NA): upgrade usage_collection, ui_actions, tile_map, telemtry, share, saved_objects, saved_objects_management, region_map and navigation to lodash4"

This reverts commit 137055c5fed2fc52bb26547e0bc1ad2e3d4fe309.

Revert "Revert "chore(NA): upgrade usage_collection, ui_actions, tile_map, telemtry, share, saved_objects, saved_objects_management, region_map and navigation to lodash4""

This reverts commit f7e73688782998513d9fb6d7e8f0765e9beb28d1.

Revert "chore(NA): missing data upgrades to lodash4"

This reverts commit 92b85bf947a89bfc70cc4052738a6b2128ffb076.

Revert "chore(NA): upgrade data plugin to lodash4"

This reverts commit 88fdb075ee1e26c4ac979b6681d8a2b002df74c6.

chore(NA): upgrade idx_pattern_mgt, input_control_vis, inspector, kbn_legacy, kbn_react, kbn_usage_collections, kbn_utils, management and maps_legacy to lodash4

chore(NA): map src plugin data to lodash3

chore(NA): missing lodash.clonedeep dep

chore(NA): change packages kbn-config-schema deps

chore(NA): update renovate config

chore(NA): upgrade vis_type plugins to lodash4

chore(NA): move vis_type_vislib to lodash3

chore(NA): update visualizations and visualize to lodash4

chore(NA): remove lodash 3 types from src and move test to lodash4

chore(NA): move home, usage_collection and management to lodash 3

Revert "chore(NA): move home, usage_collection and management to lodash 3"

This reverts commit f86e8585f02d21550746569af54215b076a79a3d.

chore(NA): move kibana_legacy, saved_objects saved_objects_management into lodash3

chore(NA): update x-pack test to mock lodash4

Revert "chore(NA): move kibana_legacy, saved_objects saved_objects_management into lodash3"

This reverts commit 2d10fe450533e1b36db21d99cfae3ce996a244e0.

* chore(NA): move x-pack and packages to lodash 4

* chore(NA): remove mention to lodash from main package.json

* chore(NA): remove helper alias for lodash4 and make it the default lodash

* chore(NA): fix last failing types in the repo

* chore(NA): fix public api

* chore(NA): fix types for agg_row.tsx

* chore(NA): fix increment of optimizer modules in the rollup plugin

* chore(NA): migrate `src/core/public/http/fetch.ts` (#5)

* omit undefined query props

* just remove merge usage

* fix types

* chore(NA): fixes for feedback from apm team

* chore(NA): recover old behaviour on apm LoadingIndeicatorContext.tsx

* chore(NA): fixes for feedback from watson

* Platform lodash4 tweaks (#6)

* chore(NA): fix types and behaviour on src/core/server/elasticsearch/errors.ts

* Canvas fixes for lodash upgrade

* [APM] Adds unit test for APM service maps transform (#7)

* Adds a snapshot unit test for getConnections and rearranges some code to make testing easier

* reverts `ArrayList` back to `String[]` in the painless script within `fetch_service_paths_from_trace_ids.ts`

* chore(NA): update yarn.lock

* chore(NA): remove any and use a real type for alerts task runner

Co-authored-by: Gidi Meir Morris <github@gidi.io>

* chore(NA): used named import for triggers_actions_ui file

* chore(NA): fix eslint

* chore(NA): fix types

* Delete most uptime lodash references.

* Simplify. Clean up types.

* [Uptime] Delete most uptime lodash references (#8)

* Delete most uptime lodash references.

* Simplify. Clean up types.

* chore(NA): add eslint rule to avoid using lodash3

* chore(NA): apply changes on feedback from es-ui team

* fix some types (#9)

* Clean up some expressions types.

* chore(NA): missing ts-expect-error statements

* Upgrade lodash 4 vislib (#11)

* replace lodash 3 with lodash 4 on vislib plugin

* Further changes

* further replacement of lodash3 to 4

* further work on upgrading to lodash 4

* final changes to update lodash

* chore(NA): upgrade data plugin to lodash4

chore(NA): upgrade data plugin public to lodash4

chore(NA): fix typecheck task

chore(NA): fix agg_config with hasIn

chore(NA): assign to assignIn and has to hasIn

chore(NA): upgrade data plugin server to lodash4

chore(NA): new signature for core api

fix(NA): match behaviour between lodash3 and lodash4 for set in search_source

* chore(NA): remove lodash3 completely from the repo

* chore(NA): fix x-pack/test/api_integration/apis/metrics_ui/snapshot.ts missing content

* chore(NA): fix lodash usage on apm

* chore(NA): fix typecheck for maps

* Patch lodash template (#12)

* Applying changes from https://github.com/elastic/kibana/pull/64985

* Using isIterateeCall, because it seems less brittle

* Also patching `lodash/template` and `lodash/fp/template`

* Reorganizing some files...

* Revising comment

* Ends up `_` is a function also... I hate JavaScript

Co-authored-by: Pierre Gayvallet <pierre.gayvallet@gmail.com>
Co-authored-by: Josh Dover <me@joshdover.com>
Co-authored-by: Clint Andrew Hall <clint.hall@elastic.co>
Co-authored-by: Oliver Gupte <ogupte@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Gidi Meir Morris <github@gidi.io>
Co-authored-by: Justin Kambic <justin.kambic@elastic.co>
Co-authored-by: Stratoula Kalafateli <stratoula1@gmail.com>
Co-authored-by: Luke Elmers <luke.elmers@elastic.co>
Co-authored-by: Brandon Kobel <brandon.kobel@gmail.com>
Co-authored-by: kobelb <brandon.kobel@elastic.co>
2020-07-03 01:30:13 +01:00
Josh Dover
200957bb63
Add plugin API for customizing the logging configuration (#68704) 2020-06-23 14:45:47 -06:00
Pierre Gayvallet
9e8448fc06
HttpService: duplicate some APIs from setup to start and clean mocks. (#69021)
* add apis to http start contract and clean mocks

* add apis to http start contract and clean mocks

* add `getStartContract` method

* fix new calls

* remove isTlsEnabled

* deprecates HttpServiceSetup.auth
2020-06-18 15:55:47 +02:00
Larry Gregory
639dbbeb19
Migrate audit logging to KP (#67381)
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-05-28 14:46:42 -04:00
restrry
bf04235dae apply prettier styles 2020-05-22 09:08:58 +02:00
Larry Gregory
dc8dd19543
Spaces - migrate default space and enter space view to KP (#66098) 2020-05-12 19:59:29 -04:00
Joe Portner
d72de0ea16
Refactor saved object types to use namespaceType (#63217)
Remove `namespaceAgnostic` field that was deprecated in #54605,
use `namespaceType` instead.
2020-04-16 14:37:55 -04:00
Mikhail Shustov
af09fedaf2
[NP] add http resources sub-service (#61797)
* add HttpResources basic implementation

* expose http resources to plugins

* add mocks

* move http resources to a separate service

* hide rendering service

* adopt internal types

* expose HttpResources service to plugins

* update platform mocks

* plugins start using HttpResources API

* remove RenderingServiceSetup export

* RenderingServiceSetup --> InternalRenderingServiceSetup

* improve types

* remove httpRespources leftovers from http service

* remove rendering types from RequestHanlderContext

* fix security plugin tests

* add unit tests for httpResources service

* add unit tests

* remove outdated cache-control header

* restructure http resources service

* merge getUiPlugins and discover

* static route declaration shouldnt require auth & validate

* update docs

* use HttpResources service instad of rendering

* address comments

* update docs

* roll back unnecessary changes

* use getVars for rendering

* dont pass app. it is not public API

* remove static registers

* update migration guide
2020-04-16 16:09:39 +02:00
Joe Portner
97d1685c3d
Sharing saved-objects phase 1 (#54605)
Co-authored-by: kobelb <brandon.kobel@elastic.co>
2020-04-09 23:18:18 -04:00
Mikhail Shustov
bdf628d29a
use union of strings instead of enum (#62493)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-04-06 12:31:36 +02:00
Larry Gregory
37c826229b
Spaces - Migrate to NP Saved Objects Service (#58716)
* use NP saved objects service for type and wrapper registration

* simplifying

* additional testing

* revert snapshot changes

* removing dependency on legacy saved objects service

* consolidate mocks

* fixing imports

* addrress PR feedback

* remove unused docs

* adjust tests for updated corestart contract

* address test flakiness

* address flakiness, part 2

* address test flakiness

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-04-03 09:50:06 -04:00
Larry Gregory
91330d2493
Spaces - NP updates for usage collection and capabilities (#57693)
* remove kibanaIndex from LegacyAPI

* moving capabilities, adding tests

* moving usage collection

* cleanup

* don't toggle capabilities on unauthenticated routes

* reintroduce exception handling

* pipe dat config

* start addressing PR feedback

* fix CoreSetup's generic type

* fix usage collector tests

* PR review updates

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-28 09:06:48 -05:00
Larry Gregory
974a51d104
Spaces -> Client to NP (#54298)
* moves

* updates to support spaces client in NP

* fixing MLs import

* update karma mock

* remove unnecessary setup license

* fix merge from master

* moving management app registration to NP

* move space selector app to NP

* remove unused xpackMain legacy dependency

* hide spaces management if not authorized

* additional testing

* additional cleanup

* additional testing

* use NP advancedSettings plugin

* Apply suggestions from code review

Co-Authored-By: Aleh Zasypkin <aleh.zasypkin@gmail.com>

* start addressing PR feedback

* reverting logic to determine serverBasePath

* removing spaces mock

* mantain BWC with old management links

* add types to management mock

* address remaining PR feedback

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
2020-02-10 09:15:57 -05:00
Joe Reuter
7c40a24fcc
Tutorial migration (#54910) 2020-01-22 15:31:11 +01:00
Mikhail Shustov
56041f03ad
Don't expose Elasticsearch client as Observable (#53824)
* expose ES clients without observables

* expose observable-less api to plugins

* update core api and mocks

* update plugins

* NP SO & legacy use updated API

* update SO tests

* update TSDocs

* update types

* update docs

* document createCluster analog in np

* typo
2020-01-08 12:01:47 +03:00
Alejandro Fernández Haro
3bdbcd0d1a
[NP] Allow custom validations in HTTP Routes apart from @kbn/config-schema (#51919)
* [NP] Allow custom validations in HTTP Routes apart from @kbn/config-schema

* API docs

* Allow validate function in the route handler (run-code validation)

* Prefix RouteXXX + Params and Body Validation Aliases

* Fix test broken by lodash

* Update API docs

* Add default types for simpler manual declaration

* Add run-time validation of the RouteValidateSpec

* Expose RouteValidationError instead of SchemaTypeError

* RouteValidator as a class to match config-schema interface

* Test for not-inline handler (need to check IRouter for #47047)

* Add preValidation of the input for a safer custom validation

* Better types for RouteHandlers

* [NP] Move route validation to RouteValidator wrapper

* Use the class only internally but maintain the same API

* Fix types

* Ensure RouteValidator instance in KibanaRequest.from

* Fix validator.tests (Buffer.from instead of new Buffer)

* Default precheck should allow null values

* Also allow undefined in preChecks

* MR feedback fixes

* Provide RouteValidationResolver to the validation function

* Add functional tests

* Fix new functional tests

* Fix validator additional test

* Fix test with new resolver

* Remove unused import

* Rename ValidationResolver to ValidationResultFactory and change the interface to look more like the KibanaResponseFactory

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2019-12-20 17:53:08 +00:00
Larry Gregory
fcdaed954e
Spaces - Client NP Migration, Phase 1 (#40856)
* shimming NP for spaces client-side plugin

* refresh active space in nav control when updated

* fix advanced settings screen

* allow npStart from unauthed routes

* use NP for deriving space management url

* remove security's usage of SpacesManager

* remove usages of ui/capabilities

* fix tests

* implement NP plugin interface

* remove hack in favor of convention in migration guide

* shim feature catalogue registration

* streamline nav control, and handle async loading more gracefully

* adding opaqueId

* fixes from merge

* fix merge from master

* fixing merge from master

* move _active_space route to NP

* moving to the NP feature catalogue registry

* moving setup to setup phase

* optimizing active space retrieval

* reverting test isolation change

* Apply suggestions from code review

Co-Authored-By: Aleh Zasypkin <aleh.zasypkin@gmail.com>

* removing unnecessary PluginInitializerContext

* updating advanced settings subtitle

* using NP anonymousPaths service

* additional nav_control_popover cleanup

* additional cleanup

* testing out onActiveSpaceChange$ property

* make the linter happy

* make the type checker happy

* fixing types

* fix merge from master

* spaces LP init should run on all pages, not just the kibana app

* address nits

* fix infra/logs, and the spaces disabled scenario

* fix typescript errors

* revert changes to infra plugin

* reintroducing activeSpace injected var for legacy plugins

* fixing react deprecation warning and unhandled promise rejection

* restore activeSpace default var

* spaces does not need to check its own enabled status

* fix from merge


Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2019-12-16 08:31:07 -05:00
Pierre Gayvallet
99c6396fd5
Migrate Capabilities to new platform (#51438)
* create service skeleton

* move registerCapabilitiesModifier to capabilities service and rename to registerCapabilitiesSwitcher

* starts to move capabilities logic to CapabilitiesService

* move capabilities route to service

* add initial integration test for capabilities route

* capabilitiesMixin now delegates to capability service

* use server-side Capabilities import in server code

* update generated doc

* remove capabilities from injectedMetadatas

* use applications sent from client instead of server-registered navLinks

* disable authRequired for capabilities route

* (temp) exposes two endpoints for capabilities

* Add fetch-mock on capabilities call for karma tests

* adapt xpack Capabilities test - first attempt

* adapt x-pack ui_capabilities test

* add '/status' to the list of anonymous pages

* Add documentation on Capabilities APIs

* move Capabilities to core/types

* update generated docs

* add service tests

* protecting resolveCapabilities against added/removed capabilities

* update generated docs

* adapt mocks due to rebase

* add forgotten exports

* improve capabilities routes registering

* name capabilities registering methods

* resolve conflicts due to merge

* address review issues

* add comment about reason for exposing two routes

* extract createHttpServer test helper

* fix merge conflicts

* improve documentation

* remove `/status` anon registration as now done in NP status plugin

* fix merge conflicts
2019-12-03 09:34:49 +01:00
Ahmad Bamieh
0039e97747
[Telemetry] collector set to np (#51618)
* first iteration

* local collection ready

* type check

* fix collectorSet tests

* unskip test

* ordering

* collectors as array in constructor

* update README files

* update README and canvas to check for optional dep

* update README with more details

* Add file path for README example

* type UsageCollectionSetup

* run type check after refactor
2019-11-27 01:55:48 +02:00
Mikhail Shustov
643f15c5d9
Licensing plugin (#49345)
* Add x-pack plugin for new platform browser licensing information

* Address next round of reviews

* Remove poller functionality in favor of inline observables

* More observable changes from review comments

* Fix outstanding tests

* More changes from review, adding additional testing

* Add additional tests for license comparisons and sessions

* Update test snapshot due to sessionstorage mock

* Next round of review feedback from restrry

* Fix more review requests from restrry, add additional tests

* Pass correct sign mock to license info changed test

* Improve doc comments, switch to I-interface pattern

* Test error polling sanity, do not expose signature, do not poll on client

* Fix type check issues from rebase

* Fix build error from rebase

* minimize config

* move all types to server with consistency with other code

* implement License

* implement license update & refactor has License changed check

* update tests for licensing extending route handler context

* implement client side side license plugin

* implement server side licensing plugin

* remove old code

* update testing harness

* update types for license status

* remove jest-localstorage-mock

* fix tests

* update license in security

* address comments. first pass

* error is a part of signature. pass error message to License

* move common license types under common folder

* rename feature props for BWC and unify name with ILicense

* test should work in any timezone

* make prettier happy

* remove obsolete comment

* address Pierre comments

* use sha256 for security reasons

* use stable stringify to avoid churn
2019-11-19 13:35:27 +01:00
Tim Roes
fce52133d8
Upgrade Prettier 1.19 (#50487)
* Upgrade Prettier to 1.19

* Fix new prettier style
2019-11-13 17:00:02 +01:00
Aleh Zasypkin
ad356f5c11
Migrate authorization subsystem to the new platform. (#46145) 2019-11-12 11:31:46 +01:00
Aleh Zasypkin
57efead954
Correctly process paths in map_of and record_of. Do not swallow and use indent for nested one_of error messages. (#49457) 2019-10-28 19:39:48 +02:00
Larry Gregory
7fd639b700
Spaces - server-side to NP plugin (#46181) 2019-10-15 09:17:40 -04:00
Court Ewing
7ac8e4d9cc Move x-pack plugins/server/common to x-pack/legacy 2019-06-20 13:34:48 -04:00
Larry Gregory
7e4e8fee54
Spaces - New Platform Migration, Step 1 (#35429)
* crude test updates

* remove custom server typedef

* allow spaces to aquire security plugin after init

* split CoreSetup into CoreSetup and PluginsSetup

* move interfaces to new plugin

* init interceptors in legacy plugin

* fix import

* add placeholder kibana.json

* use NP Elasticsearch service instead of legacy ES Plugin

* cleanup imports

* don't destructure the es client

* introduce request facade

* document reason for getSecurity

* prefer relative imports from src/core

* fix typo in filename: inteceptors --> interceptors

* fix imports; remove stray ts-ignore

* improve typings for spaces client

* rename InterfaceExcept --> Omit

* don't use legacy config in NP

* additional comment

* shim NP config service

* fix merge from master

* revert relative imports into src/core and src/legacy

* shim capabilities modifier into new platform

* removing placeholder kibana.json

* fix prettier problem

* temporary: patch NP 'setUrl'

* migrate onRequest interceptor to NP, without tests

* fix ts error

* testing and deps cleanup for onRequestInterceptor

* replace spaces's usages of request.getBasePath with http.getBasePathFor

* add explicit timeouts for jest interceptor tests

* attempt to fix imports

* use NP logging instead of faked implementation

* revert stray yarn.lock change

* attempt to stablize and fix tests

* update jest config to include src/core/server/mocks

* fix plugin config typings

* add service tests

* fix merge

* allow spaces service to also work with legacy requests

* update interfaces to confirm to new internal/external API convention

* re-enable some post auth interceptor tests

* add explicit timeouts for tests

* prefer modifyUrl instead of manual url modification

* update logger shim to conform to PluginInitializerContext

* remove spaces ConfigClass

* don't weaken type declaration for scoped cluster client calls

* remove legacy server from SpacesCoreSetup

* remove spaces service cache

* remove legacy server as an interceptor dependency

* use modifyUrl on the raw request too

* remove unused import

* cleanup typings

* replace onRequest interceptor with new onPreAuth interceptor

* fix onPostAuth tests

* temporarily copy modifyUrl into spaces plugin

* fix mock export

* fix merge from master

* spaces scopedClient always uses updated ES client and config

* improve typings for usage collector

* rename isLegacyRequest -> isFakeRequest

* use updated NP base path API

* remove commented code

* only expose scoped spaces client

* use OptionalPlugin instead of getSecurity

* update imports of Saved Objects Service to use new src/core/server location

* update core docs
2019-06-19 10:08:54 -04:00