From 7fbb0f6aaff43869a38a6f4802a4590eb16e208b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20D=C3=ADaz?= Date: Sat, 14 Oct 2023 10:43:42 +0200 Subject: [PATCH 1/9] Bump to 4.9.0-00 (#6004) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump to 4.9.0-00 * bump: mock server to 4.9.0 * fix(test): update snapshosts * changelog: add change to 4.9.0 --------- Co-authored-by: Antonio David GutiƩrrez --- CHANGELOG.md | 8 +- docker/imposter/api-info/api_info.json | 2 +- plugins/main/opensearch_dashboards.json | 4 +- plugins/main/package.json | 6 +- .../__snapshots__/agent-status.test.tsx.snap | 6 +- .../__snapshots__/inventory.test.tsx.snap | 84 +++++++++---------- .../table-with-search-bar.test.tsx.snap | 10 +-- .../__snapshots__/agent-table.test.tsx.snap | 32 +++---- .../server-address.test.tsx.snap | 2 +- .../SubscriptionTab.test.tsx.snap | 8 +- .../__snapshots__/api-auth-tab.test.tsx.snap | 8 +- .../__snapshots__/general-tab.test.tsx.snap | 8 +- 12 files changed, 92 insertions(+), 86 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0564187b23..c7a03075ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,13 @@ All notable changes to the Wazuh app project will be documented in this file. -## Wazuh v4.8.0 - OpenSearch Dashboards 2.9.0 - Revision 00 +## Wazuh v4.9.0 - OpenSearch Dashboards 2.10.0 - Revision 00 + +### Added + +- Support for Wazuh 4.9.0 + +## Wazuh v4.8.0 - OpenSearch Dashboards 2.10.0 - Revision 00 ### Added diff --git a/docker/imposter/api-info/api_info.json b/docker/imposter/api-info/api_info.json index 760da093a4..0d122b0ce2 100644 --- a/docker/imposter/api-info/api_info.json +++ b/docker/imposter/api-info/api_info.json @@ -1,7 +1,7 @@ { "data": { "title": "Wazuh API REST", - "api_version": "4.8.0", + "api_version": "4.9.0", "revision": 1, "license_name": "GPL 2.0", "license_url": "https://github.com/wazuh/wazuh/blob/4.5/LICENSE", diff --git a/plugins/main/opensearch_dashboards.json b/plugins/main/opensearch_dashboards.json index 45fdb57a36..e6483d260b 100644 --- a/plugins/main/opensearch_dashboards.json +++ b/plugins/main/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuh", - "version": "4.8.0-00", + "version": "4.9.0-00", "opensearchDashboardsVersion": "opensearchDashboards", "configPath": [ "wazuh" @@ -26,4 +26,4 @@ ], "server": true, "ui": true -} \ No newline at end of file +} diff --git a/plugins/main/package.json b/plugins/main/package.json index 3c3826d3ba..2d053c3367 100644 --- a/plugins/main/package.json +++ b/plugins/main/package.json @@ -1,9 +1,9 @@ { "name": "wazuh", - "version": "4.8.0", + "version": "4.9.0", "revision": "00", "pluginPlatform": { - "version": "2.9.0" + "version": "2.10.0" }, "description": "Wazuh dashboard", "keywords": [ @@ -85,4 +85,4 @@ "redux-mock-store": "^1.5.4", "swagger-client": "^3.19.11" } -} \ No newline at end of file +} diff --git a/plugins/main/public/components/agents/__snapshots__/agent-status.test.tsx.snap b/plugins/main/public/components/agents/__snapshots__/agent-status.test.tsx.snap index e9894d11db..6253e66ffd 100644 --- a/plugins/main/public/components/agents/__snapshots__/agent-status.test.tsx.snap +++ b/plugins/main/public/components/agents/__snapshots__/agent-status.test.tsx.snap @@ -118,7 +118,7 @@ exports[`AgentStatus component Renders status indicator with the its color and t xmlns="http://www.w3.org/2000/svg" > @@ -185,7 +185,7 @@ exports[`AgentStatus component Renders status indicator with the its color and t xmlns="http://www.w3.org/2000/svg" > @@ -252,7 +252,7 @@ exports[`AgentStatus component Renders status indicator with the its color and t xmlns="http://www.w3.org/2000/svg" > diff --git a/plugins/main/public/components/agents/syscollector/__snapshots__/inventory.test.tsx.snap b/plugins/main/public/components/agents/syscollector/__snapshots__/inventory.test.tsx.snap index 539eeb3f55..f515d70f35 100644 --- a/plugins/main/public/components/agents/syscollector/__snapshots__/inventory.test.tsx.snap +++ b/plugins/main/public/components/agents/syscollector/__snapshots__/inventory.test.tsx.snap @@ -147,7 +147,7 @@ exports[`Inventory component A Apple agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -352,7 +352,7 @@ exports[`Inventory component A Apple agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -531,7 +531,7 @@ exports[`Inventory component A Apple agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -865,7 +865,7 @@ exports[`Inventory component A Apple agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -1070,7 +1070,7 @@ exports[`Inventory component A Apple agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -1252,7 +1252,7 @@ exports[`Inventory component A Apple agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -1457,7 +1457,7 @@ exports[`Inventory component A Apple agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -1641,7 +1641,7 @@ exports[`Inventory component A Apple agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -1847,7 +1847,7 @@ exports[`Inventory component A Apple agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -4279,7 +4279,7 @@ exports[`Inventory component A Windows agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -4484,7 +4484,7 @@ exports[`Inventory component A Windows agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -4663,7 +4663,7 @@ exports[`Inventory component A Windows agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -5021,7 +5021,7 @@ exports[`Inventory component A Windows agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -5226,7 +5226,7 @@ exports[`Inventory component A Windows agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -5405,7 +5405,7 @@ exports[`Inventory component A Windows agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -5610,7 +5610,7 @@ exports[`Inventory component A Windows agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -5696,7 +5696,7 @@ exports[`Inventory component A Windows agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -5901,7 +5901,7 @@ exports[`Inventory component A Windows agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -6061,7 +6061,7 @@ exports[`Inventory component A Windows agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -6267,7 +6267,7 @@ exports[`Inventory component A Windows agent should be well rendered. 1`] = ` xmlns="http://www.w3.org/2000/svg" > diff --git a/plugins/main/public/components/common/tables/__snapshots__/table-with-search-bar.test.tsx.snap b/plugins/main/public/components/common/tables/__snapshots__/table-with-search-bar.test.tsx.snap index 8fd2d4bcea..78c2233732 100644 --- a/plugins/main/public/components/common/tables/__snapshots__/table-with-search-bar.test.tsx.snap +++ b/plugins/main/public/components/common/tables/__snapshots__/table-with-search-bar.test.tsx.snap @@ -109,7 +109,7 @@ exports[`Table With Search Bar component renders correctly to match the snapshot
@@ -178,7 +178,7 @@ exports[`Table With Search Bar component renders correctly to match the snapshot
@@ -258,7 +258,7 @@ exports[`Table With Search Bar component renders correctly to match the snapshot
@@ -368,7 +368,7 @@ exports[`Table With Search Bar component renders correctly to match the snapshot
@@ -434,7 +434,7 @@ exports[`Table With Search Bar component renders correctly to match the snapshot
diff --git a/plugins/main/public/controllers/agent/components/__snapshots__/agent-table.test.tsx.snap b/plugins/main/public/controllers/agent/components/__snapshots__/agent-table.test.tsx.snap index 828132dbed..c13fb6e2cd 100644 --- a/plugins/main/public/controllers/agent/components/__snapshots__/agent-table.test.tsx.snap +++ b/plugins/main/public/controllers/agent/components/__snapshots__/agent-table.test.tsx.snap @@ -611,7 +611,7 @@ exports[`AgentsTable component Renders correctly to match the snapshot with cust xmlns="http://www.w3.org/2000/svg" > @@ -644,7 +644,7 @@ exports[`AgentsTable component Renders correctly to match the snapshot with cust xmlns="http://www.w3.org/2000/svg" > @@ -811,7 +811,7 @@ exports[`AgentsTable component Renders correctly to match the snapshot with cust xmlns="http://www.w3.org/2000/svg" > @@ -928,7 +928,7 @@ exports[`AgentsTable component Renders correctly to match the snapshot with cust xmlns="http://www.w3.org/2000/svg" > @@ -1155,7 +1155,7 @@ exports[`AgentsTable component Renders correctly to match the snapshot with no p xmlns="http://www.w3.org/2000/svg" > @@ -1188,7 +1188,7 @@ exports[`AgentsTable component Renders correctly to match the snapshot with no p xmlns="http://www.w3.org/2000/svg" > @@ -1355,7 +1355,7 @@ exports[`AgentsTable component Renders correctly to match the snapshot with no p xmlns="http://www.w3.org/2000/svg" > @@ -1472,7 +1472,7 @@ exports[`AgentsTable component Renders correctly to match the snapshot with no p xmlns="http://www.w3.org/2000/svg" > diff --git a/plugins/main/public/controllers/agent/register-agent/steps/__snapshots__/server-address.test.tsx.snap b/plugins/main/public/controllers/agent/register-agent/steps/__snapshots__/server-address.test.tsx.snap index d41e54d637..5326643f51 100644 --- a/plugins/main/public/controllers/agent/register-agent/steps/__snapshots__/server-address.test.tsx.snap +++ b/plugins/main/public/controllers/agent/register-agent/steps/__snapshots__/server-address.test.tsx.snap @@ -70,7 +70,7 @@ exports[`Server Address Combobox should match snapshot 1`] = ` xmlns="http://www.w3.org/2000/svg" > diff --git a/plugins/main/public/controllers/management/components/management/configuration/office365/components/SubscriptionTab/__snapshots__/SubscriptionTab.test.tsx.snap b/plugins/main/public/controllers/management/components/management/configuration/office365/components/SubscriptionTab/__snapshots__/SubscriptionTab.test.tsx.snap index 7779a6ec74..e0d47aa5f6 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/office365/components/SubscriptionTab/__snapshots__/SubscriptionTab.test.tsx.snap +++ b/plugins/main/public/controllers/management/components/management/configuration/office365/components/SubscriptionTab/__snapshots__/SubscriptionTab.test.tsx.snap @@ -36,11 +36,11 @@ exports[`SubscriptionTab component renders correctly to match the snapshot 1`] = help={ Array [ Object { - "href": "https://documentation.wazuh.com/4.8/cloud-security/office365/index.html", + "href": "https://documentation.wazuh.com/4.9/cloud-security/office365/index.html", "text": "Using Wazuh to monitor Office 365", }, Object { - "href": "https://documentation.wazuh.com/4.8/user-manual/reference/ossec-conf/office365-module.html", + "href": "https://documentation.wazuh.com/4.9/user-manual/reference/ossec-conf/office365-module.html", "text": "Configuration options for the module", }, ] @@ -87,11 +87,11 @@ exports[`SubscriptionTab component renders correctly to match the snapshot 1`] = links={ Array [ Object { - "href": "https://documentation.wazuh.com/4.8/cloud-security/office365/index.html", + "href": "https://documentation.wazuh.com/4.9/cloud-security/office365/index.html", "text": "Using Wazuh to monitor Office 365", }, Object { - "href": "https://documentation.wazuh.com/4.8/user-manual/reference/ossec-conf/office365-module.html", + "href": "https://documentation.wazuh.com/4.9/user-manual/reference/ossec-conf/office365-module.html", "text": "Configuration options for the module", }, ] diff --git a/plugins/main/public/controllers/management/components/management/configuration/office365/components/api-auth-tab/__snapshots__/api-auth-tab.test.tsx.snap b/plugins/main/public/controllers/management/components/management/configuration/office365/components/api-auth-tab/__snapshots__/api-auth-tab.test.tsx.snap index 9f5afff765..4d24e0d32d 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/office365/components/api-auth-tab/__snapshots__/api-auth-tab.test.tsx.snap +++ b/plugins/main/public/controllers/management/components/management/configuration/office365/components/api-auth-tab/__snapshots__/api-auth-tab.test.tsx.snap @@ -41,11 +41,11 @@ exports[`ApiAuthTab component renders correctly to match the snapshot 1`] = ` help={ Array [ Object { - "href": "https://documentation.wazuh.com/4.8/cloud-security/office365/index.html", + "href": "https://documentation.wazuh.com/4.9/cloud-security/office365/index.html", "text": "Using Wazuh to monitor Office 365", }, Object { - "href": "https://documentation.wazuh.com/4.8/user-manual/reference/ossec-conf/office365-module.html", + "href": "https://documentation.wazuh.com/4.9/user-manual/reference/ossec-conf/office365-module.html", "text": "Configuration options for the module", }, ] @@ -92,11 +92,11 @@ exports[`ApiAuthTab component renders correctly to match the snapshot 1`] = ` links={ Array [ Object { - "href": "https://documentation.wazuh.com/4.8/cloud-security/office365/index.html", + "href": "https://documentation.wazuh.com/4.9/cloud-security/office365/index.html", "text": "Using Wazuh to monitor Office 365", }, Object { - "href": "https://documentation.wazuh.com/4.8/user-manual/reference/ossec-conf/office365-module.html", + "href": "https://documentation.wazuh.com/4.9/user-manual/reference/ossec-conf/office365-module.html", "text": "Configuration options for the module", }, ] diff --git a/plugins/main/public/controllers/management/components/management/configuration/office365/components/general-tab/__snapshots__/general-tab.test.tsx.snap b/plugins/main/public/controllers/management/components/management/configuration/office365/components/general-tab/__snapshots__/general-tab.test.tsx.snap index 4747759679..c3a7836d15 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/office365/components/general-tab/__snapshots__/general-tab.test.tsx.snap +++ b/plugins/main/public/controllers/management/components/management/configuration/office365/components/general-tab/__snapshots__/general-tab.test.tsx.snap @@ -37,11 +37,11 @@ exports[`GeneralTab component renders correctly to match the snapshot 1`] = ` help={ Array [ Object { - "href": "https://documentation.wazuh.com/4.8/cloud-security/office365/index.html", + "href": "https://documentation.wazuh.com/4.9/cloud-security/office365/index.html", "text": "Using Wazuh to monitor Office 365", }, Object { - "href": "https://documentation.wazuh.com/4.8/user-manual/reference/ossec-conf/office365-module.html", + "href": "https://documentation.wazuh.com/4.9/user-manual/reference/ossec-conf/office365-module.html", "text": "Configuration options for the module", }, ] @@ -106,11 +106,11 @@ exports[`GeneralTab component renders correctly to match the snapshot 1`] = ` links={ Array [ Object { - "href": "https://documentation.wazuh.com/4.8/cloud-security/office365/index.html", + "href": "https://documentation.wazuh.com/4.9/cloud-security/office365/index.html", "text": "Using Wazuh to monitor Office 365", }, Object { - "href": "https://documentation.wazuh.com/4.8/user-manual/reference/ossec-conf/office365-module.html", + "href": "https://documentation.wazuh.com/4.9/user-manual/reference/ossec-conf/office365-module.html", "text": "Configuration options for the module", }, ] From 7a9a72b99556920b27ff863a7e26f08699017722 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Oct 2023 14:38:30 +0200 Subject: [PATCH 2/9] Bump tough-cookie and @cypress/request in /plugins/main/test/cypress (#6030) Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) and [@cypress/request](https://github.com/cypress-io/request). These dependencies needed to be updated together. Updates `tough-cookie` from 2.5.0 to 4.1.3 - [Release notes](https://github.com/salesforce/tough-cookie/releases) - [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md) - [Commits](https://github.com/salesforce/tough-cookie/compare/v2.5.0...v4.1.3) Updates `@cypress/request` from 2.88.10 to 2.88.12 - [Release notes](https://github.com/cypress-io/request/releases) - [Changelog](https://github.com/cypress-io/request/blob/master/CHANGELOG.md) - [Commits](https://github.com/cypress-io/request/compare/v2.88.10...v2.88.12) --- updated-dependencies: - dependency-name: tough-cookie dependency-type: indirect - dependency-name: "@cypress/request" dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- plugins/main/test/cypress/package-lock.json | 140 +++++++++++++++----- 1 file changed, 106 insertions(+), 34 deletions(-) diff --git a/plugins/main/test/cypress/package-lock.json b/plugins/main/test/cypress/package-lock.json index 870e56b8df..705ac87fd6 100644 --- a/plugins/main/test/cypress/package-lock.json +++ b/plugins/main/test/cypress/package-lock.json @@ -1891,9 +1891,9 @@ } }, "node_modules/@cypress/request": { - "version": "2.88.10", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.10.tgz", - "integrity": "sha512-Zp7F+R93N0yZyG34GutyTNr+okam7s/Fzc1+i3kcqOP8vk6OuajuE9qZJ6Rs+10/1JFtXFYMdyarnU1rZuJesg==", + "version": "2.88.12", + "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.12.tgz", + "integrity": "sha512-tOn+0mDZxASFM+cuAP9szGUGPI1HwWVSvdzm7V4cCsPdFTx6qMj29CwaQmRAMIEhORIUBFBsYROYJcveK4uOjA==", "dev": true, "dependencies": { "aws-sign2": "~0.7.0", @@ -1909,9 +1909,9 @@ "json-stringify-safe": "~5.0.1", "mime-types": "~2.1.19", "performance-now": "^2.1.0", - "qs": "~6.5.2", + "qs": "~6.10.3", "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", + "tough-cookie": "^4.1.3", "tunnel-agent": "^0.6.0", "uuid": "^8.3.2" }, @@ -7214,12 +7214,18 @@ "dev": true }, "node_modules/qs": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", - "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "version": "6.10.4", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.4.tgz", + "integrity": "sha512-OQiU+C+Ds5qiH91qh/mg0w+8nwQuLjM4F4M/PbmhDOoYehPh+Fb0bDjtR1sOvy7YKxvj28Y/M0PhP5uVX0kB+g==", "dev": true, + "dependencies": { + "side-channel": "^1.0.4" + }, "engines": { "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/querystring": { @@ -7241,6 +7247,12 @@ "node": ">=0.4.x" } }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "dev": true + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -7483,6 +7495,12 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, "node_modules/resolve": { "version": "1.22.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", @@ -8190,27 +8208,38 @@ } }, "node_modules/tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "dev": true, "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" }, "engines": { - "node": ">=0.8" + "node": ">=6" } }, "node_modules/tough-cookie/node_modules/punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true, "engines": { "node": ">=6" } }, + "node_modules/tough-cookie/node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/tslib": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", @@ -8447,6 +8476,16 @@ "querystring": "0.2.0" } }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dev": true, + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "node_modules/url/node_modules/punycode": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", @@ -10195,9 +10234,9 @@ } }, "@cypress/request": { - "version": "2.88.10", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.10.tgz", - "integrity": "sha512-Zp7F+R93N0yZyG34GutyTNr+okam7s/Fzc1+i3kcqOP8vk6OuajuE9qZJ6Rs+10/1JFtXFYMdyarnU1rZuJesg==", + "version": "2.88.12", + "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.12.tgz", + "integrity": "sha512-tOn+0mDZxASFM+cuAP9szGUGPI1HwWVSvdzm7V4cCsPdFTx6qMj29CwaQmRAMIEhORIUBFBsYROYJcveK4uOjA==", "dev": true, "requires": { "aws-sign2": "~0.7.0", @@ -10213,9 +10252,9 @@ "json-stringify-safe": "~5.0.1", "mime-types": "~2.1.19", "performance-now": "^2.1.0", - "qs": "~6.5.2", + "qs": "~6.10.3", "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", + "tough-cookie": "^4.1.3", "tunnel-agent": "^0.6.0", "uuid": "^8.3.2" } @@ -14381,10 +14420,13 @@ "dev": true }, "qs": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", - "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", - "dev": true + "version": "6.10.4", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.4.tgz", + "integrity": "sha512-OQiU+C+Ds5qiH91qh/mg0w+8nwQuLjM4F4M/PbmhDOoYehPh+Fb0bDjtR1sOvy7YKxvj28Y/M0PhP5uVX0kB+g==", + "dev": true, + "requires": { + "side-channel": "^1.0.4" + } }, "querystring": { "version": "0.2.0", @@ -14398,6 +14440,12 @@ "integrity": "sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA==", "dev": true }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "dev": true + }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -14594,6 +14642,12 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, "resolve": { "version": "1.22.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", @@ -15146,19 +15200,27 @@ } }, "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "dev": true, "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" }, "dependencies": { "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dev": true + }, + "universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", "dev": true } } @@ -15348,6 +15410,16 @@ } } }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dev": true, + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "util": { "version": "0.10.4", "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", From 7c04036ff337385ddb98cf4b4902066beeded6af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Oct 2023 14:44:33 +0200 Subject: [PATCH 3/9] Bump @babel/traverse from 7.18.13 to 7.23.2 in /plugins/main/test/cypress (#6032) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bump @babel/traverse in /plugins/main/test/cypress Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.18.13 to 7.23.2. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse) --- updated-dependencies: - dependency-name: "@babel/traverse" dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ɓlex Ruiz --- plugins/main/test/cypress/package-lock.json | 386 +++++++++++++------- 1 file changed, 252 insertions(+), 134 deletions(-) diff --git a/plugins/main/test/cypress/package-lock.json b/plugins/main/test/cypress/package-lock.json index 705ac87fd6..620f56f100 100644 --- a/plugins/main/test/cypress/package-lock.json +++ b/plugins/main/test/cypress/package-lock.json @@ -40,17 +40,80 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", "dev": true, "dependencies": { - "@babel/highlight": "^7.18.6" + "@babel/highlight": "^7.22.13", + "chalk": "^2.4.2" }, "engines": { "node": ">=6.9.0" } }, + "node_modules/@babel/code-frame/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/code-frame/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/code-frame/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@babel/compat-data": { "version": "7.18.13", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.18.13.tgz", @@ -100,13 +163,14 @@ } }, "node_modules/@babel/generator": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.13.tgz", - "integrity": "sha512-CkPg8ySSPuHTYPJYo7IRALdqyjM9HCbt/3uOBEFbzyGVP6Mn8bwFPB0jX6982JVNBlYzM1nnPkfjuXSOPtQeEQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "dev": true, "dependencies": { - "@babel/types": "^7.18.13", + "@babel/types": "^7.23.0", "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" }, "engines": { @@ -243,9 +307,9 @@ } }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "dev": true, "engines": { "node": ">=6.9.0" @@ -264,25 +328,25 @@ } }, "node_modules/@babel/helper-function-name": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.18.9.tgz", - "integrity": "sha512-fJgWlZt7nxGksJS9a0XdSaI4XvpExnNIgRP+rVefWh5U7BL8pPuir6SJUmFKRfjWQ51OtWSzwOxhaH/EBWWc0A==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, "dependencies": { - "@babel/template": "^7.18.6", - "@babel/types": "^7.18.9" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", "dev": true, "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" @@ -411,30 +475,30 @@ } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", "dev": true, "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-string-parser": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz", - "integrity": "sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", - "integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "dev": true, "engines": { "node": ">=6.9.0" @@ -479,13 +543,13 @@ } }, "node_modules/@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, "engines": { @@ -555,9 +619,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.13.tgz", - "integrity": "sha512-dgXcIfMuQ0kgzLB2b9tRZs7TTFFaGM2AbtA4fJgUUYukzGH4jwsS7hzQHEGs67jdehpm22vkgKwvbU+aEflgwg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -1803,33 +1867,33 @@ } }, "node_modules/@babel/template": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", - "integrity": "sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.18.10", - "@babel/types": "^7.18.10" + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.13.tgz", - "integrity": "sha512-N6kt9X1jRMLPxxxPYWi7tgvJRH/rtoU+dbKAPDM44RFHiMH8igdsaSBgFeskhSl/kLWLDUvIh1RXCrTmg0/zvA==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.18.13", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.18.13", - "@babel/types": "^7.18.13", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", + "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -1838,13 +1902,13 @@ } }, "node_modules/@babel/types": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.13.tgz", - "integrity": "sha512-ePqfTihzW0W6XAU+aMw2ykilisStJfDnsejDCXRchCcMJ4O0+8DhPXf2YUbZ6wjBlsEmZwLK/sPweWtu8hcJYQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "dev": true, "dependencies": { - "@babel/helper-string-parser": "^7.18.10", - "@babel/helper-validator-identifier": "^7.18.6", + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, "engines": { @@ -2096,13 +2160,13 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.15", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", - "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", "dev": true, "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "node_modules/@nodelib/fs.scandir": { @@ -8931,12 +8995,65 @@ } }, "@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", "dev": true, "requires": { - "@babel/highlight": "^7.18.6" + "@babel/highlight": "^7.22.13", + "chalk": "^2.4.2" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "@babel/compat-data": { @@ -8977,13 +9094,14 @@ } }, "@babel/generator": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.13.tgz", - "integrity": "sha512-CkPg8ySSPuHTYPJYo7IRALdqyjM9HCbt/3uOBEFbzyGVP6Mn8bwFPB0jX6982JVNBlYzM1nnPkfjuXSOPtQeEQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "dev": true, "requires": { - "@babel/types": "^7.18.13", + "@babel/types": "^7.23.0", "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" }, "dependencies": { @@ -9087,9 +9205,9 @@ } }, "@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "dev": true }, "@babel/helper-explode-assignable-expression": { @@ -9102,22 +9220,22 @@ } }, "@babel/helper-function-name": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.18.9.tgz", - "integrity": "sha512-fJgWlZt7nxGksJS9a0XdSaI4XvpExnNIgRP+rVefWh5U7BL8pPuir6SJUmFKRfjWQ51OtWSzwOxhaH/EBWWc0A==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, "requires": { - "@babel/template": "^7.18.6", - "@babel/types": "^7.18.9" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" } }, "@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", "dev": true, "requires": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" } }, "@babel/helper-member-expression-to-functions": { @@ -9213,24 +9331,24 @@ } }, "@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", "dev": true, "requires": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" } }, "@babel/helper-string-parser": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz", - "integrity": "sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", "dev": true }, "@babel/helper-validator-identifier": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", - "integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "dev": true }, "@babel/helper-validator-option": { @@ -9263,13 +9381,13 @@ } }, "@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, "dependencies": { @@ -9326,9 +9444,9 @@ } }, "@babel/parser": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.13.tgz", - "integrity": "sha512-dgXcIfMuQ0kgzLB2b9tRZs7TTFFaGM2AbtA4fJgUUYukzGH4jwsS7hzQHEGs67jdehpm22vkgKwvbU+aEflgwg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", "dev": true }, "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { @@ -10161,42 +10279,42 @@ } }, "@babel/template": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", - "integrity": "sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", "dev": true, "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.18.10", - "@babel/types": "^7.18.10" + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" } }, "@babel/traverse": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.13.tgz", - "integrity": "sha512-N6kt9X1jRMLPxxxPYWi7tgvJRH/rtoU+dbKAPDM44RFHiMH8igdsaSBgFeskhSl/kLWLDUvIh1RXCrTmg0/zvA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.18.13", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.18.13", - "@babel/types": "^7.18.13", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", + "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" } }, "@babel/types": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.13.tgz", - "integrity": "sha512-ePqfTihzW0W6XAU+aMw2ykilisStJfDnsejDCXRchCcMJ4O0+8DhPXf2YUbZ6wjBlsEmZwLK/sPweWtu8hcJYQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "dev": true, "requires": { - "@babel/helper-string-parser": "^7.18.10", - "@babel/helper-validator-identifier": "^7.18.6", + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" } }, @@ -10396,13 +10514,13 @@ "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.15", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", - "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", "dev": true, "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "@nodelib/fs.scandir": { From 8a410249db4a7c2bd5e624a9e75022cb6da1c729 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Oct 2023 14:57:39 +0200 Subject: [PATCH 4/9] Bump the npm_and_yarn at /plugins/main/test/cypress security update group in /plugins/main/test/cypress with 1 update (#6033) Bump the npm_and_yarn at /plugins/main/test/cypress security update group Bumps the npm_and_yarn at /plugins/main/test/cypress security update group in /plugins/main/test/cypress with 1 update: [cypress](https://github.com/cypress-io/cypress). - [Release notes](https://github.com/cypress-io/cypress/releases) - [Changelog](https://github.com/cypress-io/cypress/blob/develop/CHANGELOG.md) - [Commits](https://github.com/cypress-io/cypress/compare/v9.7.0...v13.3.2) --- updated-dependencies: - dependency-name: cypress dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- plugins/main/test/cypress/package-lock.json | 139 ++++++++++---------- plugins/main/test/cypress/package.json | 2 +- 2 files changed, 73 insertions(+), 68 deletions(-) diff --git a/plugins/main/test/cypress/package-lock.json b/plugins/main/test/cypress/package-lock.json index 620f56f100..3d39259d39 100644 --- a/plugins/main/test/cypress/package-lock.json +++ b/plugins/main/test/cypress/package-lock.json @@ -14,7 +14,7 @@ "prettier": "^2.3.0" }, "devDependencies": { - "cypress": "^9.5.2", + "cypress": "^13.3.2", "cypress-cucumber-preprocessor": "^4.0.3", "cypress-real-events": "^1.7.1", "cypress-xpath": "^1.6.2", @@ -1955,9 +1955,9 @@ } }, "node_modules/@cypress/request": { - "version": "2.88.12", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.12.tgz", - "integrity": "sha512-tOn+0mDZxASFM+cuAP9szGUGPI1HwWVSvdzm7V4cCsPdFTx6qMj29CwaQmRAMIEhORIUBFBsYROYJcveK4uOjA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.1.tgz", + "integrity": "sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ==", "dev": true, "dependencies": { "aws-sign2": "~0.7.0", @@ -1973,7 +1973,7 @@ "json-stringify-safe": "~5.0.1", "mime-types": "~2.1.19", "performance-now": "^2.1.0", - "qs": "~6.10.3", + "qs": "6.10.4", "safe-buffer": "^5.1.2", "tough-cookie": "^4.1.3", "tunnel-agent": "^0.6.0", @@ -2208,9 +2208,9 @@ } }, "node_modules/@types/node": { - "version": "14.18.26", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.26.tgz", - "integrity": "sha512-0b+utRBSYj8L7XAp0d+DX7lI4cSmowNaaTkk6/1SKzbKkG+doLuPusB9EOvzLJ8ahJSk03bTLIL6cWaEd4dBKA==", + "version": "18.18.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.6.tgz", + "integrity": "sha512-wf3Vz+jCmOQ2HV1YUJuCWdL64adYxumkrxtc+H1VUQlnQI04+5HtH+qZCOE21lBE7gIrt+CwX2Wv8Acrw5Ak6w==", "dev": true }, "node_modules/@types/sinonjs__fake-timers": { @@ -2564,9 +2564,9 @@ } }, "node_modules/aws4": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", - "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", + "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==", "dev": true }, "node_modules/babel-plugin-add-module-exports": { @@ -3362,9 +3362,9 @@ } }, "node_modules/commander": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", - "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", "dev": true, "engines": { "node": ">= 6" @@ -3645,15 +3645,15 @@ } }, "node_modules/cypress": { - "version": "9.7.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-9.7.0.tgz", - "integrity": "sha512-+1EE1nuuuwIt/N1KXRR2iWHU+OiIt7H28jJDyyI4tiUftId/DrXYEwoDa5+kH2pki1zxnA0r6HrUGHV5eLbF5Q==", + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.3.2.tgz", + "integrity": "sha512-ArLmZObcLC+xxCp7zJZZbhby9FUf5CueLej9dUM4+5j37FTS4iMSgHxQLDu01PydFUvDXcNoIVRCYrHHxD7Ybg==", "dev": true, "hasInstallScript": true, "dependencies": { - "@cypress/request": "^2.88.10", + "@cypress/request": "^3.0.0", "@cypress/xvfb": "^1.2.4", - "@types/node": "^14.14.31", + "@types/node": "^18.17.5", "@types/sinonjs__fake-timers": "8.1.1", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", @@ -3665,12 +3665,12 @@ "check-more-types": "^2.24.0", "cli-cursor": "^3.1.0", "cli-table3": "~0.6.1", - "commander": "^5.1.0", + "commander": "^6.2.1", "common-tags": "^1.8.0", "dayjs": "^1.10.4", - "debug": "^4.3.2", + "debug": "^4.3.4", "enquirer": "^2.3.6", - "eventemitter2": "^6.4.3", + "eventemitter2": "6.4.7", "execa": "4.1.0", "executable": "^4.1.1", "extract-zip": "2.0.1", @@ -3683,12 +3683,13 @@ "listr2": "^3.8.3", "lodash": "^4.17.21", "log-symbols": "^4.0.0", - "minimist": "^1.2.6", + "minimist": "^1.2.8", "ospath": "^1.2.2", "pretty-bytes": "^5.6.0", + "process": "^0.11.10", "proxy-from-env": "1.0.0", "request-progress": "^3.0.0", - "semver": "^7.3.2", + "semver": "^7.5.3", "supports-color": "^8.1.1", "tmp": "~0.2.1", "untildify": "^4.0.0", @@ -3698,7 +3699,7 @@ "cypress": "bin/cypress" }, "engines": { - "node": ">=12.0.0" + "node": "^16.0.0 || ^18.0.0 || >=20.0.0" } }, "node_modules/cypress-cucumber-preprocessor": { @@ -6250,10 +6251,13 @@ } }, "node_modules/minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/mkdirp-classic": { "version": "0.5.3", @@ -7712,9 +7716,9 @@ "dev": true }, "node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -7887,9 +7891,9 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" }, "node_modules/sshpk": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", - "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz", + "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", "dev": true, "dependencies": { "asn1": "~0.2.3", @@ -10352,9 +10356,9 @@ } }, "@cypress/request": { - "version": "2.88.12", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.12.tgz", - "integrity": "sha512-tOn+0mDZxASFM+cuAP9szGUGPI1HwWVSvdzm7V4cCsPdFTx6qMj29CwaQmRAMIEhORIUBFBsYROYJcveK4uOjA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.1.tgz", + "integrity": "sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ==", "dev": true, "requires": { "aws-sign2": "~0.7.0", @@ -10370,7 +10374,7 @@ "json-stringify-safe": "~5.0.1", "mime-types": "~2.1.19", "performance-now": "^2.1.0", - "qs": "~6.10.3", + "qs": "6.10.4", "safe-buffer": "^5.1.2", "tough-cookie": "^4.1.3", "tunnel-agent": "^0.6.0", @@ -10553,9 +10557,9 @@ } }, "@types/node": { - "version": "14.18.26", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.26.tgz", - "integrity": "sha512-0b+utRBSYj8L7XAp0d+DX7lI4cSmowNaaTkk6/1SKzbKkG+doLuPusB9EOvzLJ8ahJSk03bTLIL6cWaEd4dBKA==", + "version": "18.18.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.6.tgz", + "integrity": "sha512-wf3Vz+jCmOQ2HV1YUJuCWdL64adYxumkrxtc+H1VUQlnQI04+5HtH+qZCOE21lBE7gIrt+CwX2Wv8Acrw5Ak6w==", "dev": true }, "@types/sinonjs__fake-timers": { @@ -10831,9 +10835,9 @@ "dev": true }, "aws4": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", - "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", + "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==", "dev": true }, "babel-plugin-add-module-exports": { @@ -11471,9 +11475,9 @@ } }, "commander": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", - "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", "dev": true }, "common-tags": { @@ -11722,14 +11726,14 @@ "dev": true }, "cypress": { - "version": "9.7.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-9.7.0.tgz", - "integrity": "sha512-+1EE1nuuuwIt/N1KXRR2iWHU+OiIt7H28jJDyyI4tiUftId/DrXYEwoDa5+kH2pki1zxnA0r6HrUGHV5eLbF5Q==", + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.3.2.tgz", + "integrity": "sha512-ArLmZObcLC+xxCp7zJZZbhby9FUf5CueLej9dUM4+5j37FTS4iMSgHxQLDu01PydFUvDXcNoIVRCYrHHxD7Ybg==", "dev": true, "requires": { - "@cypress/request": "^2.88.10", + "@cypress/request": "^3.0.0", "@cypress/xvfb": "^1.2.4", - "@types/node": "^14.14.31", + "@types/node": "^18.17.5", "@types/sinonjs__fake-timers": "8.1.1", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", @@ -11741,12 +11745,12 @@ "check-more-types": "^2.24.0", "cli-cursor": "^3.1.0", "cli-table3": "~0.6.1", - "commander": "^5.1.0", + "commander": "^6.2.1", "common-tags": "^1.8.0", "dayjs": "^1.10.4", - "debug": "^4.3.2", + "debug": "^4.3.4", "enquirer": "^2.3.6", - "eventemitter2": "^6.4.3", + "eventemitter2": "6.4.7", "execa": "4.1.0", "executable": "^4.1.1", "extract-zip": "2.0.1", @@ -11759,12 +11763,13 @@ "listr2": "^3.8.3", "lodash": "^4.17.21", "log-symbols": "^4.0.0", - "minimist": "^1.2.6", + "minimist": "^1.2.8", "ospath": "^1.2.2", "pretty-bytes": "^5.6.0", + "process": "^0.11.10", "proxy-from-env": "1.0.0", "request-progress": "^3.0.0", - "semver": "^7.3.2", + "semver": "^7.5.3", "supports-color": "^8.1.1", "tmp": "~0.2.1", "untildify": "^4.0.0", @@ -13734,9 +13739,9 @@ } }, "minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "dev": true }, "mkdirp-classic": { @@ -14863,9 +14868,9 @@ "dev": true }, "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -14994,9 +14999,9 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" }, "sshpk": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", - "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz", + "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", "dev": true, "requires": { "asn1": "~0.2.3", diff --git a/plugins/main/test/cypress/package.json b/plugins/main/test/cypress/package.json index 7f153c5667..5b88b71d8c 100644 --- a/plugins/main/test/cypress/package.json +++ b/plugins/main/test/cypress/package.json @@ -34,7 +34,7 @@ "prettier": "^2.3.0" }, "devDependencies": { - "cypress": "^9.5.2", + "cypress": "^13.3.2", "cypress-cucumber-preprocessor": "^4.0.3", "cypress-real-events": "^1.7.1", "cypress-xpath": "^1.6.2", From 9a5857701c2e60ac7ac8b1637b0ad821cfe0dd33 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Oct 2023 14:53:50 -0300 Subject: [PATCH 5/9] Bump crypto-js from 4.1.1 to 4.2.0 in /plugins/main (#6062) Bumps [crypto-js](https://github.com/brix/crypto-js) from 4.1.1 to 4.2.0. - [Commits](https://github.com/brix/crypto-js/compare/4.1.1...4.2.0) --- updated-dependencies: - dependency-name: crypto-js dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- plugins/main/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/main/yarn.lock b/plugins/main/yarn.lock index 3db28ae6c7..c30706356d 100644 --- a/plugins/main/yarn.lock +++ b/plugins/main/yarn.lock @@ -1094,9 +1094,9 @@ crypt@0.0.2: integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow== crypto-js@^4.0.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.1.1.tgz#9e485bcf03521041bd85844786b83fb7619736cf" - integrity sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw== + version "4.2.0" + resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.2.0.tgz#4d931639ecdfd12ff80e8186dba6af2c2e856631" + integrity sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q== csstype@^3.0.2: version "3.1.2" From 37bd379f0aef3494fea32afa641dfe02ca67e1ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Mon, 30 Oct 2023 11:59:53 +0100 Subject: [PATCH 6/9] Rename compatibilty_request.md to compatibility_request.md --- .../{compatibilty_request.md => compatibility_request.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/ISSUE_TEMPLATE/{compatibilty_request.md => compatibility_request.md} (100%) diff --git a/.github/ISSUE_TEMPLATE/compatibilty_request.md b/.github/ISSUE_TEMPLATE/compatibility_request.md similarity index 100% rename from .github/ISSUE_TEMPLATE/compatibilty_request.md rename to .github/ISSUE_TEMPLATE/compatibility_request.md From 61418969c1b4a52ec2dedcde63787b90e5f0896d Mon Sep 17 00:00:00 2001 From: Federico Rodriguez Date: Wed, 22 Nov 2023 11:01:03 +0100 Subject: [PATCH 7/9] Bump version 4.8.1 rev 00 (#6140) --- CHANGELOG.md | 6 + plugins/main/common/api-info/endpoints.json | 929 +++++++++++++----- .../common/api-info/security-actions.json | 853 ++++++++++++---- plugins/main/opensearch_dashboards.json | 15 +- plugins/main/package.json | 2 +- .../opensearch_dashboards.json | 2 +- plugins/wazuh-check-updates/package.json | 2 +- plugins/wazuh-core/opensearch_dashboards.json | 2 +- plugins/wazuh-core/package.json | 2 +- 9 files changed, 1360 insertions(+), 453 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1143785ebd..37854a786d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to the Wazuh app project will be documented in this file. +## Wazuh v4.8.1 - OpenSearch Dashboards 2.10.0 - Revision 00 + +### Added + +- Support for Wazuh 4.8.1 + ## Wazuh v4.8.0 - OpenSearch Dashboards 2.10.0 - Revision 00 ### Added diff --git a/plugins/main/common/api-info/endpoints.json b/plugins/main/common/api-info/endpoints.json index 440a61fcf6..b36353c39f 100644 --- a/plugins/main/common/api-info/endpoints.json +++ b/plugins/main/common/api-info/endpoints.json @@ -7,7 +7,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.default_controller.default_info", "description": "Return basic information about the API", "summary": "Get API info", - "tags": ["API Info"], + "tags": [ + "API Info" + ], "query": [ { "name": "pretty", @@ -24,7 +26,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_agents", "description": "Return information about all available agents or a list of them", "summary": "List agents", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "agents_list", @@ -61,7 +65,10 @@ "description": "Agent groups configuration sync status", "schema": { "type": "string", - "enum": ["synced", "not synced"] + "enum": [ + "synced", + "not synced" + ] } }, { @@ -206,7 +213,12 @@ "type": "array", "items": { "type": "string", - "enum": ["active", "pending", "never_connected", "disconnected"] + "enum": [ + "active", + "pending", + "never_connected", + "disconnected" + ] }, "minItems": 1 } @@ -234,7 +246,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_agent_config", "description": "Return the active configuration the agent is currently using. This can be different from the configuration present in the configuration file, if it has been modified and the agent has not been restarted yet", "summary": "Get active configuration", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "args": [ { "name": ":agent_id", @@ -332,7 +346,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_daemon_stats", "description": "Return Wazuh statistical information from specified daemons in a specified agent", "summary": "Get Wazuh daemon stats from an agent", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "args": [ { "name": ":agent_id", @@ -354,7 +370,10 @@ "type": "array", "items": { "type": "string", - "enum": ["wazuh-analysisd", "wazuh-remoted"] + "enum": [ + "wazuh-analysisd", + "wazuh-remoted" + ] } } }, @@ -381,7 +400,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_sync_agent", "description": "Return whether the agent configuration has been synchronized with the agent or not. This can be useful to check after updating a group configuration", "summary": "Get configuration sync status", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "args": [ { "name": ":agent_id", @@ -419,7 +440,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_agent_key", "description": "Return the key of an agent", "summary": "Get key", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "args": [ { "name": ":agent_id", @@ -457,7 +480,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_component_stats", "description": "Return Wazuh's {component} statistical information from agent {agent_id}", "summary": "Get agent's component stats", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "args": [ { "name": ":agent_id", @@ -476,7 +501,10 @@ "required": true, "schema": { "type": "string", - "enum": ["logcollector", "agent"] + "enum": [ + "logcollector", + "agent" + ] } } ], @@ -504,7 +532,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_agent_no_group", "description": "Return a list with all the available agents without an assigned group", "summary": "List agents without group", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "limit", @@ -584,7 +614,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_agent_outdated", "description": "Return the list of outdated agents", "summary": "List outdated agents", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "limit", @@ -653,7 +685,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_agent_fields", "description": "Return all the different combinations that agents have for the selected fields. It also indicates the total number of agents that have each combination", "summary": "List agents distinct", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "fields", @@ -733,7 +767,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_agent_summary_os", "description": "Return a summary of the OS of available agents", "summary": "Summarize agents OS", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "pretty", @@ -758,7 +794,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_agent_summary_status", "description": "Return a summary of the connection and groups configuration synchronization statuses of available agents", "summary": "Summarize agents status", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "pretty", @@ -783,7 +821,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_agent_upgrade", "description": "Return the agents upgrade results", "summary": "Get upgrade results", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "agents_list", @@ -909,7 +949,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.ciscat_controller.get_agents_ciscat_results", "description": "Return the agent's ciscat results info", "summary": "Get results", - "tags": ["Ciscat"], + "tags": [ + "Ciscat" + ], "args": [ { "name": ":agent_id", @@ -1071,7 +1113,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_configuration_node", "description": "Return wazuh configuration used in node {node_id}. The 'section' and 'field' parameters will be ignored if 'raw' parameter is provided.", "summary": "Get node config", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "args": [ { "name": ":node_id", @@ -1163,7 +1207,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_node_config", "description": "Return the requested configuration in JSON format for the specified node", "summary": "Get node active configuration", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "args": [ { "name": ":component", @@ -1259,7 +1305,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_daemon_stats_node", "description": "Return Wazuh statistical information from specified daemons in a specified cluster node", "summary": "Get Wazuh daemon stats from a cluster node", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "args": [ { "name": ":node_id", @@ -1279,7 +1327,11 @@ "type": "array", "items": { "type": "string", - "enum": ["wazuh-analysisd", "wazuh-remoted", "wazuh-db"] + "enum": [ + "wazuh-analysisd", + "wazuh-remoted", + "wazuh-db" + ] } } }, @@ -1306,7 +1358,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_info_node", "description": "Return basic information about a specified node such as version, compilation date, installation path", "summary": "Get node info", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "args": [ { "name": ":node_id", @@ -1342,7 +1396,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_log_node", "description": "Return the last 2000 wazuh log entries in the specified node", "summary": "Get node logs", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "args": [ { "name": ":node_id", @@ -1464,7 +1520,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_log_summary_node", "description": "Return a summary of the last 2000 wazuh log entries in the specified node", "summary": "Get node logs summary", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "args": [ { "name": ":node_id", @@ -1500,7 +1558,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_stats_node", "description": "Return Wazuh statistical information in node {node_id} for the current or specified date", "summary": "Get node stats", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "args": [ { "name": ":node_id", @@ -1544,7 +1604,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_stats_analysisd_node", "description": "Return Wazuh analysisd statistical information in node {node_id}", "summary": "Get node stats analysisd", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "args": [ { "name": ":node_id", @@ -1580,7 +1642,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_stats_hourly_node", "description": "Return Wazuh statistical information in node {node_id} per hour. Each number in the averages field represents the average of alerts per hour", "summary": "Get node stats hour", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "args": [ { "name": ":node_id", @@ -1616,7 +1680,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_stats_remoted_node", "description": "Return Wazuh remoted statistical information in node {node_id}", "summary": "Get node stats remoted", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "args": [ { "name": ":node_id", @@ -1652,7 +1718,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_stats_weekly_node", "description": "Return Wazuh statistical information in node {node_id} per week. Each number in the averages field represents the average of alerts per hour for that specific day", "summary": "Get node stats week", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "args": [ { "name": ":node_id", @@ -1688,7 +1756,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_status_node", "description": "Return the status of all Wazuh daemons in node node_id", "summary": "Get node status", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "args": [ { "name": ":node_id", @@ -1724,7 +1794,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_api_config", "description": "Return the API configuration of all nodes (or a list of them) in JSON format", "summary": "Get nodes API config", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "query": [ { "name": "nodes_list", @@ -1759,7 +1831,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_conf_validation", "description": "Return whether the Wazuh configuration is correct or not in all cluster nodes or a list of them", "summary": "Check nodes config", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "query": [ { "name": "nodes_list", @@ -1794,7 +1868,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_healthcheck", "description": "Return cluster healthcheck information for all nodes or a list of them. Such information includes last keep alive, last synchronization time and number of agents reporting on each node", "summary": "Get nodes healthcheck", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "query": [ { "name": "nodes_list", @@ -1829,7 +1905,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_config", "description": "Return the current node cluster configuration", "summary": "Get local node config", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "query": [ { "name": "pretty", @@ -1854,7 +1932,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_cluster_node", "description": "Return basic information about the cluster node receiving the request", "summary": "Get local node info", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "query": [ { "name": "pretty", @@ -1879,7 +1959,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_cluster_nodes", "description": "Get information about all nodes in the cluster or a list of them", "summary": "Get nodes info", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "query": [ { "name": "distinct", @@ -1967,7 +2049,10 @@ "description": "Filter by node type", "schema": { "type": "string", - "enum": ["worker", "master"] + "enum": [ + "worker", + "master" + ] } }, { @@ -1985,7 +2070,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_nodes_ruleset_sync_status", "description": "Return ruleset synchronization status for all nodes or a list of them. This synchronization only covers the user custom ruleset", "summary": "Get cluster nodes ruleset synchronization status", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "query": [ { "name": "nodes_list", @@ -2020,7 +2107,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.get_status", "description": "Return information about the cluster status", "summary": "Get cluster status", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "query": [ { "name": "pretty", @@ -2045,7 +2134,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.decoder_controller.get_decoders", "description": "Return information about all decoders included in ossec.conf. This information include decoder's route, decoder's name, decoder's file among others", "summary": "List decoders", - "tags": ["Decoders"], + "tags": [ + "Decoders" + ], "query": [ { "name": "decoder_names", @@ -2153,7 +2244,11 @@ "description": "Filter by list status. Use commas to enter multiple statuses", "schema": { "type": "string", - "enum": ["enabled", "disabled", "all"], + "enum": [ + "enabled", + "disabled", + "all" + ], "minItems": 1 } }, @@ -2172,7 +2267,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.decoder_controller.get_decoders_files", "description": "Return information about all decoders files used in Wazuh. This information include decoder's file, decoder's route and decoder's status among others", "summary": "Get files", - "tags": ["Decoders"], + "tags": [ + "Decoders" + ], "query": [ { "name": "distinct", @@ -2269,7 +2366,11 @@ "description": "Filter by list status. Use commas to enter multiple statuses", "schema": { "type": "string", - "enum": ["enabled", "disabled", "all"], + "enum": [ + "enabled", + "disabled", + "all" + ], "minItems": 1 } }, @@ -2288,7 +2389,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.decoder_controller.get_file", "description": "Get the content of a specified decoder file", "summary": "Get decoders file content", - "tags": ["Decoders"], + "tags": [ + "Decoders" + ], "args": [ { "name": ":filename", @@ -2340,7 +2443,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.decoder_controller.get_decoders_parents", "description": "Return information about all parent decoders. A parent decoder is a decoder used as base of other decoders", "summary": "Get parent decoders", - "tags": ["Decoders"], + "tags": [ + "Decoders" + ], "query": [ { "name": "limit", @@ -2413,7 +2518,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.experimental_controller.get_cis_cat_results", "description": "Return CIS-CAT results for all agents or a list of them", "summary": "Get agents CIS-CAT results", - "tags": ["Experimental"], + "tags": [ + "Experimental" + ], "query": [ { "name": "agents_list", @@ -2568,7 +2675,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.experimental_controller.get_hardware_info", "description": "Return all agents (or a list of them) hardware info. This information include cpu, ram, scan info among others of all agents", "summary": "Get agents hardware", - "tags": ["Experimental"], + "tags": [ + "Experimental" + ], "query": [ { "name": "agents_list", @@ -2705,7 +2814,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.experimental_controller.get_hotfixes_info", "description": "Return all agents (or a list of them) hotfixes info", "summary": "Get agents hotfixes", - "tags": ["Experimental"], + "tags": [ + "Experimental" + ], "query": [ { "name": "agents_list", @@ -2798,7 +2909,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.experimental_controller.get_network_address_info", "description": "Return all agents (or a list of them) IPv4 and IPv6 addresses associated to their network interfaces. This information include used IP protocol, interface, and IP address among others", "summary": "Get agents netaddr", - "tags": ["Experimental"], + "tags": [ + "Experimental" + ], "query": [ { "name": "address", @@ -2916,7 +3029,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.experimental_controller.get_network_interface_info", "description": "Return all agents (or a list of them) network interfaces. This information includes rx, scan, tx info and some network information among other", "summary": "Get agents netiface", - "tags": ["Experimental"], + "tags": [ + "Experimental" + ], "query": [ { "name": "adapter", @@ -3115,7 +3230,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.experimental_controller.get_network_protocol_info", "description": "Return all agents (or a list of them) routing configuration for each network interface. This information includes interface, type protocol information among other", "summary": "Get agents netproto", - "tags": ["Experimental"], + "tags": [ + "Experimental" + ], "query": [ { "name": "agents_list", @@ -3136,7 +3253,12 @@ "schema": { "type": "string", "description": "DHCP status", - "enum": ["enabled", "disabled", "unknown", "BOOTP"] + "enum": [ + "enabled", + "disabled", + "unknown", + "BOOTP" + ] } }, { @@ -3234,7 +3356,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.experimental_controller.get_os_info", "description": "Return all agents (or a list of them) OS info. This information includes os information, architecture information among other", "summary": "Get agents OS", - "tags": ["Experimental"], + "tags": [ + "Experimental" + ], "query": [ { "name": "agents_list", @@ -3360,7 +3484,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.experimental_controller.get_packages_info", "description": "Return all agents (or a list of them) packages info. This information includes name, section, size, and priority information of all packages among other", "summary": "Get agents packages", - "tags": ["Experimental"], + "tags": [ + "Experimental" + ], "query": [ { "name": "agents_list", @@ -3484,7 +3610,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.experimental_controller.get_ports_info", "description": "Return all agents (or a list of them) ports info. This information includes local IP, Remote IP, protocol information among other", "summary": "Get agents ports", - "tags": ["Experimental"], + "tags": [ + "Experimental" + ], "query": [ { "name": "agents_list", @@ -3634,7 +3762,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.experimental_controller.get_processes_info", "description": "Return all agents (or a list of them) processes info", "summary": "Get agents processes", - "tags": ["Experimental"], + "tags": [ + "Experimental" + ], "query": [ { "name": "agents_list", @@ -3832,7 +3962,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_list_group", "description": "Get information about all groups or a list of them. Returns a list containing basic information about each group such as number of agents belonging to the group and the checksums of the configuration and shared files", "summary": "Get groups", - "tags": ["Groups"], + "tags": [ + "Groups" + ], "query": [ { "name": "distinct", @@ -3953,7 +4085,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_agents_in_group", "description": "Return the list of agents that belong to the specified group", "summary": "Get agents in a group", - "tags": ["Groups"], + "tags": [ + "Groups" + ], "args": [ { "name": ":group_id", @@ -4045,7 +4179,12 @@ "type": "array", "items": { "type": "string", - "enum": ["active", "pending", "never_connected", "disconnected"] + "enum": [ + "active", + "pending", + "never_connected", + "disconnected" + ] }, "minItems": 1 } @@ -4065,7 +4204,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_group_config", "description": "Return the group configuration defined in the `agent.conf` file", "summary": "Get group configuration", - "tags": ["Groups"], + "tags": [ + "Groups" + ], "args": [ { "name": ":group_id", @@ -4123,7 +4264,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_group_files", "description": "Return the files placed under the group directory", "summary": "Get group files", - "tags": ["Groups"], + "tags": [ + "Groups" + ], "args": [ { "name": ":group_id", @@ -4244,7 +4387,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_group_file_json", "description": "Return the content of the specified group file parsed to JSON", "summary": "Get a file in group", - "tags": ["Groups"], + "tags": [ + "Groups" + ], "args": [ { "name": ":file_name", @@ -4282,7 +4427,12 @@ "type": "array", "items": { "type": "string", - "enum": ["conf", "rootkit_files", "rootkit_trojans", "rcl"] + "enum": [ + "conf", + "rootkit_files", + "rootkit_trojans", + "rcl" + ] } } }, @@ -4301,7 +4451,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.get_group_file_xml", "description": "Return the contents of the specified group file parsed to XML", "summary": "Get a file in group", - "tags": ["Groups"], + "tags": [ + "Groups" + ], "args": [ { "name": ":file_name", @@ -4339,7 +4491,12 @@ "type": "array", "items": { "type": "string", - "enum": ["conf", "rootkit_files", "rootkit_trojans", "rcl"] + "enum": [ + "conf", + "rootkit_files", + "rootkit_trojans", + "rcl" + ] } } }, @@ -4358,7 +4515,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cdb_list_controller.get_lists", "description": "Return the contents of all CDB lists. Optionally, the result can be filtered by several criteria. See available parameters for more details", "summary": "Get CDB lists info", - "tags": ["Lists"], + "tags": [ + "Lists" + ], "query": [ { "name": "distinct", @@ -4465,7 +4624,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cdb_list_controller.get_lists_files", "description": "Return the path from all CDB lists. Use this method to know all the CDB lists and their location in the filesystem relative to Wazuh installation folder", "summary": "Get CDB lists files", - "tags": ["Lists"], + "tags": [ + "Lists" + ], "query": [ { "name": "filename", @@ -4546,7 +4707,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cdb_list_controller.get_file", "description": "Return the content of a CDB list file. Only the filename can be specified. It will be searched recursively if not found", "summary": "Get CDB list file content", - "tags": ["Lists"], + "tags": [ + "Lists" + ], "args": [ { "name": ":filename", @@ -4590,7 +4753,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_api_config", "description": "Return the local API configuration in JSON format", "summary": "Get API config", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "pretty", @@ -4615,7 +4780,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_configuration", "description": "Return wazuh configuration used. The 'section' and 'field' parameters will be ignored if 'raw' parameter is provided.", "summary": "Get configuration", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "distinct", @@ -4704,7 +4871,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_manager_config_ondemand", "description": "Return the requested active configuration in JSON format", "summary": "Get active configuration", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "args": [ { "name": ":component", @@ -4791,7 +4960,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_conf_validation", "description": "Return whether the Wazuh configuration is correct", "summary": "Check config", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "pretty", @@ -4816,7 +4987,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_daemon_stats", "description": "Return Wazuh statistical information from specified daemons", "summary": "Get Wazuh daemon stats", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "daemons_list", @@ -4825,7 +4998,11 @@ "type": "array", "items": { "type": "string", - "enum": ["wazuh-analysisd", "wazuh-remoted", "wazuh-db"] + "enum": [ + "wazuh-analysisd", + "wazuh-remoted", + "wazuh-db" + ] } } }, @@ -4852,7 +5029,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_info", "description": "Return basic information such as version, compilation date, installation path", "summary": "Get information", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "pretty", @@ -4877,7 +5056,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_log", "description": "Return the last 2000 wazuh log entries", "summary": "Get logs", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "distinct", @@ -4988,7 +5169,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_log_summary", "description": "Return a summary of the last 2000 wazuh log entries", "summary": "Get logs summary", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "pretty", @@ -5013,7 +5196,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_stats", "description": "Return Wazuh statistical information for the current or specified date", "summary": "Get stats", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "date", @@ -5046,7 +5231,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_stats_analysisd", "description": "Return Wazuh analysisd statistical information", "summary": "Get stats analysisd", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "pretty", @@ -5071,7 +5258,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_stats_hourly", "description": "Return Wazuh statistical information per hour. Each number in the averages field represents the average of alerts per hour", "summary": "Get stats hour", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "pretty", @@ -5096,7 +5285,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_stats_remoted", "description": "Return Wazuh remoted statistical information", "summary": "Get stats remoted", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "pretty", @@ -5121,7 +5312,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_stats_weekly", "description": "Return Wazuh statistical information per week. Each number in the averages field represents the average of alerts per hour for that specific day", "summary": "Get stats week", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "pretty", @@ -5146,32 +5339,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_status", "description": "Return the status of all Wazuh daemons", "summary": "Get status", - "tags": ["Manager"], - "query": [ - { - "name": "pretty", - "description": "Show results in human-readable format", - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "wait_for_complete", - "description": "Disable timeout response", - "schema": { - "type": "boolean", - "default": false - } - } - ] - }, - { - "name": "/manager/version/check", - "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api_controllers_manager_controller_get_available_updates", - "description": "Return the version of the API and the available updates", - "summary": "Get available updates", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "pretty", @@ -5196,7 +5366,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.mitre_controller.get_groups", "description": "Return the groups from MITRE database", "summary": "Get MITRE groups", - "tags": ["MITRE"], + "tags": [ + "MITRE" + ], "query": [ { "name": "distinct", @@ -5295,7 +5467,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.mitre_controller.get_metadata", "description": "Return the metadata from MITRE database", "summary": "Get MITRE metadata", - "tags": ["MITRE"], + "tags": [ + "MITRE" + ], "query": [ { "name": "pretty", @@ -5320,7 +5494,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.mitre_controller.get_mitigations", "description": "Return the mitigations from MITRE database", "summary": "Get MITRE mitigations", - "tags": ["MITRE"], + "tags": [ + "MITRE" + ], "query": [ { "name": "distinct", @@ -5419,7 +5595,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.mitre_controller.get_references", "description": "Return the references from MITRE database", "summary": "Get MITRE references", - "tags": ["MITRE"], + "tags": [ + "MITRE" + ], "query": [ { "name": "limit", @@ -5510,7 +5688,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.mitre_controller.get_software", "description": "Return the software from MITRE database", "summary": "Get MITRE software", - "tags": ["MITRE"], + "tags": [ + "MITRE" + ], "query": [ { "name": "distinct", @@ -5609,7 +5789,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.mitre_controller.get_tactics", "description": "Return the tactics from MITRE database", "summary": "Get MITRE tactics", - "tags": ["MITRE"], + "tags": [ + "MITRE" + ], "query": [ { "name": "distinct", @@ -5708,7 +5890,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.mitre_controller.get_techniques", "description": "Return the techniques from MITRE database", "summary": "Get MITRE techniques", - "tags": ["MITRE"], + "tags": [ + "MITRE" + ], "query": [ { "name": "distinct", @@ -5807,7 +5991,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.overview_controller.get_overview_agents", "description": "Return a dictionary with a full agents overview", "summary": "Get agents overview", - "tags": ["Overview"], + "tags": [ + "Overview" + ], "query": [ { "name": "pretty", @@ -5832,7 +6018,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.rootcheck_controller.get_rootcheck_agent", "description": "Return the rootcheck database of an agent", "summary": "Get results", - "tags": ["Rootcheck"], + "tags": [ + "Rootcheck" + ], "args": [ { "name": ":agent_id", @@ -5957,7 +6145,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.rootcheck_controller.get_last_scan_agent", "description": "Return the timestamp of the last rootcheck scan of an agent", "summary": "Get last scan datetime", - "tags": ["Rootcheck"], + "tags": [ + "Rootcheck" + ], "args": [ { "name": ":agent_id", @@ -5995,7 +6185,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.rule_controller.get_rules", "description": "Return a list containing information about each rule such as file where it's defined, description, rule group, status, etc", "summary": "List rules", - "tags": ["Rules"], + "tags": [ + "Rules" + ], "query": [ { "name": "distinct", @@ -6168,7 +6360,11 @@ "description": "Filter by list status. Use commas to enter multiple statuses", "schema": { "type": "string", - "enum": ["enabled", "disabled", "all"], + "enum": [ + "enabled", + "disabled", + "all" + ], "minItems": 1 } }, @@ -6195,7 +6391,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.rule_controller.get_rules_files", "description": "Return a list containing all files used to define rules and their status", "summary": "Get files", - "tags": ["Rules"], + "tags": [ + "Rules" + ], "query": [ { "name": "distinct", @@ -6292,7 +6490,11 @@ "description": "Filter by list status. Use commas to enter multiple statuses", "schema": { "type": "string", - "enum": ["enabled", "disabled", "all"], + "enum": [ + "enabled", + "disabled", + "all" + ], "minItems": 1 } }, @@ -6311,7 +6513,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.rule_controller.get_file", "description": "Get the content of a specified rule in the ruleset", "summary": "Get rules file content", - "tags": ["Rules"], + "tags": [ + "Rules" + ], "args": [ { "name": ":filename", @@ -6363,7 +6567,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.rule_controller.get_rules_groups", "description": "Return a list containing all rule groups names", "summary": "Get groups", - "tags": ["Rules"], + "tags": [ + "Rules" + ], "query": [ { "name": "limit", @@ -6425,7 +6631,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.rule_controller.get_rules_requirement", "description": "Return all specified requirement names defined in the Wazuh ruleset", "summary": "Get requirements", - "tags": ["Rules"], + "tags": [ + "Rules" + ], "args": [ { "name": ":requirement", @@ -6505,7 +6713,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.sca_controller.get_sca_agent", "description": "Return the security SCA database of an agent", "summary": "Get results", - "tags": ["SCA"], + "tags": [ + "SCA" + ], "args": [ { "name": ":agent_id", @@ -6628,7 +6838,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.sca_controller.get_sca_checks", "description": "Return the policy monitoring alerts for a given policy", "summary": "Get policy checks", - "tags": ["SCA"], + "tags": [ + "SCA" + ], "args": [ { "name": ":agent_id", @@ -6839,7 +7051,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.get_rbac_actions", "description": "Get all RBAC actions, including the potential related resources and endpoints.", "summary": "List RBAC actions", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "endpoint", @@ -6863,7 +7077,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.get_security_config", "description": "Return the security configuration in JSON format", "summary": "Get security config", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "pretty", @@ -6888,7 +7104,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.get_policies", "description": "Get all policies in the system, including the administrator policy", "summary": "List policies", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "distinct", @@ -6988,7 +7206,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.get_rbac_resources", "description": "This method should be called to get all current defined RBAC resources.", "summary": "List RBAC resources", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "pretty", @@ -7025,7 +7245,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.get_roles", "description": "For a specific list, indicate the ids separated by commas. Example: ?role_ids=1,2,3", "summary": "List roles", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "distinct", @@ -7125,7 +7347,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.get_rules", "description": "Get a list of security rules from the system or all of them. These rules must be mapped with roles to obtain certain access privileges. For a specific list, indicate the ids separated by commas. Example: ?rule_ids=1,2,3", "summary": "List security rules", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "distinct", @@ -7225,7 +7449,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.deprecated_login_user", "description": "This method should be called to get an API token. This token will expire after auth_token_exp_timeout seconds (default: 900). This value can be changed using PUT /security/config", "summary": "Login", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "raw", @@ -7242,7 +7468,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.get_users", "description": "Get the information of a specified user", "summary": "List users", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "distinct", @@ -7342,7 +7570,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.get_user_me", "description": "Get the information of the current user", "summary": "Get current user info", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "pretty", @@ -7367,7 +7597,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.get_user_me_policies", "description": "Get the processed policies information for the current user", "summary": "Get current user processed policies", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "pretty", @@ -7384,7 +7616,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.syscheck_controller.get_syscheck_agent", "description": "Return FIM findings in the specified agent", "summary": "Get results", - "tags": ["Syscheck"], + "tags": [ + "Syscheck" + ], "args": [ { "name": ":agent_id", @@ -7404,7 +7638,10 @@ "description": "Filter by architecture", "schema": { "type": "string", - "enum": ["[x32]", "[x64]"] + "enum": [ + "[x32]", + "[x64]" + ] } }, { @@ -7531,7 +7768,11 @@ "description": "Filter by file type. Registry_key and registry_value types are only available in Windows agents", "schema": { "type": "string", - "enum": ["file", "registry_key", "registry_value"] + "enum": [ + "file", + "registry_key", + "registry_value" + ] } }, { @@ -7565,7 +7806,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.syscheck_controller.get_last_scan_agent", "description": "Return when the last syscheck scan started and ended. If the scan is still in progress the end date will be unknown", "summary": "Get last scan datetime", - "tags": ["Syscheck"], + "tags": [ + "Syscheck" + ], "args": [ { "name": ":agent_id", @@ -7603,7 +7846,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.syscollector_controller.get_hardware_info", "description": "Return the agent's hardware info. This information include cpu, ram, scan info among others", "summary": "Get agent hardware", - "tags": ["Syscollector"], + "tags": [ + "Syscollector" + ], "args": [ { "name": ":agent_id", @@ -7652,7 +7897,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.syscollector_controller.get_hotfix_info", "description": "Return all hotfixes installed by Microsoft(R) in Windows(R) systems (KB... fixes)", "summary": "Get agent hotfixes", - "tags": ["Syscollector"], + "tags": [ + "Syscollector" + ], "args": [ { "name": ":agent_id", @@ -7760,7 +8007,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.syscollector_controller.get_network_address_info", "description": "Return the agent's network address info. This information include used IP protocol, interface, IP address among others", "summary": "Get agent netaddr", - "tags": ["Syscollector"], + "tags": [ + "Syscollector" + ], "args": [ { "name": ":agent_id", @@ -7901,7 +8150,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.syscollector_controller.get_network_interface_info", "description": "Return the agent's network interface info. This information include rx, scan, tx info and some network information among others", "summary": "Get agent netiface", - "tags": ["Syscollector"], + "tags": [ + "Syscollector" + ], "args": [ { "name": ":agent_id", @@ -8114,7 +8365,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.syscollector_controller.get_network_protocol_info", "description": "Return the agent's routing configuration for each network interface", "summary": "Get agent netproto", - "tags": ["Syscollector"], + "tags": [ + "Syscollector" + ], "args": [ { "name": ":agent_id", @@ -8135,15 +8388,12 @@ "schema": { "type": "string", "description": "DHCP status", - "enum": ["enabled", "disabled", "unknown", "BOOTP"] - } - }, - { - "name": "distinct", - "description": "Look for distinct values.", - "schema": { - "type": "boolean", - "default": false + "enum": [ + "enabled", + "disabled", + "unknown", + "BOOTP" + ] } }, { @@ -8256,7 +8506,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.syscollector_controller.get_os_info", "description": "Return the agent's OS info. This information include os information, architecture information among others of all agents", "summary": "Get agent OS", - "tags": ["Syscollector"], + "tags": [ + "Syscollector" + ], "args": [ { "name": ":agent_id", @@ -8305,7 +8557,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.syscollector_controller.get_packages_info", "description": "Return the agent's packages info. This information include name, section, size, priority information of all packages among others", "summary": "Get agent packages", - "tags": ["Syscollector"], + "tags": [ + "Syscollector" + ], "args": [ { "name": ":agent_id", @@ -8444,7 +8698,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.syscollector_controller.get_ports_info", "description": "Return the agent's ports info. This information include local IP, Remote IP, protocol information among others", "summary": "Get agent ports", - "tags": ["Syscollector"], + "tags": [ + "Syscollector" + ], "args": [ { "name": ":agent_id", @@ -8609,7 +8865,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.syscollector_controller.get_processes_info", "description": "Return the agent's processes info", "summary": "Get agent processes", - "tags": ["Syscollector"], + "tags": [ + "Syscollector" + ], "args": [ { "name": ":agent_id", @@ -8822,7 +9080,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.task_controller.get_tasks_status", "description": "Returns all available information about the specified tasks", "summary": "List tasks", - "tags": ["Tasks"], + "tags": [ + "Tasks" + ], "query": [ { "name": "agents_list", @@ -8959,7 +9219,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.vulnerability_controller.get_vulnerability_agent", "description": "Return the vulnerabilities of an agent", "summary": "Get vulnerabilities", - "tags": ["Vulnerability"], + "tags": [ + "Vulnerability" + ], "args": [ { "name": ":agent_id", @@ -9082,7 +9344,11 @@ "description": "Filter by CVE status", "schema": { "type": "string", - "enum": ["valid", "pending", "obsolete"] + "enum": [ + "valid", + "pending", + "obsolete" + ] } }, { @@ -9090,7 +9356,10 @@ "description": "Filter by CVE type", "schema": { "type": "string", - "enum": ["os", "package"] + "enum": [ + "os", + "package" + ] } }, { @@ -9116,7 +9385,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.vulnerability_controller.get_last_scan_agent", "description": "Return when the last full and partial vulnerability scan of a specified agent ended.", "summary": "Get last scan datetime", - "tags": ["Vulnerability"], + "tags": [ + "Vulnerability" + ], "args": [ { "name": ":agent_id", @@ -9154,7 +9425,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.vulnerability_controller.get_vulnerabilities_field_summary", "description": "Return a summary of the vulnerabilities' field of an agent", "summary": "Get agent vulnerabilities' field summary", - "tags": ["Vulnerability"], + "tags": [ + "Vulnerability" + ], "args": [ { "name": ":agent_id", @@ -9233,7 +9506,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.active_response_controller.run_command", "description": "Run an Active Response command on all agents or a list of them", "summary": "Run command", - "tags": ["Active-response"], + "tags": [ + "Active-response" + ], "query": [ { "name": "agents_list", @@ -9291,7 +9566,9 @@ } } }, - "required": ["command"] + "required": [ + "command" + ] } ] }, @@ -9300,7 +9577,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.put_agent_single_group", "description": "Assign an agent to a specified group", "summary": "Assign agent to group", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "args": [ { "name": ":agent_id", @@ -9355,7 +9634,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.restart_agent", "description": "Restart the specified agent", "summary": "Restart agent", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "args": [ { "name": ":agent_id", @@ -9393,7 +9674,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.put_multiple_agent_single_group", "description": "Assign all agents or a list of them to the specified group", "summary": "Assign agents to group", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "agents_list", @@ -9448,7 +9731,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.restart_agents_by_group", "description": "Restart all agents which belong to a given group", "summary": "Restart agents in group", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "args": [ { "name": ":group_id", @@ -9485,7 +9770,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.restart_agents_by_node", "description": "Restart all agents which belong to a specific given node", "summary": "Restart agents in node", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "args": [ { "name": ":node_id", @@ -9521,7 +9808,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.reconnect_agents", "description": "Force reconnect all agents or a list of them", "summary": "Force reconnect agents", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "agents_list", @@ -9559,7 +9848,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.restart_agents", "description": "Restart all agents or a list of them", "summary": "Restart agents", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "agents_list", @@ -9597,7 +9888,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.put_upgrade_agents", "description": "Upgrade agents using a WPK file from online repository. When upgrading more than 3000 agents at the same time, it's highly recommended to use the parameter `wait_for_complete` set to `true` to avoid a possible API timeout", "summary": "Upgrade agents", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "agents_list", @@ -9756,7 +10049,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.put_upgrade_custom_agents", "description": "Upgrade the agents using a local WPK file. When upgrading more than 3000 agents at the same time, it's highly recommended to use the parameter `wait_for_complete` set to `true` to avoid a possible API timeout", "summary": "Upgrade agents custom", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "agents_list", @@ -9900,7 +10195,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.update_configuration", "description": "Replace wazuh configuration for the given node with the data contained in the API request", "summary": "Update node configuration", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "args": [ { "name": ":node_id", @@ -9936,7 +10233,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cluster_controller.put_restart", "description": "Restart all nodes in the cluster or a list of them", "summary": "Restart nodes", - "tags": ["Cluster"], + "tags": [ + "Cluster" + ], "query": [ { "name": "nodes_list", @@ -9971,7 +10270,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.decoder_controller.put_file", "description": "Upload or replace a user decoder file content", "summary": "Update decoders file", - "tags": ["Decoders"], + "tags": [ + "Decoders" + ], "args": [ { "name": ":filename", @@ -10023,7 +10324,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.put_group_config", "description": "Update an specified group's configuration. This API call expects a full valid XML file with the shared configuration tags/syntax", "summary": "Update group configuration", - "tags": ["Groups"], + "tags": [ + "Groups" + ], "args": [ { "name": ":group_id", @@ -10060,7 +10363,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cdb_list_controller.put_file", "description": "Replace or upload a CDB list file with the data contained in the API request", "summary": "Update CDB list file", - "tags": ["Lists"], + "tags": [ + "Lists" + ], "args": [ { "name": ":filename", @@ -10104,7 +10409,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.logtest_controller.run_logtest_tool", "description": "Run logtest tool to check if a specified log raises any alert among other information", "summary": "Run logtest", - "tags": ["Logtest"], + "tags": [ + "Logtest" + ], "query": [ { "name": "pretty", @@ -10126,7 +10433,11 @@ "body": [ { "type": "object", - "required": ["event", "log_format", "location"], + "required": [ + "event", + "log_format", + "location" + ], "properties": { "token": { "type": "string", @@ -10153,7 +10464,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.update_configuration", "description": "Replace Wazuh configuration with the data contained in the API request", "summary": "Update Wazuh configuration", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "pretty", @@ -10178,7 +10491,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.manager_controller.put_restart", "description": "Restart the wazuh manager", "summary": "Restart manager", - "tags": ["Manager"], + "tags": [ + "Manager" + ], "query": [ { "name": "pretty", @@ -10203,7 +10518,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.rootcheck_controller.put_rootcheck", "description": "Run rootcheck scan in all agents or a list of them", "summary": "Run scan", - "tags": ["Rootcheck"], + "tags": [ + "Rootcheck" + ], "query": [ { "name": "agents_list", @@ -10241,7 +10558,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.rule_controller.put_file", "description": "Upload or replace a user ruleset file content", "summary": "Update rules file", - "tags": ["Rules"], + "tags": [ + "Rules" + ], "args": [ { "name": ":filename", @@ -10293,7 +10612,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.put_security_config", "description": "Update the security configuration with the data contained in the API request", "summary": "Update security config", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "pretty", @@ -10327,7 +10648,10 @@ "rbac_mode": { "description": "RBAC mode (white/black)", "type": "string", - "enum": ["white", "black"], + "enum": [ + "white", + "black" + ], "example": "white" } } @@ -10339,7 +10663,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.update_policy", "description": "Modify a policy, at least one property must be indicated", "summary": "Update policy", - "tags": ["Security"], + "tags": [ + "Security" + ], "args": [ { "name": ":policy_id", @@ -10403,7 +10729,11 @@ "description": "Effect of the policy" } }, - "required": ["actions", "resources", "effect"] + "required": [ + "actions", + "resources", + "effect" + ] } } } @@ -10414,7 +10744,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.update_role", "description": "Modify a role, cannot modify associated policies in this endpoint, at least one property must be indicated", "summary": "Update role", - "tags": ["Security"], + "tags": [ + "Security" + ], "args": [ { "name": ":role_id", @@ -10464,7 +10796,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.update_rule", "description": "Modify a security rule by specifying its ID", "summary": "Update security rule", - "tags": ["Security"], + "tags": [ + "Security" + ], "args": [ { "name": ":rule_id", @@ -10518,14 +10852,18 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.revoke_all_tokens", "description": "This method should be called to revoke all active JWT tokens", "summary": "Revoke JWT tokens", - "tags": ["Security"] + "tags": [ + "Security" + ] }, { "name": "/security/users/:user_id", "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.update_user", "description": "Modify a user's password by specifying their ID", "summary": "Update users", - "tags": ["Security"], + "tags": [ + "Security" + ], "args": [ { "name": ":user_id", @@ -10573,7 +10911,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.edit_run_as", "description": "Modify a user's allow_run_as flag by specifying their ID", "summary": "Enable/Disable run_as", - "tags": ["Security"], + "tags": [ + "Security" + ], "args": [ { "name": ":user_id", @@ -10618,7 +10958,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.syscheck_controller.put_syscheck", "description": "Run FIM scan in all agents", "summary": "Run scan", - "tags": ["Syscheck"], + "tags": [ + "Syscheck" + ], "query": [ { "name": "agents_list", @@ -10656,7 +10998,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.vulnerability_controller.run_vulnerability_scan", "description": "Run a vulnerability detector scan in all nodes", "summary": "Run vulnerability detector scan", - "tags": ["Vulnerability"], + "tags": [ + "Vulnerability" + ], "query": [ { "name": "pretty", @@ -10686,7 +11030,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.add_agent", "description": "Add a new agent", "summary": "Add agent", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "pretty", @@ -10720,7 +11066,9 @@ "format": "alphanumeric" } }, - "required": ["name"] + "required": [ + "name" + ] } ] }, @@ -10729,7 +11077,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.insert_agent", "description": "Add an agent specifying its name, ID and IP. If an agent with the same name, the same ID or the same IP already exists, replace it using the `force` parameter", "summary": "Add agent full", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "pretty", @@ -10809,7 +11159,9 @@ } } }, - "required": ["name"] + "required": [ + "name" + ] } ] }, @@ -10818,7 +11170,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.post_new_agent", "description": "Add a new agent with name `agent_name`. This agent will use `any` as IP", "summary": "Add agent quick", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "agent_name", @@ -10853,7 +11207,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.event_controller.forward_event", "description": "Send security events to analysisd.\n\nThe endpoint is limited to receiving a max of 30 requests per minute and a max bulk size of 100 events per request.", "summary": "Ingest events", - "tags": ["Events"], + "tags": [ + "Events" + ], "query": [ { "name": "pretty", @@ -10884,7 +11240,9 @@ } } }, - "required": ["events"] + "required": [ + "events" + ] } ] }, @@ -10893,7 +11251,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.post_group", "description": "Create a new group", "summary": "Create a group", - "tags": ["Groups"], + "tags": [ + "Groups" + ], "query": [ { "name": "pretty", @@ -10923,7 +11283,9 @@ "maxLength": 128 } }, - "required": ["group_id"] + "required": [ + "group_id" + ] } ] }, @@ -10932,7 +11294,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.add_policy", "description": "Add a new policy, all fields need to be specified", "summary": "Add policy", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "pretty", @@ -10954,7 +11318,10 @@ "body": [ { "type": "object", - "required": ["name", "policy"], + "required": [ + "name", + "policy" + ], "properties": { "name": { "description": "Policy name", @@ -10985,7 +11352,11 @@ "description": "Effect of the policy" } }, - "required": ["actions", "resources", "effect"] + "required": [ + "actions", + "resources", + "effect" + ] } } } @@ -10996,7 +11367,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.add_role", "description": "Add a new role, all fields need to be specified", "summary": "Add role", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "pretty", @@ -11018,7 +11391,9 @@ "body": [ { "type": "object", - "required": ["name"], + "required": [ + "name" + ], "properties": { "name": { "type": "string", @@ -11035,7 +11410,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.set_role_policy", "description": "Create a specified relation role-policy, one role may have multiples policies", "summary": "Add policies to role", - "tags": ["Security"], + "tags": [ + "Security" + ], "args": [ { "name": ":role_id", @@ -11094,7 +11471,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.set_role_rule", "description": "Create a specific role-rule relation. One role may have multiple security rules", "summary": "Add security rules to role", - "tags": ["Security"], + "tags": [ + "Security" + ], "args": [ { "name": ":role_id", @@ -11144,7 +11523,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.add_rule", "description": "Add a new security rule", "summary": "Add security rule", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "pretty", @@ -11166,7 +11547,10 @@ "body": [ { "type": "object", - "required": ["name", "rule"], + "required": [ + "name", + "rule" + ], "properties": { "name": { "type": "string", @@ -11187,7 +11571,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.login_user", "description": "This method should be called to get an API token. This token will expire after auth_token_exp_timeout seconds (default: 900). This value can be changed using PUT /security/config", "summary": "Login", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "raw", @@ -11204,7 +11590,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.run_as_login", "description": "This method should be called to get an API token using an authorization context body. This token will expire after auth_token_exp_timeout seconds (default: 900). This value can be changed using PUT /security/config", "summary": "Login auth_context", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "raw", @@ -11221,7 +11609,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.create_user", "description": "Add a new API user to the system", "summary": "Add user", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "pretty", @@ -11255,7 +11645,10 @@ "format": "password" } }, - "required": ["username", "password"] + "required": [ + "username", + "password" + ] } ] }, @@ -11264,7 +11657,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.set_user_role", "description": "Create a specified relation role-policy, one user may have multiples roles", "summary": "Add roles to user", - "tags": ["Security"], + "tags": [ + "Security" + ], "args": [ { "name": ":user_id", @@ -11328,7 +11723,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.delete_agents", "description": "Delete all agents or a list of them based on optional criteria", "summary": "Delete agents", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "agents_list", @@ -11491,7 +11888,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.delete_single_agent_multiple_groups", "description": "Remove the agent from all groups or a list of them. The agent will automatically revert to the default group if it is removed from all its assigned groups", "summary": "Remove agent from groups", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "args": [ { "name": ":agent_id", @@ -11541,7 +11940,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.delete_single_agent_single_group", "description": "Remove an agent from a specified group. If the agent belongs to several groups, only the specified group will be deleted.", "summary": "Remove agent from group", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "args": [ { "name": ":agent_id", @@ -11589,7 +11990,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.delete_multiple_agent_single_group", "description": "Remove all agents assignment or a list of them from the specified group", "summary": "Remove agents from group", - "tags": ["Agents"], + "tags": [ + "Agents" + ], "query": [ { "name": "agents_list", @@ -11638,7 +12041,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.decoder_controller.delete_file", "description": "Delete a specified decoder file", "summary": "Delete decoders file", - "tags": ["Decoders"], + "tags": [ + "Decoders" + ], "args": [ { "name": ":filename", @@ -11682,7 +12087,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.experimental_controller.clear_rootcheck_database", "description": "Clear rootcheck database for all agents or a list of them", "summary": "Clear rootcheck results", - "tags": ["Experimental"], + "tags": [ + "Experimental" + ], "query": [ { "name": "agents_list", @@ -11721,7 +12128,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.experimental_controller.clear_syscheck_database", "description": "Clear the syscheck database for all agents or a list of them", "summary": "Clear agents FIM results", - "tags": ["Experimental"], + "tags": [ + "Experimental" + ], "query": [ { "name": "agents_list", @@ -11760,7 +12169,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.agent_controller.delete_groups", "description": "Delete all groups or a list of them", "summary": "Delete groups", - "tags": ["Groups"], + "tags": [ + "Groups" + ], "query": [ { "name": "groups_list", @@ -11799,7 +12210,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.cdb_list_controller.delete_file", "description": "Delete a specified CDB list file. Only the filename can be specified. It will be searched recursively if not found", "summary": "Delete CDB list file", - "tags": ["Lists"], + "tags": [ + "Lists" + ], "args": [ { "name": ":filename", @@ -11835,7 +12248,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.logtest_controller.end_logtest_session", "description": "Delete the saved logtest session corresponding to {token}", "summary": "End session", - "tags": ["Logtest"], + "tags": [ + "Logtest" + ], "args": [ { "name": ":token", @@ -11871,7 +12286,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.rootcheck_controller.delete_rootcheck", "description": "Clear an agent's rootcheck database", "summary": "Clear results", - "tags": ["Rootcheck"], + "tags": [ + "Rootcheck" + ], "args": [ { "name": ":agent_id", @@ -11909,7 +12326,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.rule_controller.delete_file", "description": "Delete a specified rule file", "summary": "Delete rules file", - "tags": ["Rules"], + "tags": [ + "Rules" + ], "args": [ { "name": ":filename", @@ -11953,7 +12372,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.delete_security_config", "description": "Replaces the security configuration with the original one", "summary": "Restore default security config", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "pretty", @@ -11978,7 +12399,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.remove_policies", "description": "Delete a list of policies or all policies in the system, roles linked to policies are not going to be removed", "summary": "Delete policies", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "policy_ids", @@ -12016,7 +12439,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.remove_roles", "description": "Policies linked to roles are not going to be removed", "summary": "Delete roles", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "pretty", @@ -12054,7 +12479,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.remove_role_policy", "description": "Delete a specified relation role-policy", "summary": "Remove policies from role", - "tags": ["Security"], + "tags": [ + "Security" + ], "args": [ { "name": ":role_id", @@ -12104,7 +12531,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.remove_role_rule", "description": "Delete a specific role-rule relation", "summary": "Remove security rules from role", - "tags": ["Security"], + "tags": [ + "Security" + ], "args": [ { "name": ":role_id", @@ -12154,7 +12583,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.remove_rules", "description": "Delete a list of security rules or all security rules in the system, roles linked to rules are not going to be deleted", "summary": "Delete security rules", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "pretty", @@ -12192,14 +12623,18 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.logout_user", "description": "This method should be called to invalidate all the current user's tokens", "summary": "Logout current user", - "tags": ["Security"] + "tags": [ + "Security" + ] }, { "name": "/security/users", "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.delete_users", "description": "Delete a list of users by specifying their IDs", "summary": "Delete users", - "tags": ["Security"], + "tags": [ + "Security" + ], "query": [ { "name": "pretty", @@ -12237,7 +12672,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.security_controller.remove_user_role", "description": "Delete a specified relation user-roles", "summary": "Remove roles from user", - "tags": ["Security"], + "tags": [ + "Security" + ], "args": [ { "name": ":user_id", @@ -12287,7 +12724,9 @@ "documentation": "https://documentation.wazuh.com/4.8/user-manual/api/reference.html#operation/api.controllers.syscheck_controller.delete_syscheck_agent", "description": "Clear file integrity monitoring scan results for a specified agent. Only available for agents < 3.12.0, it doesn't apply for more recent ones", "summary": "Clear results", - "tags": ["Syscheck"], + "tags": [ + "Syscheck" + ], "args": [ { "name": ":agent_id", @@ -12322,4 +12761,4 @@ } ] } -] +] \ No newline at end of file diff --git a/plugins/main/common/api-info/security-actions.json b/plugins/main/common/api-info/security-actions.json index 418600f6c4..37d13fe040 100644 --- a/plugins/main/common/api-info/security-actions.json +++ b/plugins/main/common/api-info/security-actions.json @@ -1,30 +1,57 @@ { "active-response:command": { "description": "Execute active response commands in the agents", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["active-response:command"], - "resources": ["agent:id:001", "agent:group:atlantic"], + "actions": [ + "active-response:command" + ], + "resources": [ + "agent:id:001", + "agent:group:atlantic" + ], "effect": "allow" }, - "related_endpoints": ["PUT /active-response"] + "related_endpoints": [ + "PUT /active-response" + ] }, "agent:delete": { "description": "Delete agents", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["agent:delete"], - "resources": ["agent:id:010", "agent:group:pacific"], + "actions": [ + "agent:delete" + ], + "resources": [ + "agent:id:010", + "agent:group:pacific" + ], "effect": "allow" }, - "related_endpoints": ["DELETE /agents"] + "related_endpoints": [ + "DELETE /agents" + ] }, "agent:read": { "description": "Access agents information (id, name, group, last keep alive, etc)", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["agent:read"], - "resources": ["agent:id:*"], + "actions": [ + "agent:read" + ], + "resources": [ + "agent:id:*" + ], "effect": "allow" }, "related_endpoints": [ @@ -45,20 +72,38 @@ }, "agent:create": { "description": "Create new agents", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["agent:create"], - "resources": ["*:*:*"], + "actions": [ + "agent:create" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, - "related_endpoints": ["POST /agents", "POST /agents/insert", "POST /agents/insert/quick"] + "related_endpoints": [ + "POST /agents", + "POST /agents/insert", + "POST /agents/insert/quick" + ] }, "agent:modify_group": { "description": "Change the group of agents", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["agent:modify_group"], - "resources": ["agent:id:004", "agent:group:us-east"], + "actions": [ + "agent:modify_group" + ], + "resources": [ + "agent:id:004", + "agent:group:us-east" + ], "effect": "allow" }, "related_endpoints": [ @@ -71,10 +116,16 @@ }, "group:modify_assignments": { "description": "Change the agents assigned to the group", - "resources": ["group:id"], + "resources": [ + "group:id" + ], "example": { - "actions": ["group:modify_assignments"], - "resources": ["group:id:*"], + "actions": [ + "group:modify_assignments" + ], + "resources": [ + "group:id:*" + ], "effect": "allow" }, "related_endpoints": [ @@ -87,10 +138,18 @@ }, "agent:restart": { "description": "Restart agents", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["agent:restart"], - "resources": ["agent:id:050", "agent:id:049"], + "actions": [ + "agent:restart" + ], + "resources": [ + "agent:id:050", + "agent:id:049" + ], "effect": "deny" }, "related_endpoints": [ @@ -102,10 +161,18 @@ }, "agent:upgrade": { "description": "Upgrade the version of the agents", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["agent:upgrade"], - "resources": ["agent:id:001", "agent:group:mediterranean"], + "actions": [ + "agent:upgrade" + ], + "resources": [ + "agent:id:001", + "agent:group:mediterranean" + ], "effect": "allow" }, "related_endpoints": [ @@ -116,20 +183,34 @@ }, "group:delete": { "description": "Delete agent groups", - "resources": ["group:id"], + "resources": [ + "group:id" + ], "example": { - "actions": ["group:delete"], - "resources": ["group:id:*"], + "actions": [ + "group:delete" + ], + "resources": [ + "group:id:*" + ], "effect": "allow" }, - "related_endpoints": ["DELETE /groups"] + "related_endpoints": [ + "DELETE /groups" + ] }, "group:read": { "description": "Access agent groups information (id, name, agents, etc)", - "resources": ["group:id"], + "resources": [ + "group:id" + ], "example": { - "actions": ["group:create"], - "resources": ["group:id:*"], + "actions": [ + "group:create" + ], + "resources": [ + "group:id:*" + ], "effect": "allow" }, "related_endpoints": [ @@ -144,30 +225,53 @@ }, "group:create": { "description": "Create new agent groups", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["group:create"], - "resources": ["*:*:*"], + "actions": [ + "group:create" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, - "related_endpoints": ["POST /groups"] + "related_endpoints": [ + "POST /groups" + ] }, "group:update_config": { "description": "Change the configuration of agent groups", - "resources": ["group:id"], + "resources": [ + "group:id" + ], "example": { - "actions": ["group:update_config"], - "resources": ["group:id:*"], + "actions": [ + "group:update_config" + ], + "resources": [ + "group:id:*" + ], "effect": "deny" }, - "related_endpoints": ["PUT /groups/{group_id}/configuration"] + "related_endpoints": [ + "PUT /groups/{group_id}/configuration" + ] }, "cluster:read": { "description": "Read Wazuh's cluster nodes configuration", - "resources": ["node:id"], + "resources": [ + "node:id" + ], "example": { - "actions": ["cluster:read"], - "resources": ["node:id:worker1", "node:id:worker3"], + "actions": [ + "cluster:read" + ], + "resources": [ + "node:id:worker1", + "node:id:worker3" + ], "effect": "deny" }, "related_endpoints": [ @@ -195,110 +299,207 @@ }, "agent:reconnect": { "description": "Force reconnect agents", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["agent:reconnect"], - "resources": ["agent:id:050", "agent:id:049"], + "actions": [ + "agent:reconnect" + ], + "resources": [ + "agent:id:050", + "agent:id:049" + ], "effect": "deny" }, - "related_endpoints": ["PUT /agents/reconnect"] + "related_endpoints": [ + "PUT /agents/reconnect" + ] }, "ciscat:read": { "description": "Access CIS-CAT results for agents", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["ciscat:read"], - "resources": ["agent:id:001", "agent:id:003", "agent:group:default"], + "actions": [ + "ciscat:read" + ], + "resources": [ + "agent:id:001", + "agent:id:003", + "agent:group:default" + ], "effect": "deny" }, - "related_endpoints": ["GET /ciscat/{agent_id}/results", "GET /experimental/ciscat/results"] + "related_endpoints": [ + "GET /ciscat/{agent_id}/results", + "GET /experimental/ciscat/results" + ] }, "cluster:status": { "description": "Check Wazuh's cluster general status", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["cluster:status"], - "resources": ["*:*:*"], + "actions": [ + "cluster:status" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, - "related_endpoints": ["GET /cluster/status"] + "related_endpoints": [ + "GET /cluster/status" + ] }, "cluster:read_api_config": { "description": "Check Wazuh's cluster nodes API configuration", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["cluster:read_api_config"], - "resources": ["node:id:worker1", "node:id:worker3"], + "actions": [ + "cluster:read_api_config" + ], + "resources": [ + "node:id:worker1", + "node:id:worker3" + ], "effect": "allow" }, - "related_endpoints": ["GET /cluster/api/config"] + "related_endpoints": [ + "GET /cluster/api/config" + ] }, "cluster:update_config": { "description": "Change the Wazuh's cluster node configuration", - "resources": ["node:id"], + "resources": [ + "node:id" + ], "example": { - "actions": ["cluster:update_config"], - "resources": ["node:id:worker1"], + "actions": [ + "cluster:update_config" + ], + "resources": [ + "node:id:worker1" + ], "effect": "allow" }, - "related_endpoints": ["PUT /cluster/{node_id}/configuration"] + "related_endpoints": [ + "PUT /cluster/{node_id}/configuration" + ] }, "cluster:restart": { "description": "Restart Wazuh's cluster nodes", - "resources": ["node:id"], + "resources": [ + "node:id" + ], "example": { - "actions": ["cluster:restart"], - "resources": ["node:id:worker1"], + "actions": [ + "cluster:restart" + ], + "resources": [ + "node:id:worker1" + ], "effect": "allow" }, - "related_endpoints": ["PUT /cluster/restart"] + "related_endpoints": [ + "PUT /cluster/restart" + ] }, "lists:read": { "description": "Read cdb lists files", - "resources": ["list:file"], + "resources": [ + "list:file" + ], "example": { - "actions": ["lists:read"], - "resources": ["list:file:audit-keys"], + "actions": [ + "lists:read" + ], + "resources": [ + "list:file:audit-keys" + ], "effect": "deny" }, - "related_endpoints": ["GET /lists", "GET /lists/files/{filename}", "GET /lists/files"] + "related_endpoints": [ + "GET /lists", + "GET /lists/files/{filename}", + "GET /lists/files" + ] }, "lists:update": { "description": "Update or upload cdb lists files", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["lists:update"], - "resources": ["*:*:*"], + "actions": [ + "lists:update" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, - "related_endpoints": ["PUT /lists/files/{filename}"] + "related_endpoints": [ + "PUT /lists/files/{filename}" + ] }, "lists:delete": { "description": "Delete cdb lists files", - "resources": ["list:file"], + "resources": [ + "list:file" + ], "example": { - "actions": ["lists:delete"], - "resources": ["list:file:audit-keys"], + "actions": [ + "lists:delete" + ], + "resources": [ + "list:file:audit-keys" + ], "effect": "deny" }, - "related_endpoints": ["PUT /lists/files/{filename}", "DELETE /lists/files/{filename}"] + "related_endpoints": [ + "PUT /lists/files/{filename}", + "DELETE /lists/files/{filename}" + ] }, "logtest:run": { "description": "Run logtest tool or end a logtest session", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["logtest:run"], - "resources": ["*:*:*"], + "actions": [ + "logtest:run" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, - "related_endpoints": ["PUT /logtest", "DELETE /logtest/sessions/{token}"] + "related_endpoints": [ + "PUT /logtest", + "DELETE /logtest/sessions/{token}" + ] }, "manager:read": { "description": "Read Wazuh manager configuration", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["manager:read"], - "resources": ["*:*:*"], + "actions": [ + "manager:read" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, "related_endpoints": [ @@ -315,46 +516,75 @@ "GET /manager/logs/summary", "PUT /manager/restart", "GET /manager/configuration/validation", - "GET /manager/configuration/{component}/{configuration}", - "GET /manager/version/check" + "GET /manager/configuration/{component}/{configuration}" ] }, "manager:update_config": { "description": "Update current Wazuh manager configuration", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["manager:update_config"], - "resources": ["*:*:*"], + "actions": [ + "manager:update_config" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, - "related_endpoints": ["PUT /manager/configuration"] + "related_endpoints": [ + "PUT /manager/configuration" + ] }, "manager:read_api_config": { "description": "Read Wazuh manager API configuration", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["manager:read_api_config"], - "resources": ["*:*:*"], + "actions": [ + "manager:read_api_config" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, - "related_endpoints": ["GET /manager/api/config"] + "related_endpoints": [ + "GET /manager/api/config" + ] }, "manager:restart": { "description": "Restart Wazuh managers", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["manager:restart"], - "resources": ["*:*:*"], + "actions": [ + "manager:restart" + ], + "resources": [ + "*:*:*" + ], "effect": "deny" }, - "related_endpoints": ["PUT /manager/restart"] + "related_endpoints": [ + "PUT /manager/restart" + ] }, "mitre:read": { "description": "Access information from MITRE database", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["mitre:read"], - "resources": ["*:*:*"], + "actions": [ + "mitre:read" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, "related_endpoints": [ @@ -369,40 +599,75 @@ }, "rootcheck:run": { "description": "Run agents rootcheck scan", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["rootcheck:run"], - "resources": ["agent:id:*"], + "actions": [ + "rootcheck:run" + ], + "resources": [ + "agent:id:*" + ], "effect": "allow" }, - "related_endpoints": ["PUT /rootcheck"] + "related_endpoints": [ + "PUT /rootcheck" + ] }, "rootcheck:read": { "description": "Access information from agents rootcheck database", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["rootcheck:read"], - "resources": ["agent:id:011"], + "actions": [ + "rootcheck:read" + ], + "resources": [ + "agent:id:011" + ], "effect": "allow" }, - "related_endpoints": ["GET /rootcheck/{agent_id}", "GET /rootcheck/{agent_id}/last_scan"] + "related_endpoints": [ + "GET /rootcheck/{agent_id}", + "GET /rootcheck/{agent_id}/last_scan" + ] }, "rootcheck:clear": { "description": "Clear the agents rootcheck database", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["rootcheck:clear"], - "resources": ["agent:id:*"], + "actions": [ + "rootcheck:clear" + ], + "resources": [ + "agent:id:*" + ], "effect": "deny" }, - "related_endpoints": ["DELETE /rootcheck/{agent_id}", "DELETE /experimental/rootcheck"] + "related_endpoints": [ + "DELETE /rootcheck/{agent_id}", + "DELETE /experimental/rootcheck" + ] }, "rules:read": { "description": "Read rules files", - "resources": ["rule:file"], + "resources": [ + "rule:file" + ], "example": { - "actions": ["rules:read"], - "resources": ["rule:file:0610-win-ms_logs_rules.xml"], + "actions": [ + "rules:read" + ], + "resources": [ + "rule:file:0610-win-ms_logs_rules.xml" + ], "effect": "allow" }, "related_endpoints": [ @@ -415,70 +680,133 @@ }, "rules:update": { "description": "Update or upload custom rule files", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["rules:update"], - "resources": ["*:*:*"], + "actions": [ + "rules:update" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, - "related_endpoints": ["PUT /rules/files/{filename}"] + "related_endpoints": [ + "PUT /rules/files/{filename}" + ] }, "rules:delete": { "description": "Delete custom rule files", - "resources": ["rule:file"], + "resources": [ + "rule:file" + ], "example": { - "actions": ["rules:delete"], - "resources": ["rule:file:0610-win-ms_logs_rules.xml"], + "actions": [ + "rules:delete" + ], + "resources": [ + "rule:file:0610-win-ms_logs_rules.xml" + ], "effect": "allow" }, - "related_endpoints": ["PUT /rules/files/{filename}", "DELETE /rules/files/{filename}"] + "related_endpoints": [ + "PUT /rules/files/{filename}", + "DELETE /rules/files/{filename}" + ] }, "sca:read": { "description": "Access agents security configuration assessment", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["sca:read"], - "resources": ["agent:id:*"], + "actions": [ + "sca:read" + ], + "resources": [ + "agent:id:*" + ], "effect": "allow" }, - "related_endpoints": ["GET /sca/{agent_id}", "GET /sca/{agent_id}/checks/{policy_id}"] + "related_endpoints": [ + "GET /sca/{agent_id}", + "GET /sca/{agent_id}/checks/{policy_id}" + ] }, "syscheck:run": { "description": "Run agents syscheck scan", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["syscheck:run"], - "resources": ["agent:id:*"], + "actions": [ + "syscheck:run" + ], + "resources": [ + "agent:id:*" + ], "effect": "allow" }, - "related_endpoints": ["PUT /syscheck"] + "related_endpoints": [ + "PUT /syscheck" + ] }, "syscheck:read": { "description": "Access information from agents syscheck database", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["syscheck:read"], - "resources": ["agent:id:011", "agent:group:us-west"], + "actions": [ + "syscheck:read" + ], + "resources": [ + "agent:id:011", + "agent:group:us-west" + ], "effect": "allow" }, - "related_endpoints": ["GET /syscheck/{agent_id}", "GET /syscheck/{agent_id}/last_scan"] + "related_endpoints": [ + "GET /syscheck/{agent_id}", + "GET /syscheck/{agent_id}/last_scan" + ] }, "syscheck:clear": { "description": "Clear the agents syscheck database", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["syscheck:clear"], - "resources": ["agent:id:*"], + "actions": [ + "syscheck:clear" + ], + "resources": [ + "agent:id:*" + ], "effect": "deny" }, - "related_endpoints": ["DELETE /syscheck/{agent_id}", "DELETE /experimental/syscheck"] + "related_endpoints": [ + "DELETE /syscheck/{agent_id}", + "DELETE /experimental/syscheck" + ] }, "decoders:read": { "description": "Read decoders files", - "resources": ["decoder:file"], + "resources": [ + "decoder:file" + ], "example": { - "actions": ["decoders:read"], - "resources": ["decoder:file:*"], + "actions": [ + "decoders:read" + ], + "resources": [ + "decoder:file:*" + ], "effect": "allow" }, "related_endpoints": [ @@ -490,30 +818,54 @@ }, "decoders:update": { "description": "Update or upload custom decoder files", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["decoders:update"], - "resources": ["*:*:*"], + "actions": [ + "decoders:update" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, - "related_endpoints": ["PUT /decoders/files/{filename}"] + "related_endpoints": [ + "PUT /decoders/files/{filename}" + ] }, "decoders:delete": { "description": "Delete custom decoder files", - "resources": ["decoder:file"], + "resources": [ + "decoder:file" + ], "example": { - "actions": ["decoders:delete"], - "resources": ["decoder:file:local_decoder.xml"], + "actions": [ + "decoders:delete" + ], + "resources": [ + "decoder:file:local_decoder.xml" + ], "effect": "allow" }, - "related_endpoints": ["PUT /decoders/files/{filename}", "DELETE /decoders/files/{filename}"] + "related_endpoints": [ + "PUT /decoders/files/{filename}", + "DELETE /decoders/files/{filename}" + ] }, "syscollector:read": { "description": "Access agents syscollector information", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["syscollector:read"], - "resources": ["agent:id:*"], + "actions": [ + "syscollector:read" + ], + "resources": [ + "agent:id:*" + ], "effect": "allow" }, "related_endpoints": [ @@ -539,20 +891,40 @@ }, "security:edit_run_as": { "description": "Change the value of the allow_run_as flag for a user", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["security:edit_run_as"], - "resources": ["*:*:*"], + "actions": [ + "security:edit_run_as" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, - "related_endpoints": ["PUT /security/users/{user_id}/run_as"] + "related_endpoints": [ + "PUT /security/users/{user_id}/run_as" + ] }, "security:read": { "description": "Access information about system security resources", - "resources": ["policy:id", "role:id", "user:id", "rule:id"], + "resources": [ + "policy:id", + "role:id", + "user:id", + "rule:id" + ], "example": { - "actions": ["security:read"], - "resources": ["policy:id:*", "role:id:2", "user:id:5", "rule:id:3"], + "actions": [ + "security:read" + ], + "resources": [ + "policy:id:*", + "role:id:2", + "user:id:5", + "rule:id:3" + ], "effect": "allow" }, "related_endpoints": [ @@ -564,20 +936,40 @@ }, "security:create_user": { "description": "Create new system users", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["security:create_user"], - "resources": ["*:*:*"], + "actions": [ + "security:create_user" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, - "related_endpoints": ["POST /security/users"] + "related_endpoints": [ + "POST /security/users" + ] }, "security:delete": { "description": "Delete system security resources", - "resources": ["policy:id", "role:id", "user:id", "rule:id"], + "resources": [ + "policy:id", + "role:id", + "user:id", + "rule:id" + ], "example": { - "actions": ["security:update"], - "resources": ["policy:id:*", "role:id:3", "user:id:4", "rule:id:2"], + "actions": [ + "security:update" + ], + "resources": [ + "policy:id:*", + "role:id:3", + "user:id:4", + "rule:id:2" + ], "effect": "deny" }, "related_endpoints": [ @@ -592,10 +984,22 @@ }, "security:update": { "description": "Update the information of system security resources", - "resources": ["policy:id", "role:id", "user:id", "rule:id"], + "resources": [ + "policy:id", + "role:id", + "user:id", + "rule:id" + ], "example": { - "actions": ["security:update"], - "resources": ["policy:id:*", "role:id:4", "user:id:3", "rule:id:4"], + "actions": [ + "security:update" + ], + "resources": [ + "policy:id:*", + "role:id:4", + "user:id:3", + "rule:id:4" + ], "effect": "deny" }, "related_endpoints": [ @@ -610,60 +1014,111 @@ }, "security:create": { "description": "Create new system security resources", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["security:create"], - "resources": ["*:*:*"], + "actions": [ + "security:create" + ], + "resources": [ + "*:*:*" + ], "effect": "deny" }, - "related_endpoints": ["POST /security/roles", "POST /security/rules", "POST /security/policies"] + "related_endpoints": [ + "POST /security/roles", + "POST /security/rules", + "POST /security/policies" + ] }, "security:read_config": { "description": "Read current system security configuration", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["security:read_config"], - "resources": ["*:*:*"], + "actions": [ + "security:read_config" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, - "related_endpoints": ["GET /security/config"] + "related_endpoints": [ + "GET /security/config" + ] }, "security:update_config": { "description": "Update current system security configuration", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["security:update_config"], - "resources": ["*:*:*"], + "actions": [ + "security:update_config" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, - "related_endpoints": ["PUT /security/config", "DELETE /security/config"] + "related_endpoints": [ + "PUT /security/config", + "DELETE /security/config" + ] }, "task:status": { "description": "Access task's status information", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["task:status"], - "resources": ["*:*:*"], + "actions": [ + "task:status" + ], + "resources": [ + "*:*:*" + ], "effect": "deny" }, - "related_endpoints": ["GET /tasks/status"] + "related_endpoints": [ + "GET /tasks/status" + ] }, "vulnerability:run": { "description": "Allow running a vulnerability detector scan", - "resources": ["*:*"], + "resources": [ + "*:*" + ], "example": { - "actions": ["vulnerability:run"], - "resources": ["*:*:*"], + "actions": [ + "vulnerability:run" + ], + "resources": [ + "*:*:*" + ], "effect": "allow" }, - "related_endpoints": ["PUT /vulnerability"] + "related_endpoints": [ + "PUT /vulnerability" + ] }, "vulnerability:read": { "description": "Allow reading agents' vulnerabilities information", - "resources": ["agent:id", "agent:group"], + "resources": [ + "agent:id", + "agent:group" + ], "example": { - "actions": ["vulnerability:read"], - "resources": ["agent:id:011", "agent:group:us-west"], + "actions": [ + "vulnerability:read" + ], + "resources": [ + "agent:id:011", + "agent:group:us-west" + ], "effect": "allow" }, "related_endpoints": [ @@ -690,4 +1145,4 @@ "POST /events" ] } -} +} \ No newline at end of file diff --git a/plugins/main/opensearch_dashboards.json b/plugins/main/opensearch_dashboards.json index 744edec00f..37b654d045 100644 --- a/plugins/main/opensearch_dashboards.json +++ b/plugins/main/opensearch_dashboards.json @@ -1,8 +1,10 @@ { "id": "wazuh", - "version": "4.8.0-00", + "version": "4.8.1-00", "opensearchDashboardsVersion": "opensearchDashboards", - "configPath": ["wazuh"], + "configPath": [ + "wazuh" + ], "requiredPlugins": [ "navigation", "data", @@ -19,7 +21,12 @@ "opensearchDashboardsLegacy", "wazuhCheckUpdates" ], - "optionalPlugins": ["security", "securityDashboards", "searchguard", "telemetry"], + "optionalPlugins": [ + "security", + "securityDashboards", + "searchguard", + "telemetry" + ], "server": true, "ui": true -} +} \ No newline at end of file diff --git a/plugins/main/package.json b/plugins/main/package.json index 12693996bc..c8152d661b 100644 --- a/plugins/main/package.json +++ b/plugins/main/package.json @@ -1,6 +1,6 @@ { "name": "wazuh", - "version": "4.8.0", + "version": "4.8.1", "revision": "00", "pluginPlatform": { "version": "2.10.0" diff --git a/plugins/wazuh-check-updates/opensearch_dashboards.json b/plugins/wazuh-check-updates/opensearch_dashboards.json index fc816ab6d5..112f05fa5a 100644 --- a/plugins/wazuh-check-updates/opensearch_dashboards.json +++ b/plugins/wazuh-check-updates/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuhCheckUpdates", - "version": "4.8.0-00", + "version": "4.8.1-00", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, "ui": true, diff --git a/plugins/wazuh-check-updates/package.json b/plugins/wazuh-check-updates/package.json index b6655d602a..106451ed81 100644 --- a/plugins/wazuh-check-updates/package.json +++ b/plugins/wazuh-check-updates/package.json @@ -1,6 +1,6 @@ { "name": "wazuh-check-updates", - "version": "4.8.0", + "version": "4.8.1", "revision": "00", "pluginPlatform": { "version": "2.10.0" diff --git a/plugins/wazuh-core/opensearch_dashboards.json b/plugins/wazuh-core/opensearch_dashboards.json index 33b39ce69f..a68490fc52 100644 --- a/plugins/wazuh-core/opensearch_dashboards.json +++ b/plugins/wazuh-core/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuhCore", - "version": "4.8.0-00", + "version": "4.8.1-00", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, "ui": true, diff --git a/plugins/wazuh-core/package.json b/plugins/wazuh-core/package.json index 29db1c64c6..e0a811f4f9 100644 --- a/plugins/wazuh-core/package.json +++ b/plugins/wazuh-core/package.json @@ -1,6 +1,6 @@ { "name": "wazuh-core", - "version": "4.8.0", + "version": "4.8.1", "revision": "00", "pluginPlatform": { "version": "2.10.0" From f5dbad24a0c897fa70f37e5e29a94e0b1d943103 Mon Sep 17 00:00:00 2001 From: Federico Rodriguez Date: Thu, 30 Nov 2023 19:00:06 +0100 Subject: [PATCH 8/9] Add angularJS dependencies (#6145) * Add angularJS dependencies and fix unit tests * Add changelog --- CHANGELOG.md | 1 + docker/osd-dev/dev.sh | 2 + plugins/main/package.json | 8 +- .../common/modules/discover/discover.tsx | 193 +++++--- plugins/main/public/get_inner_angular.ts | 34 +- .../kibana-integrations/kibana-discover.js | 4 +- .../packages/osd-i18n/angular/directive.ts | 126 +++++ .../packages/osd-i18n/angular/filter.ts | 42 ++ .../packages/osd-i18n/angular/index.ts | 38 ++ .../packages/osd-i18n/angular/provider.ts | 48 ++ .../packages/osd-i18n/core/formats.ts | 163 +++++++ .../packages/osd-i18n/core/helper.ts | 56 +++ .../packages/osd-i18n/core/i18n.ts | 265 +++++++++++ .../packages/osd-i18n/core/index.ts | 32 ++ .../packages/osd-i18n/core/locales.js | 40 ++ .../packages/osd-i18n/core/pseudo_locale.ts | 115 +++++ .../public/angular/angular_config.tsx | 380 +++++++++++++++ .../public/angular/index.ts | 38 ++ .../public/angular/osd_top_nav.js | 140 ++++++ .../public/angular/promises.js | 140 ++++++ .../angular/subscribe_with_scope.test.ts | 208 +++++++++ .../public/angular/subscribe_with_scope.ts | 96 ++++ .../public/angular/watch_multi.js | 159 +++++++ .../angular_bootstrap/bind_html/bind_html.js | 28 ++ .../public/angular_bootstrap/index.ts | 61 +++ .../angular_bootstrap/tooltip/position.js | 178 +++++++ .../angular_bootstrap/tooltip/tooltip.js | 434 ++++++++++++++++++ .../tooltip/tooltip_html_unsafe_popup.html | 4 + .../tooltip/tooltip_popup.html | 4 + .../public/index.ts | 34 ++ .../public/notify/index.ts | 32 ++ .../public/notify/lib/add_fatal_error.ts | 49 ++ .../notify/lib/format_angular_http_error.ts | 69 +++ .../public/notify/lib/format_msg.test.js | 90 ++++ .../public/notify/lib/format_msg.ts | 91 ++++ .../notify/lib/format_opensearch_msg.test.js | 87 ++++ .../notify/lib/format_opensearch_msg.ts | 48 ++ .../public/notify/lib/format_stack.ts | 46 ++ .../public/notify/lib/index.ts | 39 ++ .../notify/toasts/TOAST_NOTIFICATIONS.md | 100 ++++ .../public/notify/toasts/index.ts | 31 ++ .../notify/toasts/toast_notifications.ts | 64 +++ .../public/utils/index.ts | 37 ++ .../public/utils/inject_header_style.ts | 54 +++ .../public/utils/osd_accessible_click.js | 82 ++++ .../public/utils/private.d.ts | 31 ++ .../public/utils/private.js | 214 +++++++++ .../utils/register_listen_event_listener.js | 47 ++ .../public/utils/system_api.ts | 62 +++ plugins/main/yarn.lock | 30 ++ .../opensearch_dashboards.json | 4 +- plugins/wazuh-check-updates/package.json | 6 +- plugins/wazuh-check-updates/yarn.lock | 8 +- plugins/wazuh-core/opensearch_dashboards.json | 4 +- plugins/wazuh-core/package.json | 6 +- plugins/wazuh-core/yarn.lock | 8 +- 56 files changed, 4312 insertions(+), 98 deletions(-) create mode 100644 plugins/main/public/kibana-integrations/packages/osd-i18n/angular/directive.ts create mode 100644 plugins/main/public/kibana-integrations/packages/osd-i18n/angular/filter.ts create mode 100644 plugins/main/public/kibana-integrations/packages/osd-i18n/angular/index.ts create mode 100644 plugins/main/public/kibana-integrations/packages/osd-i18n/angular/provider.ts create mode 100644 plugins/main/public/kibana-integrations/packages/osd-i18n/core/formats.ts create mode 100644 plugins/main/public/kibana-integrations/packages/osd-i18n/core/helper.ts create mode 100644 plugins/main/public/kibana-integrations/packages/osd-i18n/core/i18n.ts create mode 100644 plugins/main/public/kibana-integrations/packages/osd-i18n/core/index.ts create mode 100644 plugins/main/public/kibana-integrations/packages/osd-i18n/core/locales.js create mode 100644 plugins/main/public/kibana-integrations/packages/osd-i18n/core/pseudo_locale.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/angular_config.tsx create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/index.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/osd_top_nav.js create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/promises.js create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/subscribe_with_scope.test.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/subscribe_with_scope.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/watch_multi.js create mode 100755 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/bind_html/bind_html.js create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/index.ts create mode 100755 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/position.js create mode 100755 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/tooltip.js create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/tooltip_html_unsafe_popup.html create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/tooltip_popup.html create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/index.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/index.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/add_fatal_error.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_angular_http_error.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_msg.test.js create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_msg.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_opensearch_msg.test.js create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_opensearch_msg.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_stack.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/index.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/toasts/TOAST_NOTIFICATIONS.md create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/toasts/index.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/toasts/toast_notifications.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/index.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/inject_header_style.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/osd_accessible_click.js create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/private.d.ts create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/private.js create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/register_listen_event_listener.js create mode 100644 plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/system_api.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 79a34c5c88..b09a7c01f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Added - Support for Wazuh 4.9.0 +- Added AngularJS dependencies [#6145](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6145) ## Wazuh v4.8.1 - OpenSearch Dashboards 2.10.0 - Revision 00 diff --git a/docker/osd-dev/dev.sh b/docker/osd-dev/dev.sh index 19558e9518..6e56b90aa0 100755 --- a/docker/osd-dev/dev.sh +++ b/docker/osd-dev/dev.sh @@ -12,6 +12,7 @@ os_versions=( '2.8.0' '2.9.0' '2.10.0' + '2.11.0' ) osd_versions=( @@ -26,6 +27,7 @@ osd_versions=( '2.8.0' '2.9.0' '2.10.0' + '2.11.0' '4.6.0' '4.7.0' ) diff --git a/plugins/main/package.json b/plugins/main/package.json index 81563935b9..0641b43211 100644 --- a/plugins/main/package.json +++ b/plugins/main/package.json @@ -3,7 +3,7 @@ "version": "4.9.0", "revision": "00", "pluginPlatform": { - "version": "2.10.0" + "version": "2.11.0" }, "description": "Wazuh dashboard", "keywords": [ @@ -44,8 +44,10 @@ "prebuild": "node scripts/generate-build-version" }, "dependencies": { + "angular": "^1.8.2", "angular-animate": "1.8.3", "angular-material": "1.2.5", + "angular-sanitize": "^1.8.0", "axios": "^1.6.1", "install": "^0.13.0", "js2xmlparser": "^5.0.0", @@ -69,6 +71,10 @@ "@types/node-cron": "^2.0.3", "@typescript-eslint/eslint-plugin": "^6.2.1", "@typescript-eslint/parser": "^6.2.1", + "angular-aria": "^1.8.0", + "angular-route": "^1.8.0", + "angular-mocks": "^1.8.2", + "ngreact": "^0.5.1", "eslint": "^8.46.0", "eslint-config-prettier": "^8.5.0", "eslint-import-resolver-typescript": "3.5.5", diff --git a/plugins/main/public/components/common/modules/discover/discover.tsx b/plugins/main/public/components/common/modules/discover/discover.tsx index 130d33ec82..af57b12b9a 100644 --- a/plugins/main/public/components/common/modules/discover/discover.tsx +++ b/plugins/main/public/components/common/modules/discover/discover.tsx @@ -11,7 +11,10 @@ */ import React, { Component } from 'react'; import './discover.scss'; -import { FilterManager, Filter } from '../../../../../../../src/plugins/data/public/'; +import { + FilterManager, + Filter, +} from '../../../../../../../src/plugins/data/public/'; import { GenericRequest } from '../../../../react-services/generic-request'; import { AppState } from '../../../../react-services/app-state'; import { AppNavigate } from '../../../../react-services/app-navigate'; @@ -52,9 +55,13 @@ import { buildOpenSearchQuery, IFieldType, } from '../../../../../../../src/plugins/data/common'; -import { getDataPlugin, getToasts, getUiSettings } from '../../../../kibana-services'; +import { + getDataPlugin, + getToasts, + getUiSettings, +} from '../../../../kibana-services'; -const mapStateToProps = (state) => ({ +const mapStateToProps = state => ({ currentAgentData: state.appStateReducers.currentAgentData, }); @@ -66,7 +73,7 @@ interface ColumnDefinition { export const Discover = compose( withErrorBoundary, withReduxProvider, - connect(mapStateToProps) + connect(mapStateToProps), )( class Discover extends Component { _isMount!: boolean; @@ -156,12 +163,14 @@ export const Discover = compose( async componentDidMount() { this._isMount = true; try { - this.timeSubscription = this.timefilter.getTimeUpdate$().subscribe(() => { - this.setState({ - dateRange: this.timefilter.getTime(), - dateRangeHistory: this.timefilter._history, + this.timeSubscription = this.timefilter + .getTimeUpdate$() + .subscribe(() => { + this.setState({ + dateRange: this.timefilter.getTime(), + dateRangeHistory: this.timefilter._history, + }); }); - }); this.setState({ columns: this.getColumns() }); //initial columns await this.getIndexPattern(); await this.getAlerts(); @@ -208,7 +217,9 @@ export const Discover = compose( this.props.refreshAngularDiscover !== prevProps.refreshAngularDiscover ) { this.setState({ pageIndex: 0, tsUpdated: Date.now() }); - if (!_.isEqual(this.props.shareFilterManager, this.state.searchBarFilters)) { + if ( + !_.isEqual(this.props.shareFilterManager, this.state.searchBarFilters) + ) { this.setState({ columns: this.getColumns(), searchBarFilters: this.props.shareFilterManager || [], @@ -218,7 +229,7 @@ export const Discover = compose( } if ( ['pageIndex', 'pageSize', 'sortField', 'sortDirection'].some( - (field) => this.state[field] !== prevState[field] + field => this.state[field] !== prevState[field], ) || this.state.tsUpdated !== prevState.tsUpdated ) { @@ -249,10 +260,12 @@ export const Discover = compose( } getColumns() { //Extract array of terms from object - return this.getInnitialDefinitions().map((column) => column.field); + return this.getInnitialDefinitions().map(column => column.field); } getLabel(field) { - const innitialLabels = this.getInnitialDefinitions().filter((value) => value.field === field); + const innitialLabels = this.getInnitialDefinitions().filter( + value => value.field === field, + ); if (innitialLabels.length) { return innitialLabels[0].label || field; } else { @@ -262,18 +275,22 @@ export const Discover = compose( async getIndexPattern() { this.indexPattern = { - ...(await this.PluginPlatformServices.indexPatterns.get(AppState.getCurrentPattern())), + ...(await this.PluginPlatformServices.indexPatterns.get( + AppState.getCurrentPattern(), + )), }; } hideCreateCustomLabel = () => { try { const button = document.querySelector( - '.wz-discover #addFilterPopover > div > button > span > span' + '.wz-discover #addFilterPopover > div > button > span > span', ); if (!button) return setTimeout(this.hideCreateCustomLabel, 100); const findAndHide = () => { - const switcher = document.querySelector('#filterEditorCustomLabelSwitch'); + const switcher = document.querySelector( + '#filterEditorCustomLabelSwitch', + ); if (!switcher) return setTimeout(findAndHide, 100); switcher.parentElement.style.display = 'none'; }; @@ -304,7 +321,7 @@ export const Discover = compose( return result; } - toggleDetails = (item) => { + toggleDetails = item => { const itemIdToExpandedRowMap = { ...this.state.itemIdToExpandedRowMap }; const { rowDetailsFields } = this.props; @@ -318,9 +335,9 @@ export const Discover = compose( {' '} this.addFilter(filter)} - addFilterOut={(filter) => this.addFilterOut(filter)} - toggleColumn={(id) => this.addColumn(id)} + addFilter={filter => this.addFilter(filter)} + addFilterOut={filter => this.addFilterOut(filter)} + toggleColumn={id => this.addColumn(id)} rowDetailsFields={rowDetailsFields} indexPattern={this.indexPattern} /> @@ -331,8 +348,10 @@ export const Discover = compose( }; buildFilter() { - const dateParse = (ds) => - /\d+-\d+-\d+T\d+:\d+:\d+.\d+Z/.test(ds) ? DateMatch.parse(ds).toDate().getTime() : ds; + const dateParse = ds => + /\d+-\d+-\d+T\d+:\d+:\d+.\d+Z/.test(ds) + ? DateMatch.parse(ds).toDate().getTime() + : ds; const { query } = this.state; const { hideManagerAlerts } = this.wazuhConfig.getConfig(); const extraFilters = []; @@ -355,7 +374,9 @@ export const Discover = compose( ? this.props.shareFilterManager.getFilters() : []; const previousFilters = - (this.PluginPlatformServices && this.PluginPlatformServices.query.filterManager.getFilters()) || []; + (this.PluginPlatformServices && + this.PluginPlatformServices.query.filterManager.getFilters()) || + []; const elasticQuery = buildOpenSearchQuery( this.indexPattern, query, @@ -363,9 +384,9 @@ export const Discover = compose( previousFilters, filters, extraFilters, - this.props.shareFilterManagerWithUserAuthorized || [] + this.props.shareFilterManagerWithUserAuthorized || [], ), - getOpenSearchQueryConfig(getUiSettings()) + getOpenSearchQueryConfig(getUiSettings()), ); const { sortField, sortDirection } = this.state; @@ -382,10 +403,10 @@ export const Discover = compose( elasticQuery.bool.must.push(range); if (this.props.implicitFilters) { - this.props.implicitFilters.map((impicitFilter) => + this.props.implicitFilters.map(impicitFilter => elasticQuery.bool.must.push({ match: impicitFilter, - }) + }), ); } if (this.props.currentAgentData.id) { @@ -397,7 +418,9 @@ export const Discover = compose( query: elasticQuery, size: this.state.pageSize, from: this.state.pageIndex * this.state.pageSize, - ...(sortField ? { sort: { [sortField]: { order: sortDirection } } } : {}), + ...(sortField + ? { sort: { [sortField]: { order: sortDirection } } } + : {}), }; } @@ -435,8 +458,8 @@ export const Discover = compose( } const columns = this.state.columns; columns.splice( - columns.findIndex((v) => v === id), - 1 + columns.findIndex(v => v === id), + 1, ); this.setState(columns); } @@ -446,7 +469,7 @@ export const Discover = compose( this.showToast('warning', 'The maximum number of columns is 10', 3000); return; } - if (this.state.columns.find((element) => element === id)) { + if (this.state.columns.find(element => element === id)) { this.removeColumn(id); return; } @@ -457,16 +480,20 @@ export const Discover = compose( columns = () => { var columnsList = [...this.state.columns]; - const columns = columnsList.map((item) => { + const columns = columnsList.map(item => { if (item === 'icon') { return { width: '2.3%', isExpander: true, - render: (item) => { + render: item => { return ( ); }, @@ -478,7 +505,7 @@ export const Discover = compose( name: 'Time', width: '10%', sortable: true, - render: (time) => { + render: time => { return {formatUIDate(time)}; }, }; @@ -495,7 +522,10 @@ export const Discover = compose( if (item === 'agent.id') { link = (ev, x) => { - AppNavigate.navigateToModule(ev, 'agents', { tab: 'welcome', agent: x }); + AppNavigate.navigateToModule(ev, 'agents', { + tab: 'welcome', + agent: x, + }); }; width = '8%'; } @@ -507,10 +537,16 @@ export const Discover = compose( } if (item === 'rule.id') { link = (ev, x) => - AppNavigate.navigateToModule(ev, 'manager', { tab: 'rules', redirectRule: x }); + AppNavigate.navigateToModule(ev, 'manager', { + tab: 'rules', + redirectRule: x, + }); width = '9%'; } - if (item === 'rule.description' && columnsList.indexOf('syscheck.event') === -1) { + if ( + item === 'rule.description' && + columnsList.indexOf('syscheck.event') === -1 + ) { width = '30%'; } if (item === 'syscheck.event') { @@ -537,16 +573,20 @@ export const Discover = compose( > {this.getLabel(item)}{' '} {this.state.hover === item && ( - + { + style={{ + paddingBottom: 12, + marginBottom: '-10px', + paddingTop: 0, + }} + onClick={e => { this.removeColumn(item); e.stopPropagation(); }} - iconType="cross" - aria-label="Filter" - iconSize="s" + iconType='cross' + aria-label='Filter' + iconSize='s' /> )} @@ -562,20 +602,23 @@ export const Discover = compose( (link && item !== 'rule.mitre.id') || (item === 'rule.mitre.id' && this.props.shareFilterManager) ) { - column.render = (itemValue) => { + column.render = itemValue => { return ( {(item === 'agent.id' && itemValue === '000' && ( - {itemValue} + + {itemValue} + )) || (item === 'rule.mitre.id' && Array.isArray(itemValue) && - itemValue.map((currentItem) => ( + itemValue.map((currentItem, key) => ( { + key={key} + onClick={ev => { ev.stopPropagation(); }} - onMouseDown={(ev) => { + onMouseDown={ev => { ev.stopPropagation(); link(ev, currentItem); }} @@ -584,10 +627,10 @@ export const Discover = compose( ))) || ( { + onClick={ev => { ev.stopPropagation(); }} - onMouseDown={(ev) => { + onMouseDown={ev => { ev.stopPropagation(); link(ev, itemValue); }} @@ -634,11 +677,11 @@ export const Discover = compose( const key = Object.keys(filter)[0]; const value = filter[key]; const valuesArray = Array.isArray(value) ? [...value] : [value]; - valuesArray.map((item) => { + valuesArray.map(item => { const formattedFilter = buildPhraseFilter( { name: key, type: 'string' }, item, - this.indexPattern + this.indexPattern, ); formattedFilter.meta.negate = true; @@ -656,11 +699,11 @@ export const Discover = compose( const key = Object.keys(filter)[0]; const value = filter[key]; const valuesArray = Array.isArray(value) ? [...value] : [value]; - valuesArray.map((item) => { + valuesArray.map(item => { const formattedFilter = buildPhraseFilter( { name: key, type: 'string' }, item, - this.indexPattern + this.indexPattern, ); if ( formattedFilter.meta.key === 'manager.name' || @@ -673,7 +716,10 @@ export const Discover = compose( this.setState({ pageIndex: 0, tsUpdated: Date.now() }); } - onQuerySubmit = (payload: { dateRange: TimeRange; query: Query | undefined }) => { + onQuerySubmit = (payload: { + dateRange: TimeRange; + query: Query | undefined; + }) => { this.setState({ ...payload, tsUpdated: Date.now() }); }; @@ -681,7 +727,6 @@ export const Discover = compose( this.setState({ pageIndex: 0, tsUpdated: Date.now() }); }; - openDiscover(e, techniqueID) { AppNavigate.navigateToModule(e, 'overview', { tab: 'mitre', @@ -699,7 +744,12 @@ export const Discover = compose( } openIntelligence(e, redirectTo, itemID) { - AppNavigate.navigateToModule(e, 'overview', { "tab": 'mitre', "tabView": "intelligence", "tabRedirect": redirectTo, "idToRedirect": itemID }); + AppNavigate.navigateToModule(e, 'overview', { + tab: 'mitre', + tabView: 'intelligence', + tabRedirect: redirectTo, + idToRedirect: itemID, + }); } render() { @@ -711,7 +761,7 @@ export const Discover = compose( ); const { total, itemIdToExpandedRowMap } = this.state; const { query = this.state.query } = this.props; - const getRowProps = (item) => { + const getRowProps = item => { const { _id } = item; return { 'data-test-subj': `row-${_id}`, @@ -737,7 +787,7 @@ export const Discover = compose( }; const noResultsText = `No results match for this search criteria`; return ( -
+
{this.props.kbnSearchBar && ( this.setState({ dateRange }), + setTimeFilter: dateRange => this.setState({ dateRange }), }} onQuerySubmit={this.onQuerySubmit} onFiltersUpdated={this.onFiltersUpdated} @@ -757,9 +807,12 @@ export const Discover = compose( {this.state.alerts.length && ( ({ ...alert._source, _id: alert._id }))} - className="module-discover-table" - itemId="_id" + items={this.state.alerts.map(alert => ({ + ...alert._source, + _id: alert._id, + }))} + className='module-discover-table' + itemId='_id' itemIdToExpandedRowMap={itemIdToExpandedRowMap} isExpandable={true} columns={columns} @@ -774,13 +827,17 @@ export const Discover = compose( ) : ( - - + + )}
); } - } + }, ); diff --git a/plugins/main/public/get_inner_angular.ts b/plugins/main/public/get_inner_angular.ts index c186f65f1d..637f2a1b32 100644 --- a/plugins/main/public/get_inner_angular.ts +++ b/plugins/main/public/get_inner_angular.ts @@ -23,8 +23,16 @@ import angular from 'angular'; // required for `ngSanitize` angular module import 'angular-sanitize'; -import { i18nDirective, i18nFilter, I18nProvider } from '@osd/i18n/angular'; -import { CoreStart, PluginInitializerContext } from 'opensearch_dashboards/public'; +import 'ngreact'; +import { + i18nDirective, + i18nFilter, + I18nProvider, +} from './kibana-integrations/packages/osd-i18n/angular'; +import { + CoreStart, + PluginInitializerContext, +} from 'opensearch_dashboards/public'; import { Storage } from '../../../src/plugins/opensearch_dashboards_utils/public'; import { NavigationPublicPluginStart as NavigationStart } from '../../../src/plugins/navigation/public'; import { @@ -36,7 +44,7 @@ import { watchMultiDecorator, createTopNavDirective, createTopNavHelper, -} from '../../../src/plugins/opensearch_dashboards_legacy/public'; +} from './kibana-integrations/plugins/opensearch_dashboards_legacy/public'; import { AppPluginStartDependencies } from './types'; import { getScopedHistory, setDiscoverModule } from './kibana-services'; import { createDiscoverLegacyDirective } from './kibana-integrations/discover/application/components/create_discover_legacy_directive'; @@ -51,17 +59,25 @@ export function getInnerAngularModule( name: string, core: CoreStart, deps: AppPluginStartDependencies, - context: PluginInitializerContext + context: PluginInitializerContext, ) { initAngularBootstrap(); const module = initializeInnerAngularModule(name, deps.navigation); - configureAppAngularModule(module, { core, env: context.env }, true, getScopedHistory); + configureAppAngularModule( + module, + { core, env: context.env }, + true, + getScopedHistory, + ); return module; } let initialized = false; -export function initializeInnerAngularModule(name = 'app/wazuh', navigation: NavigationStart) { +export function initializeInnerAngularModule( + name = 'app/wazuh', + navigation: NavigationStart, +) { if (!initialized) { createLocalI18nModule(); createLocalPrivateModule(); @@ -93,12 +109,14 @@ export function initializeInnerAngularModule(name = 'app/wazuh', navigation: Nav .config(watchMultiDecorator) .run(registerListenEventListener) .directive('discoverLegacy', createDiscoverLegacyDirective) - .directive('icon', (reactDirective) => reactDirective(EuiIcon)) + .directive('icon', reactDirective => reactDirective(EuiIcon)) .directive('contextErrorMessage', createContextErrorMessageDirective); } function createLocalPromiseModule() { - angular.module('discoverPromise', []).service('Promise', PromiseServiceCreator); + angular + .module('discoverPromise', []) + .service('Promise', PromiseServiceCreator); } function createLocalPrivateModule() { diff --git a/plugins/main/public/kibana-integrations/kibana-discover.js b/plugins/main/public/kibana-integrations/kibana-discover.js index b0c5404fff..e571f705d3 100644 --- a/plugins/main/public/kibana-integrations/kibana-discover.js +++ b/plugins/main/public/kibana-integrations/kibana-discover.js @@ -32,12 +32,10 @@ import { getServices, setServices, setDocViewsRegistry, - subscribeWithScope, tabifyAggResponse, - getHeaderActionMenuMounter, setUiActions, } from './discover/kibana_services'; - +import { subscribeWithScope } from './plugins/opensearch_dashboards_legacy/public'; import indexTemplateLegacy from './discover/application/angular/discover_legacy.html'; getAngularModule().directive('kbnDis', [ diff --git a/plugins/main/public/kibana-integrations/packages/osd-i18n/angular/directive.ts b/plugins/main/public/kibana-integrations/packages/osd-i18n/angular/directive.ts new file mode 100644 index 0000000000..790357da7d --- /dev/null +++ b/plugins/main/public/kibana-integrations/packages/osd-i18n/angular/directive.ts @@ -0,0 +1,126 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { IDirective, IRootElementService, IScope } from 'angular'; + +import { I18nServiceType } from './provider'; + +interface I18nScope extends IScope { + values?: Record; + defaultMessage: string; + id: string; +} + +const HTML_KEY_PREFIX = 'html_'; +const PLACEHOLDER_SEPARATOR = '@I18N@'; + +export const i18nDirective: [string, string, typeof i18nDirectiveFn] = [ + 'i18n', + '$sanitize', + i18nDirectiveFn, +]; + +function i18nDirectiveFn( + i18n: I18nServiceType, + $sanitize: (html: string) => string +): IDirective { + return { + restrict: 'A', + scope: { + id: '@i18nId', + defaultMessage: '@i18nDefaultMessage', + values: ' { + setContent($element, $scope, $sanitize, i18n); + }); + } else { + setContent($element, $scope, $sanitize, i18n); + } + }, + }; +} + +function setContent( + $element: IRootElementService, + $scope: I18nScope, + $sanitize: (html: string) => string, + i18n: I18nServiceType +) { + const originalValues = $scope.values; + const valuesWithPlaceholders = {} as Record; + let hasValuesWithPlaceholders = false; + + // If we have values with the keys that start with HTML_KEY_PREFIX we should replace + // them with special placeholders that later on will be inserted as HTML + // into the DOM, the rest of the content will be treated as text. We don't + // sanitize values at this stage as some of the values can be excluded from + // the translated string (e.g. not used by ICU conditional statements). + if (originalValues) { + for (const [key, value] of Object.entries(originalValues)) { + if (key.startsWith(HTML_KEY_PREFIX)) { + valuesWithPlaceholders[ + key.slice(HTML_KEY_PREFIX.length) + ] = `${PLACEHOLDER_SEPARATOR}${key}${PLACEHOLDER_SEPARATOR}`; + + hasValuesWithPlaceholders = true; + } else { + valuesWithPlaceholders[key] = value; + } + } + } + + const label = i18n($scope.id, { + values: valuesWithPlaceholders, + defaultMessage: $scope.defaultMessage, + }); + + // If there are no placeholders to replace treat everything as text, otherwise + // insert label piece by piece replacing every placeholder with corresponding + // sanitized HTML content. + if (!hasValuesWithPlaceholders) { + $element.text(label); + } else { + $element.empty(); + for (const contentOrPlaceholder of label.split(PLACEHOLDER_SEPARATOR)) { + if (!contentOrPlaceholder) { + continue; + } + + $element.append( + originalValues!.hasOwnProperty(contentOrPlaceholder) + ? $sanitize(originalValues![contentOrPlaceholder]) + : document.createTextNode(contentOrPlaceholder) + ); + } + } +} diff --git a/plugins/main/public/kibana-integrations/packages/osd-i18n/angular/filter.ts b/plugins/main/public/kibana-integrations/packages/osd-i18n/angular/filter.ts new file mode 100644 index 0000000000..4ffa5dd3ef --- /dev/null +++ b/plugins/main/public/kibana-integrations/packages/osd-i18n/angular/filter.ts @@ -0,0 +1,42 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { I18nServiceType } from './provider'; + +export const i18nFilter: [string, typeof i18nFilterFn] = ['i18n', i18nFilterFn]; + +function i18nFilterFn(i18n: I18nServiceType) { + return (id: string, { defaultMessage = '', values = {} } = {}) => { + return i18n(id, { + values, + defaultMessage, + }); + }; +} diff --git a/plugins/main/public/kibana-integrations/packages/osd-i18n/angular/index.ts b/plugins/main/public/kibana-integrations/packages/osd-i18n/angular/index.ts new file mode 100644 index 0000000000..04f7d66eb1 --- /dev/null +++ b/plugins/main/public/kibana-integrations/packages/osd-i18n/angular/index.ts @@ -0,0 +1,38 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { I18nProvider } from './provider'; + +export { i18nFilter } from './filter'; +export { i18nDirective } from './directive'; + +// re-export types: https://github.com/babel/babel-loader/issues/603 +import { I18nServiceType as _I18nServiceType } from './provider'; +export type I18nServiceType = _I18nServiceType; diff --git a/plugins/main/public/kibana-integrations/packages/osd-i18n/angular/provider.ts b/plugins/main/public/kibana-integrations/packages/osd-i18n/angular/provider.ts new file mode 100644 index 0000000000..bd02a30cef --- /dev/null +++ b/plugins/main/public/kibana-integrations/packages/osd-i18n/angular/provider.ts @@ -0,0 +1,48 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import * as i18n from '../core'; + +export type I18nServiceType = ReturnType; + +export class I18nProvider implements angular.IServiceProvider { + public addTranslation = i18n.addTranslation; + public getTranslation = i18n.getTranslation; + public setLocale = i18n.setLocale; + public getLocale = i18n.getLocale; + public setDefaultLocale = i18n.setDefaultLocale; + public getDefaultLocale = i18n.getDefaultLocale; + public setFormats = i18n.setFormats; + public getFormats = i18n.getFormats; + public getRegisteredLocales = i18n.getRegisteredLocales; + public init = i18n.init; + public load = i18n.load; + public $get = () => i18n.translate; +} diff --git a/plugins/main/public/kibana-integrations/packages/osd-i18n/core/formats.ts b/plugins/main/public/kibana-integrations/packages/osd-i18n/core/formats.ts new file mode 100644 index 0000000000..f87fd57e6c --- /dev/null +++ b/plugins/main/public/kibana-integrations/packages/osd-i18n/core/formats.ts @@ -0,0 +1,163 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Default format options used for "en" locale. + * These are used when constructing the internal Intl.NumberFormat + * (`number` formatter) and Intl.DateTimeFormat (`date` and `time` formatters) instances. + * The value of each parameter of `number` formatter is options object which is + * described in `options` section of [NumberFormat constructor]. + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat} + * The value of each parameter of `date` and `time` formatters is options object which is + * described in `options` section of [DateTimeFormat constructor]. + * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat} + */ +export const formats: Formats = { + number: { + currency: { + style: 'currency', + }, + percent: { + style: 'percent', + }, + }, + date: { + short: { + month: 'numeric', + day: 'numeric', + year: '2-digit', + }, + medium: { + month: 'short', + day: 'numeric', + year: 'numeric', + }, + long: { + month: 'long', + day: 'numeric', + year: 'numeric', + }, + full: { + weekday: 'long', + month: 'long', + day: 'numeric', + year: 'numeric', + }, + }, + time: { + short: { + hour: 'numeric', + minute: 'numeric', + }, + medium: { + hour: 'numeric', + minute: 'numeric', + second: 'numeric', + }, + long: { + hour: 'numeric', + minute: 'numeric', + second: 'numeric', + timeZoneName: 'short', + }, + full: { + hour: 'numeric', + minute: 'numeric', + second: 'numeric', + timeZoneName: 'short', + }, + }, + relative: { + years: { + units: 'year', + }, + months: { + units: 'month', + }, + days: { + units: 'day', + }, + hours: { + units: 'hour', + }, + minutes: { + units: 'minute', + }, + seconds: { + units: 'second', + }, + }, +}; + +interface NumberFormatOptions extends Intl.NumberFormatOptions { + style?: TStyle; + localeMatcher?: 'lookup' | 'best fit'; + currencyDisplay?: 'symbol' | 'code' | 'name'; +} + +export interface Formats { + number?: Partial<{ + [key: string]: NumberFormatOptions<'currency' | 'percent' | 'decimal'>; + currency: NumberFormatOptions<'currency'>; + percent: NumberFormatOptions<'percent'>; + }>; + date?: Partial<{ + [key: string]: DateTimeFormatOptions; + short: DateTimeFormatOptions; + medium: DateTimeFormatOptions; + long: DateTimeFormatOptions; + full: DateTimeFormatOptions; + }>; + time?: Partial<{ + [key: string]: DateTimeFormatOptions; + short: DateTimeFormatOptions; + medium: DateTimeFormatOptions; + long: DateTimeFormatOptions; + full: DateTimeFormatOptions; + }>; + relative?: Partial<{ + [key: string]: { + style?: 'numeric' | 'best fit'; + units: 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second'; + }; + }>; +} + +interface DateTimeFormatOptions extends Intl.DateTimeFormatOptions { + weekday?: 'narrow' | 'short' | 'long'; + era?: 'narrow' | 'short' | 'long'; + year?: 'numeric' | '2-digit'; + month?: 'numeric' | '2-digit' | 'narrow' | 'short' | 'long'; + day?: 'numeric' | '2-digit'; + hour?: 'numeric' | '2-digit'; + minute?: 'numeric' | '2-digit'; + second?: 'numeric' | '2-digit'; + timeZoneName?: 'short' | 'long'; +} diff --git a/plugins/main/public/kibana-integrations/packages/osd-i18n/core/helper.ts b/plugins/main/public/kibana-integrations/packages/osd-i18n/core/helper.ts new file mode 100644 index 0000000000..528465e539 --- /dev/null +++ b/plugins/main/public/kibana-integrations/packages/osd-i18n/core/helper.ts @@ -0,0 +1,56 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export const isString = (value: any): value is string => typeof value === 'string'; + +export const isObject = (value: any): value is object => + typeof value === 'object' && value !== null; + +export const hasValues = (values: any) => Object.keys(values).length > 0; + +export const unique = (arr: T[] = []): T[] => [...new Set(arr)]; + +const merge = (a: any, b: any): { [k: string]: any } => + unique([...Object.keys(a), ...Object.keys(b)]).reduce((acc, key) => { + if (isObject(a[key]) && isObject(b[key]) && !Array.isArray(a[key]) && !Array.isArray(b[key])) { + return { + ...acc, + [key]: merge(a[key], b[key]), + }; + } + + return { + ...acc, + [key]: b[key] === undefined ? a[key] : b[key], + }; + }, {}); + +export const mergeAll = (...sources: any[]) => + sources.filter(isObject).reduce((acc, source) => merge(acc, source)); diff --git a/plugins/main/public/kibana-integrations/packages/osd-i18n/core/i18n.ts b/plugins/main/public/kibana-integrations/packages/osd-i18n/core/i18n.ts new file mode 100644 index 0000000000..3268fae507 --- /dev/null +++ b/plugins/main/public/kibana-integrations/packages/osd-i18n/core/i18n.ts @@ -0,0 +1,265 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import memoizeIntlConstructor from 'intl-format-cache'; +import IntlMessageFormat from 'intl-messageformat'; +import IntlRelativeFormat from 'intl-relativeformat'; + +import { Translation } from '../translation'; +import { Formats, formats as EN_FORMATS } from './formats'; +import { hasValues, isObject, isString, mergeAll } from './helper'; +import { isPseudoLocale, translateUsingPseudoLocale } from './pseudo_locale'; + +// Add all locale data to `IntlMessageFormat`. +import './locales.js'; + +const EN_LOCALE = 'en'; +const translationsForLocale: Record = {}; +const getMessageFormat = memoizeIntlConstructor(IntlMessageFormat); + +let defaultLocale = EN_LOCALE; +let currentLocale = EN_LOCALE; +let formats = EN_FORMATS; + +IntlMessageFormat.defaultLocale = defaultLocale; +IntlRelativeFormat.defaultLocale = defaultLocale; + +/** + * Returns message by the given message id. + * @param id - path to the message + */ +function getMessageById(id: string): string | undefined { + const translation = getTranslation(); + return translation.messages ? translation.messages[id] : undefined; +} + +/** + * Normalizes locale to make it consistent with IntlMessageFormat locales + * @param locale + */ +function normalizeLocale(locale: string) { + return locale.toLowerCase(); +} + +/** + * Provides a way to register translations with the engine + * @param newTranslation + * @param [locale = messages.locale] + */ +export function addTranslation(newTranslation: Translation, locale = newTranslation.locale) { + if (!locale || !isString(locale)) { + throw new Error('[I18n] A `locale` must be a non-empty string to add messages.'); + } + + if (newTranslation.locale && newTranslation.locale !== locale) { + throw new Error( + '[I18n] A `locale` in the translation object is different from the one provided as a second argument.' + ); + } + + const normalizedLocale = normalizeLocale(locale); + const existingTranslation = translationsForLocale[normalizedLocale] || { messages: {} }; + + translationsForLocale[normalizedLocale] = { + formats: newTranslation.formats || existingTranslation.formats, + locale: newTranslation.locale || existingTranslation.locale, + messages: { + ...existingTranslation.messages, + ...newTranslation.messages, + }, + }; +} + +/** + * Returns messages for the current language + */ +export function getTranslation(): Translation { + return translationsForLocale[currentLocale] || { messages: {} }; +} + +/** + * Tells the engine which language to use by given language key + * @param locale + */ +export function setLocale(locale: string) { + if (!locale || !isString(locale)) { + throw new Error('[I18n] A `locale` must be a non-empty string.'); + } + + currentLocale = normalizeLocale(locale); +} + +/** + * Returns the current locale + */ +export function getLocale() { + return currentLocale; +} + +/** + * Tells the library which language to fallback when missing translations + * @param locale + */ +export function setDefaultLocale(locale: string) { + if (!locale || !isString(locale)) { + throw new Error('[I18n] A `locale` must be a non-empty string.'); + } + + defaultLocale = normalizeLocale(locale); + IntlMessageFormat.defaultLocale = defaultLocale; + IntlRelativeFormat.defaultLocale = defaultLocale; +} + +export function getDefaultLocale() { + return defaultLocale; +} + +/** + * Supplies a set of options to the underlying formatter + * [Default format options used as the prototype of the formats] + * {@link https://github.com/yahoo/intl-messageformat/blob/master/src/core.js#L62} + * These are used when constructing the internal Intl.NumberFormat + * and Intl.DateTimeFormat instances. + * @param newFormats + * @param [newFormats.number] + * @param [newFormats.date] + * @param [newFormats.time] + */ +export function setFormats(newFormats: Formats) { + if (!isObject(newFormats) || !hasValues(newFormats)) { + throw new Error('[I18n] A `formats` must be a non-empty object.'); + } + + formats = mergeAll(formats, newFormats); +} + +/** + * Returns current formats + */ +export function getFormats() { + return formats; +} + +/** + * Returns array of locales having translations + */ +export function getRegisteredLocales() { + return Object.keys(translationsForLocale); +} + +interface TranslateArguments { + values?: Record; + defaultMessage: string; + description?: string; +} + +/** + * Translate message by id + * @param id - translation id to be translated + * @param [options] + * @param [options.values] - values to pass into translation + * @param [options.defaultMessage] - will be used unless translation was successful + */ +export function translate(id: string, { values = {}, defaultMessage }: TranslateArguments) { + const shouldUsePseudoLocale = isPseudoLocale(currentLocale); + + if (!id || !isString(id)) { + throw new Error('[I18n] An `id` must be a non-empty string to translate a message.'); + } + + const message = shouldUsePseudoLocale ? defaultMessage : getMessageById(id); + + if (!message && !defaultMessage) { + throw new Error(`[I18n] Cannot format message: "${id}". Default message must be provided.`); + } + + if (message) { + try { + // We should call `format` even for messages without any value references + // to let it handle escaped curly braces `\\{` that are the part of the text itself + // and not value reference boundaries. + const formattedMessage = getMessageFormat(message, getLocale(), getFormats()).format(values); + + return shouldUsePseudoLocale + ? translateUsingPseudoLocale(formattedMessage) + : formattedMessage; + } catch (e) { + throw new Error( + `[I18n] Error formatting message: "${id}" for locale: "${getLocale()}".\n${e}` + ); + } + } + + try { + const msg = getMessageFormat(defaultMessage, getDefaultLocale(), getFormats()); + + return msg.format(values); + } catch (e) { + throw new Error(`[I18n] Error formatting the default message for: "${id}".\n${e}`); + } +} + +/** + * Initializes the engine + * @param newTranslation + */ +export function init(newTranslation?: Translation) { + if (!newTranslation) { + return; + } + + addTranslation(newTranslation); + + if (newTranslation.locale) { + setLocale(newTranslation.locale); + } + + if (newTranslation.formats) { + setFormats(newTranslation.formats); + } +} + +/** + * Loads JSON with translations from the specified URL and initializes i18n engine with them. + * @param translationsUrl URL pointing to the JSON bundle with translations. + */ +export async function load(translationsUrl: string) { + // Once this package is integrated into core OpenSearch Dashboards we should switch to an abstraction + // around `fetch` provided by the platform, e.g. `kfetch`. + const response = await fetch(translationsUrl, { + credentials: 'same-origin', + }); + + if (response.status >= 300) { + throw new Error(`Translations request failed with status code: ${response.status}`); + } + + init(await response.json()); +} diff --git a/plugins/main/public/kibana-integrations/packages/osd-i18n/core/index.ts b/plugins/main/public/kibana-integrations/packages/osd-i18n/core/index.ts new file mode 100644 index 0000000000..fe0619fa1e --- /dev/null +++ b/plugins/main/public/kibana-integrations/packages/osd-i18n/core/index.ts @@ -0,0 +1,32 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { formats } from './formats'; +export * from './i18n'; diff --git a/plugins/main/public/kibana-integrations/packages/osd-i18n/core/locales.js b/plugins/main/public/kibana-integrations/packages/osd-i18n/core/locales.js new file mode 100644 index 0000000000..a837462b74 --- /dev/null +++ b/plugins/main/public/kibana-integrations/packages/osd-i18n/core/locales.js @@ -0,0 +1,40 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* eslint-disable */ + +// Copied from https://github.com/yahoo/intl-relativeformat/tree/master/dist/locale-data + +import IntlMessageFormat from 'intl-messageformat'; +import IntlRelativeFormat from 'intl-relativeformat'; + +function addLocaleData(localeData) { + IntlMessageFormat.__addLocaleData(localeData); + IntlRelativeFormat.__addLocaleData(localeData); +} + +addLocaleData({ locale: "en", pluralRuleFunction: function (n,ord){var s=String(n).split("."),v0=!s[1],t0=Number(s[0])==n,n10=t0&&s[0].slice(-1),n100=t0&&s[0].slice(-2);if(ord)return n10==1&&n100!=11?"one":n10==2&&n100!=12?"two":n10==3&&n100!=13?"few":"other";return n==1&&v0?"one":"other"},"fields":{"year":{"displayName":"year","relative":{"0":"this year","1":"next year","-1":"last year"},"relativeTime":{"future":{"one":"in {0} year","other":"in {0} years"},"past":{"one":"{0} year ago","other":"{0} years ago"}}},"year-short":{"displayName":"yr.","relative":{"0":"this yr.","1":"next yr.","-1":"last yr."},"relativeTime":{"future":{"one":"in {0} yr.","other":"in {0} yr."},"past":{"one":"{0} yr. ago","other":"{0} yr. ago"}}},"month":{"displayName":"month","relative":{"0":"this month","1":"next month","-1":"last month"},"relativeTime":{"future":{"one":"in {0} month","other":"in {0} months"},"past":{"one":"{0} month ago","other":"{0} months ago"}}},"month-short":{"displayName":"mo.","relative":{"0":"this mo.","1":"next mo.","-1":"last mo."},"relativeTime":{"future":{"one":"in {0} mo.","other":"in {0} mo."},"past":{"one":"{0} mo. ago","other":"{0} mo. ago"}}},"day":{"displayName":"day","relative":{"0":"today","1":"tomorrow","-1":"yesterday"},"relativeTime":{"future":{"one":"in {0} day","other":"in {0} days"},"past":{"one":"{0} day ago","other":"{0} days ago"}}},"day-short":{"displayName":"day","relative":{"0":"today","1":"tomorrow","-1":"yesterday"},"relativeTime":{"future":{"one":"in {0} day","other":"in {0} days"},"past":{"one":"{0} day ago","other":"{0} days ago"}}},"hour":{"displayName":"hour","relative":{"0":"this hour"},"relativeTime":{"future":{"one":"in {0} hour","other":"in {0} hours"},"past":{"one":"{0} hour ago","other":"{0} hours ago"}}},"hour-short":{"displayName":"hr.","relative":{"0":"this hour"},"relativeTime":{"future":{"one":"in {0} hr.","other":"in {0} hr."},"past":{"one":"{0} hr. ago","other":"{0} hr. ago"}}},"minute":{"displayName":"minute","relative":{"0":"this minute"},"relativeTime":{"future":{"one":"in {0} minute","other":"in {0} minutes"},"past":{"one":"{0} minute ago","other":"{0} minutes ago"}}},"minute-short":{"displayName":"min.","relative":{"0":"this minute"},"relativeTime":{"future":{"one":"in {0} min.","other":"in {0} min."},"past":{"one":"{0} min. ago","other":"{0} min. ago"}}},"second":{"displayName":"second","relative":{"0":"now"},"relativeTime":{"future":{"one":"in {0} second","other":"in {0} seconds"},"past":{"one":"{0} second ago","other":"{0} seconds ago"}}},"second-short":{"displayName":"sec.","relative":{"0":"now"},"relativeTime":{"future":{"one":"in {0} sec.","other":"in {0} sec."},"past":{"one":"{0} sec. ago","other":"{0} sec. ago"}}}} }); +addLocaleData({ locale: "en-US", parentLocale: "en" }); +addLocaleData({ locale: "en-xa", pluralRuleFunction: function (n,ord){var s=String(n).split("."),v0=!s[1],t0=Number(s[0])==n,n10=t0&&s[0].slice(-1),n100=t0&&s[0].slice(-2);if(ord)return n10==1&&n100!=11?"one":n10==2&&n100!=12?"two":n10==3&&n100!=13?"few":"other";return n==1&&v0?"one":"other"}, "fields":{"year":{"displayName":"Ć½Ć©Ć Ć Å•","relative":{"0":"Å£Ä„Ć®Ć®Å” Ć½Ć©Ć©Ć Å•","1":"ƱƩįŗ‹įŗ‹Å£ Ć½Ć©Ć©Ć Å•","-1":"Ä¼Ć Å”Å”Å£ Ć½Ć©Ć©Ć Å•"},"relativeTime":{"future":{"one":"ƮƱ {0} Ć½Ć½Ć©Ć Å•Å•","other":"ƮƱ {0} Ć½Ć½Ć©Ć Å•Å•Å”"},"past":{"one":"{0} Ć½Ć©Ć Ć Å• Ć ÄÄĆ“","other":"{0} Ć½Ć©Ć Ć Å•Å” Ć Ć ÄĆ“"}}},"year-short":{"displayName":"Ć½Å•.","relative":{"0":"Å£Ä„Ć®Ć®Å” Ć½Å•Å•.","1":"ƱƩįŗ‹įŗ‹Å£ Ć½Å•Å•.","-1":"Ä¼Ć Å”Å”Å£ Ć½Å•Å•."},"relativeTime":{"future":{"one":"ƮƱ {0} Ć½Ć½Å•.","other":"ƮƱ {0} Ć½Ć½Å•."},"past":{"one":"{0} Ć½Å•. Ć Ć ÄĆ“","other":"{0} Ć½Å•. Ć Ć ÄĆ“"}}},"month":{"displayName":"É±Ć“Ć±Ć±Å£Ä„","relative":{"0":"Å£Ä„Ć®Ć®Å” É±Ć“Ć“Ć±Å£Ä„Ä„","1":"ƱƩįŗ‹įŗ‹Å£ É±Ć“Ć“Ć±Å£Ä„Ä„","-1":"Ä¼Ć Å”Å”Å£ É±Ć“Ć“Ć±Å£Ä„Ä„"},"relativeTime":{"future":{"one":"ƮƱ {0} É±É±Ć“Ć±Å£Å£Ä„","other":"ƮƱ {0} É±É±Ć“Ć±Å£Å£Ä„Å”"},"past":{"one":"{0} É±Ć“Ć±Ć±Å£Ä„ Ć Ć ÄĆ“","other":"{0} É±Ć“Ć±Ć±Å£Ä„Å”Å” Ć ÄĆ“Ć“"}}},"month-short":{"displayName":"ɱƓ.","relative":{"0":"Å£Ä„Ć®Ć®Å” ɱƓƓ.","1":"ƱƩįŗ‹įŗ‹Å£ ɱƓƓ.","-1":"Ä¼Ć Å”Å”Å£ ɱƓƓ."},"relativeTime":{"future":{"one":"ƮƱ {0} ɱɱƓ.","other":"ƮƱ {0} ɱɱƓ."},"past":{"one":"{0} ɱƓ. Ć Ć ÄĆ“","other":"{0} ɱƓ. Ć Ć ÄĆ“"}}},"day":{"displayName":"Ć°Ć Ć½Ć½","relative":{"0":"Å£Ć“Ć°Ć°Ć Ć½","1":"Å£Ć“É±É±Ć“Å•Å•Å•Ć“Åµ","-1":"Ć½Ć©Å”Å”Å£Ć©Å•Å•Ć°Ć Ć½Ć½"},"relativeTime":{"future":{"one":"ƮƱ {0} Ć°Ć°Ć Ć½","other":"ƮƱ {0} Ć°Ć°Ć Ć½Å”Å”"},"past":{"one":"{0} Ć°Ć Ć½Ć½ Ć ÄĆ“Ć“","other":"{0} Ć°Ć Ć½Ć½Å” Ć ÄÄĆ“"}}},"day-short":{"displayName":"Ć°Ć Ć½Ć½","relative":{"0":"Å£Ć“Ć°Ć°Ć Ć½","1":"Å£Ć“É±É±Ć“Å•Å•Å•Ć“Åµ","-1":"Ć½Ć©Å”Å”Å£Ć©Å•Å•Ć°Ć Ć½Ć½"},"relativeTime":{"future":{"one":"ƮƱ {0} Ć°Ć°Ć Ć½","other":"ƮƱ {0} Ć°Ć°Ć Ć½Å”Å”"},"past":{"one":"{0} Ć°Ć Ć½Ć½ Ć ÄĆ“Ć“","other":"{0} Ć°Ć Ć½Ć½Å” Ć ÄÄĆ“"}}},"hour":{"displayName":"Ä„Ć“Ć»Ć»Å•","relative":{"0":"Å£Ä„Ć®Ć®Å” Ä„Ć“Ć“Ć»Å•"},"relativeTime":{"future":{"one":"ƮƱ {0} Ä„Ä„Ć“Ć»Å•Å•","other":"ƮƱ {0} Ä„Ä„Ć“Ć»Å•Å•Å”"},"past":{"one":"{0} Ä„Ć“Ć»Ć»Å• Ć ÄÄĆ“","other":"{0} Ä„Ć“Ć»Ć»Å•Å” Ć Ć ÄĆ“"}}},"hour-short":{"displayName":"Ä„Å•.","relative":{"0":"Å£Ä„Ć®Ć®Å” Ä„Ć“Ć“Ć»Å•"},"relativeTime":{"future":{"one":"ƮƱ {0} Ä„Ä„Å•.","other":"ƮƱ {0} Ä„Ä„Å•."},"past":{"one":"{0} Ä„Å•. Ć Ć ÄĆ“","other":"{0} Ä„Å•. Ć Ć ÄĆ“"}}},"minute":{"displayName":"É±Ć®Ć±Ć±Ć»Å£Ć©Ć©","relative":{"0":"Å£Ä„Ć®Ć®Å” É±Ć®Ć®Ć±Ć»Å£Å£Ć©"},"relativeTime":{"future":{"one":"ƮƱ {0} É±É±Ć®Ć±Ć»Ć»Å£Ć©","other":"ƮƱ {0} É±É±Ć®Ć±Ć»Ć»Å£Ć©Å”Å”"},"past":{"one":"{0} É±Ć®Ć±Ć±Ć»Å£Ć©Ć© Ć ÄĆ“Ć“","other":"{0} É±Ć®Ć±Ć±Ć»Å£Ć©Ć©Å” Ć ÄÄĆ“"}}},"minute-short":{"displayName":"ɱƮƱƱ.","relative":{"0":"Å£Ä„Ć®Ć®Å” É±Ć®Ć®Ć±Ć»Å£Å£Ć©"},"relativeTime":{"future":{"one":"ƮƱ {0} ɱɱƮƱ.","other":"ƮƱ {0} ɱɱƮƱ."},"past":{"one":"{0} ɱƮƱƱ. Ć ÄĆ“Ć“","other":"{0} ɱƮƱƱ. Ć ÄĆ“Ć“"}}},"second":{"displayName":"Å”Ć©Ć§Ć§Ć“Ć±Ć°Ć°","relative":{"0":"Ć±Ć“ÅµÅµ"},"relativeTime":{"future":{"one":"ƮƱ {0} Å”Å”Ć©Ć§Ć“Ć“Ć±Ć°","other":"ƮƱ {0} Å”Å”Ć©Ć§Ć“Ć“Ć±Ć°Å”Å”"},"past":{"one":"{0} Å”Ć©Ć§Ć§Ć“Ć±Ć°Ć° Ć ÄĆ“Ć“","other":"{0} Å”Ć©Ć§Ć§Ć“Ć±Ć°Ć°Å” Ć ÄÄĆ“"}}},"second-short":{"displayName":"Å”Ć©Ć§Ć§.","relative":{"0":"Ć±Ć“ÅµÅµ"},"relativeTime":{"future":{"one":"ƮƱ {0} Å”Å”Ć©Ć§.","other":"ƮƱ {0} Å”Å”Ć©Ć§."},"past":{"one":"{0} Å”Ć©Ć§Ć§. Ć ÄĆ“Ć“","other":"{0} Å”Ć©Ć§Ć§. Ć ÄĆ“Ć“"}}}} }); +addLocaleData({ locale: "es", pluralRuleFunction: function (n,ord){if(ord)return"other";return n==1?"one":"other"},"fields":{"year":{"displayName":"aƱo","relative":{"0":"este aƱo","1":"el prĆ³ximo aƱo","-1":"el aƱo pasado"},"relativeTime":{"future":{"one":"dentro de {0} aƱo","other":"dentro de {0} aƱos"},"past":{"one":"hace {0} aƱo","other":"hace {0} aƱos"}}},"year-short":{"displayName":"a","relative":{"0":"este aƱo","1":"el prĆ³ximo aƱo","-1":"el aƱo pasado"},"relativeTime":{"future":{"one":"dentro de {0} a","other":"dentro de {0} a"},"past":{"one":"hace {0} a","other":"hace {0} a"}}},"month":{"displayName":"mes","relative":{"0":"este mes","1":"el prĆ³ximo mes","-1":"el mes pasado"},"relativeTime":{"future":{"one":"dentro de {0} mes","other":"dentro de {0} meses"},"past":{"one":"hace {0} mes","other":"hace {0} meses"}}},"month-short":{"displayName":"m","relative":{"0":"este mes","1":"el prĆ³ximo mes","-1":"el mes pasado"},"relativeTime":{"future":{"one":"dentro de {0} m","other":"dentro de {0} m"},"past":{"one":"hace {0} m","other":"hace {0} m"}}},"day":{"displayName":"dĆ­a","relative":{"0":"hoy","1":"maƱana","2":"pasado maƱana","-2":"anteayer","-1":"ayer"},"relativeTime":{"future":{"one":"dentro de {0} dĆ­a","other":"dentro de {0} dĆ­as"},"past":{"one":"hace {0} dĆ­a","other":"hace {0} dĆ­as"}}},"day-short":{"displayName":"d","relative":{"0":"hoy","1":"maƱana","2":"pasado maƱana","-2":"anteayer","-1":"ayer"},"relativeTime":{"future":{"one":"dentro de {0} dĆ­a","other":"dentro de {0} dĆ­as"},"past":{"one":"hace {0} dĆ­a","other":"hace {0} dĆ­as"}}},"hour":{"displayName":"hora","relative":{"0":"esta hora"},"relativeTime":{"future":{"one":"dentro de {0} hora","other":"dentro de {0} horas"},"past":{"one":"hace {0} hora","other":"hace {0} horas"}}},"hour-short":{"displayName":"h","relative":{"0":"esta hora"},"relativeTime":{"future":{"one":"dentro de {0} h","other":"dentro de {0} h"},"past":{"one":"hace {0} h","other":"hace {0} h"}}},"minute":{"displayName":"minuto","relative":{"0":"este minuto"},"relativeTime":{"future":{"one":"dentro de {0} minuto","other":"dentro de {0} minutos"},"past":{"one":"hace {0} minuto","other":"hace {0} minutos"}}},"minute-short":{"displayName":"min","relative":{"0":"este minuto"},"relativeTime":{"future":{"one":"dentro de {0} min","other":"dentro de {0} min"},"past":{"one":"hace {0} min","other":"hace {0} min"}}},"second":{"displayName":"segundo","relative":{"0":"ahora"},"relativeTime":{"future":{"one":"dentro de {0} segundo","other":"dentro de {0} segundos"},"past":{"one":"hace {0} segundo","other":"hace {0} segundos"}}},"second-short":{"displayName":"s","relative":{"0":"ahora"},"relativeTime":{"future":{"one":"dentro de {0} s","other":"dentro de {0} s"},"past":{"one":"hace {0} s","other":"hace {0} s"}}}} }); +addLocaleData({ locale: "es-LA", parentLocale: "es" }); +addLocaleData({ locale: "fr", pluralRuleFunction: function (n,ord){if(ord)return n==1?"one":"other";return n>=0&&n<2?"one":"other"},"fields":{"year":{"displayName":"annĆ©e","relative":{"0":"cette annĆ©e","1":"lā€™annĆ©e prochaine","-1":"lā€™annĆ©e derniĆØre"},"relativeTime":{"future":{"one":"dans {0} an","other":"dans {0} ans"},"past":{"one":"il y a {0} an","other":"il y a {0} ans"}}},"year-short":{"displayName":"an","relative":{"0":"cette annĆ©e","1":"lā€™annĆ©e prochaine","-1":"lā€™annĆ©e derniĆØre"},"relativeTime":{"future":{"one":"dans {0} a","other":"dans {0} a"},"past":{"one":"il y a {0} a","other":"il y a {0} a"}}},"month":{"displayName":"mois","relative":{"0":"ce mois-ci","1":"le mois prochain","-1":"le mois dernier"},"relativeTime":{"future":{"one":"dans {0} mois","other":"dans {0} mois"},"past":{"one":"il y a {0} mois","other":"il y a {0} mois"}}},"month-short":{"displayName":"m.","relative":{"0":"ce mois-ci","1":"le mois prochain","-1":"le mois dernier"},"relativeTime":{"future":{"one":"dans {0} m.","other":"dans {0} m."},"past":{"one":"il y a {0} m.","other":"il y a {0} m."}}},"day":{"displayName":"jour","relative":{"0":"aujourdā€™hui","1":"demain","2":"aprĆØs-demain","-2":"avant-hier","-1":"hier"},"relativeTime":{"future":{"one":"dans {0} jour","other":"dans {0} jours"},"past":{"one":"il y a {0} jour","other":"il y a {0} jours"}}},"day-short":{"displayName":"j","relative":{"0":"aujourdā€™hui","1":"demain","2":"aprĆØs-demain","-2":"avant-hier","-1":"hier"},"relativeTime":{"future":{"one":"dans {0} j","other":"dans {0} j"},"past":{"one":"il y a {0} j","other":"il y a {0} j"}}},"hour":{"displayName":"heure","relative":{"0":"cette heure-ci"},"relativeTime":{"future":{"one":"dans {0} heure","other":"dans {0} heures"},"past":{"one":"il y a {0} heure","other":"il y a {0} heures"}}},"hour-short":{"displayName":"h","relative":{"0":"cette heure-ci"},"relativeTime":{"future":{"one":"dans {0} h","other":"dans {0} h"},"past":{"one":"il y a {0} h","other":"il y a {0} h"}}},"minute":{"displayName":"minute","relative":{"0":"cette minute-ci"},"relativeTime":{"future":{"one":"dans {0} minute","other":"dans {0} minutes"},"past":{"one":"il y a {0} minute","other":"il y a {0} minutes"}}},"minute-short":{"displayName":"min","relative":{"0":"cette minute-ci"},"relativeTime":{"future":{"one":"dans {0} min","other":"dans {0} min"},"past":{"one":"il y a {0} min","other":"il y a {0} min"}}},"second":{"displayName":"seconde","relative":{"0":"maintenant"},"relativeTime":{"future":{"one":"dans {0} seconde","other":"dans {0} secondes"},"past":{"one":"il y a {0} seconde","other":"il y a {0} secondes"}}},"second-short":{"displayName":"s","relative":{"0":"maintenant"},"relativeTime":{"future":{"one":"dans {0} s","other":"dans {0} s"},"past":{"one":"il y a {0} s","other":"il y a {0} s"}}}} }); +addLocaleData({ locale: "fr-FR", parentLocale: "fr" }); +addLocaleData({ locale: "de", pluralRuleFunction: function (n,ord){var s=String(n).split("."),v0=!s[1];if(ord)return"other";return n==1&&v0?"one":"other"},"fields":{"year":{"displayName":"Jahr","relative":{"0":"dieses Jahr","1":"nƤchstes Jahr","-1":"letztes Jahr"},"relativeTime":{"future":{"one":"in {0} Jahr","other":"in {0} Jahren"},"past":{"one":"vor {0} Jahr","other":"vor {0} Jahren"}}},"year-short":{"displayName":"Jahr","relative":{"0":"dieses Jahr","1":"nƤchstes Jahr","-1":"letztes Jahr"},"relativeTime":{"future":{"one":"in {0} Jahr","other":"in {0} Jahren"},"past":{"one":"vor {0} Jahr","other":"vor {0} Jahren"}}},"month":{"displayName":"Monat","relative":{"0":"diesen Monat","1":"nƤchsten Monat","-1":"letzten Monat"},"relativeTime":{"future":{"one":"in {0} Monat","other":"in {0} Monaten"},"past":{"one":"vor {0} Monat","other":"vor {0} Monaten"}}},"month-short":{"displayName":"Monat","relative":{"0":"diesen Monat","1":"nƤchsten Monat","-1":"letzten Monat"},"relativeTime":{"future":{"one":"in {0} Monat","other":"in {0} Monaten"},"past":{"one":"vor {0} Monat","other":"vor {0} Monaten"}}},"day":{"displayName":"Tag","relative":{"0":"heute","1":"morgen","2":"Ć¼bermorgen","-2":"vorgestern","-1":"gestern"},"relativeTime":{"future":{"one":"in {0} Tag","other":"in {0} Tagen"},"past":{"one":"vor {0} Tag","other":"vor {0} Tagen"}}},"day-short":{"displayName":"Tag","relative":{"0":"heute","1":"morgen","2":"Ć¼bermorgen","-2":"vorgestern","-1":"gestern"},"relativeTime":{"future":{"one":"in {0} Tag","other":"in {0} Tagen"},"past":{"one":"vor {0} Tag","other":"vor {0} Tagen"}}},"hour":{"displayName":"Stunde","relative":{"0":"in dieser Stunde"},"relativeTime":{"future":{"one":"in {0} Stunde","other":"in {0} Stunden"},"past":{"one":"vor {0} Stunde","other":"vor {0} Stunden"}}},"hour-short":{"displayName":"Std.","relative":{"0":"in dieser Stunde"},"relativeTime":{"future":{"one":"in {0} Std.","other":"in {0} Std."},"past":{"one":"vor {0} Std.","other":"vor {0} Std."}}},"minute":{"displayName":"Minute","relative":{"0":"in dieser Minute"},"relativeTime":{"future":{"one":"in {0} Minute","other":"in {0} Minuten"},"past":{"one":"vor {0} Minute","other":"vor {0} Minuten"}}},"minute-short":{"displayName":"Min.","relative":{"0":"in dieser Minute"},"relativeTime":{"future":{"one":"in {0} Min.","other":"in {0} Min."},"past":{"one":"vor {0} Min.","other":"vor {0} Min."}}},"second":{"displayName":"Sekunde","relative":{"0":"jetzt"},"relativeTime":{"future":{"one":"in {0} Sekunde","other":"in {0} Sekunden"},"past":{"one":"vor {0} Sekunde","other":"vor {0} Sekunden"}}},"second-short":{"displayName":"Sek.","relative":{"0":"jetzt"},"relativeTime":{"future":{"one":"in {0} Sek.","other":"in {0} Sek."},"past":{"one":"vor {0} Sek.","other":"vor {0} Sek."}}}} }); +addLocaleData({ locale: "de-DE", parentLocale: "de" }); +addLocaleData({ locale: "ja", pluralRuleFunction: function (n,ord){if(ord)return"other";return"other"},"fields":{"year":{"displayName":"幓","relative":{"0":"今幓","1":"ēæŒå¹“","-1":"ę˜Ø幓"},"relativeTime":{"future":{"other":"{0} 幓後"},"past":{"other":"{0} 幓前"}}},"year-short":{"displayName":"幓","relative":{"0":"今幓","1":"ēæŒå¹“","-1":"ę˜Ø幓"},"relativeTime":{"future":{"other":"{0} 幓後"},"past":{"other":"{0} 幓前"}}},"month":{"displayName":"꜈","relative":{"0":"ä»Šęœˆ","1":"ēæŒęœˆ","-1":"å…ˆęœˆ"},"relativeTime":{"future":{"other":"{0} ć‹ęœˆå¾Œ"},"past":{"other":"{0} ć‹ęœˆå‰"}}},"month-short":{"displayName":"꜈","relative":{"0":"ä»Šęœˆ","1":"ēæŒęœˆ","-1":"å…ˆęœˆ"},"relativeTime":{"future":{"other":"{0} ć‹ęœˆå¾Œ"},"past":{"other":"{0} ć‹ęœˆå‰"}}},"day":{"displayName":"ę—„","relative":{"0":"今ꗄ","1":"ę˜Žę—„","2":"ę˜Žå¾Œę—„","-2":"äø€ę˜Øę—„","-1":"ę˜Øę—„"},"relativeTime":{"future":{"other":"{0} ę—„å¾Œ"},"past":{"other":"{0} ę—„å‰"}}},"day-short":{"displayName":"ę—„","relative":{"0":"今ꗄ","1":"ę˜Žę—„","2":"ę˜Žå¾Œę—„","-2":"äø€ę˜Øę—„","-1":"ę˜Øę—„"},"relativeTime":{"future":{"other":"{0} ę—„å¾Œ"},"past":{"other":"{0} ę—„å‰"}}},"hour":{"displayName":"Ꙃ","relative":{"0":"1 ę™‚é–“ä»„å†…"},"relativeTime":{"future":{"other":"{0} ę™‚é–“å¾Œ"},"past":{"other":"{0} ę™‚é–“å‰"}}},"hour-short":{"displayName":"Ꙃ","relative":{"0":"1 ę™‚é–“ä»„å†…"},"relativeTime":{"future":{"other":"{0} ę™‚é–“å¾Œ"},"past":{"other":"{0} ę™‚é–“å‰"}}},"minute":{"displayName":"分","relative":{"0":"1 分仄内"},"relativeTime":{"future":{"other":"{0} 分後"},"past":{"other":"{0} 分前"}}},"minute-short":{"displayName":"分","relative":{"0":"1 分仄内"},"relativeTime":{"future":{"other":"{0} 分後"},"past":{"other":"{0} 分前"}}},"second":{"displayName":"ē§’","relative":{"0":"今"},"relativeTime":{"future":{"other":"{0} ē§’後"},"past":{"other":"{0} ē§’前"}}},"second-short":{"displayName":"ē§’","relative":{"0":"今"},"relativeTime":{"future":{"other":"{0} ē§’後"},"past":{"other":"{0} ē§’前"}}}} }); +addLocaleData({ locale: "ja-JP", parentLocale: "ja" }); +addLocaleData({ locale: "ko", pluralRuleFunction: function (n,ord){if(ord)return"other";return"other"},"fields":{"year":{"displayName":"ė…„","relative":{"0":"ģ˜¬ķ•“","1":"ė‚“ė…„","-1":"ģž‘ė…„"},"relativeTime":{"future":{"other":"{0}ė…„ ķ›„"},"past":{"other":"{0}ė…„ ģ „"}}},"year-short":{"displayName":"ė…„","relative":{"0":"ģ˜¬ķ•“","1":"ė‚“ė…„","-1":"ģž‘ė…„"},"relativeTime":{"future":{"other":"{0}ė…„ ķ›„"},"past":{"other":"{0}ė…„ ģ „"}}},"month":{"displayName":"ģ›”","relative":{"0":"ģ“ė²ˆ ė‹¬","1":"ė‹¤ģŒ ė‹¬","-1":"ģ§€ė‚œė‹¬"},"relativeTime":{"future":{"other":"{0}ź°œģ›” ķ›„"},"past":{"other":"{0}ź°œģ›” ģ „"}}},"month-short":{"displayName":"ģ›”","relative":{"0":"ģ“ė²ˆ ė‹¬","1":"ė‹¤ģŒ ė‹¬","-1":"ģ§€ė‚œė‹¬"},"relativeTime":{"future":{"other":"{0}ź°œģ›” ķ›„"},"past":{"other":"{0}ź°œģ›” ģ „"}}},"day":{"displayName":"ģ¼","relative":{"0":"ģ˜¤ėŠ˜","1":"ė‚“ģ¼","2":"ėŖØė ˆ","-2":"ź·øģ €ź»˜","-1":"ģ–“ģ œ"},"relativeTime":{"future":{"other":"{0}ģ¼ ķ›„"},"past":{"other":"{0}ģ¼ ģ „"}}},"day-short":{"displayName":"ģ¼","relative":{"0":"ģ˜¤ėŠ˜","1":"ė‚“ģ¼","2":"ėŖØė ˆ","-2":"ź·øģ €ź»˜","-1":"ģ–“ģ œ"},"relativeTime":{"future":{"other":"{0}ģ¼ ķ›„"},"past":{"other":"{0}ģ¼ ģ „"}}},"hour":{"displayName":"ģ‹œ","relative":{"0":"ķ˜„ģž¬ ģ‹œź°„"},"relativeTime":{"future":{"other":"{0}ģ‹œź°„ ķ›„"},"past":{"other":"{0}ģ‹œź°„ ģ „"}}},"hour-short":{"displayName":"ģ‹œ","relative":{"0":"ķ˜„ģž¬ ģ‹œź°„"},"relativeTime":{"future":{"other":"{0}ģ‹œź°„ ķ›„"},"past":{"other":"{0}ģ‹œź°„ ģ „"}}},"minute":{"displayName":"ė¶„","relative":{"0":"ķ˜„ģž¬ ė¶„"},"relativeTime":{"future":{"other":"{0}ė¶„ ķ›„"},"past":{"other":"{0}ė¶„ ģ „"}}},"minute-short":{"displayName":"ė¶„","relative":{"0":"ķ˜„ģž¬ ė¶„"},"relativeTime":{"future":{"other":"{0}ė¶„ ķ›„"},"past":{"other":"{0}ė¶„ ģ „"}}},"second":{"displayName":"ģ“ˆ","relative":{"0":"ģ§€źøˆ"},"relativeTime":{"future":{"other":"{0}ģ“ˆ ķ›„"},"past":{"other":"{0}ģ“ˆ ģ „"}}},"second-short":{"displayName":"ģ“ˆ","relative":{"0":"ģ§€źøˆ"},"relativeTime":{"future":{"other":"{0}ģ“ˆ ķ›„"},"past":{"other":"{0}ģ“ˆ ģ „"}}}} }); +addLocaleData({ locale: "ko-KR", parentLocale: "ko" }); +addLocaleData({ locale: 'ru', pluralRuleFunction: function (n,ord){var s=String(n).split("."),i=s[0],v0=!s[1],i10=i.slice(-1),i100=i.slice(-2);if(ord)return"other";return v0&&i10==1&&i100!=11?"one":v0&&i10>=2&&i10<=4&&(i100<12||i100>14)?"few":(v0&&i10==0)||(v0&&i10>=5&&i10<=9)||(v0&&i100>=11&&i100<=14)?"many":"other";},"fields":{"year":{"displayName":"Š³Š¾Š“","relative":{"0":"Š² этŠ¾Š¼ Š³Š¾Š“у","1":"Š² сŠ»ŠµŠ“ующŠµŠ¼ Š³Š¾Š“у","-1":"Š² ŠæрŠ¾ŃˆŠ»Š¾Š¼ Š³Š¾Š“у"},"relativeTime":{"future":{"one":"чŠµŃ€ŠµŠ· {0} Š³Š¾Š“","few":"чŠµŃ€ŠµŠ· {0} Š³Š¾Š“Š°","many":"чŠµŃ€ŠµŠ· {0} Š»ŠµŃ‚","other":"чŠµŃ€ŠµŠ· {0} Š³Š¾Š“Š°"},"past":{"one":"{0} Š³Š¾Š“ Š½Š°Š·Š°Š“","few":"{0} Š³Š¾Š“Š° Š½Š°Š·Š°Š“","many":"{0} Š»ŠµŃ‚ Š½Š°Š·Š°Š“","other":"{0} Š³Š¾Š“Š° Š½Š°Š·Š°Š“"}}},"year-short":{"displayName":"Š³.","relative":{"0":"Š² этŠ¾Š¼ Š³.","1":"Š² сŠ»ŠµŠ“. Š³.","-1":"Š² ŠæрŠ¾ŃˆŠ»Š¾Š¼ Š³."},"relativeTime":{"future":{"one":"чŠµŃ€ŠµŠ· {0} Š³.","few":"чŠµŃ€ŠµŠ· {0} Š³.","many":"чŠµŃ€ŠµŠ· {0} Š».","other":"чŠµŃ€ŠµŠ· {0} Š³."},"past":{"one":"{0} Š³. Š½Š°Š·Š°Š“","few":"{0} Š³. Š½Š°Š·Š°Š“","many":"{0} Š». Š½Š°Š·Š°Š“","other":"{0} Š³. Š½Š°Š·Š°Š“"}}},"month":{"displayName":"Š¼ŠµŃŃŃ†","relative":{"0":"Š² этŠ¾Š¼ Š¼ŠµŃŃŃ†Šµ","1":"Š² сŠ»ŠµŠ“ующŠµŠ¼ Š¼ŠµŃŃŃ†Šµ","-1":"Š² ŠæрŠ¾ŃˆŠ»Š¾Š¼ Š¼ŠµŃŃŃ†Šµ"},"relativeTime":{"future":{"one":"чŠµŃ€ŠµŠ· {0} Š¼ŠµŃŃŃ†","few":"чŠµŃ€ŠµŠ· {0} Š¼ŠµŃŃŃ†Š°","many":"чŠµŃ€ŠµŠ· {0} Š¼ŠµŃŃŃ†ŠµŠ²","other":"чŠµŃ€ŠµŠ· {0} Š¼ŠµŃŃŃ†Š°"},"past":{"one":"{0} Š¼ŠµŃŃŃ† Š½Š°Š·Š°Š“","few":"{0} Š¼ŠµŃŃŃ†Š° Š½Š°Š·Š°Š“","many":"{0} Š¼ŠµŃŃŃ†ŠµŠ² Š½Š°Š·Š°Š“","other":"{0} Š¼ŠµŃŃŃ†Š° Š½Š°Š·Š°Š“"}}},"month-short":{"displayName":"Š¼ŠµŃ.","relative":{"0":"Š² этŠ¾Š¼ Š¼ŠµŃ.","1":"Š² сŠ»ŠµŠ“ующŠµŠ¼ Š¼ŠµŃ.","-1":"Š² ŠæрŠ¾ŃˆŠ»Š¾Š¼ Š¼ŠµŃ."},"relativeTime":{"future":{"one":"чŠµŃ€ŠµŠ· {0} Š¼ŠµŃ.","few":"чŠµŃ€ŠµŠ· {0} Š¼ŠµŃ.","many":"чŠµŃ€ŠµŠ· {0} Š¼ŠµŃ.","other":"чŠµŃ€ŠµŠ· {0} Š¼ŠµŃ."},"past":{"one":"{0} Š¼ŠµŃ. Š½Š°Š·Š°Š“","few":"{0} Š¼ŠµŃ. Š½Š°Š·Š°Š“","many":"{0} Š¼ŠµŃ. Š½Š°Š·Š°Š“","other":"{0} Š¼ŠµŃ. Š½Š°Š·Š°Š“"}}},"week":{"displayName":"Š½ŠµŠ“ŠµŠ»Ń","relativePeriod":"Š½Š° Š½ŠµŠ“ŠµŠ»Šµ {0}","relative":{"0":"Š½Š° этŠ¾Š¹ Š½ŠµŠ“ŠµŠ»Šµ","1":"Š½Š° сŠ»ŠµŠ“ующŠµŠ¹ Š½ŠµŠ“ŠµŠ»Šµ","-1":"Š½Š° ŠæрŠ¾ŃˆŠ»Š¾Š¹ Š½ŠµŠ“ŠµŠ»Šµ"},"relativeTime":{"future":{"one":"чŠµŃ€ŠµŠ· {0} Š½ŠµŠ“ŠµŠ»ŃŽ","few":"чŠµŃ€ŠµŠ· {0} Š½ŠµŠ“ŠµŠ»Šø","many":"чŠµŃ€ŠµŠ· {0} Š½ŠµŠ“ŠµŠ»ŃŒ","other":"чŠµŃ€ŠµŠ· {0} Š½ŠµŠ“ŠµŠ»Šø"},"past":{"one":"{0} Š½ŠµŠ“ŠµŠ»ŃŽ Š½Š°Š·Š°Š“","few":"{0} Š½ŠµŠ“ŠµŠ»Šø Š½Š°Š·Š°Š“","many":"{0} Š½ŠµŠ“ŠµŠ»ŃŒ Š½Š°Š·Š°Š“","other":"{0} Š½ŠµŠ“ŠµŠ»Šø Š½Š°Š·Š°Š“"}}},"week-short":{"displayName":"Š½ŠµŠ“.","relativePeriod":"Š½Š° Š½ŠµŠ“. {0}","relative":{"0":"Š½Š° этŠ¾Š¹ Š½ŠµŠ“.","1":"Š½Š° сŠ»ŠµŠ“ующŠµŠ¹ Š½ŠµŠ“.","-1":"Š½Š° ŠæрŠ¾ŃˆŠ»Š¾Š¹ Š½ŠµŠ“."},"relativeTime":{"future":{"one":"чŠµŃ€ŠµŠ· {0} Š½ŠµŠ“.","few":"чŠµŃ€ŠµŠ· {0} Š½ŠµŠ“.","many":"чŠµŃ€ŠµŠ· {0} Š½ŠµŠ“.","other":"чŠµŃ€ŠµŠ· {0} Š½ŠµŠ“."},"past":{"one":"{0} Š½ŠµŠ“. Š½Š°Š·Š°Š“","few":"{0} Š½ŠµŠ“. Š½Š°Š·Š°Š“","many":"{0} Š½ŠµŠ“. Š½Š°Š·Š°Š“","other":"{0} Š½ŠµŠ“. Š½Š°Š·Š°Š“"}}},"day":{"displayName":"Š“ŠµŠ½ŃŒ","relative":{"0":"сŠµŠ³Š¾Š“Š½Ń","1":"Š·Š°Š²Ń‚Ń€Š°","2":"ŠæŠ¾ŃŠ»ŠµŠ·Š°Š²Ń‚Ń€Š°","-1":"Š²Ń‡ŠµŃ€Š°","-2":"ŠæŠ¾Š·Š°Š²Ń‡ŠµŃ€Š°"},"relativeTime":{"future":{"one":"чŠµŃ€ŠµŠ· {0} Š“ŠµŠ½ŃŒ","few":"чŠµŃ€ŠµŠ· {0} Š“Š½Ń","many":"чŠµŃ€ŠµŠ· {0} Š“Š½ŠµŠ¹","other":"чŠµŃ€ŠµŠ· {0} Š“Š½Ń"},"past":{"one":"{0} Š“ŠµŠ½ŃŒ Š½Š°Š·Š°Š“","few":"{0} Š“Š½Ń Š½Š°Š·Š°Š“","many":"{0} Š“Š½ŠµŠ¹ Š½Š°Š·Š°Š“","other":"{0} Š“Š½Ń Š½Š°Š·Š°Š“"}}},"day-short":{"displayName":"Š“Š½.","relative":{"0":"сŠµŠ³Š¾Š“Š½Ń","1":"Š·Š°Š²Ń‚Ń€Š°","2":"ŠæŠ¾ŃŠ»ŠµŠ·Š°Š²Ń‚Ń€Š°","-1":"Š²Ń‡ŠµŃ€Š°","-2":"ŠæŠ¾Š·Š°Š²Ń‡ŠµŃ€Š°"},"relativeTime":{"future":{"one":"чŠµŃ€ŠµŠ· {0} Š“Š½.","few":"чŠµŃ€ŠµŠ· {0} Š“Š½.","many":"чŠµŃ€ŠµŠ· {0} Š“Š½.","other":"чŠµŃ€ŠµŠ· {0} Š“Š½."},"past":{"one":"{0} Š“Š½. Š½Š°Š·Š°Š“","few":"{0} Š“Š½. Š½Š°Š·Š°Š“","many":"{0} Š“Š½. Š½Š°Š·Š°Š“","other":"{0} Š“Š½. Š½Š°Š·Š°Š“"}}},"hour":{"displayName":"чŠ°Ń","relative":{"0":"Š² этŠ¾Ń‚ чŠ°Ń"},"relativeTime":{"future":{"one":"чŠµŃ€ŠµŠ· {0} чŠ°Ń","few":"чŠµŃ€ŠµŠ· {0} чŠ°ŃŠ°","many":"чŠµŃ€ŠµŠ· {0} чŠ°ŃŠ¾Š²","other":"чŠµŃ€ŠµŠ· {0} чŠ°ŃŠ°"},"past":{"one":"{0} чŠ°Ń Š½Š°Š·Š°Š“","few":"{0} чŠ°ŃŠ° Š½Š°Š·Š°Š“","many":"{0} чŠ°ŃŠ¾Š² Š½Š°Š·Š°Š“","other":"{0} чŠ°ŃŠ° Š½Š°Š·Š°Š“"}}},"hour-short":{"displayName":"ч","relative":{"0":"Š² этŠ¾Ń‚ чŠ°Ń"},"relativeTime":{"future":{"one":"чŠµŃ€ŠµŠ· {0} ч.","few":"чŠµŃ€ŠµŠ· {0} ч.","many":"чŠµŃ€ŠµŠ· {0} ч.","other":"чŠµŃ€ŠµŠ· {0} ч."},"past":{"one":"{0} ч. Š½Š°Š·Š°Š“","few":"{0} ч. Š½Š°Š·Š°Š“","many":"{0} ч. Š½Š°Š·Š°Š“","other":"{0} ч. Š½Š°Š·Š°Š“"}}},"minute":{"displayName":"Š¼ŠøŠ½ŃƒŃ‚Š°","relative":{"0":"Š² эту Š¼ŠøŠ½ŃƒŃ‚Ńƒ"},"relativeTime":{"future":{"one":"чŠµŃ€ŠµŠ· {0} Š¼ŠøŠ½ŃƒŃ‚Ńƒ","few":"чŠµŃ€ŠµŠ· {0} Š¼ŠøŠ½ŃƒŃ‚Ń‹","many":"чŠµŃ€ŠµŠ· {0} Š¼ŠøŠ½ŃƒŃ‚","other":"чŠµŃ€ŠµŠ· {0} Š¼ŠøŠ½ŃƒŃ‚Ń‹"},"past":{"one":"{0} Š¼ŠøŠ½ŃƒŃ‚Ńƒ Š½Š°Š·Š°Š“","few":"{0} Š¼ŠøŠ½ŃƒŃ‚Ń‹ Š½Š°Š·Š°Š“","many":"{0} Š¼ŠøŠ½ŃƒŃ‚ Š½Š°Š·Š°Š“","other":"{0} Š¼ŠøŠ½ŃƒŃ‚Ń‹ Š½Š°Š·Š°Š“"}}},"minute-short":{"displayName":"Š¼ŠøŠ½.","relative":{"0":"Š² эту Š¼ŠøŠ½ŃƒŃ‚Ńƒ"},"relativeTime":{"future":{"one":"чŠµŃ€ŠµŠ· {0} Š¼ŠøŠ½.","few":"чŠµŃ€ŠµŠ· {0} Š¼ŠøŠ½.","many":"чŠµŃ€ŠµŠ· {0} Š¼ŠøŠ½.","other":"чŠµŃ€ŠµŠ· {0} Š¼ŠøŠ½."},"past":{"one":"{0} Š¼ŠøŠ½. Š½Š°Š·Š°Š“","few":"{0} Š¼ŠøŠ½. Š½Š°Š·Š°Š“","many":"{0} Š¼ŠøŠ½. Š½Š°Š·Š°Š“","other":"{0} Š¼ŠøŠ½. Š½Š°Š·Š°Š“"}}},"second":{"displayName":"сŠµŠŗуŠ½Š“Š°","relative":{"0":"сŠµŠ¹Ń‡Š°Ń"},"relativeTime":{"future":{"one":"чŠµŃ€ŠµŠ· {0} сŠµŠŗуŠ½Š“у","few":"чŠµŃ€ŠµŠ· {0} сŠµŠŗуŠ½Š“ы","many":"чŠµŃ€ŠµŠ· {0} сŠµŠŗуŠ½Š“","other":"чŠµŃ€ŠµŠ· {0} сŠµŠŗуŠ½Š“ы"},"past":{"one":"{0} сŠµŠŗуŠ½Š“у Š½Š°Š·Š°Š“","few":"{0} сŠµŠŗуŠ½Š“ы Š½Š°Š·Š°Š“","many":"{0} сŠµŠŗуŠ½Š“ Š½Š°Š·Š°Š“","other":"{0} сŠµŠŗуŠ½Š“ы Š½Š°Š·Š°Š“"}}},"second-short":{"displayName":"сŠµŠŗ.","relative":{"0":"сŠµŠ¹Ń‡Š°Ń"},"relativeTime":{"future":{"one":"чŠµŃ€ŠµŠ· {0} сŠµŠŗ.","few":"чŠµŃ€ŠµŠ· {0} сŠµŠŗ.","many":"чŠµŃ€ŠµŠ· {0} сŠµŠŗ.","other":"чŠµŃ€ŠµŠ· {0} сŠµŠŗ."},"past":{"one":"{0} сŠµŠŗ. Š½Š°Š·Š°Š“","few":"{0} сŠµŠŗ. Š½Š°Š·Š°Š“","many":"{0} сŠµŠŗ. Š½Š°Š·Š°Š“","other":"{0} сŠµŠŗ. Š½Š°Š·Š°Š“"}}}} }); +addLocaleData({ locale: "ru-RU", parentLocale: "ru" }); +addLocaleData({ locale: "zh", pluralRuleFunction: function (n,ord){if(ord)return"other";return"other"},"fields":{"year":{"displayName":"幓","relative":{"0":"今幓","1":"ę˜Žå¹“","-1":"去幓"},"relativeTime":{"future":{"other":"{0}幓后"},"past":{"other":"{0}幓前"}}},"year-short":{"displayName":"幓","relative":{"0":"今幓","1":"ę˜Žå¹“","-1":"去幓"},"relativeTime":{"future":{"other":"{0}幓后"},"past":{"other":"{0}幓前"}}},"month":{"displayName":"꜈","relative":{"0":"ęœ¬ęœˆ","1":"äø‹äøŖ꜈","-1":"äøŠäøŖ꜈"},"relativeTime":{"future":{"other":"{0}äøŖęœˆåŽ"},"past":{"other":"{0}äøŖęœˆå‰"}}},"month-short":{"displayName":"꜈","relative":{"0":"ęœ¬ęœˆ","1":"äø‹äøŖ꜈","-1":"äøŠäøŖ꜈"},"relativeTime":{"future":{"other":"{0}äøŖęœˆåŽ"},"past":{"other":"{0}äøŖęœˆå‰"}}},"day":{"displayName":"ę—„","relative":{"0":"今天","1":"ę˜Žå¤©","2":"后天","-2":"前天","-1":"ę˜Ø天"},"relativeTime":{"future":{"other":"{0}天后"},"past":{"other":"{0}天前"}}},"day-short":{"displayName":"ę—„","relative":{"0":"今天","1":"ę˜Žå¤©","2":"后天","-2":"前天","-1":"ę˜Ø天"},"relativeTime":{"future":{"other":"{0}天后"},"past":{"other":"{0}天前"}}},"hour":{"displayName":"å°ę—¶","relative":{"0":"čæ™äø€ę—¶é—“ \u002F ꭤꗶ"},"relativeTime":{"future":{"other":"{0}å°ę—¶åŽ"},"past":{"other":"{0}å°ę—¶å‰"}}},"hour-short":{"displayName":"å°ę—¶","relative":{"0":"čæ™äø€ę—¶é—“ \u002F ꭤꗶ"},"relativeTime":{"future":{"other":"{0}å°ę—¶åŽ"},"past":{"other":"{0}å°ę—¶å‰"}}},"minute":{"displayName":"分钟","relative":{"0":"ę­¤åˆ»"},"relativeTime":{"future":{"other":"{0}分钟后"},"past":{"other":"{0}分钟前"}}},"minute-short":{"displayName":"分","relative":{"0":"ę­¤åˆ»"},"relativeTime":{"future":{"other":"{0}分钟后"},"past":{"other":"{0}分钟前"}}},"second":{"displayName":"ē§’","relative":{"0":"ēŽ°åœØ"},"relativeTime":{"future":{"other":"{0}ē§’钟后"},"past":{"other":"{0}ē§’钟前"}}},"second-short":{"displayName":"ē§’","relative":{"0":"ēŽ°åœØ"},"relativeTime":{"future":{"other":"{0}ē§’后"},"past":{"other":"{0}ē§’前"}}}} }); +addLocaleData({ locale: "zh-CN", parentLocale: "zh" }); diff --git a/plugins/main/public/kibana-integrations/packages/osd-i18n/core/pseudo_locale.ts b/plugins/main/public/kibana-integrations/packages/osd-i18n/core/pseudo_locale.ts new file mode 100644 index 0000000000..02affa92c4 --- /dev/null +++ b/plugins/main/public/kibana-integrations/packages/osd-i18n/core/pseudo_locale.ts @@ -0,0 +1,115 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Matches every single [A-Za-z] character, ``, `](markdown-link-address)` and `@I18N@valid_variable_name@I18N@` + */ +const CHARS_FOR_PSEUDO_LOCALIZATION_REGEX = /[A-Za-z]|(\]\([\s\S]*?\))|(<([^"<>]|("[^"]*?"))*?>)|(@I18N@\w*?@I18N@)/g; +const PSEUDO_ACCENTS_LOCALE = 'en-xa'; + +export function isPseudoLocale(locale: string) { + return locale.toLowerCase() === PSEUDO_ACCENTS_LOCALE; +} + +/** + * Replaces every latin char by pseudo char and repeats every third char twice. + */ +function replacer() { + let count = 0; + + return (match: string) => { + // if `match.length !== 1`, then `match` is html tag or markdown link address, so it should be ignored + if (match.length !== 1) { + return match; + } + + const pseudoChar = pseudoAccentCharMap[match] || match; + return ++count % 3 === 0 ? pseudoChar.repeat(2) : pseudoChar; + }; +} + +export function translateUsingPseudoLocale(message: string) { + return message.replace(CHARS_FOR_PSEUDO_LOCALIZATION_REGEX, replacer()); +} + +const pseudoAccentCharMap: Record = { + a: 'Ć ', + b: 'ʀ', + c: 'Ƨ', + d: 'Ć°', + e: 'Ć©', + f: 'ʒ', + g: 'ĝ', + h: 'Ä„', + i: 'Ć®', + l: 'ļ', + k: 'Ä·', + j: 'ĵ', + m: 'ɱ', + n: 'Ʊ', + o: 'Ć“', + p: 'Ć¾', + q: 'Ē«', + r: 'ŕ', + s: 'Å”', + t: 'Å£', + u: 'Ć»', + v: 'į¹½', + w: 'ŵ', + x: 'įŗ‹', + y: 'Ć½', + z: 'ž', + A: 'ƀ', + B: 'ʁ', + C: 'Ƈ', + D: 'Ɛ', + E: 'Ɖ', + F: 'ʑ', + G: 'Ĝ', + H: 'Ĥ', + I: 'Ǝ', + L: 'Ä»', + K: 'Ķ', + J: 'Ä“', + M: 'į¹€', + N: 'Ƒ', + O: 'Ɣ', + P: 'ƞ', + Q: 'ĒŖ', + R: 'Ŕ', + S: 'Å ', + T: 'Å¢', + U: 'ƛ', + V: 'į¹¼', + W: 'Å“', + X: 'įŗŠ', + Y: 'Ɲ', + Z: 'Ž', +}; diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/angular_config.tsx b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/angular_config.tsx new file mode 100644 index 0000000000..fbe36a289d --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/angular_config.tsx @@ -0,0 +1,380 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { + ICompileProvider, + IHttpProvider, + IHttpService, + ILocationProvider, + IModule, + IRootScopeService, +} from 'angular'; +import $ from 'jquery'; +import { set } from '@elastic/safer-lodash-set'; +import { get } from 'lodash'; +import * as Rx from 'rxjs'; +import { ChromeBreadcrumb, EnvironmentMode, PackageInfo } from 'opensearch-dashboards/public'; +import { History } from 'history'; + +import { CoreStart } from 'opensearch-dashboards/public'; +import { isSystemApiRequest } from '../utils'; +import { formatAngularHttpError, isAngularHttpError } from '../notify/lib'; + +export interface RouteConfiguration { + controller?: string | ((...args: any[]) => void); + redirectTo?: string; + resolveRedirectTo?: (...args: any[]) => void; + reloadOnSearch?: boolean; + reloadOnUrl?: boolean; + outerAngularWrapperRoute?: boolean; + resolve?: object; + template?: string; + k7Breadcrumbs?: (...args: any[]) => ChromeBreadcrumb[]; + requireUICapability?: string; +} + +/** + * Detects whether a given angular route is a dummy route that doesn't + * require any action. There are two ways this can happen: + * If `outerAngularWrapperRoute` is set on the route config object, + * it means the local application service set up this route on the outer angular + * and the internal routes will handle the hooks. + * + * If angular did not detect a route and it is the local angular, we are currently + * navigating away from a URL controlled by a local angular router and the + * application will get unmounted. In this case the outer router will handle + * the hooks. + * @param $route Injected $route dependency + * @param isLocalAngular Flag whether this is the local angular router + */ +function isDummyRoute($route: any, isLocalAngular: boolean) { + return ( + ($route.current && $route.current.$$route && $route.current.$$route.outerAngularWrapperRoute) || + (!$route.current && isLocalAngular) + ); +} + +export const configureAppAngularModule = ( + angularModule: IModule, + newPlatform: { + core: CoreStart; + readonly env: { + mode: Readonly; + packageInfo: Readonly; + }; + }, + isLocalAngular: boolean, + getHistory?: () => History +) => { + const core = 'core' in newPlatform ? newPlatform.core : newPlatform; + const packageInfo = newPlatform.env.packageInfo; + + angularModule + .value('osdVersion', packageInfo.version) + .value('buildNum', packageInfo.buildNum) + .value('buildSha', packageInfo.buildSha) + .value('opensearchUrl', getOpenSearchUrl(core)) + .value('uiCapabilities', core.application.capabilities) + .config(setupCompileProvider(newPlatform.env.mode.dev)) + .config(setupLocationProvider()) + .config($setupXsrfRequestInterceptor(packageInfo.version)) + .run(capture$httpLoadingCount(core)) + .run(digestOnHashChange(getHistory)) + .run($setupBreadcrumbsAutoClear(core, isLocalAngular)) + .run($setupBadgeAutoClear(core, isLocalAngular)) + .run($setupHelpExtensionAutoClear(core, isLocalAngular)) + .run($setupUICapabilityRedirect(core)); +}; + +const getOpenSearchUrl = (newPlatform: CoreStart) => { + const a = document.createElement('a'); + a.href = newPlatform.http.basePath.prepend('/opensearch'); + const protocolPort = /https/.test(a.protocol) ? 443 : 80; + const port = a.port || protocolPort; + return { + host: a.hostname, + port, + protocol: a.protocol, + pathname: a.pathname, + }; +}; + +const digestOnHashChange = (getHistory?: () => History) => ($rootScope: IRootScopeService) => { + if (!getHistory) return; + const unlisten = getHistory().listen(() => { + // dispatch synthetic hash change event to update hash history objects and angular routing + // this is necessary because hash updates triggered by using popState won't trigger this event naturally. + // this has to happen in the next tick to not change the existing timing of angular digest cycles. + setTimeout(() => { + window.dispatchEvent(new HashChangeEvent('hashchange')); + }, 0); + }); + $rootScope.$on('$destroy', unlisten); +}; + +const setupCompileProvider = (devMode: boolean) => ($compileProvider: ICompileProvider) => { + if (!devMode) { + $compileProvider.debugInfoEnabled(false); + } +}; + +const setupLocationProvider = () => ($locationProvider: ILocationProvider) => { + $locationProvider.html5Mode({ + enabled: false, + requireBase: false, + rewriteLinks: false, + }); + + $locationProvider.hashPrefix(''); +}; + +export const $setupXsrfRequestInterceptor = (version: string) => { + // Configure jQuery prefilter + $.ajaxPrefilter(({ osdXsrfToken = true }: any, originalOptions, jqXHR) => { + if (osdXsrfToken) { + jqXHR.setRequestHeader('osd-xsrf', 'osd-legacy'); + // ToDo: Remove next; `osd-version` incorrectly used for satisfying XSRF protection + jqXHR.setRequestHeader('osd-version', version); + } + }); + + return ($httpProvider: IHttpProvider) => { + // Configure $httpProvider interceptor + $httpProvider.interceptors.push(() => { + return { + request(opts) { + const { osdXsrfToken = true } = opts as any; + if (osdXsrfToken) { + set(opts, ['headers', 'osd-xsrf'], 'osd-legacy'); + // ToDo: Remove next; `osd-version` incorrectly used for satisfying XSRF protection + set(opts, ['headers', 'osd-version'], version); + } + return opts; + }, + }; + }); + }; +}; + +/** + * Injected into angular module by ui/chrome angular integration + * and adds a root-level watcher that will capture the count of + * active $http requests on each digest loop and expose the count to + * the core.loadingCount api + */ +const capture$httpLoadingCount = (newPlatform: CoreStart) => ( + $rootScope: IRootScopeService, + $http: IHttpService +) => { + newPlatform.http.addLoadingCountSource( + new Rx.Observable((observer) => { + const unwatch = $rootScope.$watch(() => { + const reqs = $http.pendingRequests || []; + observer.next(reqs.filter((req) => !isSystemApiRequest(req)).length); + }); + + return unwatch; + }) + ); +}; + +/** + * integrates with angular to automatically redirect to home if required + * capability is not met + */ +const $setupUICapabilityRedirect = (newPlatform: CoreStart) => ( + $rootScope: IRootScopeService, + $injector: any +) => { + const isOpenSearchDashboardsAppRoute = window.location.pathname.endsWith( + '/app/opensearch-dashboards' + ); + // this feature only works within opensearch dashboards app for now after everything is + // switched to the application service, this can be changed to handle all + // apps. + if (!isOpenSearchDashboardsAppRoute) { + return; + } + $rootScope.$on( + '$routeChangeStart', + (event, { $$route: route }: { $$route?: RouteConfiguration } = {}) => { + if (!route || !route.requireUICapability) { + return; + } + + if (!get(newPlatform.application.capabilities, route.requireUICapability)) { + $injector.get('$location').url('/home'); + event.preventDefault(); + } + } + ); +}; + +/** + * internal angular run function that will be called when angular bootstraps and + * lets us integrate with the angular router so that we can automatically clear + * the breadcrumbs if we switch to a OpenSearch Dashboards app that does not use breadcrumbs correctly + */ +const $setupBreadcrumbsAutoClear = (newPlatform: CoreStart, isLocalAngular: boolean) => ( + $rootScope: IRootScopeService, + $injector: any +) => { + // A flag used to determine if we should automatically + // clear the breadcrumbs between angular route changes. + let breadcrumbSetSinceRouteChange = false; + const $route = $injector.has('$route') ? $injector.get('$route') : {}; + + // reset breadcrumbSetSinceRouteChange any time the breadcrumbs change, even + // if it was done directly through the new platform + newPlatform.chrome.getBreadcrumbs$().subscribe({ + next() { + breadcrumbSetSinceRouteChange = true; + }, + }); + + $rootScope.$on('$routeChangeStart', () => { + breadcrumbSetSinceRouteChange = false; + }); + + $rootScope.$on('$routeChangeSuccess', () => { + if (isDummyRoute($route, isLocalAngular)) { + return; + } + const current = $route.current || {}; + + if (breadcrumbSetSinceRouteChange || (current.$$route && current.$$route.redirectTo)) { + return; + } + + const k7BreadcrumbsProvider = current.k7Breadcrumbs; + if (!k7BreadcrumbsProvider) { + newPlatform.chrome.setBreadcrumbs([]); + return; + } + + try { + newPlatform.chrome.setBreadcrumbs($injector.invoke(k7BreadcrumbsProvider)); + } catch (error) { + if (isAngularHttpError(error)) { + error = formatAngularHttpError(error); + } + newPlatform.fatalErrors.add(error, 'location'); + } + }); +}; + +/** + * internal angular run function that will be called when angular bootstraps and + * lets us integrate with the angular router so that we can automatically clear + * the badge if we switch to a OpenSearch Dashboards app that does not use the badge correctly + */ +const $setupBadgeAutoClear = (newPlatform: CoreStart, isLocalAngular: boolean) => ( + $rootScope: IRootScopeService, + $injector: any +) => { + // A flag used to determine if we should automatically + // clear the badge between angular route changes. + let badgeSetSinceRouteChange = false; + const $route = $injector.has('$route') ? $injector.get('$route') : {}; + + $rootScope.$on('$routeChangeStart', () => { + badgeSetSinceRouteChange = false; + }); + + $rootScope.$on('$routeChangeSuccess', () => { + if (isDummyRoute($route, isLocalAngular)) { + return; + } + const current = $route.current || {}; + + if (badgeSetSinceRouteChange || (current.$$route && current.$$route.redirectTo)) { + return; + } + + const badgeProvider = current.badge; + if (!badgeProvider) { + newPlatform.chrome.setBadge(undefined); + return; + } + + try { + newPlatform.chrome.setBadge($injector.invoke(badgeProvider)); + } catch (error) { + if (isAngularHttpError(error)) { + error = formatAngularHttpError(error); + } + newPlatform.fatalErrors.add(error, 'location'); + } + }); +}; + +/** + * internal angular run function that will be called when angular bootstraps and + * lets us integrate with the angular router so that we can automatically clear + * the helpExtension if we switch to a OpenSearch Dashboards app that does not set its own + * helpExtension + */ +const $setupHelpExtensionAutoClear = (newPlatform: CoreStart, isLocalAngular: boolean) => ( + $rootScope: IRootScopeService, + $injector: any +) => { + /** + * reset helpExtensionSetSinceRouteChange any time the helpExtension changes, even + * if it was done directly through the new platform + */ + let helpExtensionSetSinceRouteChange = false; + newPlatform.chrome.getHelpExtension$().subscribe({ + next() { + helpExtensionSetSinceRouteChange = true; + }, + }); + + const $route = $injector.has('$route') ? $injector.get('$route') : {}; + + $rootScope.$on('$routeChangeStart', () => { + if (isDummyRoute($route, isLocalAngular)) { + return; + } + helpExtensionSetSinceRouteChange = false; + }); + + $rootScope.$on('$routeChangeSuccess', () => { + if (isDummyRoute($route, isLocalAngular)) { + return; + } + const current = $route.current || {}; + + if (helpExtensionSetSinceRouteChange || (current.$$route && current.$$route.redirectTo)) { + return; + } + + newPlatform.chrome.setHelpExtension(current.helpExtension); + }); +}; diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/index.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/index.ts new file mode 100644 index 0000000000..c492de5100 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/index.ts @@ -0,0 +1,38 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// @ts-ignore +export { PromiseServiceCreator } from './promises'; +// @ts-ignore +export { watchMultiDecorator } from './watch_multi'; +export * from './angular_config'; +// @ts-ignore +export { createTopNavDirective, createTopNavHelper, loadOsdTopNavDirectives } from './osd_top_nav'; +export { subscribeWithScope } from './subscribe_with_scope'; diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/osd_top_nav.js b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/osd_top_nav.js new file mode 100644 index 0000000000..11835005b6 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/osd_top_nav.js @@ -0,0 +1,140 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import angular from 'angular'; +import 'ngreact'; + +export function createTopNavDirective() { + return { + restrict: 'E', + template: '', + compile: (elem) => { + const child = document.createElement('osd-top-nav-helper'); + + // Copy attributes to the child directive + for (const attr of elem[0].attributes) { + child.setAttribute(attr.name, attr.value); + } + + // Add a special attribute that will change every time that one + // of the config array's disableButton function return value changes. + child.setAttribute('disabled-buttons', 'disabledButtons'); + + // Append helper directive + elem.append(child); + + const linkFn = ($scope, _, $attr) => { + // Watch config changes + $scope.$watch( + () => { + const config = $scope.$eval($attr.config) || []; + return config.map((item) => { + // Copy key into id, as it's a reserved react propery. + // This is done for Angular directive backward compatibility. + // In React only id is recognized. + if (item.key && !item.id) { + item.id = item.key; + } + + // Watch the disableButton functions + if (typeof item.disableButton === 'function') { + return item.disableButton(); + } + return item.disableButton; + }); + }, + (newVal) => { + $scope.disabledButtons = newVal; + }, + true + ); + }; + + return linkFn; + }, + }; +} + +export const createTopNavHelper = ({ TopNavMenu }) => (reactDirective) => { + return reactDirective(TopNavMenu, [ + ['config', { watchDepth: 'value' }], + ['setMenuMountPoint', { watchDepth: 'reference' }], + ['disabledButtons', { watchDepth: 'reference' }], + + ['query', { watchDepth: 'reference' }], + ['savedQuery', { watchDepth: 'reference' }], + ['intl', { watchDepth: 'reference' }], + + ['onQuerySubmit', { watchDepth: 'reference' }], + ['onFiltersUpdated', { watchDepth: 'reference' }], + ['onRefreshChange', { watchDepth: 'reference' }], + ['onClearSavedQuery', { watchDepth: 'reference' }], + ['onSaved', { watchDepth: 'reference' }], + ['onSavedQueryUpdated', { watchDepth: 'reference' }], + ['onSavedQueryIdChange', { watchDepth: 'reference' }], + + ['indexPatterns', { watchDepth: 'collection' }], + ['filters', { watchDepth: 'collection' }], + + // All modifiers default to true. + // Set to false to hide subcomponents. + 'showSearchBar', + 'showQueryBar', + 'showQueryInput', + 'showSaveQuery', + 'showDatePicker', + 'showFilterBar', + + 'appName', + 'screenTitle', + 'dateRangeFrom', + 'dateRangeTo', + 'savedQueryId', + 'isRefreshPaused', + 'refreshInterval', + 'disableAutoFocus', + 'showAutoRefreshOnly', + + // temporary flag to use the stateful components + 'useDefaultBehaviors', + ]); +}; + +let isLoaded = false; + +export function loadOsdTopNavDirectives(navUi) { + if (!isLoaded) { + isLoaded = true; + angular + .module('opensearchDashboards') + .directive('osdTopNav', createTopNavDirective) + .directive('osdTopNavHelper', createTopNavHelper(navUi)); + } +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/promises.js b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/promises.js new file mode 100644 index 0000000000..690bc5489d --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/promises.js @@ -0,0 +1,140 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import _ from 'lodash'; + +export function PromiseServiceCreator($q, $timeout) { + function Promise(fn) { + if (typeof this === 'undefined') + throw new Error('Promise constructor must be called with "new"'); + + const defer = $q.defer(); + try { + fn(defer.resolve, defer.reject); + } catch (e) { + defer.reject(e); + } + return defer.promise; + } + + Promise.all = Promise.props = $q.all; + Promise.resolve = function (val) { + const defer = $q.defer(); + defer.resolve(val); + return defer.promise; + }; + Promise.reject = function (reason) { + const defer = $q.defer(); + defer.reject(reason); + return defer.promise; + }; + Promise.cast = $q.when; + Promise.delay = function (ms) { + return $timeout(_.noop, ms); + }; + Promise.method = function (fn) { + return function () { + const args = Array.prototype.slice.call(arguments); + return Promise.try(fn, args, this); + }; + }; + Promise.nodeify = function (promise, cb) { + promise.then(function (val) { + cb(void 0, val); + }, cb); + }; + Promise.map = function (arr, fn) { + return Promise.all( + arr.map(function (i, el, list) { + return Promise.try(fn, [i, el, list]); + }) + ); + }; + Promise.each = function (arr, fn) { + const queue = arr.slice(0); + let i = 0; + return (function next() { + if (!queue.length) return arr; + return Promise.try(fn, [arr.shift(), i++]).then(next); + })(); + }; + Promise.is = function (obj) { + // $q doesn't create instances of any constructor, promises are just objects with a then function + // https://github.com/angular/angular.js/blob/58f5da86645990ef984353418cd1ed83213b111e/src/ng/q.js#L335 + return obj && typeof obj.then === 'function'; + }; + Promise.halt = _.once(function () { + const promise = new Promise(() => {}); + promise.then = _.constant(promise); + promise.catch = _.constant(promise); + return promise; + }); + Promise.try = function (fn, args, ctx) { + if (typeof fn !== 'function') { + return Promise.reject(new TypeError('fn must be a function')); + } + + let value; + + if (Array.isArray(args)) { + try { + value = fn.apply(ctx, args); + } catch (e) { + return Promise.reject(e); + } + } else { + try { + value = fn.call(ctx, args); + } catch (e) { + return Promise.reject(e); + } + } + + return Promise.resolve(value); + }; + Promise.fromNode = function (takesCbFn) { + return new Promise(function (resolve, reject) { + takesCbFn(function (err, ...results) { + if (err) reject(err); + else if (results.length > 1) resolve(results); + else resolve(results[0]); + }); + }); + }; + Promise.race = function (iterable) { + return new Promise((resolve, reject) => { + for (const i of iterable) { + Promise.resolve(i).then(resolve, reject); + } + }); + }; + + return Promise; +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/subscribe_with_scope.test.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/subscribe_with_scope.test.ts new file mode 100644 index 0000000000..3784988fc8 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/subscribe_with_scope.test.ts @@ -0,0 +1,208 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import * as Rx from 'rxjs'; +import { subscribeWithScope } from './subscribe_with_scope'; + +// eslint-disable-next-line prefer-const +let $rootScope: Scope; + +class Scope { + public $$phase?: string; + public $root = $rootScope; + public $apply = jest.fn((fn: () => void) => fn()); +} + +$rootScope = new Scope(); + +afterEach(() => { + jest.clearAllMocks(); +}); + +it('subscribes to the passed observable, returns subscription', () => { + const $scope = new Scope(); + + const unsubSpy = jest.fn(); + const subSpy = jest.fn(() => unsubSpy); + const observable = new Rx.Observable(subSpy); + + const subscription = subscribeWithScope($scope as any, observable); + expect(subSpy).toHaveBeenCalledTimes(1); + expect(unsubSpy).not.toHaveBeenCalled(); + + subscription.unsubscribe(); + + expect(subSpy).toHaveBeenCalledTimes(1); + expect(unsubSpy).toHaveBeenCalledTimes(1); +}); + +it('calls observer.next() if already in a digest cycle, wraps in $scope.$apply if not', () => { + const subject = new Rx.Subject(); + const nextSpy = jest.fn(); + const $scope = new Scope(); + + subscribeWithScope($scope as any, subject, { next: nextSpy }); + + subject.next(); + expect($scope.$apply).toHaveBeenCalledTimes(1); + expect(nextSpy).toHaveBeenCalledTimes(1); + + jest.clearAllMocks(); + + $rootScope.$$phase = '$digest'; + subject.next(); + expect($scope.$apply).not.toHaveBeenCalled(); + expect(nextSpy).toHaveBeenCalledTimes(1); +}); + +it('reports fatalError if observer.next() throws', () => { + const fatalError = jest.fn(); + const $scope = new Scope(); + subscribeWithScope( + $scope as any, + Rx.of(undefined), + { + next() { + throw new Error('foo bar'); + }, + }, + fatalError + ); + + expect(fatalError.mock.calls).toMatchInlineSnapshot(` +Array [ + Array [ + [Error: foo bar], + ], +] +`); +}); + +it('reports fatal error if observer.error is not defined and observable errors', () => { + const fatalError = jest.fn(); + const $scope = new Scope(); + const error = new Error('foo'); + error.stack = `${error.message}\n---stack trace ---`; + subscribeWithScope($scope as any, Rx.throwError(error), undefined, fatalError); + + expect(fatalError.mock.calls).toMatchInlineSnapshot(` +Array [ + Array [ + [Error: Uncaught error in subscribeWithScope(): foo +---stack trace ---], + ], +] +`); +}); + +it('reports fatal error if observer.error throws', () => { + const fatalError = jest.fn(); + const $scope = new Scope(); + subscribeWithScope( + $scope as any, + Rx.throwError(new Error('foo')), + { + error: () => { + throw new Error('foo'); + }, + }, + fatalError + ); + + expect(fatalError.mock.calls).toMatchInlineSnapshot(` +Array [ + Array [ + [Error: foo], + ], +] +`); +}); + +it('does not report fatal error if observer.error handles the error', () => { + const fatalError = jest.fn(); + const $scope = new Scope(); + subscribeWithScope( + $scope as any, + Rx.throwError(new Error('foo')), + { + error: () => { + // noop, swallow error + }, + }, + fatalError + ); + + expect(fatalError.mock.calls).toEqual([]); +}); + +it('reports fatal error if observer.complete throws', () => { + const fatalError = jest.fn(); + const $scope = new Scope(); + subscribeWithScope( + $scope as any, + Rx.EMPTY, + { + complete: () => { + throw new Error('foo'); + }, + }, + fatalError + ); + + expect(fatalError.mock.calls).toMatchInlineSnapshot(` +Array [ + Array [ + [Error: foo], + ], +] +`); +}); + +it('preserves the context of the observer functions', () => { + const $scope = new Scope(); + const observer = { + next() { + expect(this).toBe(observer); + }, + complete() { + expect(this).toBe(observer); + }, + }; + + subscribeWithScope($scope as any, Rx.of([1, 2, 3]), observer); + + const observer2 = { + error() { + expect(this).toBe(observer); + }, + }; + + subscribeWithScope($scope as any, Rx.throwError(new Error('foo')), observer2); +}); diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/subscribe_with_scope.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/subscribe_with_scope.ts new file mode 100644 index 0000000000..f8cb102379 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/subscribe_with_scope.ts @@ -0,0 +1,96 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { IScope } from 'angular'; +import * as Rx from 'rxjs'; +import { AngularHttpError } from '../notify/lib'; + +type FatalErrorFn = (error: AngularHttpError | Error | string, location?: string) => void; + +function callInDigest($scope: IScope, fn: () => void, fatalError?: FatalErrorFn) { + try { + // this is terrible, but necessary to synchronously deliver subscription values + // to angular scopes. This is required by some APIs, like the `config` service, + // and beneficial for root level directives where additional digest cycles make + // opensearch dashboards sluggish to load. + // + // If you copy this code elsewhere you better have a good reason :) + if ($scope.$root.$$phase) { + fn(); + } else { + $scope.$apply(() => fn()); + } + } catch (error) { + if (fatalError) { + fatalError(error); + } + } +} + +/** + * Subscribe to an observable at a $scope, ensuring that the digest cycle + * is run for subscriber hooks and routing errors to fatalError if not handled. + */ +export function subscribeWithScope( + $scope: IScope, + observable: Rx.Observable, + observer?: Rx.PartialObserver, + fatalError?: FatalErrorFn +) { + return observable.subscribe({ + next(value) { + if (observer && observer.next) { + callInDigest($scope, () => observer.next!(value), fatalError); + } + }, + error(error) { + callInDigest( + $scope, + () => { + if (observer && observer.error) { + observer.error(error); + } else { + throw new Error( + `Uncaught error in subscribeWithScope(): ${ + error ? error.stack || error.message : error + }` + ); + } + }, + fatalError + ); + }, + complete() { + if (observer && observer.complete) { + callInDigest($scope, () => observer.complete!(), fatalError); + } + }, + }); +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/watch_multi.js b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/watch_multi.js new file mode 100644 index 0000000000..8dfcb0f594 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular/watch_multi.js @@ -0,0 +1,159 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import _ from 'lodash'; + +export function watchMultiDecorator($provide) { + $provide.decorator('$rootScope', function ($delegate) { + /** + * Watch multiple expressions with a single callback. Along + * with making code simpler it also merges all of the watcher + * handlers within a single tick. + * + * # expression format + * expressions can be specified in one of the following ways: + * 1. string that evaluates to a value on scope. Creates a regular $watch + * expression. + * 'someScopeValue.prop' === $scope.$watch('someScopeValue.prop', fn); + * + * 2. #1 prefixed with '[]', which uses $watchCollection rather than $watch. + * '[]expr' === $scope.$watchCollection('expr', fn); + * + * 3. #1 prefixed with '=', which uses $watch with objectEquality turned on + * '=expr' === $scope.$watch('expr', fn, true); + * + * 4. a function that will be called, like a normal function water + * + * 5. an object with any of the properties: + * `get`: the getter called on each iteration + * `deep`: a flag to turn on objectEquality in $watch + * `fn`: the watch registration function ($scope.$watch or $scope.$watchCollection) + * + * @param {array[string|function|obj]} expressions - the list of expressions to $watch + * @param {Function} fn - the callback function + * @return {Function} - an unwatch function, just like the return value of $watch + */ + $delegate.constructor.prototype.$watchMulti = function (expressions, fn) { + if (!Array.isArray(expressions)) { + throw new TypeError('expected an array of expressions to watch'); + } + + if (!_.isFunction(fn)) { + throw new TypeError('expected a function that is triggered on each watch'); + } + const $scope = this; + const vals = new Array(expressions.length); + const prev = new Array(expressions.length); + let fire = false; + let init = 0; + const neededInits = expressions.length; + + // first, register all of the multi-watchers + const unwatchers = expressions.map(function (expr, i) { + expr = normalizeExpression($scope, expr); + if (!expr) return; + + return expr.fn.call( + $scope, + expr.get, + function (newVal, oldVal) { + if (newVal === oldVal) { + init += 1; + } + + vals[i] = newVal; + prev[i] = oldVal; + fire = true; + }, + expr.deep + ); + }); + + // then, the watcher that checks to see if any of + // the other watchers triggered this cycle + let flip = false; + unwatchers.push( + $scope.$watch( + function () { + if (init < neededInits) return init; + + if (fire) { + fire = false; + flip = !flip; + } + return flip; + }, + function () { + if (init < neededInits) return false; + + fn(vals.slice(0), prev.slice(0)); + vals.forEach(function (v, i) { + prev[i] = v; + }); + } + ) + ); + + return function () { + unwatchers.forEach((listener) => listener()); + }; + }; + + function normalizeExpression($scope, expr) { + if (!expr) return; + const norm = { + fn: $scope.$watch, + deep: false, + }; + + if (_.isFunction(expr)) return _.assign(norm, { get: expr }); + if (_.isObject(expr)) return _.assign(norm, expr); + if (!_.isString(expr)) return; + + if (expr.substr(0, 2) === '[]') { + return _.assign(norm, { + fn: $scope.$watchCollection, + get: expr.substr(2), + }); + } + + if (expr.charAt(0) === '=') { + return _.assign(norm, { + deep: true, + get: expr.substr(1), + }); + } + + return _.assign(norm, { get: expr }); + } + + return $delegate; + }); +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/bind_html/bind_html.js b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/bind_html/bind_html.js new file mode 100755 index 0000000000..5e6f2edea6 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/bind_html/bind_html.js @@ -0,0 +1,28 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* eslint-disable */ + +import angular from 'angular'; + +export function initBindHtml() { + angular + .module('ui.bootstrap.bindHtml', []) + + .directive('bindHtmlUnsafe', function() { + return function(scope, element, attr) { + element.addClass('ng-binding').data('$binding', attr.bindHtmlUnsafe); + scope.$watch(attr.bindHtmlUnsafe, function bindHtmlUnsafeWatchAction(value) { + element.html(value || ''); + }); + }; + }); +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/index.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/index.ts new file mode 100644 index 0000000000..63b0431ebb --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/index.ts @@ -0,0 +1,61 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* eslint-disable */ + +import { once } from 'lodash'; +import angular from 'angular'; + +// @ts-ignore +import { initBindHtml } from './bind_html/bind_html'; +// @ts-ignore +import { initBootstrapTooltip } from './tooltip/tooltip'; + +import tooltipPopup from './tooltip/tooltip_popup.html'; + +import tooltipUnsafePopup from './tooltip/tooltip_html_unsafe_popup.html'; + +export const initAngularBootstrap = once(() => { + /* + * angular-ui-bootstrap + * http://angular-ui.github.io/bootstrap/ + + * Version: 0.12.1 - 2015-02-20 + * License: MIT + */ + angular.module('ui.bootstrap', [ + 'ui.bootstrap.tpls', + 'ui.bootstrap.bindHtml', + 'ui.bootstrap.tooltip', + ]); + + angular.module('ui.bootstrap.tpls', [ + 'template/tooltip/tooltip-html-unsafe-popup.html', + 'template/tooltip/tooltip-popup.html', + ]); + + initBindHtml(); + initBootstrapTooltip(); + + angular.module('template/tooltip/tooltip-html-unsafe-popup.html', []).run([ + '$templateCache', + function($templateCache: any) { + $templateCache.put('template/tooltip/tooltip-html-unsafe-popup.html', tooltipUnsafePopup); + }, + ]); + + angular.module('template/tooltip/tooltip-popup.html', []).run([ + '$templateCache', + function($templateCache: any) { + $templateCache.put('template/tooltip/tooltip-popup.html', tooltipPopup); + }, + ]); +}); diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/position.js b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/position.js new file mode 100755 index 0000000000..2f322e2b42 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/position.js @@ -0,0 +1,178 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* eslint-disable */ + +import angular from 'angular'; + +export function initBootstrapPosition() { + angular + .module('ui.bootstrap.position', []) + + /** + * A set of utility methods that can be use to retrieve position of DOM elements. + * It is meant to be used where we need to absolute-position DOM elements in + * relation to other, existing elements (this is the case for tooltips, popovers, + * typeahead suggestions etc.). + */ + .factory('$position', [ + '$document', + '$window', + function($document, $window) { + function getStyle(el, cssprop) { + if (el.currentStyle) { + //IE + return el.currentStyle[cssprop]; + } else if ($window.getComputedStyle) { + return $window.getComputedStyle(el)[cssprop]; + } + // finally try and get inline style + return el.style[cssprop]; + } + + /** + * Checks if a given element is statically positioned + * @param element - raw DOM element + */ + function isStaticPositioned(element) { + return (getStyle(element, 'position') || 'static') === 'static'; + } + + /** + * returns the closest, non-statically positioned parentOffset of a given element + * @param element + */ + const parentOffsetEl = function(element) { + const docDomEl = $document[0]; + let offsetParent = element.offsetParent || docDomEl; + while (offsetParent && offsetParent !== docDomEl && isStaticPositioned(offsetParent)) { + offsetParent = offsetParent.offsetParent; + } + return offsetParent || docDomEl; + }; + + return { + /** + * Provides read-only equivalent of jQuery's position function: + * http://api.jquery.com/position/ + */ + position: function(element) { + const elBCR = this.offset(element); + let offsetParentBCR = { top: 0, left: 0 }; + const offsetParentEl = parentOffsetEl(element[0]); + if (offsetParentEl != $document[0]) { + offsetParentBCR = this.offset(angular.element(offsetParentEl)); + offsetParentBCR.top += offsetParentEl.clientTop - offsetParentEl.scrollTop; + offsetParentBCR.left += offsetParentEl.clientLeft - offsetParentEl.scrollLeft; + } + + const boundingClientRect = element[0].getBoundingClientRect(); + return { + width: boundingClientRect.width || element.prop('offsetWidth'), + height: boundingClientRect.height || element.prop('offsetHeight'), + top: elBCR.top - offsetParentBCR.top, + left: elBCR.left - offsetParentBCR.left, + }; + }, + + /** + * Provides read-only equivalent of jQuery's offset function: + * http://api.jquery.com/offset/ + */ + offset: function(element) { + const boundingClientRect = element[0].getBoundingClientRect(); + return { + width: boundingClientRect.width || element.prop('offsetWidth'), + height: boundingClientRect.height || element.prop('offsetHeight'), + top: + boundingClientRect.top + + ($window.pageYOffset || $document[0].documentElement.scrollTop), + left: + boundingClientRect.left + + ($window.pageXOffset || $document[0].documentElement.scrollLeft), + }; + }, + + /** + * Provides coordinates for the targetEl in relation to hostEl + */ + positionElements: function(hostEl, targetEl, positionStr, appendToBody) { + const positionStrParts = positionStr.split('-'); + const pos0 = positionStrParts[0]; + const pos1 = positionStrParts[1] || 'center'; + + let hostElPos; + let targetElWidth; + let targetElHeight; + let targetElPos; + + hostElPos = appendToBody ? this.offset(hostEl) : this.position(hostEl); + + targetElWidth = targetEl.prop('offsetWidth'); + targetElHeight = targetEl.prop('offsetHeight'); + + const shiftWidth = { + center: function() { + return hostElPos.left + hostElPos.width / 2 - targetElWidth / 2; + }, + left: function() { + return hostElPos.left; + }, + right: function() { + return hostElPos.left + hostElPos.width; + }, + }; + + const shiftHeight = { + center: function() { + return hostElPos.top + hostElPos.height / 2 - targetElHeight / 2; + }, + top: function() { + return hostElPos.top; + }, + bottom: function() { + return hostElPos.top + hostElPos.height; + }, + }; + + switch (pos0) { + case 'right': + targetElPos = { + top: shiftHeight[pos1](), + left: shiftWidth[pos0](), + }; + break; + case 'left': + targetElPos = { + top: shiftHeight[pos1](), + left: hostElPos.left - targetElWidth, + }; + break; + case 'bottom': + targetElPos = { + top: shiftHeight[pos0](), + left: shiftWidth[pos1](), + }; + break; + default: + targetElPos = { + top: hostElPos.top - targetElHeight, + left: shiftWidth[pos1](), + }; + break; + } + + return targetElPos; + }, + }; + }, + ]); +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/tooltip.js b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/tooltip.js new file mode 100755 index 0000000000..086fa6a7d6 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/tooltip.js @@ -0,0 +1,434 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* eslint-disable */ + +import angular from 'angular'; + +import { initBootstrapPosition } from './position'; + +export function initBootstrapTooltip() { + initBootstrapPosition(); + /** + * The following features are still outstanding: animation as a + * function, placement as a function, inside, support for more triggers than + * just mouse enter/leave, html tooltips, and selector delegation. + */ + angular + .module('ui.bootstrap.tooltip', ['ui.bootstrap.position']) + + /** + * The $tooltip service creates tooltip- and popover-like directives as well as + * houses global options for them. + */ + .provider('$tooltip', function() { + // The default options tooltip and popover. + const defaultOptions = { + placement: 'top', + animation: true, + popupDelay: 0, + }; + + // Default hide triggers for each show trigger + const triggerMap = { + mouseenter: 'mouseleave', + click: 'click', + focus: 'blur', + }; + + // The options specified to the provider globally. + const globalOptions = {}; + + /** + * `options({})` allows global configuration of all tooltips in the + * application. + * + * var app = angular.module( 'App', ['ui.bootstrap.tooltip'], function( $tooltipProvider ) { + * // place tooltips left instead of top by default + * $tooltipProvider.options( { placement: 'left' } ); + * }); + */ + this.options = function(value) { + angular.extend(globalOptions, value); + }; + + /** + * This allows you to extend the set of trigger mappings available. E.g.: + * + * $tooltipProvider.setTriggers( 'openTrigger': 'closeTrigger' ); + */ + this.setTriggers = function setTriggers(triggers) { + angular.extend(triggerMap, triggers); + }; + + /** + * This is a helper function for translating camel-case to snake-case. + */ + function snake_case(name) { + const regexp = /[A-Z]/g; + const separator = '-'; + return name.replace(regexp, function(letter, pos) { + return (pos ? separator : '') + letter.toLowerCase(); + }); + } + + /** + * Returns the actual instance of the $tooltip service. + * TODO support multiple triggers + */ + this.$get = [ + '$window', + '$compile', + '$timeout', + '$document', + '$position', + '$interpolate', + function($window, $compile, $timeout, $document, $position, $interpolate) { + return function $tooltip(type, prefix, defaultTriggerShow) { + const options = angular.extend({}, defaultOptions, globalOptions); + + /** + * Returns an object of show and hide triggers. + * + * If a trigger is supplied, + * it is used to show the tooltip; otherwise, it will use the `trigger` + * option passed to the `$tooltipProvider.options` method; else it will + * default to the trigger supplied to this directive factory. + * + * The hide trigger is based on the show trigger. If the `trigger` option + * was passed to the `$tooltipProvider.options` method, it will use the + * mapped trigger from `triggerMap` or the passed trigger if the map is + * undefined; otherwise, it uses the `triggerMap` value of the show + * trigger; else it will just use the show trigger. + */ + function getTriggers(trigger) { + const show = trigger || options.trigger || defaultTriggerShow; + const hide = triggerMap[show] || show; + return { + show: show, + hide: hide, + }; + } + + const directiveName = snake_case(type); + + const startSym = $interpolate.startSymbol(); + const endSym = $interpolate.endSymbol(); + const template = + '
' + + '
'; + + return { + restrict: 'EA', + compile: function(tElem, tAttrs) { + const tooltipLinker = $compile(template); + + return function link(scope, element, attrs) { + let tooltip; + let tooltipLinkedScope; + let transitionTimeout; + let popupTimeout; + let appendToBody = angular.isDefined(options.appendToBody) + ? options.appendToBody + : false; + let triggers = getTriggers(undefined); + const hasEnableExp = angular.isDefined(attrs[prefix + 'Enable']); + let ttScope = scope.$new(true); + + const positionTooltip = function() { + const ttPosition = $position.positionElements( + element, + tooltip, + ttScope.placement, + appendToBody + ); + ttPosition.top += 'px'; + ttPosition.left += 'px'; + + // Now set the calculated positioning. + tooltip.css(ttPosition); + }; + + // By default, the tooltip is not open. + // TODO add ability to start tooltip opened + ttScope.isOpen = false; + + function toggleTooltipBind() { + if (!ttScope.isOpen) { + showTooltipBind(); + } else { + hideTooltipBind(); + } + } + + // Show the tooltip with delay if specified, otherwise show it immediately + function showTooltipBind() { + if (hasEnableExp && !scope.$eval(attrs[prefix + 'Enable'])) { + return; + } + + prepareTooltip(); + + if (ttScope.popupDelay) { + // Do nothing if the tooltip was already scheduled to pop-up. + // This happens if show is triggered multiple times before any hide is triggered. + if (!popupTimeout) { + popupTimeout = $timeout(show, ttScope.popupDelay, false); + popupTimeout + .then(reposition => reposition()) + .catch(error => { + // if the timeout is canceled then the string `canceled` is thrown. To prevent + // this from triggering an 'unhandled promise rejection' in angular 1.5+ the + // $timeout service explicitly tells $q that the promise it generated is "handled" + // but that does not include down chain promises like the one created by calling + // `popupTimeout.then()`. Because of this we need to ignore the "canceled" string + // and only propagate real errors + if (error !== 'canceled') { + throw error; + } + }); + } + } else { + show()(); + } + } + + function hideTooltipBind() { + scope.$evalAsync(function() { + hide(); + }); + } + + // Show the tooltip popup element. + function show() { + popupTimeout = null; + + // If there is a pending remove transition, we must cancel it, lest the + // tooltip be mysteriously removed. + if (transitionTimeout) { + $timeout.cancel(transitionTimeout); + transitionTimeout = null; + } + + // Don't show empty tooltips. + if (!ttScope.content) { + return angular.noop; + } + + createTooltip(); + + // Set the initial positioning. + tooltip.css({ top: 0, left: 0, display: 'block' }); + ttScope.$digest(); + + positionTooltip(); + + // And show the tooltip. + ttScope.isOpen = true; + ttScope.$digest(); // digest required as $apply is not called + + // Return positioning function as promise callback for correct + // positioning after draw. + return positionTooltip; + } + + // Hide the tooltip popup element. + function hide() { + // First things first: we don't show it anymore. + ttScope.isOpen = false; + + //if tooltip is going to be shown after delay, we must cancel this + $timeout.cancel(popupTimeout); + popupTimeout = null; + + // And now we remove it from the DOM. However, if we have animation, we + // need to wait for it to expire beforehand. + // FIXME: this is a placeholder for a port of the transitions library. + if (ttScope.animation) { + if (!transitionTimeout) { + transitionTimeout = $timeout(removeTooltip, 500); + } + } else { + removeTooltip(); + } + } + + function createTooltip() { + // There can only be one tooltip element per directive shown at once. + if (tooltip) { + removeTooltip(); + } + tooltipLinkedScope = ttScope.$new(); + tooltip = tooltipLinker(tooltipLinkedScope, function(tooltip) { + if (appendToBody) { + $document.find('body').append(tooltip); + } else { + element.after(tooltip); + } + }); + } + + function removeTooltip() { + transitionTimeout = null; + if (tooltip) { + tooltip.remove(); + tooltip = null; + } + if (tooltipLinkedScope) { + tooltipLinkedScope.$destroy(); + tooltipLinkedScope = null; + } + } + + function prepareTooltip() { + prepPlacement(); + prepPopupDelay(); + } + + /** + * Observe the relevant attributes. + */ + attrs.$observe(type, function(val) { + ttScope.content = val; + + if (!val && ttScope.isOpen) { + hide(); + } + }); + + attrs.$observe(prefix + 'Title', function(val) { + ttScope.title = val; + }); + + function prepPlacement() { + const val = attrs[prefix + 'Placement']; + ttScope.placement = angular.isDefined(val) ? val : options.placement; + } + + function prepPopupDelay() { + const val = attrs[prefix + 'PopupDelay']; + const delay = parseInt(val, 10); + ttScope.popupDelay = !isNaN(delay) ? delay : options.popupDelay; + } + + const unregisterTriggers = function() { + element.unbind(triggers.show, showTooltipBind); + element.unbind(triggers.hide, hideTooltipBind); + }; + + function prepTriggers() { + const val = attrs[prefix + 'Trigger']; + unregisterTriggers(); + + triggers = getTriggers(val); + + if (triggers.show === triggers.hide) { + element.bind(triggers.show, toggleTooltipBind); + } else { + element.bind(triggers.show, showTooltipBind); + element.bind(triggers.hide, hideTooltipBind); + } + } + + prepTriggers(); + + const animation = scope.$eval(attrs[prefix + 'Animation']); + ttScope.animation = angular.isDefined(animation) + ? !!animation + : options.animation; + + const appendToBodyVal = scope.$eval(attrs[prefix + 'AppendToBody']); + appendToBody = angular.isDefined(appendToBodyVal) + ? appendToBodyVal + : appendToBody; + + // if a tooltip is attached to we need to remove it on + // location change as its parent scope will probably not be destroyed + // by the change. + if (appendToBody) { + scope.$on( + '$locationChangeSuccess', + function closeTooltipOnLocationChangeSuccess() { + if (ttScope.isOpen) { + hide(); + } + } + ); + } + + // Make sure tooltip is destroyed and removed. + scope.$on('$destroy', function onDestroyTooltip() { + $timeout.cancel(transitionTimeout); + $timeout.cancel(popupTimeout); + unregisterTriggers(); + removeTooltip(); + ttScope = null; + }); + }; + }, + }; + }; + }, + ]; + }) + + .directive('tooltip', [ + '$tooltip', + function($tooltip) { + return $tooltip('tooltip', 'tooltip', 'mouseenter'); + }, + ]) + + .directive('tooltipPopup', function() { + return { + restrict: 'EA', + replace: true, + scope: { content: '@', placement: '@', animation: '&', isOpen: '&' }, + templateUrl: 'template/tooltip/tooltip-popup.html', + }; + }) + + .directive('tooltipHtmlUnsafe', [ + '$tooltip', + function($tooltip) { + return $tooltip('tooltipHtmlUnsafe', 'tooltip', 'mouseenter'); + }, + ]) + + .directive('tooltipHtmlUnsafePopup', function() { + return { + restrict: 'EA', + replace: true, + scope: { content: '@', placement: '@', animation: '&', isOpen: '&' }, + templateUrl: 'template/tooltip/tooltip-html-unsafe-popup.html', + }; + }); +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/tooltip_html_unsafe_popup.html b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/tooltip_html_unsafe_popup.html new file mode 100644 index 0000000000..b48bf70498 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/tooltip_html_unsafe_popup.html @@ -0,0 +1,4 @@ +
+
+
+
\ No newline at end of file diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/tooltip_popup.html b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/tooltip_popup.html new file mode 100644 index 0000000000..eed4ca7d93 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/angular_bootstrap/tooltip/tooltip_popup.html @@ -0,0 +1,4 @@ +
+
+
+
\ No newline at end of file diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/index.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/index.ts new file mode 100644 index 0000000000..36fd9a993c --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/index.ts @@ -0,0 +1,34 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export * from './angular'; +export * from './angular_bootstrap'; +export * from './notify'; +export * from './utils'; diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/index.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/index.ts new file mode 100644 index 0000000000..934ca937e1 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/index.ts @@ -0,0 +1,32 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export * from './toasts'; +export * from './lib'; diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/add_fatal_error.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/add_fatal_error.ts new file mode 100644 index 0000000000..beb6f81e3e --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/add_fatal_error.ts @@ -0,0 +1,49 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { FatalErrorsSetup } from '../../../../../core/public'; +import { + AngularHttpError, + formatAngularHttpError, + isAngularHttpError, +} from './format_angular_http_error'; + +export function addFatalError( + fatalErrors: FatalErrorsSetup, + error: AngularHttpError | Error | string, + location?: string +) { + // add support for angular http errors to newPlatformFatalErrors + if (isAngularHttpError(error)) { + error = formatAngularHttpError(error); + } + + fatalErrors.add(error, location); +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_angular_http_error.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_angular_http_error.ts new file mode 100644 index 0000000000..68b3701814 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_angular_http_error.ts @@ -0,0 +1,69 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { i18n } from '@osd/i18n'; +import { IHttpResponse } from 'angular'; + +export type AngularHttpError = IHttpResponse<{ message: string }>; + +export function isAngularHttpError(error: any): error is AngularHttpError { + return ( + error && + typeof error.status === 'number' && + typeof error.statusText === 'string' && + error.data && + typeof error.data.message === 'string' + ); +} + +export function formatAngularHttpError(error: AngularHttpError) { + // is an Angular $http "error object" + if (error.status === -1) { + // status = -1 indicates that the request was failed to reach the server + return i18n.translate( + 'opensearch_dashboards_legacy.notify.fatalError.unavailableServerErrorMessage', + { + defaultMessage: + 'An HTTP request has failed to connect. ' + + 'Please check if the OpenSearch Dashboards server is running and that your browser has a working connection, ' + + 'or contact your system administrator.', + } + ); + } + + return i18n.translate('opensearch_dashboards_legacy.notify.fatalError.errorStatusMessage', { + defaultMessage: 'Error {errStatus} {errStatusText}: {errMessage}', + values: { + errStatus: error.status, + errStatusText: error.statusText, + errMessage: error.data.message, + }, + }); +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_msg.test.js b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_msg.test.js new file mode 100644 index 0000000000..aee1e140d3 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_msg.test.js @@ -0,0 +1,90 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { formatMsg } from './format_msg'; +import expect from '@osd/expect'; + +describe('formatMsg', () => { + test('should prepend the second argument to result', () => { + const actual = formatMsg('error message', 'unit_test'); + + expect(actual).to.equal('unit_test: error message'); + }); + + test('should handle a simple string', () => { + const actual = formatMsg('error message'); + + expect(actual).to.equal('error message'); + }); + + test('should handle a simple Error object', () => { + const err = new Error('error message'); + const actual = formatMsg(err); + + expect(actual).to.equal('error message'); + }); + + test('should handle a simple Angular $http error object', () => { + const err = { + data: { + statusCode: 403, + error: 'Forbidden', + message: + '[security_exception] action [indices:data/read/msearch] is unauthorized for user [user]', + }, + status: 403, + config: {}, + statusText: 'Forbidden', + }; + const actual = formatMsg(err); + + expect(actual).to.equal( + 'Error 403 Forbidden: [security_exception] action [indices:data/read/msearch] is unauthorized for user [user]' + ); + }); + + test('should handle an extended opensearch error', () => { + const err = { + resp: { + error: { + root_cause: [ + { + reason: 'I am the detailed message', + }, + ], + }, + }, + }; + + const actual = formatMsg(err); + + expect(actual).to.equal('I am the detailed message'); + }); +}); diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_msg.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_msg.ts new file mode 100644 index 0000000000..67a4771219 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_msg.ts @@ -0,0 +1,91 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import _ from 'lodash'; +import { i18n } from '@osd/i18n'; +import { formatOpenSearchMsg } from './format_opensearch_msg'; +const has = _.has; + +/** + * Formats the error message from an error object, extended opensearch + * object or simple string; prepends optional second parameter to the message + * @param {Error|String} err + * @param {String} source - Prefix for message indicating source (optional) + * @returns {string} + */ +export function formatMsg(err: Record | string, source: string = '') { + let message = ''; + if (source) { + message += source + ': '; + } + + const opensearchMsg = formatOpenSearchMsg(err); + + if (typeof err === 'string') { + message += err; + } else if (opensearchMsg) { + message += opensearchMsg; + } else if (err instanceof Error) { + message += formatMsg.describeError(err); + } else if (has(err, 'status') && has(err, 'data')) { + // is an Angular $http "error object" + if (err.status === -1) { + // status = -1 indicates that the request was failed to reach the server + message += i18n.translate( + 'opensearch_dashboards_legacy.notify.toaster.unavailableServerErrorMessage', + { + defaultMessage: + 'An HTTP request has failed to connect. ' + + 'Please check if the OpenSearch Dashboards server is running and that your browser has a working connection, ' + + 'or contact your system administrator.', + } + ); + } else { + message += i18n.translate('opensearch_dashboards_legacy.notify.toaster.errorStatusMessage', { + defaultMessage: 'Error {errStatus} {errStatusText}: {errMessage}', + values: { + errStatus: err.status, + errStatusText: err.statusText, + errMessage: err.data.message, + }, + }); + } + } + + return message; +} + +formatMsg.describeError = function (err: Record) { + if (!err) return undefined; + if (err.shortMessage) return err.shortMessage; + if (err.body && err.body.message) return err.body.message; + if (err.message) return err.message; + return '' + err; +}; diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_opensearch_msg.test.js b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_opensearch_msg.test.js new file mode 100644 index 0000000000..bd20b36f35 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_opensearch_msg.test.js @@ -0,0 +1,87 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { formatOpenSearchMsg } from './format_opensearch_msg'; +import expect from '@osd/expect'; + +describe('formatOpenSearchMsg', () => { + test('should return undefined if passed a basic error', () => { + const err = new Error('This is a normal error'); + + const actual = formatOpenSearchMsg(err); + + expect(actual).to.be(undefined); + }); + + test('should return undefined if passed a string', () => { + const err = 'This is a error string'; + + const actual = formatOpenSearchMsg(err); + + expect(actual).to.be(undefined); + }); + + test('should return the root_cause if passed an extended opensearch', () => { + const err = new Error('This is an opensearch error'); + err.resp = { + error: { + root_cause: [ + { + reason: 'I am the detailed message', + }, + ], + }, + }; + + const actual = formatOpenSearchMsg(err); + + expect(actual).to.equal('I am the detailed message'); + }); + + test('should combine the reason messages if more than one is returned.', () => { + const err = new Error('This is an opensearch error'); + err.resp = { + error: { + root_cause: [ + { + reason: 'I am the detailed message 1', + }, + { + reason: 'I am the detailed message 2', + }, + ], + }, + }; + + const actual = formatOpenSearchMsg(err); + + expect(actual).to.equal('I am the detailed message 1\nI am the detailed message 2'); + }); +}); diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_opensearch_msg.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_opensearch_msg.ts new file mode 100644 index 0000000000..b253b949b7 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_opensearch_msg.ts @@ -0,0 +1,48 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import _ from 'lodash'; + +const getRootCause = (err: Record | string) => _.get(err, 'resp.error.root_cause'); + +/** + * Utilize the extended error information returned from opensearch + * @param {Error|String} err + * @returns {string} + */ +export const formatOpenSearchMsg = (err: Record | string) => { + const rootCause = getRootCause(err); + + if (!Array.isArray(rootCause)) { + return; + } + + return rootCause.map((cause: Record) => cause.reason).join('\n'); +}; diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_stack.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_stack.ts new file mode 100644 index 0000000000..d571ebc69e --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/format_stack.ts @@ -0,0 +1,46 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { i18n } from '@osd/i18n'; + +// browsers format Error.stack differently; always include message +export function formatStack(err: Record) { + if (err.stack && err.stack.indexOf(err.message) === -1) { + return i18n.translate('opensearch_dashboards_legacy.notify.toaster.errorMessage', { + defaultMessage: `Error: {errorMessage} + {errorStack}`, + values: { + errorMessage: err.message, + errorStack: err.stack, + }, + }); + } + return err.stack; +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/index.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/index.ts new file mode 100644 index 0000000000..22a8631dfe --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/lib/index.ts @@ -0,0 +1,39 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { formatOpenSearchMsg } from './format_opensearch_msg'; +export { formatMsg } from './format_msg'; +export { formatStack } from './format_stack'; +export { + isAngularHttpError, + formatAngularHttpError, + AngularHttpError, +} from './format_angular_http_error'; +export { addFatalError } from './add_fatal_error'; diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/toasts/TOAST_NOTIFICATIONS.md b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/toasts/TOAST_NOTIFICATIONS.md new file mode 100644 index 0000000000..de6a51f392 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/toasts/TOAST_NOTIFICATIONS.md @@ -0,0 +1,100 @@ +# Toast notifications + +Use this service to surface toasts in the bottom-right corner of the screen. After a brief delay, they'll disappear. They're useful for notifying the user of state changes. See [the EUI docs](https://elastic.github.io/eui/) for more information on toasts and their role within the UI. + +## Importing the module + +```js +import { toastNotifications } from 'ui/notify'; +``` + +## Interface + +### Adding toasts + +For convenience, there are several methods which predefine the appearance of different types of toasts. Use these methods so that the same types of toasts look similar to the user. + +#### Default + +Neutral toast. Tell the user a change in state has occurred, which is not necessarily good or bad. + +```js +toastNotifications.add('Copied to clipboard'); +``` + +#### Success + +Let the user know that an action was successful, such as saving or deleting an object. + +```js +toastNotifications.addSuccess('Your document was saved'); +``` + +#### Warning + +If something OK or good happened, but perhaps wasn't perfect, show a warning toast. + +```js +toastNotifications.addWarning('Your document was saved, but not its edit history'); +``` + +#### Danger + +When the user initiated an action but the action failed, show them a danger toast. + +```js +toastNotifications.addDanger('An error caused your document to be lost'); +``` + +### Removing a toast + +Toasts will automatically be dismissed after a brief delay, but if for some reason you want to dismiss a toast, you can use the returned toast from one of the `add` methods and then pass it to `remove`. + +```js +const toast = toastNotifications.add('Your document was saved'); +toastNotifications.remove(toast); +``` + +### Configuration options + +If you want to configure the toast further you can provide an object instead of a string. The properties of this object correspond to the `propTypes` accepted by the `EuiToast` component. Refer to [the EUI docs](https://elastic.github.io/eui/) for info on these `propTypes`. + +```js +toastNotifications.add({ + title: 'Your document was saved', + text: 'Only you have access to this document', + color: 'success', + iconType: 'check', + 'data-test-subj': 'saveDocumentSuccess', +}); +``` + +Because the underlying components are React, you can use JSX to pass in React elements to the `text` prop. This gives you total flexibility over the content displayed within the toast. + +```js +toastNotifications.add({ + title: 'Your document was saved', + text: ( +
+

+ Only you have access to this document. Edit permissions. +

+ + +
+ ), +}); +``` + +## Use in functional tests + +Functional tests are commonly used to verify that a user action yielded a successful outcome. If you surface a toast to notify the user of this successful outcome, you can place a `data-test-subj` attribute on the toast and use it to check if the toast exists inside of your functional test. This acts as a proxy for verifying the successful outcome. + +```js +toastNotifications.addSuccess({ + title: 'Your document was saved', + 'data-test-subj': 'saveDocumentSuccess', +}); +``` diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/toasts/index.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/toasts/index.ts new file mode 100644 index 0000000000..71115523dc --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/toasts/index.ts @@ -0,0 +1,31 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { ToastNotifications } from './toast_notifications'; diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/toasts/toast_notifications.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/toasts/toast_notifications.ts new file mode 100644 index 0000000000..8860c089c6 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/notify/toasts/toast_notifications.ts @@ -0,0 +1,64 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { + NotificationsSetup, + Toast, + ToastInput, + ErrorToastOptions, +} from 'opensearch-dashboards/public'; + +export class ToastNotifications { + public list: Toast[] = []; + + private onChangeCallback?: () => void; + + constructor(private readonly toasts: NotificationsSetup['toasts']) { + toasts.get$().subscribe((list) => { + this.list = list; + + if (this.onChangeCallback) { + this.onChangeCallback(); + } + }); + } + + public onChange = (callback: () => void) => { + this.onChangeCallback = callback; + }; + + public add = (toastOrTitle: ToastInput) => this.toasts.add(toastOrTitle); + public remove = (toast: Toast) => this.toasts.remove(toast); + public addSuccess = (toastOrTitle: ToastInput) => this.toasts.addSuccess(toastOrTitle); + public addWarning = (toastOrTitle: ToastInput) => this.toasts.addWarning(toastOrTitle); + public addDanger = (toastOrTitle: ToastInput) => this.toasts.addDanger(toastOrTitle); + public addError = (error: Error, options: ErrorToastOptions) => + this.toasts.addError(error, options); +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/index.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/index.ts new file mode 100644 index 0000000000..6313548a1b --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/index.ts @@ -0,0 +1,37 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export * from './system_api'; +// @ts-ignore +export { OsdAccessibleClickProvider } from './osd_accessible_click'; +// @ts-ignore +export { PrivateProvider, IPrivate } from './private'; +// @ts-ignore +export { registerListenEventListener } from './register_listen_event_listener'; diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/inject_header_style.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/inject_header_style.ts new file mode 100644 index 0000000000..3ff447aeb9 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/inject_header_style.ts @@ -0,0 +1,54 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { IUiSettingsClient } from 'opensearch-dashboards/public'; + +export function buildCSS(maxHeight = 0, truncateGradientHeight = 15) { + return ` +.truncate-by-height { + max-height: ${maxHeight > 0 ? `${maxHeight}px !important` : 'none'}; + display: inline-block; +} +.truncate-by-height:before { + top: ${maxHeight > 0 ? maxHeight - truncateGradientHeight : truncateGradientHeight * -1}px; +} +`; +} + +export function injectHeaderStyle(uiSettings: IUiSettingsClient) { + const style = document.createElement('style'); + style.setAttribute('id', 'style-compile'); + document.getElementsByTagName('head')[0].appendChild(style); + + uiSettings.get$('truncate:maxHeight').subscribe((value: number) => { + // eslint-disable-next-line no-unsanitized/property + style.innerHTML = buildCSS(value); + }); +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/osd_accessible_click.js b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/osd_accessible_click.js new file mode 100644 index 0000000000..6c49ff8de4 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/osd_accessible_click.js @@ -0,0 +1,82 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { accessibleClickKeys, keys } from '@elastic/eui'; + +export function OsdAccessibleClickProvider() { + return { + restrict: 'A', + controller: ($element) => { + $element.on('keydown', (e) => { + // Prevent a scroll from occurring if the user has hit space. + if (e.key === keys.SPACE) { + e.preventDefault(); + } + }); + }, + link: (scope, element, attrs) => { + // The whole point of this directive is to hack in functionality that native buttons provide + // by default. + const elementType = element.prop('tagName'); + + if (elementType === 'BUTTON') { + throw new Error(`osdAccessibleClick doesn't need to be used on a button.`); + } + + if (elementType === 'A' && attrs.href !== undefined) { + throw new Error( + `osdAccessibleClick doesn't need to be used on a link if it has a href attribute.` + ); + } + + // We're emulating a click action, so we should already have a regular click handler defined. + if (!attrs.ngClick) { + throw new Error('osdAccessibleClick requires ng-click to be defined on its element.'); + } + + // If the developer hasn't already specified attributes required for accessibility, add them. + if (attrs.tabindex === undefined) { + element.attr('tabindex', '0'); + } + + if (attrs.role === undefined) { + element.attr('role', 'button'); + } + + element.on('keyup', (e) => { + // Support keyboard accessibility by emulating mouse click on ENTER or SPACE keypress. + if (accessibleClickKeys[e.key]) { + // Delegate to the click handler on the element (assumed to be ng-click). + element.click(); + } + }); + }, + }; +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/private.d.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/private.d.ts new file mode 100644 index 0000000000..fe264fc193 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/private.d.ts @@ -0,0 +1,31 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export type IPrivate = (provider: (...injectable: any[]) => T) => T; diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/private.js b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/private.js new file mode 100644 index 0000000000..1a3a0a5965 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/private.js @@ -0,0 +1,214 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * # `Private()` + * Private module loader, used to merge angular and require js dependency styles + * by allowing a require.js module to export a single provider function that will + * create a value used within an angular application. This provider can declare + * angular dependencies by listing them as arguments, and can be require additional + * Private modules. + * + * ## Define a private module provider: + * ```js + * export default function PingProvider($http) { + * this.ping = function () { + * return $http.head('/health-check'); + * }; + * }; + * ``` + * + * ## Require a private module: + * ```js + * export default function ServerHealthProvider(Private, Promise) { + * let ping = Private(require('ui/ping')); + * return { + * check: Promise.method(function () { + * let attempts = 0; + * return (function attempt() { + * attempts += 1; + * return ping.ping() + * .catch(function (err) { + * if (attempts < 3) return attempt(); + * }) + * }()) + * .then(function () { + * return true; + * }) + * .catch(function () { + * return false; + * }); + * }) + * } + * }; + * ``` + * + * # `Private.stub(provider, newInstance)` + * `Private.stub()` replaces the instance of a module with another value. This is all we have needed until now. + * + * ```js + * beforeEach(inject(function ($injector, Private) { + * Private.stub( + * // since this module just exports a function, we need to change + * // what Private returns in order to modify it's behavior + * require('ui/agg_response/hierarchical/_build_split'), + * sinon.stub().returns(fakeSplit) + * ); + * })); + * ``` + * + * # `Private.swap(oldProvider, newProvider)` + * This new method does an 1-for-1 swap of module providers, unlike `stub()` which replaces a modules instance. + * Pass the module you want to swap out, and the one it should be replaced with, then profit. + * + * Note: even though this example shows `swap()` being called in a config + * function, it can be called from anywhere. It is particularly useful + * in this scenario though. + * + * ```js + * beforeEach(module('opensearchDashboards', function (PrivateProvider) { + * PrivateProvider.swap( + * function StubbedRedirectProvider($decorate) { + * // $decorate is a function that will instantiate the original module when called + * return sinon.spy($decorate()); + * } + * ); + * })); + * ``` + * + * @param {[type]} prov [description] + */ +import _ from 'lodash'; + +const nextId = _.partial(_.uniqueId, 'privateProvider#'); + +function name(fn) { + return fn.name || fn.toString().split('\n').shift(); +} + +export function PrivateProvider() { + const provider = this; + + // one cache/swaps per Provider + const cache = {}; + const swaps = {}; + + // return the uniq id for this function + function identify(fn) { + if (typeof fn !== 'function') { + throw new TypeError('Expected private module "' + fn + '" to be a function'); + } + + if (fn.$$id) return fn.$$id; + else return (fn.$$id = nextId()); + } + + provider.stub = function (fn, instance) { + cache[identify(fn)] = instance; + return instance; + }; + + provider.swap = function (fn, prov) { + const id = identify(fn); + swaps[id] = prov; + }; + + provider.$get = [ + '$injector', + function PrivateFactory($injector) { + // prevent circular deps by tracking where we came from + const privPath = []; + const pathToString = function () { + return privPath.map(name).join(' -> '); + }; + + // call a private provider and return the instance it creates + function instantiate(prov, locals) { + if (~privPath.indexOf(prov)) { + throw new Error( + 'Circular reference to "' + + name(prov) + + '"' + + ' found while resolving private deps: ' + + pathToString() + ); + } + + privPath.push(prov); + + const context = {}; + let instance = $injector.invoke(prov, context, locals); + if (!_.isObject(instance)) instance = context; + + privPath.pop(); + return instance; + } + + // retrieve an instance from cache or create and store on + function get(id, prov, $delegateId, $delegateProv) { + if (cache[id]) return cache[id]; + + let instance; + + if ($delegateId != null && $delegateProv != null) { + instance = instantiate(prov, { + $decorate: _.partial(get, $delegateId, $delegateProv), + }); + } else { + instance = instantiate(prov); + } + + return (cache[id] = instance); + } + + // main api, get the appropriate instance for a provider + function Private(prov) { + let id = identify(prov); + let $delegateId; + let $delegateProv; + + if (swaps[id]) { + $delegateId = id; + $delegateProv = prov; + + prov = swaps[$delegateId]; + id = identify(prov); + } + + return get(id, prov, $delegateId, $delegateProv); + } + + Private.stub = provider.stub; + Private.swap = provider.swap; + + return Private; + }, + ]; +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/register_listen_event_listener.js b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/register_listen_event_listener.js new file mode 100644 index 0000000000..19652d94cf --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/register_listen_event_listener.js @@ -0,0 +1,47 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export function registerListenEventListener($rootScope) { + /** + * Helper that registers an event listener, and removes that listener when + * the $scope is destroyed. + * + * @param {EventEmitter} emitter - the event emitter to listen to + * @param {string} eventName - the event name + * @param {Function} handler - the event handler + * @return {undefined} + */ + $rootScope.constructor.prototype.$listen = function (emitter, eventName, handler) { + emitter.on(eventName, handler); + this.$on('$destroy', function () { + emitter.off(eventName, handler); + }); + }; +} diff --git a/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/system_api.ts b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/system_api.ts new file mode 100644 index 0000000000..2675bbc084 --- /dev/null +++ b/plugins/main/public/kibana-integrations/plugins/opensearch_dashboards_legacy/public/utils/system_api.ts @@ -0,0 +1,62 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { IRequestConfig } from 'angular'; + +const SYSTEM_REQUEST_HEADER_NAME = 'osd-system-request'; +const LEGACY_SYSTEM_API_HEADER_NAME = 'osd-system-api'; + +/** + * Adds a custom header designating request as system API + * @param originalHeaders Object representing set of headers + * @return Object representing set of headers, with system API header added in + */ +export function addSystemApiHeader(originalHeaders: Record) { + const systemApiHeaders = { + [SYSTEM_REQUEST_HEADER_NAME]: true, + }; + return { + ...originalHeaders, + ...systemApiHeaders, + }; +} + +/** + * Returns true if request is a system API request; false otherwise + * + * @param request Object Request object created by $http service + * @return true if request is a system API request; false otherwise + */ +export function isSystemApiRequest(request: IRequestConfig) { + const { headers } = request; + return ( + headers && (!!headers[SYSTEM_REQUEST_HEADER_NAME] || !!headers[LEGACY_SYSTEM_API_HEADER_NAME]) + ); +} diff --git a/plugins/main/yarn.lock b/plugins/main/yarn.lock index 915a66d1d9..b04bca1416 100644 --- a/plugins/main/yarn.lock +++ b/plugins/main/yarn.lock @@ -654,11 +654,36 @@ angular-animate@1.8.3: resolved "https://registry.yarnpkg.com/angular-animate/-/angular-animate-1.8.3.tgz#f88db37325de256f9144d1242ce3158134a9d72a" integrity sha512-/LtTKvy5sD6MZbV0v+nHgOIpnFF0mrUp+j5WIxVprVhcrJriYpuCZf4S7Owj1o76De/J0eRzANUozNJ6hVepnQ== +angular-aria@^1.8.0: + version "1.8.3" + resolved "https://registry.yarnpkg.com/angular-aria/-/angular-aria-1.8.3.tgz#b387ebca9569eb557855abb283a09c2d0457e779" + integrity sha512-qTXclmTW/KGw5JNKKQPcCKKq6hCBZ39jYINmLgMsjUHBAoxULaMRRTaRj/L2VTOjKvK5f9enkx+EUqRqzXDSFQ== + angular-material@1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/angular-material/-/angular-material-1.2.5.tgz#6fb3fbf3622d443e4449aaf237d692ad04623a23" integrity sha512-bTTDV0vszpfms1tAMzhLntxBiNMCk/I3Mx/vhbtfhijJILODjpDBfWah0nvWrniFIcxMLcsb1tcPri13hZEaew== +angular-mocks@^1.8.2: + version "1.8.3" + resolved "https://registry.yarnpkg.com/angular-mocks/-/angular-mocks-1.8.3.tgz#c0dd05e5c3fc014e07af6289b23f0e817d7a4724" + integrity sha512-vqsT6zwu80cZ8RY7qRQBZuy6Fq5X7/N5hkV9LzNT0c8b546rw4ErGK6muW1u2JnDKYa7+jJuaGM702bWir4HGw== + +angular-route@^1.8.0: + version "1.8.3" + resolved "https://registry.yarnpkg.com/angular-route/-/angular-route-1.8.3.tgz#f24a700ebd462454ca83a8b765df55c87a4edde1" + integrity sha512-kpIcRmDR2+o1FxDVVYy8Rvfab86/7LDbOgTRb9T+X9ewPQiBRuDEnZtM3oJYBiQLvAXDYTJXHV48n/bGE9Mv2g== + +angular-sanitize@^1.8.0: + version "1.8.3" + resolved "https://registry.yarnpkg.com/angular-sanitize/-/angular-sanitize-1.8.3.tgz#51378e990e78c7ecc1fb31cd68655aff690a3bf1" + integrity sha512-2rxdqzlUVafUeWOwvY/FtyWk1pFTyCtzreeiTytG9m4smpuAEKaIJAjYeVwWsoV+nlTOcgpwV4W1OCmR+BQbUg== + +angular@^1.8.2: + version "1.8.3" + resolved "https://registry.yarnpkg.com/angular/-/angular-1.8.3.tgz#851ad75d5163c105a7e329555ef70c90aa706894" + integrity sha512-5qjkWIQQVsHj4Sb5TcEs4WZWpFeVFHXwxEBHUhrny41D8UrBAd6T/6nPPAsLngJCReIOqi95W3mxdveveutpZw== + ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" @@ -2586,6 +2611,11 @@ next-tick@^1.1.0: resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== +ngreact@^0.5.1: + version "0.5.2" + resolved "https://registry.yarnpkg.com/ngreact/-/ngreact-0.5.2.tgz#d48180b578b186ad70861a3de9ba508b3f22b2ae" + integrity sha512-FCQGtTkDrnI3ywhvK9wUf7C6SYfqKDdRW+cPvy358GFe3AnA4rfvWisDVUQyf5YwNr439ito9xUuuEv80QXhSQ== + node-abi@^3.3.0: version "3.45.0" resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.45.0.tgz#f568f163a3bfca5aacfce1fbeee1fa2cc98441f5" diff --git a/plugins/wazuh-check-updates/opensearch_dashboards.json b/plugins/wazuh-check-updates/opensearch_dashboards.json index 112f05fa5a..bf69812edc 100644 --- a/plugins/wazuh-check-updates/opensearch_dashboards.json +++ b/plugins/wazuh-check-updates/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuhCheckUpdates", - "version": "4.8.1-00", + "version": "4.9.0-00", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, "ui": true, @@ -13,4 +13,4 @@ "optionalPlugins": [ "securityDashboards" ] -} \ No newline at end of file +} diff --git a/plugins/wazuh-check-updates/package.json b/plugins/wazuh-check-updates/package.json index 106451ed81..1f3a34506a 100644 --- a/plugins/wazuh-check-updates/package.json +++ b/plugins/wazuh-check-updates/package.json @@ -1,9 +1,9 @@ { "name": "wazuh-check-updates", - "version": "4.8.1", + "version": "4.9.0", "revision": "00", "pluginPlatform": { - "version": "2.10.0" + "version": "2.11.0" }, "description": "Wazuh Check Updates", "private": true, @@ -29,4 +29,4 @@ "@types/md5": "^2.3.2", "@types/node-cron": "^3.0.8" } -} \ No newline at end of file +} diff --git a/plugins/wazuh-check-updates/yarn.lock b/plugins/wazuh-check-updates/yarn.lock index 77ac1ea0cc..79110b0f40 100644 --- a/plugins/wazuh-check-updates/yarn.lock +++ b/plugins/wazuh-check-updates/yarn.lock @@ -50,10 +50,10 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== -axios@^1.5.0: - version "1.6.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.1.tgz#76550d644bf0a2d469a01f9244db6753208397d7" - integrity sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g== +axios@^1.6.1: + version "1.6.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.2.tgz#de67d42c755b571d3e698df1b6504cde9b0ee9f2" + integrity sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A== dependencies: follow-redirects "^1.15.0" form-data "^4.0.0" diff --git a/plugins/wazuh-core/opensearch_dashboards.json b/plugins/wazuh-core/opensearch_dashboards.json index a68490fc52..47ff8cfd52 100644 --- a/plugins/wazuh-core/opensearch_dashboards.json +++ b/plugins/wazuh-core/opensearch_dashboards.json @@ -1,6 +1,6 @@ { "id": "wazuhCore", - "version": "4.8.1-00", + "version": "4.9.0-00", "opensearchDashboardsVersion": "opensearchDashboards", "server": true, "ui": true, @@ -11,4 +11,4 @@ "optionalPlugins": [ "securityDashboards" ] -} \ No newline at end of file +} diff --git a/plugins/wazuh-core/package.json b/plugins/wazuh-core/package.json index e0a811f4f9..82522f6cba 100644 --- a/plugins/wazuh-core/package.json +++ b/plugins/wazuh-core/package.json @@ -1,9 +1,9 @@ { "name": "wazuh-core", - "version": "4.8.1", + "version": "4.9.0", "revision": "00", "pluginPlatform": { - "version": "2.10.0" + "version": "2.11.0" }, "description": "Wazuh Core", "private": true, @@ -30,4 +30,4 @@ "@types/": "testing-library/user-event", "@types/md5": "^2.3.2" } -} \ No newline at end of file +} diff --git a/plugins/wazuh-core/yarn.lock b/plugins/wazuh-core/yarn.lock index a28ac899ed..10107cf612 100644 --- a/plugins/wazuh-core/yarn.lock +++ b/plugins/wazuh-core/yarn.lock @@ -45,10 +45,10 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== -axios@^1.5.0: - version "1.6.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.1.tgz#76550d644bf0a2d469a01f9244db6753208397d7" - integrity sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g== +axios@^1.6.1: + version "1.6.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.2.tgz#de67d42c755b571d3e698df1b6504cde9b0ee9f2" + integrity sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A== dependencies: follow-redirects "^1.15.0" form-data "^4.0.0" From 10f26fb72399d38f663cb54799f2fc723dc71cd7 Mon Sep 17 00:00:00 2001 From: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com> Date: Thu, 7 Dec 2023 11:57:05 +0100 Subject: [PATCH 9/9] Update Build manual Github action (#6195) --- .github/workflows/dev-environment.yml | 8 +++++++- .github/workflows/manual-build.yml | 11 +++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev-environment.yml b/.github/workflows/dev-environment.yml index b20ce7d91e..92aedc3fee 100644 --- a/.github/workflows/dev-environment.yml +++ b/.github/workflows/dev-environment.yml @@ -70,6 +70,7 @@ jobs: - name: Step 01 - Download the plugin's source code uses: actions/checkout@v3 with: + repository: wazuh/wazuh-dashboard-plugins ref: ${{ inputs.reference }} path: wazuh @@ -107,11 +108,16 @@ jobs: cd /home/node/kbn/plugins/${{ matrix.plugins.container_path }} && yarn && ${{ inputs.command }}; ' + - name: Get the plugin version + run: | + echo "version=$(jq -r '.version' $(pwd)/wazuh/plugins/main/package.json)" >> $GITHUB_ENV + echo "revision=$(jq -r '.revision' $(pwd)/wazuh/plugins/main/package.json)" >> $GITHUB_ENV + - name: Step 04 - Upload artifact to GitHub if: ${{ inputs.artifact_name && inputs.artifact_path }} uses: actions/upload-artifact@v3 with: - name: ${{ inputs.artifact_name }} + name: ${{ inputs.artifact_name }}_${{ env.version }}-${{ env.revision }}_${{ inputs.reference }}.zip path: ${{ matrix.plugins.path }}/${{ inputs.artifact_path }} if-no-files-found: 'error' diff --git a/.github/workflows/manual-build.yml b/.github/workflows/manual-build.yml index 32b03b0d14..859c9e105a 100644 --- a/.github/workflows/manual-build.yml +++ b/.github/workflows/manual-build.yml @@ -6,6 +6,13 @@ name: Manual build on: + workflow_call: + inputs: + reference: + required: true + type: string + default: master + description: Source code reference (branch, tag or commit SHA) workflow_dispatch: inputs: reference: @@ -20,7 +27,7 @@ jobs: name: Build app package uses: ./.github/workflows/dev-environment.yml with: - reference: ${{ github.event.inputs.reference }} + reference: ${{ inputs.reference }} command: 'yarn build' - artifact_name: 'wazuh-package' + artifact_name: 'wazuh-dashboard-plugins' secrets: inherit