plugin-elastic-report 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/skills/elastic-report/SKILLS.md +32 -0
- package/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/index.js +10 -0
- package/dist/client-v2/851.488fdbf5bc5b6a36.js +10 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/externalVersion.js +20 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +99 -0
- package/dist/locale/vi-VN.json +99 -0
- package/dist/locale/zh-CN.json +99 -0
- package/dist/node_modules/@elastic/elasticsearch/.dockerignore +11 -0
- package/dist/node_modules/@elastic/elasticsearch/LICENSE +202 -0
- package/dist/node_modules/@elastic/elasticsearch/NOTICE.txt +2 -0
- package/dist/node_modules/@elastic/elasticsearch/catalog-info.yaml +50 -0
- package/dist/node_modules/@elastic/elasticsearch/codecov.yml +14 -0
- package/dist/node_modules/@elastic/elasticsearch/index.d.ts +28 -0
- package/dist/node_modules/@elastic/elasticsearch/index.js +85525 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/async_search.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/async_search.js +155 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/autoscaling.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/autoscaling.js +130 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/bulk.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/bulk.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/capabilities.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/capabilities.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cat.d.ts +193 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cat.js +766 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ccr.d.ts +102 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ccr.js +395 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/clear_scroll.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/clear_scroll.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/close_point_in_time.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/close_point_in_time.js +56 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cluster.d.ts +123 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cluster.js +482 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/connector.d.ts +245 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/connector.js +1121 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/count.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/count.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/create.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/create.js +53 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/dangling_indices.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/dangling_indices.js +100 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query_rethrottle.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query_rethrottle.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_script.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_script.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/enrich.d.ts +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/enrich.js +169 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/eql.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/eql.js +139 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/esql.d.ts +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/esql.js +170 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists_source.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists_source.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/explain.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/explain.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/features.d.ts +25 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/features.js +75 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/field_caps.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/field_caps.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/fleet.d.ts +50 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/fleet.js +211 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_context.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_context.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_languages.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_languages.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_source.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_source.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/graph.d.ts +18 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/graph.js +70 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/health_report.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/health_report.js +54 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ilm.d.ts +88 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ilm.js +329 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/index.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/index.js +61 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/indices.d.ts +494 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/indices.js +2133 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/inference.d.ts +221 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/inference.js +1167 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/info.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/info.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ingest.d.ts +95 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ingest.js +389 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/knn_search.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/knn_search.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/license.d.ts +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/license.js +194 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/logstash.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/logstash.js +118 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mget.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mget.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/migration.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/migration.js +107 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ml.d.ts +522 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ml.js +2468 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/monitoring.d.ts +18 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/monitoring.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch_template.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch_template.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mtermvectors.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mtermvectors.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/nodes.d.ts +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/nodes.js +290 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/open_point_in_time.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/open_point_in_time.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ping.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ping.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/profiling.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/profiling.js +135 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/put_script.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/put_script.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/query_rules.d.ts +67 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/query_rules.js +260 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rank_eval.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rank_eval.js +67 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex.js +56 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex_rethrottle.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex_rethrottle.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/render_search_template.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/render_search_template.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rollup.d.ts +67 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rollup.js +263 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scripts_painless_execute.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scripts_painless_execute.js +57 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scroll.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scroll.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search.js +75 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_application.d.ts +81 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_application.js +313 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_mvt.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_mvt.js +63 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_shards.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_shards.js +54 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_template.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_template.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/searchable_snapshots.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/searchable_snapshots.js +167 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/security.d.ts +459 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/security.js +1982 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/shutdown.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/shutdown.js +125 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/simulate.d.ts +18 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/simulate.js +78 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/slm.d.ts +74 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/slm.js +253 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/snapshot.d.ts +102 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/snapshot.js +410 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/sql.d.ts +53 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/sql.js +205 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ssl.d.ts +18 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ssl.js +54 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/streams.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/streams.js +96 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/synonyms.d.ts +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/synonyms.js +223 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/tasks.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/tasks.js +109 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/terms_enum.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/terms_enum.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/termvectors.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/termvectors.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/text_structure.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/text_structure.js +148 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/transform.d.ts +101 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/transform.js +386 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query_rethrottle.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query_rethrottle.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/watcher.d.ts +102 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/watcher.js +405 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/xpack.d.ts +25 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/xpack.js +75 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/index.d.ts +265 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/index.js +632 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/types.d.ts +19933 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/types.js +21 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/typesWithBodyKey.d.ts +20606 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/typesWithBodyKey.js +21 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/client.d.ts +152 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/client.js +369 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/helpers.d.ts +184 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/helpers.js +889 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/sniffingTransport.d.ts +4 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/sniffingTransport.js +56 -0
- package/dist/node_modules/@elastic/elasticsearch/node_modules/.bin/arrow2csv +15 -0
- package/dist/node_modules/@elastic/elasticsearch/node_modules/.bin/arrow2csv.cmd +7 -0
- package/dist/node_modules/@elastic/elasticsearch/package.json +1 -0
- package/dist/node_modules/@elastic/elasticsearch/tsconfig.json +38 -0
- package/dist/server/acl-guard.js +107 -0
- package/dist/server/collections/es-report-data-views.js +79 -0
- package/dist/server/collections/es-reports.js +95 -0
- package/dist/server/index.js +58 -0
- package/dist/server/mcp/ElasticReportMcpServer.js +344 -0
- package/dist/server/mcp/ElasticReportToolCatalog.js +417 -0
- package/dist/server/plugin.js +395 -0
- package/dist/server/services/ElasticReportService.js +263 -0
- package/dist/server/services/ElasticsearchConnectionService.js +332 -0
- package/dist/server/services/ReportQueryCompiler.js +858 -0
- package/dist/shared/constants.js +81 -0
- package/dist/shared/types.js +24 -0
- package/package.json +61 -4
- package/server.d.ts +2 -0
- package/server.js +1 -0
- package/src/client/index.tsx +19 -0
- package/src/client-v2/__tests__/elastic-report.test.tsx +311 -0
- package/src/client-v2/api.ts +224 -0
- package/src/client-v2/components/ElasticBasicCharts.tsx +399 -0
- package/src/client-v2/components/ElasticReportBlock.tsx +160 -0
- package/src/client-v2/components/ElasticReportRenderer.tsx +707 -0
- package/src/client-v2/components/HighlightText.tsx +50 -0
- package/src/client-v2/components/ReportSelect.tsx +72 -0
- package/src/client-v2/index.tsx +14 -0
- package/src/client-v2/locale.ts +23 -0
- package/src/client-v2/models/ElasticReportBlockModel.tsx +85 -0
- package/src/client-v2/pages/ElasticReportManager.tsx +1047 -0
- package/src/client-v2/plugin.tsx +52 -0
- package/src/index.ts +11 -0
- package/src/locale/en-US.json +99 -0
- package/src/locale/vi-VN.json +99 -0
- package/src/locale/zh-CN.json +99 -0
- package/src/server/__tests__/query-compiler.test.ts +231 -0
- package/src/server/__tests__/report-mcp-acl.integration.test.ts +377 -0
- package/src/server/acl-guard.ts +103 -0
- package/src/server/collections/es-report-data-views.ts +58 -0
- package/src/server/collections/es-reports.ts +74 -0
- package/src/server/index.ts +15 -0
- package/src/server/mcp/ElasticReportMcpServer.ts +391 -0
- package/src/server/mcp/ElasticReportToolCatalog.ts +417 -0
- package/src/server/plugin.ts +431 -0
- package/src/server/services/ElasticReportService.ts +326 -0
- package/src/server/services/ElasticsearchConnectionService.ts +401 -0
- package/src/server/services/ReportQueryCompiler.ts +1017 -0
- package/src/shared/constants.ts +29 -0
- package/src/shared/types.ts +175 -0
- package/README.md +0 -3
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var ElasticsearchConnectionService_exports = {};
|
|
28
|
+
__export(ElasticsearchConnectionService_exports, {
|
|
29
|
+
ElasticsearchConnectionService: () => ElasticsearchConnectionService,
|
|
30
|
+
normalizeFieldCapabilitiesResponse: () => normalizeFieldCapabilitiesResponse
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(ElasticsearchConnectionService_exports);
|
|
33
|
+
var import_elasticsearch = require("@elastic/elasticsearch");
|
|
34
|
+
function isRecord(value) {
|
|
35
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
36
|
+
}
|
|
37
|
+
function isRawEsClientLike(value) {
|
|
38
|
+
return isRecord(value) && typeof value.search === "function";
|
|
39
|
+
}
|
|
40
|
+
function normaliseApiKey(raw) {
|
|
41
|
+
const trimmed = raw.trim();
|
|
42
|
+
if (trimmed.includes(":")) {
|
|
43
|
+
return Buffer.from(trimmed).toString("base64");
|
|
44
|
+
}
|
|
45
|
+
return trimmed;
|
|
46
|
+
}
|
|
47
|
+
function extractConnectionOptions(raw) {
|
|
48
|
+
if (!isRecord(raw)) return {};
|
|
49
|
+
if (typeof raw.nodes === "string") return raw;
|
|
50
|
+
if (isRecord(raw.options)) return raw.options;
|
|
51
|
+
return raw;
|
|
52
|
+
}
|
|
53
|
+
function buildEsClientOptions(opts) {
|
|
54
|
+
const nodes = (opts.nodes || "http://localhost:9200").split(",").map((item) => item.trim()).filter(Boolean);
|
|
55
|
+
const clientOpts = {
|
|
56
|
+
nodes,
|
|
57
|
+
requestTimeout: 2e4
|
|
58
|
+
};
|
|
59
|
+
if (opts.apiKey) {
|
|
60
|
+
clientOpts.auth = { apiKey: normaliseApiKey(opts.apiKey) };
|
|
61
|
+
} else if (opts.username) {
|
|
62
|
+
clientOpts.auth = {
|
|
63
|
+
username: opts.username,
|
|
64
|
+
password: opts.password || ""
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
if (opts.rejectUnauthorized === false) {
|
|
68
|
+
clientOpts.tls = { rejectUnauthorized: false };
|
|
69
|
+
}
|
|
70
|
+
return clientOpts;
|
|
71
|
+
}
|
|
72
|
+
function assertSafeIndexPattern(indexPattern) {
|
|
73
|
+
const clean = indexPattern.trim();
|
|
74
|
+
if (!clean) {
|
|
75
|
+
throw new Error("Index pattern is required");
|
|
76
|
+
}
|
|
77
|
+
if (clean.includes("/") || clean.includes("..") || clean.includes("?") || clean.includes("#")) {
|
|
78
|
+
throw new Error("Invalid index pattern");
|
|
79
|
+
}
|
|
80
|
+
const segments = clean.split(",").map((s) => s.trim()).filter(Boolean);
|
|
81
|
+
if (segments.length === 0) {
|
|
82
|
+
throw new Error("Index pattern is required");
|
|
83
|
+
}
|
|
84
|
+
if (segments.some((seg) => seg.startsWith(".") && seg !== ".*")) {
|
|
85
|
+
throw new Error("System dot-indices cannot be queried in reports");
|
|
86
|
+
}
|
|
87
|
+
return segments.join(",");
|
|
88
|
+
}
|
|
89
|
+
const AGGREGATABLE_ES_TYPES = /* @__PURE__ */ new Set([
|
|
90
|
+
"keyword",
|
|
91
|
+
"constant_keyword",
|
|
92
|
+
"wildcard",
|
|
93
|
+
"long",
|
|
94
|
+
"integer",
|
|
95
|
+
"short",
|
|
96
|
+
"byte",
|
|
97
|
+
"double",
|
|
98
|
+
"float",
|
|
99
|
+
"half_float",
|
|
100
|
+
"scaled_float",
|
|
101
|
+
"unsigned_long",
|
|
102
|
+
"boolean",
|
|
103
|
+
"date",
|
|
104
|
+
"date_nanos",
|
|
105
|
+
"ip"
|
|
106
|
+
]);
|
|
107
|
+
function flattenMappingProperties(properties, prefix = "", out = /* @__PURE__ */ new Map()) {
|
|
108
|
+
for (const [name, rawDef] of Object.entries(properties)) {
|
|
109
|
+
if (!isRecord(rawDef)) continue;
|
|
110
|
+
const fullPath = prefix ? `${prefix}.${name}` : name;
|
|
111
|
+
const esType = typeof rawDef.type === "string" ? rawDef.type : void 0;
|
|
112
|
+
if (esType) {
|
|
113
|
+
const aggregatable = AGGREGATABLE_ES_TYPES.has(esType);
|
|
114
|
+
out.set(fullPath, {
|
|
115
|
+
name: fullPath,
|
|
116
|
+
type: esType,
|
|
117
|
+
searchable: esType !== "binary",
|
|
118
|
+
aggregatable
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
if (isRecord(rawDef.fields)) {
|
|
122
|
+
for (const [subName, rawSub] of Object.entries(rawDef.fields)) {
|
|
123
|
+
if (!isRecord(rawSub)) continue;
|
|
124
|
+
const subType = typeof rawSub.type === "string" ? rawSub.type : "keyword";
|
|
125
|
+
const subPath = `${fullPath}.${subName}`;
|
|
126
|
+
out.set(subPath, {
|
|
127
|
+
name: subPath,
|
|
128
|
+
type: subType,
|
|
129
|
+
searchable: true,
|
|
130
|
+
aggregatable: AGGREGATABLE_ES_TYPES.has(subType),
|
|
131
|
+
isSubfield: true
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (isRecord(rawDef.properties)) {
|
|
136
|
+
flattenMappingProperties(rawDef.properties, fullPath, out);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
141
|
+
function normalizeFieldCapabilitiesResponse(rawFieldCaps) {
|
|
142
|
+
const root = isRecord(rawFieldCaps) && isRecord(rawFieldCaps.fields) ? rawFieldCaps.fields : {};
|
|
143
|
+
const map = /* @__PURE__ */ new Map();
|
|
144
|
+
for (const [fieldName, typeBuckets] of Object.entries(root)) {
|
|
145
|
+
if (fieldName.startsWith("_") && fieldName !== "_id" && fieldName !== "_index") {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (!isRecord(typeBuckets)) continue;
|
|
149
|
+
let chosenType = "string";
|
|
150
|
+
let searchable = false;
|
|
151
|
+
let aggregatable = false;
|
|
152
|
+
for (const [typeName, rawCap] of Object.entries(typeBuckets)) {
|
|
153
|
+
if (!isRecord(rawCap)) continue;
|
|
154
|
+
chosenType = typeName;
|
|
155
|
+
if (rawCap.searchable === true) searchable = true;
|
|
156
|
+
if (rawCap.aggregatable === true) aggregatable = true;
|
|
157
|
+
}
|
|
158
|
+
map.set(fieldName, {
|
|
159
|
+
name: fieldName,
|
|
160
|
+
type: chosenType,
|
|
161
|
+
searchable,
|
|
162
|
+
aggregatable
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
return linkKeywordSubfields(map);
|
|
166
|
+
}
|
|
167
|
+
function linkKeywordSubfields(map) {
|
|
168
|
+
for (const [name, cap] of map.entries()) {
|
|
169
|
+
const keywordCandidate = `${name}.keyword`;
|
|
170
|
+
const sub = map.get(keywordCandidate);
|
|
171
|
+
if (sub && sub.aggregatable) {
|
|
172
|
+
cap.keywordSubfield = keywordCandidate;
|
|
173
|
+
sub.isSubfield = true;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return Array.from(map.values()).sort((a, b) => a.name.localeCompare(b.name));
|
|
177
|
+
}
|
|
178
|
+
function wrapEsClient(rawClient) {
|
|
179
|
+
return {
|
|
180
|
+
async readIndices(indexPattern = "*") {
|
|
181
|
+
var _a;
|
|
182
|
+
const safePattern = indexPattern.trim() || "*";
|
|
183
|
+
if (!((_a = rawClient.cat) == null ? void 0 : _a.indices)) {
|
|
184
|
+
return [];
|
|
185
|
+
}
|
|
186
|
+
const response = await rawClient.cat.indices({
|
|
187
|
+
index: safePattern,
|
|
188
|
+
format: "json",
|
|
189
|
+
h: "index"
|
|
190
|
+
});
|
|
191
|
+
const unwrapped = isRecord(response) && Array.isArray(response.body) ? response.body : response;
|
|
192
|
+
if (!Array.isArray(unwrapped)) return [];
|
|
193
|
+
return unwrapped.map((row) => isRecord(row) && typeof row.index === "string" ? row.index.trim() : "").filter((idx) => Boolean(idx) && !idx.startsWith(".")).sort((a, b) => a.localeCompare(b));
|
|
194
|
+
},
|
|
195
|
+
async inspectFields(indexPattern) {
|
|
196
|
+
var _a;
|
|
197
|
+
const safePattern = assertSafeIndexPattern(indexPattern);
|
|
198
|
+
if (rawClient.fieldCaps) {
|
|
199
|
+
const raw = await rawClient.fieldCaps({
|
|
200
|
+
index: safePattern,
|
|
201
|
+
fields: "*"
|
|
202
|
+
});
|
|
203
|
+
const unwrapped = isRecord(raw) && isRecord(raw.body) ? raw.body : raw;
|
|
204
|
+
const parsed = normalizeFieldCapabilitiesResponse(unwrapped);
|
|
205
|
+
if (parsed.length > 0) {
|
|
206
|
+
return parsed;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if ((_a = rawClient.indices) == null ? void 0 : _a.getMapping) {
|
|
210
|
+
const rawMapping = await rawClient.indices.getMapping({ index: safePattern });
|
|
211
|
+
const unwrapped = isRecord(rawMapping) && isRecord(rawMapping.body) ? rawMapping.body : rawMapping;
|
|
212
|
+
if (isRecord(unwrapped)) {
|
|
213
|
+
const merged = /* @__PURE__ */ new Map();
|
|
214
|
+
for (const indexEntry of Object.values(unwrapped)) {
|
|
215
|
+
if (!isRecord(indexEntry)) continue;
|
|
216
|
+
const mappings = isRecord(indexEntry.mappings) ? indexEntry.mappings : void 0;
|
|
217
|
+
const props = mappings && isRecord(mappings.properties) ? mappings.properties : void 0;
|
|
218
|
+
if (props) {
|
|
219
|
+
flattenMappingProperties(props, "", merged);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return linkKeywordSubfields(merged);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return [];
|
|
226
|
+
},
|
|
227
|
+
async search(indexPattern, body) {
|
|
228
|
+
const safePattern = assertSafeIndexPattern(indexPattern);
|
|
229
|
+
const response = await rawClient.search({
|
|
230
|
+
index: safePattern,
|
|
231
|
+
...body
|
|
232
|
+
});
|
|
233
|
+
return isRecord(response) && isRecord(response.body) ? response.body : response;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
class ElasticsearchConnectionService {
|
|
238
|
+
constructor(app) {
|
|
239
|
+
this.app = app;
|
|
240
|
+
}
|
|
241
|
+
fallbackClients = /* @__PURE__ */ new Map();
|
|
242
|
+
async close() {
|
|
243
|
+
const clients = Array.from(this.fallbackClients.values());
|
|
244
|
+
this.fallbackClients.clear();
|
|
245
|
+
await Promise.allSettled(clients.map((client) => client.close()));
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Discover all Elasticsearch data sources configured via `plugin-data-source-elasticsearch`
|
|
249
|
+
* without leaking sensitive credentials (`password`, `apiKey`).
|
|
250
|
+
*/
|
|
251
|
+
async listConnections() {
|
|
252
|
+
var _a;
|
|
253
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
254
|
+
const dsManager = this.app.dataSourceManager;
|
|
255
|
+
if ((dsManager == null ? void 0 : dsManager.dataSources) instanceof Map) {
|
|
256
|
+
for (const [key, ds] of dsManager.dataSources.entries()) {
|
|
257
|
+
if (!isRecord(ds)) continue;
|
|
258
|
+
const cm = isRecord(ds.collectionManager) ? ds.collectionManager : void 0;
|
|
259
|
+
const pubOpts = typeof ds.publicOptions === "function" ? ds.publicOptions() : void 0;
|
|
260
|
+
const opts = extractConnectionOptions(pubOpts ?? ds.options);
|
|
261
|
+
const isEs = isRawEsClientLike(cm == null ? void 0 : cm.esClient) || ((_a = ds.constructor) == null ? void 0 : _a.name) === "ElasticsearchDataSource";
|
|
262
|
+
if (!isEs) continue;
|
|
263
|
+
byKey.set(key, {
|
|
264
|
+
key,
|
|
265
|
+
displayName: typeof ds.displayName === "string" && ds.displayName ? ds.displayName : key,
|
|
266
|
+
status: "loaded",
|
|
267
|
+
...typeof opts.indexPattern === "string" ? { indexPattern: opts.indexPattern } : {},
|
|
268
|
+
...typeof opts.nodes === "string" ? { nodes: opts.nodes } : {}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
try {
|
|
273
|
+
const repo = this.app.db.getRepository("dataSources");
|
|
274
|
+
if (repo) {
|
|
275
|
+
const rows = await repo.find({
|
|
276
|
+
filter: { type: "elasticsearch" }
|
|
277
|
+
});
|
|
278
|
+
for (const row of rows) {
|
|
279
|
+
const plain = typeof (row == null ? void 0 : row.toJSON) === "function" ? row.toJSON() : row;
|
|
280
|
+
if (!isRecord(plain) || typeof plain.key !== "string" || !plain.key.trim()) continue;
|
|
281
|
+
const key = plain.key.trim();
|
|
282
|
+
const opts = extractConnectionOptions(plain.options);
|
|
283
|
+
const existing = byKey.get(key);
|
|
284
|
+
byKey.set(key, {
|
|
285
|
+
key,
|
|
286
|
+
displayName: typeof plain.displayName === "string" && plain.displayName.trim() ? plain.displayName.trim() : (existing == null ? void 0 : existing.displayName) ?? key,
|
|
287
|
+
status: typeof plain.status === "string" ? plain.status : (existing == null ? void 0 : existing.status) ?? "configured",
|
|
288
|
+
...typeof opts.indexPattern === "string" ? { indexPattern: opts.indexPattern } : (existing == null ? void 0 : existing.indexPattern) ? { indexPattern: existing.indexPattern } : {},
|
|
289
|
+
...typeof opts.nodes === "string" ? { nodes: opts.nodes } : (existing == null ? void 0 : existing.nodes) ? { nodes: existing.nodes } : {}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
} catch {
|
|
294
|
+
}
|
|
295
|
+
return Array.from(byKey.values()).sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
296
|
+
}
|
|
297
|
+
async getClient(dataSourceKey) {
|
|
298
|
+
var _a;
|
|
299
|
+
const cleanKey = dataSourceKey.trim();
|
|
300
|
+
if (!cleanKey) {
|
|
301
|
+
throw new Error("Elasticsearch dataSourceKey is required");
|
|
302
|
+
}
|
|
303
|
+
const liveDs = (_a = this.app.dataSourceManager) == null ? void 0 : _a.get(cleanKey);
|
|
304
|
+
if (isRecord(liveDs) && isRecord(liveDs.collectionManager) && isRawEsClientLike(liveDs.collectionManager.esClient)) {
|
|
305
|
+
return wrapEsClient(liveDs.collectionManager.esClient);
|
|
306
|
+
}
|
|
307
|
+
const cached = this.fallbackClients.get(cleanKey);
|
|
308
|
+
if (cached) {
|
|
309
|
+
return wrapEsClient(cached);
|
|
310
|
+
}
|
|
311
|
+
const repo = this.app.db.getRepository("dataSources");
|
|
312
|
+
const record = repo ? await repo.findOne({
|
|
313
|
+
filter: { key: cleanKey, type: "elasticsearch" }
|
|
314
|
+
}) : null;
|
|
315
|
+
if (!record) {
|
|
316
|
+
throw new Error(`Elasticsearch data source "${cleanKey}" was not found or is not loaded`);
|
|
317
|
+
}
|
|
318
|
+
const plain = typeof record.toJSON === "function" ? record.toJSON() : record;
|
|
319
|
+
const opts = extractConnectionOptions(isRecord(plain) ? plain.options : void 0);
|
|
320
|
+
if (!opts.nodes) {
|
|
321
|
+
throw new Error(`Elasticsearch data source "${cleanKey}" has no configured nodes`);
|
|
322
|
+
}
|
|
323
|
+
const client = new import_elasticsearch.Client(buildEsClientOptions(opts));
|
|
324
|
+
this.fallbackClients.set(cleanKey, client);
|
|
325
|
+
return wrapEsClient(client);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
329
|
+
0 && (module.exports = {
|
|
330
|
+
ElasticsearchConnectionService,
|
|
331
|
+
normalizeFieldCapabilitiesResponse
|
|
332
|
+
});
|