From ec6ed422b10ee3ac7ec0bd2b57f60a154dce3c8c Mon Sep 17 00:00:00 2001 From: Andreas Hilbig Date: Wed, 4 Feb 2026 02:53:33 +0100 Subject: [PATCH] feat: improve Zabbix version compatibility and optimize queries This commit introduces several improvements to ensure the API works seamlessly across Zabbix 6.0, 6.4, and 7.0+, while also optimizing data fetching performance. Key changes: - Zabbix Version Compatibility: - Added Zabbix version detection and static caching in ZabbixAPI. - Implemented name-based fallback for host/template group permissions to support Zabbix 6.0 (which lacks UUIDs for host groups). - Added manual host group expansion for Zabbix versions < 6.2.0 during user group import. - Added version-based guards for history.push (7.0+) and hostgroup.propagate (6.2+). - Updated documentation with detailed version compatibility notes. - Added src/test/zabbix_6_0_compatibility.test.ts to verify compatibility logic. - Query Optimization: - Implemented dynamic output selection in ZabbixRequest to fetch only fields requested in GraphQL queries. - Added GraphqlParamsToNeededZabbixOutput to map GraphQL selections to Zabbix API output parameters. - Moved "Query Optimization" to achieved milestones in roadmap.md. - Other: - Updated various tests to support the new version-aware logic. - Optimized imports and synchronized IDE settings. --- .idea/workspace.xml | 121 +++++++++--------- README.md | 17 ++- roadmap.md | 5 +- src/datasources/zabbix-api.ts | 14 +++ src/datasources/zabbix-history.ts | 4 + src/datasources/zabbix-hostgroups.ts | 29 +++++ src/datasources/zabbix-usergroups.ts | 143 +++++++++++++++++----- src/test/history_push.test.ts | 9 ++ src/test/history_push_integration.test.ts | 1 + src/test/host_importer.test.ts | 1 + src/test/host_integration.test.ts | 1 + src/test/host_query.test.ts | 1 + src/test/indirect_dependencies.test.ts | 1 + src/test/query_optimization.test.ts | 1 + src/test/template_integration.test.ts | 1 + src/test/template_link.test.ts | 1 + src/test/template_query.test.ts | 1 + src/test/user_rights.test.ts | 1 + src/test/user_rights_integration.test.ts | 4 +- src/test/zabbix_6_0_compatibility.test.ts | 106 ++++++++++++++++ src/test/zabbix_docs_samples.test.ts | 1 + 21 files changed, 363 insertions(+), 100 deletions(-) create mode 100644 src/test/zabbix_6_0_compatibility.test.ts diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d1b9822..efd7416 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,30 +5,21 @@ - - - - - - - - - - - - - - - + - - - - - - + + + + + + + + + + + - @@ -87,45 +78,50 @@ - { + "keyToString": { + "NIXITCH_NIXPKGS_CONFIG": "", + "NIXITCH_NIX_CONF_DIR": "", + "NIXITCH_NIX_OTHER_STORES": "", + "NIXITCH_NIX_PATH": "", + "NIXITCH_NIX_PROFILES": "", + "NIXITCH_NIX_REMOTE": "", + "NIXITCH_NIX_USER_PROFILE_DIR": "", + "Node.js.index.ts.executor": "Run", + "RunOnceActivity.MCP Project settings loaded": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true", + "RunOnceActivity.git.unshallow": "true", + "RunOnceActivity.typescript.service.memoryLimit.init": "true", + "com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1": "true", + "git-widget-placeholder": "main", + "go.import.settings.migrated": "true", + "javascript.preferred.runtime.type.id": "node", + "junie.onboarding.icon.badge.shown": "true", + "last_opened_file_path": "//wsl.localhost/Ubuntu/home/ahilbig/git/vcr/zabbix-graphql-api/docs/use-cases", + "node.js.detected.package.eslint": "true", + "node.js.detected.package.tslint": "true", + "node.js.selected.package.eslint": "(autodetect)", + "node.js.selected.package.tslint": "(autodetect)", + "nodejs_interpreter_path": "wsl://Ubuntu@/home/ahilbig/.nvm/versions/node/v24.12.0/bin/node", + "nodejs_package_manager_path": "npm", + "npm.codegen.executor": "Run", + "npm.compile.executor": "Run", + "npm.copy-schema.executor": "Run", + "npm.prod.executor": "Run", + "npm.test.executor": "Run", + "settings.editor.selected.configurable": "junie.mcp", + "settings.editor.splitter.proportion": "0.23751687", + "to.speed.mode.migration.done": "true", + "ts.external.directory.path": "\\\\wsl.localhost\\Ubuntu\\home\\ahilbig\\git\\vcr\\zabbix-graphql-api\\node_modules\\typescript\\lib", + "vue.rearranger.settings.migration": "true" + }, + "keyToStringList": { + "com.intellij.ide.scratch.ScratchImplUtil$2/New Scratch File": [ + "TEXT" + ] } -}]]> +}