plugin-elastic-report 0.0.0-stage → 0.7.0
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 +34 -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/357.0dd385384cab5dbf.js +10 -0
- package/dist/client/index.js +10 -0
- package/dist/client-v2/851.142c93fc6d666b28.js +10 -0
- package/dist/client-v2/857.a5bf9637d5fd4ef5.js +10 -0
- package/dist/client-v2/877.f4095a3dbcadf98f.js +10 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/externalVersion.js +21 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +198 -0
- package/dist/locale/vi-VN.json +198 -0
- package/dist/locale/zh-CN.json +198 -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 +179 -0
- package/dist/server/collections/es-report-data-views.js +85 -0
- package/dist/server/collections/es-reports.js +101 -0
- package/dist/server/index.js +58 -0
- package/dist/server/mcp/ElasticReportMcpServer.js +344 -0
- package/dist/server/mcp/ElasticReportToolCatalog.js +639 -0
- package/dist/server/plugin.js +529 -0
- package/dist/server/services/ElasticReportService.js +377 -0
- package/dist/server/services/ElasticsearchConnectionService.js +572 -0
- package/dist/server/services/ReportExportService.js +243 -0
- package/dist/server/services/ReportQueryCompiler.js +1299 -0
- package/dist/server/workflow/ElasticReportQueryInstruction.js +123 -0
- package/dist/shared/constants.js +96 -0
- package/dist/shared/types.js +24 -0
- package/package.json +62 -4
- package/server.d.ts +2 -0
- package/server.js +1 -0
- package/src/client/index.tsx +34 -0
- package/src/client/workflow-instructions.tsx +44 -0
- package/src/client-v2/__tests__/elastic-report.test.tsx +791 -0
- package/src/client-v2/__tests__/kql-autocomplete.test.ts +178 -0
- package/src/client-v2/api.ts +320 -0
- package/src/client-v2/bus/DashboardFilterBus.ts +212 -0
- package/src/client-v2/components/ElasticBasicCharts.tsx +652 -0
- package/src/client-v2/components/ElasticFilterBar.tsx +372 -0
- package/src/client-v2/components/ElasticKqlInput.tsx +421 -0
- package/src/client-v2/components/ElasticReportBlock.tsx +306 -0
- package/src/client-v2/components/ElasticReportRenderer.tsx +1257 -0
- package/src/client-v2/components/HighlightText.tsx +50 -0
- package/src/client-v2/components/ReportSelect.tsx +85 -0
- package/src/client-v2/index.tsx +14 -0
- package/src/client-v2/locale.ts +23 -0
- package/src/client-v2/models/ElasticFilterBarBlockModel.tsx +115 -0
- package/src/client-v2/models/ElasticReportBlockModel.tsx +118 -0
- package/src/client-v2/pages/ElasticReportManager.tsx +1453 -0
- package/src/client-v2/plugin.tsx +72 -0
- package/src/client-v2/utils/kqlAutocomplete.ts +861 -0
- package/src/client-v2/workflow/instructions.tsx +149 -0
- package/src/index.ts +11 -0
- package/src/locale/en-US.json +198 -0
- package/src/locale/vi-VN.json +198 -0
- package/src/locale/zh-CN.json +198 -0
- package/src/server/__tests__/query-compiler.test.ts +620 -0
- package/src/server/__tests__/report-mcp-acl.integration.test.ts +645 -0
- package/src/server/acl-guard.ts +194 -0
- package/src/server/collections/es-report-data-views.ts +64 -0
- package/src/server/collections/es-reports.ts +80 -0
- package/src/server/index.ts +15 -0
- package/src/server/mcp/ElasticReportMcpServer.ts +391 -0
- package/src/server/mcp/ElasticReportToolCatalog.ts +663 -0
- package/src/server/plugin.ts +599 -0
- package/src/server/services/ElasticReportService.ts +486 -0
- package/src/server/services/ElasticsearchConnectionService.ts +728 -0
- package/src/server/services/ReportExportService.ts +282 -0
- package/src/server/services/ReportQueryCompiler.ts +1552 -0
- package/src/server/workflow/ElasticReportQueryInstruction.ts +124 -0
- package/src/shared/constants.ts +36 -0
- package/src/shared/types.ts +272 -0
- package/README.md +0 -3
|
@@ -0,0 +1,124 @@
|
|
|
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
|
+
import WorkflowPlugin, { Instruction, JOB_STATUS, type FlowNodeModel, type Processor } from '@nocobase/plugin-workflow';
|
|
11
|
+
import type { ElasticWorkflowNodeConfig, ThresholdOperator, TimeRangePreset } from '../../shared/types';
|
|
12
|
+
import type { ElasticReportService } from '../services/ElasticReportService';
|
|
13
|
+
|
|
14
|
+
export function evaluateThreshold(
|
|
15
|
+
actual: number | null | undefined,
|
|
16
|
+
operator: ThresholdOperator | undefined,
|
|
17
|
+
threshold: number | undefined,
|
|
18
|
+
): boolean {
|
|
19
|
+
if (actual === null || actual === undefined || !Number.isFinite(actual)) return false;
|
|
20
|
+
if (!operator || threshold === undefined || !Number.isFinite(threshold)) return false;
|
|
21
|
+
switch (operator) {
|
|
22
|
+
case 'gt':
|
|
23
|
+
return actual > threshold;
|
|
24
|
+
case 'gte':
|
|
25
|
+
return actual >= threshold;
|
|
26
|
+
case 'lt':
|
|
27
|
+
return actual < threshold;
|
|
28
|
+
case 'lte':
|
|
29
|
+
return actual <= threshold;
|
|
30
|
+
case 'eq':
|
|
31
|
+
return actual === threshold;
|
|
32
|
+
case 'ne':
|
|
33
|
+
return actual !== threshold;
|
|
34
|
+
default:
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class ElasticReportQueryInstruction extends Instruction {
|
|
40
|
+
constructor(
|
|
41
|
+
workflow: WorkflowPlugin,
|
|
42
|
+
private readonly reportService: ElasticReportService,
|
|
43
|
+
) {
|
|
44
|
+
super(workflow);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async run(node: FlowNodeModel, _input: unknown, processor: Processor) {
|
|
48
|
+
const rawConfig = (node.config ?? {}) as ElasticWorkflowNodeConfig;
|
|
49
|
+
const parsedConfig = processor.getParsedValue(rawConfig, node.id) as ElasticWorkflowNodeConfig;
|
|
50
|
+
const reportId = parsedConfig?.reportId;
|
|
51
|
+
|
|
52
|
+
if (reportId === undefined || reportId === null || String(reportId).trim() === '') {
|
|
53
|
+
return {
|
|
54
|
+
status: JOB_STATUS.ERROR,
|
|
55
|
+
result: {
|
|
56
|
+
error: 'reportId is required in Elastic Report workflow node configuration',
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
const overrides: {
|
|
63
|
+
query?: string;
|
|
64
|
+
timeRange?: { preset: TimeRangePreset };
|
|
65
|
+
} = {};
|
|
66
|
+
if (typeof parsedConfig.queryOverride === 'string' && parsedConfig.queryOverride.trim()) {
|
|
67
|
+
overrides.query = parsedConfig.queryOverride.trim();
|
|
68
|
+
}
|
|
69
|
+
if (typeof parsedConfig.timePreset === 'string' && parsedConfig.timePreset.trim()) {
|
|
70
|
+
overrides.timeRange = { preset: parsedConfig.timePreset };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const { report, result } = await this.reportService.runSavedReport({
|
|
74
|
+
reportId,
|
|
75
|
+
overrides: Object.keys(overrides).length > 0 ? overrides : undefined,
|
|
76
|
+
requirePublished: false,
|
|
77
|
+
forMcp: true,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const targetField = parsedConfig.thresholdField ?? 'total';
|
|
81
|
+
const comparedValue =
|
|
82
|
+
targetField === 'metricValue'
|
|
83
|
+
? result.metricValue ?? result.total
|
|
84
|
+
: targetField === 'deltaPercent'
|
|
85
|
+
? result.deltaPercent ?? null
|
|
86
|
+
: result.total;
|
|
87
|
+
|
|
88
|
+
const breached = evaluateThreshold(
|
|
89
|
+
comparedValue,
|
|
90
|
+
parsedConfig.thresholdOperator,
|
|
91
|
+
typeof parsedConfig.thresholdValue === 'number'
|
|
92
|
+
? parsedConfig.thresholdValue
|
|
93
|
+
: parsedConfig.thresholdValue !== undefined
|
|
94
|
+
? Number(parsedConfig.thresholdValue)
|
|
95
|
+
: undefined,
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
status: JOB_STATUS.RESOLVED,
|
|
100
|
+
result: {
|
|
101
|
+
reportId: report.id,
|
|
102
|
+
title: report.title,
|
|
103
|
+
visualization: report.visualization,
|
|
104
|
+
total: result.total,
|
|
105
|
+
totalRelation: result.totalRelation,
|
|
106
|
+
metricValue: result.metricValue ?? result.total,
|
|
107
|
+
previousMetricValue: result.previousMetricValue ?? null,
|
|
108
|
+
deltaPercent: result.deltaPercent ?? null,
|
|
109
|
+
breached,
|
|
110
|
+
topBuckets: result.series.slice(0, 10),
|
|
111
|
+
sampleRows: result.rows.slice(0, 10).map((r) => r.source),
|
|
112
|
+
executedAt: new Date().toISOString(),
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
} catch (error) {
|
|
116
|
+
return {
|
|
117
|
+
status: JOB_STATUS.ERROR,
|
|
118
|
+
result: {
|
|
119
|
+
error: error instanceof Error ? error.message : String(error),
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
export const PLUGIN_NAME = 'plugin-elastic-report';
|
|
11
|
+
export const SETTINGS_MENU_KEY = 'elastic-report';
|
|
12
|
+
export const ACL_SNIPPET = 'pm.elastic-report';
|
|
13
|
+
|
|
14
|
+
export const DATA_VIEWS_COLLECTION = 'esReportDataViews';
|
|
15
|
+
export const REPORTS_COLLECTION = 'esReports';
|
|
16
|
+
export const SERVICE_RESOURCE = 'esReportService';
|
|
17
|
+
|
|
18
|
+
export const MCP_SERVER_NAME = 'elastic-report';
|
|
19
|
+
export const MCP_RESOURCE_NAME = 'elastic-report-mcp';
|
|
20
|
+
export const MCP_RELATIVE_PATH = '/elastic-report-mcp';
|
|
21
|
+
|
|
22
|
+
export const HIGHLIGHT_PRE_TAG = '__ES_HL_START__';
|
|
23
|
+
export const HIGHLIGHT_POST_TAG = '__ES_HL_END__';
|
|
24
|
+
|
|
25
|
+
export const DEFAULT_PAGE_SIZE = 20;
|
|
26
|
+
export const MAX_UI_PAGE_SIZE = 200;
|
|
27
|
+
export const MAX_MCP_PREVIEW_SIZE = 20;
|
|
28
|
+
export const MAX_RESULT_WINDOW = 10000;
|
|
29
|
+
export const MAX_TERMS_BUCKETS = 50;
|
|
30
|
+
export const MAX_SPLIT_SERIES = 10;
|
|
31
|
+
|
|
32
|
+
export const DEFAULT_MAX_EXPORT_ROWS = 50000;
|
|
33
|
+
export const EXPORT_BATCH_SIZE = 500;
|
|
34
|
+
|
|
35
|
+
export const WORKFLOW_GROUP_KEY = 'elastic-report';
|
|
36
|
+
export const WORKFLOW_INSTRUCTION_TYPE = 'elastic-report-query';
|
|
@@ -0,0 +1,272 @@
|
|
|
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
|
+
export type ID = string | number;
|
|
11
|
+
|
|
12
|
+
export type ReportVisualizationType = 'table' | 'bar' | 'line' | 'area' | 'pie' | 'metric';
|
|
13
|
+
|
|
14
|
+
export type FilterOperator =
|
|
15
|
+
| 'eq'
|
|
16
|
+
| 'ne'
|
|
17
|
+
| 'in'
|
|
18
|
+
| 'not_in'
|
|
19
|
+
| 'gt'
|
|
20
|
+
| 'gte'
|
|
21
|
+
| 'lt'
|
|
22
|
+
| 'lte'
|
|
23
|
+
| 'between'
|
|
24
|
+
| 'contains'
|
|
25
|
+
| 'exists'
|
|
26
|
+
| 'not_exists';
|
|
27
|
+
|
|
28
|
+
export type ScalarFilterValue = string | number | boolean;
|
|
29
|
+
|
|
30
|
+
export interface ReportFilterItem {
|
|
31
|
+
id?: string;
|
|
32
|
+
field: string;
|
|
33
|
+
operator: FilterOperator;
|
|
34
|
+
value?: ScalarFilterValue | ScalarFilterValue[];
|
|
35
|
+
valueTo?: ScalarFilterValue;
|
|
36
|
+
enabled?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ReportSortItem {
|
|
40
|
+
field: string;
|
|
41
|
+
order: 'asc' | 'desc';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type TimeRangePreset =
|
|
45
|
+
| 'last_15m'
|
|
46
|
+
| 'last_1h'
|
|
47
|
+
| 'last_24h'
|
|
48
|
+
| 'last_7d'
|
|
49
|
+
| 'last_30d'
|
|
50
|
+
| 'last_90d'
|
|
51
|
+
| 'all'
|
|
52
|
+
| 'custom';
|
|
53
|
+
|
|
54
|
+
export interface ReportTimeRange {
|
|
55
|
+
preset: TimeRangePreset;
|
|
56
|
+
from?: string;
|
|
57
|
+
to?: string;
|
|
58
|
+
timeZone?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type BucketAggType = 'date_histogram' | 'terms';
|
|
62
|
+
export type MetricAggType = 'count' | 'sum' | 'avg' | 'min' | 'max' | 'cardinality' | 'p50' | 'p95' | 'p99';
|
|
63
|
+
export type CalendarIntervalOption = 'auto' | '1m' | '5m' | '15m' | '1h' | '1d' | '1w' | '1M';
|
|
64
|
+
export type ChartStackMode = 'none' | 'stacked' | 'percent';
|
|
65
|
+
export type FieldFormatType = 'auto' | 'duration_ms' | 'bytes' | 'percent' | 'number' | 'status_badge' | 'url';
|
|
66
|
+
export type AutoRefreshInterval = 0 | 10 | 30 | 60 | 300;
|
|
67
|
+
export type ExportFormat = 'csv' | 'ndjson';
|
|
68
|
+
export type ThresholdOperator = 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'ne';
|
|
69
|
+
|
|
70
|
+
export interface RecordContextBinding {
|
|
71
|
+
esField: string;
|
|
72
|
+
recordFieldPath: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface DashboardFilterControlSpec {
|
|
76
|
+
field: string;
|
|
77
|
+
label?: string;
|
|
78
|
+
dataViewId: ID;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface SharedDashboardState {
|
|
82
|
+
query?: string;
|
|
83
|
+
timeRange?: ReportTimeRange;
|
|
84
|
+
filters: ReportFilterItem[];
|
|
85
|
+
autoRefreshSec?: AutoRefreshInterval;
|
|
86
|
+
refreshTick: number;
|
|
87
|
+
updatedAt: number;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface FieldTopValuesResult {
|
|
91
|
+
field: string;
|
|
92
|
+
resolvedField: string;
|
|
93
|
+
totalDocs: number;
|
|
94
|
+
buckets: Array<{
|
|
95
|
+
value: string;
|
|
96
|
+
count: number;
|
|
97
|
+
percentage: number;
|
|
98
|
+
}>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface ReportChartConfig {
|
|
102
|
+
bucketType?: BucketAggType;
|
|
103
|
+
bucketField?: string;
|
|
104
|
+
calendarInterval?: CalendarIntervalOption;
|
|
105
|
+
topN?: number;
|
|
106
|
+
metricType?: MetricAggType;
|
|
107
|
+
metricField?: string;
|
|
108
|
+
metricLabel?: string;
|
|
109
|
+
showHistogram?: boolean;
|
|
110
|
+
splitSeriesField?: string;
|
|
111
|
+
splitSeriesTopN?: number;
|
|
112
|
+
stackMode?: ChartStackMode;
|
|
113
|
+
comparePreviousPeriod?: boolean;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface ReportSpec {
|
|
117
|
+
query?: string;
|
|
118
|
+
queryMode?: 'kql' | 'simple';
|
|
119
|
+
filters?: ReportFilterItem[];
|
|
120
|
+
lockedFilters?: ReportFilterItem[];
|
|
121
|
+
sort?: ReportSortItem[];
|
|
122
|
+
timeRange?: ReportTimeRange;
|
|
123
|
+
columns?: string[];
|
|
124
|
+
fieldFormats?: Record<string, FieldFormatType>;
|
|
125
|
+
contextBindings?: RecordContextBinding[];
|
|
126
|
+
pageSize?: number;
|
|
127
|
+
visualization: ReportVisualizationType;
|
|
128
|
+
chart?: ReportChartConfig;
|
|
129
|
+
allowInteractiveControls?: boolean;
|
|
130
|
+
allowExport?: boolean;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface RoleSummary {
|
|
134
|
+
name: string;
|
|
135
|
+
title: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface EsFieldCapability {
|
|
139
|
+
name: string;
|
|
140
|
+
type: string;
|
|
141
|
+
searchable: boolean;
|
|
142
|
+
aggregatable: boolean;
|
|
143
|
+
keywordSubfield?: string;
|
|
144
|
+
isSubfield?: boolean;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface EsConnectionSummary {
|
|
148
|
+
key: string;
|
|
149
|
+
displayName: string;
|
|
150
|
+
status?: string;
|
|
151
|
+
indexPattern?: string;
|
|
152
|
+
nodes?: string;
|
|
153
|
+
endpointMode?: 'nodes' | 'cloud';
|
|
154
|
+
authMode?: 'none' | 'basic' | 'apiKey' | 'bearer';
|
|
155
|
+
tlsMode?: 'verify' | 'caFingerprint' | 'caCert' | 'skip';
|
|
156
|
+
cloudConfigured?: boolean;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface EsConnectionHealthResult {
|
|
160
|
+
ok: boolean;
|
|
161
|
+
clusterName?: string;
|
|
162
|
+
version?: string;
|
|
163
|
+
limitedPrivileges?: boolean;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface EsDataViewRecord {
|
|
167
|
+
id: ID;
|
|
168
|
+
title: string;
|
|
169
|
+
dataSourceKey: string;
|
|
170
|
+
indexPattern: string;
|
|
171
|
+
timeField?: string | null;
|
|
172
|
+
description?: string | null;
|
|
173
|
+
allowedRoles?: string[];
|
|
174
|
+
cachedFields?: EsFieldCapability[] | null;
|
|
175
|
+
createdAt?: string;
|
|
176
|
+
updatedAt?: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface EsReportRecord {
|
|
180
|
+
id: ID;
|
|
181
|
+
title: string;
|
|
182
|
+
description?: string | null;
|
|
183
|
+
dataViewId: ID;
|
|
184
|
+
dataView?: EsDataViewRecord | null;
|
|
185
|
+
visualization: ReportVisualizationType;
|
|
186
|
+
spec: ReportSpec;
|
|
187
|
+
published: boolean;
|
|
188
|
+
allowedRoles?: string[];
|
|
189
|
+
createdAt?: string;
|
|
190
|
+
updatedAt?: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface ReportRuntimeOverrides {
|
|
194
|
+
query?: string;
|
|
195
|
+
filters?: ReportFilterItem[];
|
|
196
|
+
sharedFilters?: ReportFilterItem[];
|
|
197
|
+
contextFilters?: ReportFilterItem[];
|
|
198
|
+
sort?: ReportSortItem[];
|
|
199
|
+
timeRange?: ReportTimeRange;
|
|
200
|
+
timeZone?: string;
|
|
201
|
+
page?: number;
|
|
202
|
+
pageSize?: number;
|
|
203
|
+
searchAfter?: Array<string | number | boolean | null>;
|
|
204
|
+
pitId?: string;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface ReportRowHit {
|
|
208
|
+
_id: string;
|
|
209
|
+
_index: string;
|
|
210
|
+
_score?: number | null;
|
|
211
|
+
_sort?: Array<string | number | boolean | null>;
|
|
212
|
+
source: Record<string, unknown>;
|
|
213
|
+
highlights?: Record<string, string[]>;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface ReportSubSeriesPoint {
|
|
217
|
+
seriesKey: string;
|
|
218
|
+
value: number;
|
|
219
|
+
count: number;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface ReportSeriesPoint {
|
|
223
|
+
key: string;
|
|
224
|
+
label: string;
|
|
225
|
+
value: number;
|
|
226
|
+
count: number;
|
|
227
|
+
breakdown?: ReportSubSeriesPoint[];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export interface ReportHistogramBucket {
|
|
231
|
+
key: string;
|
|
232
|
+
timestamp?: number;
|
|
233
|
+
count: number;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export interface ReportShardStats {
|
|
237
|
+
total: number;
|
|
238
|
+
successful: number;
|
|
239
|
+
skipped: number;
|
|
240
|
+
failed: number;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export interface ReportExecutionResult {
|
|
244
|
+
total: number;
|
|
245
|
+
totalRelation: 'eq' | 'gte';
|
|
246
|
+
tookMs: number;
|
|
247
|
+
timedOut?: boolean;
|
|
248
|
+
shards?: ReportShardStats;
|
|
249
|
+
warnings?: string[];
|
|
250
|
+
visualization: ReportVisualizationType;
|
|
251
|
+
rows: ReportRowHit[];
|
|
252
|
+
columns: string[];
|
|
253
|
+
nextSearchAfter?: Array<string | number | boolean | null>;
|
|
254
|
+
pitId?: string;
|
|
255
|
+
series: ReportSeriesPoint[];
|
|
256
|
+
seriesKeys?: string[];
|
|
257
|
+
histogram: ReportHistogramBucket[];
|
|
258
|
+
metricValue: number | null;
|
|
259
|
+
previousMetricValue?: number | null;
|
|
260
|
+
deltaPercent?: number | null;
|
|
261
|
+
metricLabel: string;
|
|
262
|
+
compiledDsl: Record<string, unknown>;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export interface ElasticWorkflowNodeConfig {
|
|
266
|
+
reportId?: ID;
|
|
267
|
+
queryOverride?: string;
|
|
268
|
+
timePreset?: TimeRangePreset;
|
|
269
|
+
thresholdField?: 'metricValue' | 'total' | 'deltaPercent';
|
|
270
|
+
thresholdOperator?: ThresholdOperator;
|
|
271
|
+
thresholdValue?: number;
|
|
272
|
+
}
|
package/README.md
DELETED