From 92ffe716842732567e50cb81e927d3182a17ec55 Mon Sep 17 00:00:00 2001 From: Andreas Hilbig Date: Mon, 5 Jan 2026 21:05:35 +0100 Subject: [PATCH] Initial commit: Extract base Zabbix GraphQl - API functionality from VCR Project and add dynamic schema samples --- .dockerignore | 2 + .gitignore | 132 ++++++ .idea/.gitignore | 9 + .idea/compiler.xml | 6 + .idea/go.imports.xml | 11 + .idea/misc.xml | 6 + .idea/modules.xml | 8 + .idea/runConfigurations/codegen.xml | 15 + .idea/runConfigurations/compile.xml | 15 + .idea/runConfigurations/index_ts.xml | 17 + .idea/vcs.xml | 6 + .idea/workspace.xml | 19 + Dockerfile | 26 ++ codegen.ts | 23 + extensions/display_devices.graphql | 74 +++ jest.config.js | 24 + package.json | 53 +++ schema.graphql | 625 ++++++++++++++++++++++++++ src/api/resolver_helpers.ts | 194 ++++++++ src/api/resolvers.ts | 257 +++++++++++ src/api/schema.ts | 59 +++ src/api/start.ts | 98 ++++ src/common_utils.ts | 8 + src/datasources/zabbix-api.ts | 115 +++++ src/datasources/zabbix-history.ts | 128 ++++++ src/datasources/zabbix-hostgroups.ts | 119 +++++ src/datasources/zabbix-hosts.ts | 303 +++++++++++++ src/datasources/zabbix-items.ts | 192 ++++++++ src/datasources/zabbix-module.ts | 16 + src/datasources/zabbix-permissions.ts | 66 +++ src/datasources/zabbix-request.ts | 530 ++++++++++++++++++++++ src/datasources/zabbix-script.ts | 89 ++++ src/datasources/zabbix-templates.ts | 32 ++ src/datasources/zabbix-usergroups.ts | 330 ++++++++++++++ src/datasources/zabbix-userroles.ts | 175 ++++++++ src/execution/host_exporter.ts | 118 +++++ src/execution/host_importer.ts | 158 +++++++ src/index.ts | 5 + src/logging/logger.ts | 64 +++ src/model/model_enum_values.ts | 70 +++ tsconfig.json | 29 ++ zabbix-graphql-api.iml | 8 + 42 files changed, 4234 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/go.imports.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/runConfigurations/codegen.xml create mode 100644 .idea/runConfigurations/compile.xml create mode 100644 .idea/runConfigurations/index_ts.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 Dockerfile create mode 100644 codegen.ts create mode 100644 extensions/display_devices.graphql create mode 100644 jest.config.js create mode 100644 package.json create mode 100644 schema.graphql create mode 100644 src/api/resolver_helpers.ts create mode 100644 src/api/resolvers.ts create mode 100644 src/api/schema.ts create mode 100644 src/api/start.ts create mode 100644 src/common_utils.ts create mode 100644 src/datasources/zabbix-api.ts create mode 100644 src/datasources/zabbix-history.ts create mode 100644 src/datasources/zabbix-hostgroups.ts create mode 100644 src/datasources/zabbix-hosts.ts create mode 100644 src/datasources/zabbix-items.ts create mode 100644 src/datasources/zabbix-module.ts create mode 100644 src/datasources/zabbix-permissions.ts create mode 100644 src/datasources/zabbix-request.ts create mode 100644 src/datasources/zabbix-script.ts create mode 100644 src/datasources/zabbix-templates.ts create mode 100644 src/datasources/zabbix-usergroups.ts create mode 100644 src/datasources/zabbix-userroles.ts create mode 100644 src/execution/host_exporter.ts create mode 100644 src/execution/host_importer.ts create mode 100644 src/index.ts create mode 100644 src/logging/logger.ts create mode 100644 src/model/model_enum_values.ts create mode 100644 tsconfig.json create mode 100644 zabbix-graphql-api.iml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5171c54 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules +npm-debug.log \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..381cdbc --- /dev/null +++ b/.gitignore @@ -0,0 +1,132 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +.vscode/settings.json diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..42b19ff --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,9 @@ +# Default ignored files +/shelf/ +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..6e70aca --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/go.imports.xml b/.idea/go.imports.xml new file mode 100644 index 0000000..d7202f0 --- /dev/null +++ b/.idea/go.imports.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..4b151ab --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..7f0ff3d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/codegen.xml b/.idea/runConfigurations/codegen.xml new file mode 100644 index 0000000..a0a55ba --- /dev/null +++ b/.idea/runConfigurations/codegen.xml @@ -0,0 +1,15 @@ + + + + + +