- Add runSmoketest mutation to automate end-to-end verification. - Add SmoketestExecutor and HostDeleter to support automated testing and cleanup. - Extend createHost and importHosts to allow linking templates by name or ID. - Update docs/howtos/cookbook.md with new recipe steps and AI/MCP guidance. - Update .junie/guidelines.md with new verification and deployment standards. - Add src/test/template_link.test.ts and update existing tests to cover new functionality. - Regenerate GraphQL types to match schema updates.
2 KiB
Technical Maintenance Guide
This guide covers the technical aspects of maintaining and developing the Zabbix GraphQL API.
🛠️ Development & Maintenance Tasks
Code Generation
The project uses GraphQL Codegen to generate TypeScript types from the GraphQL schema. This ensures type safety and consistency between the schema and the implementation.
- Configuration:
codegen.ts - Generated Output:
src/schema/generated/graphql.ts
How to Regenerate Types
Whenever you modify any .graphql files in the schema/ directory, you must regenerate the TypeScript types.
For a one-off update (e.g. in a script or before commit):
npx graphql-codegen --config codegen.ts
If you are a developer and want to watch for schema changes continuously:
npm run codegen
Testing
We use Jest for unit and integration testing.
- Test Directory:
src/test/ - Execution:
npm run test
Adding New Tests
- Location: Place new test files in
src/test/with the.test.tsextension. - Coverage: Ensure you cover both successful operations and error scenarios.
- Best Practice: If you find a bug, first create a reproduction test in
src/test/to verify the fix.
🔄 Updating Dependencies
To keep the project secure and up-to-date:
- Check for updates:
npm outdated - Update packages:
npm update - Verify with tests:
npm run test
🐳 Docker Image Maintenance
The Dockerfile uses a multi-stage build to keep the production image small and secure.
- Base Image: Node 24 (LTS)
- Build Argument:
API_VERSION(used to embed the version into the image)
To build a fresh image locally:
docker build -t zabbix-graphql-api --build-arg API_VERSION=$(git describe --tags --always) .
Related Reference: Project Configuration Reference Related Cookbook: Extending the Schema