chore: add MCP integration and refactor documentation into modular how-to guides
- Moved GraphQL query samples into a new `docs/queries` directory for better organization. - Added new queries and mutations, including `createHost.graphql` and `GetApiVersion.graphql`. - Introduced `mcp-config.yaml` and updated `docker-compose.yml` for MCP integration. - Updated IntelliJ `.idea/workspace.xml` settings to reflect project changes. - Added new how-to guides (`docs/howtos`) for permissions, tags, MCP integration, and schema usage. - Enhanced tests by updating file paths and improving sample data locations. - Refined permissions and host group structures in `zabbix-hostgroups.ts` and `resolvers.ts`.
This commit is contained in:
parent
2a82fe6cf2
commit
4ec61ffba1
33 changed files with 439 additions and 165 deletions
|
|
@ -27,7 +27,7 @@ describe("Host Integration Tests", () => {
|
|||
});
|
||||
|
||||
test("Query allHosts using sample", async () => {
|
||||
const sampleFile = readFileSync(join(process.cwd(), 'docs', 'sample_all_hosts_query.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const sampleFile = readFileSync(join(process.cwd(), 'docs', 'queries', 'sample_all_hosts_query.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const mutationMatch = sampleFile.match(/```graphql\n([\s\S]*?)\n```/);
|
||||
const variablesMatch = sampleFile.match(/```json\n([\s\S]*?)\n```/);
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ describe("Host Integration Tests", () => {
|
|||
});
|
||||
|
||||
test("Import hosts using sample", async () => {
|
||||
const sampleFile = readFileSync(join(process.cwd(), 'docs', 'sample_import_hosts_mutation.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const sampleFile = readFileSync(join(process.cwd(), 'docs', 'queries', 'sample_import_hosts_mutation.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const mutationMatch = sampleFile.match(/```graphql\n([\s\S]*?)\n```/);
|
||||
const variablesMatch = sampleFile.match(/```json\n([\s\S]*?)\n```/);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ describe("Template Integration Tests", () => {
|
|||
});
|
||||
|
||||
test("Import templates using sample query and variables", async () => {
|
||||
const sampleFile = readFileSync(join(process.cwd(), 'docs', 'sample_import_templates_mutation.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const sampleFile = readFileSync(join(process.cwd(), 'docs', 'queries', 'sample_import_templates_mutation.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
|
||||
// Extract mutation and variables from the doc file
|
||||
const mutationMatch = sampleFile.match(/```graphql\n([\s\S]*?)\n```/);
|
||||
|
|
@ -65,7 +65,7 @@ describe("Template Integration Tests", () => {
|
|||
|
||||
test("Import and Export templates comparison", async () => {
|
||||
// 1. Import
|
||||
const importSample = readFileSync(join(process.cwd(), 'docs', 'sample_import_templates_mutation.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const importSample = readFileSync(join(process.cwd(), 'docs', 'queries', 'sample_import_templates_mutation.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const importMutation = importSample.match(/```graphql\n([\s\S]*?)\n```/)![1];
|
||||
const importVariables = JSON.parse(importSample.match(/```json\n([\s\S]*?)\n```/)![1]);
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ describe("Template Integration Tests", () => {
|
|||
});
|
||||
|
||||
// 2. Export (Query)
|
||||
const querySample = readFileSync(join(process.cwd(), 'docs', 'sample_templates_query.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const querySample = readFileSync(join(process.cwd(), 'docs', 'queries', 'sample_templates_query.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const query = querySample.match(/```graphql\n([\s\S]*?)\n```/)![1];
|
||||
const queryVariables = JSON.parse(querySample.match(/```json\n([\s\S]*?)\n```/)![1]);
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ describe("Template Integration Tests", () => {
|
|||
|
||||
test("Import and Export template groups comparison", async () => {
|
||||
// 1. Import (Host Template Groups)
|
||||
const importSample = readFileSync(join(process.cwd(), 'docs', 'sample_import_host_template_groups_mutation.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const importSample = readFileSync(join(process.cwd(), 'docs', 'queries', 'sample_import_host_template_groups_mutation.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const importMutation = importSample.match(/```graphql\n([\s\S]*?)\n```/)![1];
|
||||
const importVariables = JSON.parse(importSample.match(/```json\n([\s\S]*?)\n```/)![1]);
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ describe("Template Integration Tests", () => {
|
|||
expect(importResult.data.importTemplateGroups).toHaveLength(importVariables.templateGroups.length);
|
||||
|
||||
// 2. Import (Permissions Template Groups)
|
||||
const permImportSample = readFileSync(join(process.cwd(), 'docs', 'sample_import_permissions_template_groups_mutation.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const permImportSample = readFileSync(join(process.cwd(), 'docs', 'queries', 'sample_import_permissions_template_groups_mutation.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const permImportMutation = permImportSample.match(/```graphql\n([\s\S]*?)\n```/)![1];
|
||||
const permImportVariables = JSON.parse(permImportSample.match(/```json\n([\s\S]*?)\n```/)![1]);
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ describe("Template Integration Tests", () => {
|
|||
expect(permImportResult.data.importTemplateGroups).toHaveLength(permImportVariables.templateGroups.length);
|
||||
|
||||
// 3. Export (Query)
|
||||
const querySample = readFileSync(join(process.cwd(), 'docs', 'sample_all_template_groups_query.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const querySample = readFileSync(join(process.cwd(), 'docs', 'queries', 'sample_all_template_groups_query.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const query = querySample.match(/```graphql\n([\s\S]*?)\n```/)![1];
|
||||
const queryVariables = JSON.parse(querySample.match(/```json\n([\s\S]*?)\n```/)![1]);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ describe("User Rights Integration Tests", () => {
|
|||
});
|
||||
|
||||
test("Import user rights using sample", async () => {
|
||||
const sampleFile = readFileSync(join(process.cwd(), 'docs', 'sample_import_user_rights_mutation.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const sampleFile = readFileSync(join(process.cwd(), 'docs', 'queries', 'sample_import_user_rights_mutation.graphql'), 'utf-8').replace(/\r\n/g, '\n');
|
||||
const mutationMatch = sampleFile.match(/```graphql\n([\s\S]*?)\n```/);
|
||||
const variablesMatch = sampleFile.match(/```json\n([\s\S]*?)\n```/);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue