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,417 @@
|
|
|
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 ElasticReportToolCatalog_exports = {};
|
|
28
|
+
__export(ElasticReportToolCatalog_exports, {
|
|
29
|
+
createElasticReportToolCatalog: () => createElasticReportToolCatalog
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(ElasticReportToolCatalog_exports);
|
|
32
|
+
var import_acl_guard = require("../acl-guard");
|
|
33
|
+
var import_ElasticReportService = require("../services/ElasticReportService");
|
|
34
|
+
function isRecord(value) {
|
|
35
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
36
|
+
}
|
|
37
|
+
function requireId(value, fieldName) {
|
|
38
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
39
|
+
if (typeof value === "string" && value.trim()) return value.trim();
|
|
40
|
+
throw new Error(`"${fieldName}" is required`);
|
|
41
|
+
}
|
|
42
|
+
function createElasticReportToolCatalog(app, reportService) {
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
name: "es_list_connections",
|
|
46
|
+
title: "List Elasticsearch Connections",
|
|
47
|
+
description: "List Elasticsearch data source connections configured in NocoBase (via plugin-data-source-elasticsearch) and optionally list matching indices for a connection.",
|
|
48
|
+
defaultPermission: "ALLOW",
|
|
49
|
+
inputSchema: {
|
|
50
|
+
type: "object",
|
|
51
|
+
properties: {
|
|
52
|
+
dataSourceKey: {
|
|
53
|
+
type: "string",
|
|
54
|
+
description: "Optional Elasticsearch dataSourceKey to also fetch matching index names."
|
|
55
|
+
},
|
|
56
|
+
indexPattern: {
|
|
57
|
+
type: "string",
|
|
58
|
+
description: 'Optional wildcard pattern when listing indices (default "*").'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
async execute(args, ctx) {
|
|
63
|
+
(0, import_acl_guard.assertCanManageReports)(app, ctx);
|
|
64
|
+
const connections = await reportService.listConnections();
|
|
65
|
+
const dsKey = typeof args.dataSourceKey === "string" ? args.dataSourceKey.trim() : "";
|
|
66
|
+
if (!dsKey) {
|
|
67
|
+
return { connections };
|
|
68
|
+
}
|
|
69
|
+
const pattern = typeof args.indexPattern === "string" && args.indexPattern.trim() ? args.indexPattern.trim() : "*";
|
|
70
|
+
const indices = await reportService.listIndices(dsKey, pattern);
|
|
71
|
+
return { connections, dataSourceKey: dsKey, indices };
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "es_list_data_views",
|
|
76
|
+
title: "List Elasticsearch Data Views",
|
|
77
|
+
description: "List configured Elasticsearch Data Views (index patterns + time fields) used as the foundation for Kibana-style reports.",
|
|
78
|
+
defaultPermission: "ALLOW",
|
|
79
|
+
inputSchema: {
|
|
80
|
+
type: "object",
|
|
81
|
+
properties: {}
|
|
82
|
+
},
|
|
83
|
+
async execute(_args, ctx) {
|
|
84
|
+
(0, import_acl_guard.assertAuthenticated)(ctx);
|
|
85
|
+
const dataViews = await reportService.listDataViews();
|
|
86
|
+
return { dataViews };
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "es_upsert_data_view",
|
|
91
|
+
title: "Create or Update Elasticsearch Data View",
|
|
92
|
+
description: 'Create or update an Elasticsearch Data View over an existing Elasticsearch dataSourceKey and indexPattern (e.g. "logs-*", "orders-*"), automatically introspecting field capabilities via _field_caps.',
|
|
93
|
+
defaultPermission: "ALLOW",
|
|
94
|
+
inputSchema: {
|
|
95
|
+
type: "object",
|
|
96
|
+
required: ["title", "dataSourceKey", "indexPattern"],
|
|
97
|
+
properties: {
|
|
98
|
+
id: {
|
|
99
|
+
type: ["number", "string"],
|
|
100
|
+
description: "Optional existing dataViewId to update."
|
|
101
|
+
},
|
|
102
|
+
title: {
|
|
103
|
+
type: "string",
|
|
104
|
+
description: "Human-readable Data View title."
|
|
105
|
+
},
|
|
106
|
+
dataSourceKey: {
|
|
107
|
+
type: "string",
|
|
108
|
+
description: "Key of an Elasticsearch connection from es_list_connections."
|
|
109
|
+
},
|
|
110
|
+
indexPattern: {
|
|
111
|
+
type: "string",
|
|
112
|
+
description: 'Elasticsearch index or wildcard pattern, such as "logs-*" or "events-*".'
|
|
113
|
+
},
|
|
114
|
+
timeField: {
|
|
115
|
+
type: "string",
|
|
116
|
+
description: 'Optional primary date field (e.g. "@timestamp"). Auto-detected if omitted.'
|
|
117
|
+
},
|
|
118
|
+
description: {
|
|
119
|
+
type: "string",
|
|
120
|
+
description: "Optional description of the dataset."
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
async execute(args, ctx) {
|
|
125
|
+
var _a;
|
|
126
|
+
(0, import_acl_guard.assertCanManageReports)(app, ctx);
|
|
127
|
+
const dataView = await reportService.upsertDataView(
|
|
128
|
+
{
|
|
129
|
+
...args.id !== void 0 ? { id: requireId(args.id, "id") } : {},
|
|
130
|
+
title: typeof args.title === "string" ? args.title : "",
|
|
131
|
+
dataSourceKey: typeof args.dataSourceKey === "string" ? args.dataSourceKey : "",
|
|
132
|
+
indexPattern: typeof args.indexPattern === "string" ? args.indexPattern : "",
|
|
133
|
+
timeField: typeof args.timeField === "string" ? args.timeField : null,
|
|
134
|
+
description: typeof args.description === "string" ? args.description : null
|
|
135
|
+
},
|
|
136
|
+
(0, import_ElasticReportService.extractCurrentUserId)(ctx)
|
|
137
|
+
);
|
|
138
|
+
return {
|
|
139
|
+
dataView,
|
|
140
|
+
fieldCount: ((_a = dataView.cachedFields) == null ? void 0 : _a.length) ?? 0
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "es_inspect_fields",
|
|
146
|
+
title: "Inspect Data View Field Capabilities",
|
|
147
|
+
description: "Inspect Elasticsearch field capabilities (_field_caps) for a Data View: field types, searchable/aggregatable flags, and .keyword subfields. ALWAYS call this before previewing or saving a report so you never guess field names or sort/group on non-aggregatable text fields.",
|
|
148
|
+
defaultPermission: "ALLOW",
|
|
149
|
+
inputSchema: {
|
|
150
|
+
type: "object",
|
|
151
|
+
required: ["dataViewId"],
|
|
152
|
+
properties: {
|
|
153
|
+
dataViewId: {
|
|
154
|
+
type: ["number", "string"],
|
|
155
|
+
description: "Target Data View ID from es_list_data_views."
|
|
156
|
+
},
|
|
157
|
+
refresh: {
|
|
158
|
+
type: "boolean",
|
|
159
|
+
description: "Set true to re-fetch live _field_caps from Elasticsearch instead of cached metadata."
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
async execute(args, ctx) {
|
|
164
|
+
(0, import_acl_guard.assertAuthenticated)(ctx);
|
|
165
|
+
const dataViewId = requireId(args.dataViewId, "dataViewId");
|
|
166
|
+
const refresh = args.refresh === true;
|
|
167
|
+
if (refresh) {
|
|
168
|
+
(0, import_acl_guard.assertCanManageReports)(app, ctx);
|
|
169
|
+
}
|
|
170
|
+
const { dataView, fields } = await reportService.inspectDataViewFields(dataViewId, refresh);
|
|
171
|
+
return {
|
|
172
|
+
dataView: {
|
|
173
|
+
id: dataView.id,
|
|
174
|
+
title: dataView.title,
|
|
175
|
+
dataSourceKey: dataView.dataSourceKey,
|
|
176
|
+
indexPattern: dataView.indexPattern,
|
|
177
|
+
timeField: dataView.timeField
|
|
178
|
+
},
|
|
179
|
+
fields
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: "es_preview_report",
|
|
185
|
+
title: "Preview Elasticsearch Report Query",
|
|
186
|
+
description: "Execute a read-only preview of a Kibana-style ReportSpec (table, bar, line, area, pie, or metric) against Elasticsearch (capped at 20 sample rows) to verify total hits, aggregations, filters, KQL search, and sorting before saving.",
|
|
187
|
+
defaultPermission: "ALLOW",
|
|
188
|
+
inputSchema: {
|
|
189
|
+
type: "object",
|
|
190
|
+
required: ["dataViewId", "spec"],
|
|
191
|
+
properties: {
|
|
192
|
+
dataViewId: {
|
|
193
|
+
type: ["number", "string"],
|
|
194
|
+
description: "Target Data View ID."
|
|
195
|
+
},
|
|
196
|
+
spec: {
|
|
197
|
+
type: "object",
|
|
198
|
+
description: "Declarative ReportSpec configuration.",
|
|
199
|
+
required: ["visualization"],
|
|
200
|
+
properties: {
|
|
201
|
+
visualization: {
|
|
202
|
+
type: "string",
|
|
203
|
+
enum: ["table", "bar", "line", "area", "pie", "metric"]
|
|
204
|
+
},
|
|
205
|
+
query: {
|
|
206
|
+
type: "string",
|
|
207
|
+
description: `KQL search expression, e.g. 'status >= 500 AND service: "checkout"'.`
|
|
208
|
+
},
|
|
209
|
+
queryMode: {
|
|
210
|
+
type: "string",
|
|
211
|
+
enum: ["kql", "simple"]
|
|
212
|
+
},
|
|
213
|
+
filters: {
|
|
214
|
+
type: "array",
|
|
215
|
+
items: {
|
|
216
|
+
type: "object",
|
|
217
|
+
required: ["field", "operator"],
|
|
218
|
+
properties: {
|
|
219
|
+
field: { type: "string" },
|
|
220
|
+
operator: {
|
|
221
|
+
type: "string",
|
|
222
|
+
enum: [
|
|
223
|
+
"eq",
|
|
224
|
+
"ne",
|
|
225
|
+
"in",
|
|
226
|
+
"not_in",
|
|
227
|
+
"gt",
|
|
228
|
+
"gte",
|
|
229
|
+
"lt",
|
|
230
|
+
"lte",
|
|
231
|
+
"between",
|
|
232
|
+
"contains",
|
|
233
|
+
"exists",
|
|
234
|
+
"not_exists"
|
|
235
|
+
]
|
|
236
|
+
},
|
|
237
|
+
value: {},
|
|
238
|
+
valueTo: {}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
sort: {
|
|
243
|
+
type: "array",
|
|
244
|
+
items: {
|
|
245
|
+
type: "object",
|
|
246
|
+
required: ["field", "order"],
|
|
247
|
+
properties: {
|
|
248
|
+
field: { type: "string" },
|
|
249
|
+
order: { type: "string", enum: ["asc", "desc"] }
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
timeRange: {
|
|
254
|
+
type: "object",
|
|
255
|
+
properties: {
|
|
256
|
+
preset: {
|
|
257
|
+
type: "string",
|
|
258
|
+
enum: ["last_15m", "last_1h", "last_24h", "last_7d", "last_30d", "last_90d", "all", "custom"]
|
|
259
|
+
},
|
|
260
|
+
from: { type: "string" },
|
|
261
|
+
to: { type: "string" }
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
columns: {
|
|
265
|
+
type: "array",
|
|
266
|
+
items: { type: "string" }
|
|
267
|
+
},
|
|
268
|
+
pageSize: {
|
|
269
|
+
type: "number"
|
|
270
|
+
},
|
|
271
|
+
chart: {
|
|
272
|
+
type: "object",
|
|
273
|
+
properties: {
|
|
274
|
+
bucketType: { type: "string", enum: ["date_histogram", "terms"] },
|
|
275
|
+
bucketField: { type: "string" },
|
|
276
|
+
calendarInterval: {
|
|
277
|
+
type: "string",
|
|
278
|
+
enum: ["auto", "1m", "5m", "15m", "1h", "1d", "1w", "1M"]
|
|
279
|
+
},
|
|
280
|
+
topN: { type: "number" },
|
|
281
|
+
metricType: {
|
|
282
|
+
type: "string",
|
|
283
|
+
enum: ["count", "sum", "avg", "min", "max", "cardinality"]
|
|
284
|
+
},
|
|
285
|
+
metricField: { type: "string" },
|
|
286
|
+
metricLabel: { type: "string" },
|
|
287
|
+
showHistogram: { type: "boolean" }
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
allowInteractiveControls: { type: "boolean" }
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
async execute(args, ctx) {
|
|
296
|
+
(0, import_acl_guard.assertCanManageReports)(app, ctx);
|
|
297
|
+
const dataViewId = requireId(args.dataViewId, "dataViewId");
|
|
298
|
+
const { dataView, result } = await reportService.previewReport({
|
|
299
|
+
dataViewId,
|
|
300
|
+
spec: isRecord(args.spec) ? args.spec : { visualization: "table" },
|
|
301
|
+
forMcp: true
|
|
302
|
+
});
|
|
303
|
+
return {
|
|
304
|
+
dataView: {
|
|
305
|
+
id: dataView.id,
|
|
306
|
+
title: dataView.title,
|
|
307
|
+
indexPattern: dataView.indexPattern
|
|
308
|
+
},
|
|
309
|
+
total: result.total,
|
|
310
|
+
totalRelation: result.totalRelation,
|
|
311
|
+
tookMs: result.tookMs,
|
|
312
|
+
visualization: result.visualization,
|
|
313
|
+
columns: result.columns,
|
|
314
|
+
sampleRows: result.rows.slice(0, 10),
|
|
315
|
+
series: result.series,
|
|
316
|
+
histogram: result.histogram,
|
|
317
|
+
metricValue: result.metricValue,
|
|
318
|
+
metricLabel: result.metricLabel,
|
|
319
|
+
compiledDsl: result.compiledDsl
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
name: "es_save_report",
|
|
325
|
+
title: "Create or Update Saved Elasticsearch Report",
|
|
326
|
+
description: 'Create or update a Saved Elasticsearch Report so users can immediately add an "Elastic Report" block on any NocoBase page and select this report.',
|
|
327
|
+
defaultPermission: "ALLOW",
|
|
328
|
+
inputSchema: {
|
|
329
|
+
type: "object",
|
|
330
|
+
required: ["title", "dataViewId", "spec"],
|
|
331
|
+
properties: {
|
|
332
|
+
id: {
|
|
333
|
+
type: ["number", "string"],
|
|
334
|
+
description: "Optional existing report ID when updating a report."
|
|
335
|
+
},
|
|
336
|
+
title: {
|
|
337
|
+
type: "string",
|
|
338
|
+
description: "Clear report title displayed in the Elastic Report block picker."
|
|
339
|
+
},
|
|
340
|
+
description: {
|
|
341
|
+
type: "string",
|
|
342
|
+
description: "Optional summary explaining what this report measures or filters."
|
|
343
|
+
},
|
|
344
|
+
dataViewId: {
|
|
345
|
+
type: ["number", "string"],
|
|
346
|
+
description: "Target Data View ID."
|
|
347
|
+
},
|
|
348
|
+
published: {
|
|
349
|
+
type: "boolean",
|
|
350
|
+
description: "Whether the report is published for selection in page blocks (default true)."
|
|
351
|
+
},
|
|
352
|
+
spec: {
|
|
353
|
+
type: "object",
|
|
354
|
+
description: "Validated ReportSpec object (same schema as es_preview_report.spec)."
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
async execute(args, ctx) {
|
|
359
|
+
(0, import_acl_guard.assertCanManageReports)(app, ctx);
|
|
360
|
+
const saved = await reportService.saveReport(
|
|
361
|
+
{
|
|
362
|
+
...args.id !== void 0 ? { id: requireId(args.id, "id") } : {},
|
|
363
|
+
title: typeof args.title === "string" ? args.title : "",
|
|
364
|
+
description: typeof args.description === "string" ? args.description : null,
|
|
365
|
+
dataViewId: requireId(args.dataViewId, "dataViewId"),
|
|
366
|
+
published: args.published !== false,
|
|
367
|
+
spec: isRecord(args.spec) ? args.spec : { visualization: "table" }
|
|
368
|
+
},
|
|
369
|
+
(0, import_ElasticReportService.extractCurrentUserId)(ctx)
|
|
370
|
+
);
|
|
371
|
+
return {
|
|
372
|
+
report: saved,
|
|
373
|
+
usageHint: "Report saved and published. Users can open any NocoBase /v/ page, click Add Block -> Elastic Report, and select this report from the dropdown."
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
name: "es_list_reports",
|
|
379
|
+
title: "List Saved Elasticsearch Reports",
|
|
380
|
+
description: "List Saved Elasticsearch Reports (or filter by title keyword) to inspect or refine existing reports.",
|
|
381
|
+
defaultPermission: "ALLOW",
|
|
382
|
+
inputSchema: {
|
|
383
|
+
type: "object",
|
|
384
|
+
properties: {
|
|
385
|
+
search: {
|
|
386
|
+
type: "string",
|
|
387
|
+
description: "Optional keyword to filter reports by title."
|
|
388
|
+
},
|
|
389
|
+
reportId: {
|
|
390
|
+
type: ["number", "string"],
|
|
391
|
+
description: "Optional specific reportId to retrieve full report spec."
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
async execute(args, ctx) {
|
|
396
|
+
(0, import_acl_guard.assertAuthenticated)(ctx);
|
|
397
|
+
const isManager = (0, import_acl_guard.canManageReports)(app, ctx);
|
|
398
|
+
if (args.reportId !== void 0 && args.reportId !== null && String(args.reportId).trim() !== "") {
|
|
399
|
+
const report = await reportService.getReport(requireId(args.reportId, "reportId"));
|
|
400
|
+
if (!isManager && !report.published) {
|
|
401
|
+
throw new Error("Report not found");
|
|
402
|
+
}
|
|
403
|
+
return { report };
|
|
404
|
+
}
|
|
405
|
+
const reports = await reportService.listReports({
|
|
406
|
+
publishedOnly: !isManager,
|
|
407
|
+
search: typeof args.search === "string" ? args.search : void 0
|
|
408
|
+
});
|
|
409
|
+
return { reports };
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
];
|
|
413
|
+
}
|
|
414
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
415
|
+
0 && (module.exports = {
|
|
416
|
+
createElasticReportToolCatalog
|
|
417
|
+
});
|