chore: Move schema directory away from src; Migrate extensions to schema directory, update Dockerfile and configuration paths

This commit is contained in:
Andreas Hilbig 2026-01-14 10:03:38 +01:00
parent c6314fbda0
commit 70e64448e5
14 changed files with 90 additions and 46 deletions

View file

@ -2,7 +2,7 @@
<configuration default="false" name="index.ts" type="NodeJSConfigurationType" path-to-node="wsl://Ubuntu@/home/ahilbig/.nvm/versions/node/v24.12.0/bin/node" nameIsGenerated="true" path-to-js-file="src/index.ts" typescript-loader="bundled" working-dir="$PROJECT_DIR$"> <configuration default="false" name="index.ts" type="NodeJSConfigurationType" path-to-node="wsl://Ubuntu@/home/ahilbig/.nvm/versions/node/v24.12.0/bin/node" nameIsGenerated="true" path-to-js-file="src/index.ts" typescript-loader="bundled" working-dir="$PROJECT_DIR$">
<envs> <envs>
<env name="ADDITIONAL_RESOLVERS" value="SinglePanelDevice,FourPanelDevice,DistanceTrackerDevice" /> <env name="ADDITIONAL_RESOLVERS" value="SinglePanelDevice,FourPanelDevice,DistanceTrackerDevice" />
<env name="ADDITIONAL_SCHEMAS" value="./extensions/display_devices.graphql,./extensions/location_tracker_devices.graphql,./extensions/location_tracker_commons.graphql" /> <env name="ADDITIONAL_SCHEMAS" value="./schema/extensions/display_devices.graphql,./schema/extensions/location_tracker_devices.graphql,./schema/extensions/location_tracker_commons.graphql" />
<env name="DEBUG" value="device-control-center-api:*" /> <env name="DEBUG" value="device-control-center-api:*" />
<env name="ZABBIX_AUTH_TOKEN" value="$ZABBIX_AUTH_TOKEN_VCR_DEV$" /> <env name="ZABBIX_AUTH_TOKEN" value="$ZABBIX_AUTH_TOKEN_VCR_DEV$" />
<env name="ZABBIX_BASE_URL" value="http://cockpit.vcr.develop.hilbigit.com/" /> <env name="ZABBIX_BASE_URL" value="http://cockpit.vcr.develop.hilbigit.com/" />

128
.idea/workspace.xml generated
View file

@ -4,9 +4,20 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="d7a71994-2699-4ae4-9fd2-ee13b7f33d35" name="Changes" comment="chore: Add dry-run mode and configure logger for operation mode logging"> <list default="true" id="d7a71994-2699-4ae4-9fd2-ee13b7f33d35" name="Changes" comment="chore: Replace copying of `schema.graphql` with `extensions` in Dockerfile">
<change afterPath="$PROJECT_DIR$/src/test/zabbix_api_args_parser.test.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Dockerfile" beforeDir="false" afterPath="$PROJECT_DIR$/Dockerfile" afterDir="false" />
<change beforePath="$PROJECT_DIR$/codegen.ts" beforeDir="false" afterPath="$PROJECT_DIR$/codegen.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/extensions/display_devices.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/extensions/display_devices.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/extensions/location_tracker_commons.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/extensions/location_tracker_commons.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/extensions/location_tracker_devices.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/extensions/location_tracker_devices.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/api/schema.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/schema.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/schema/api_commons.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/api_commons.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/schema/device_value_commons.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/device_value_commons.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/schema/devices.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/devices.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/schema/mutations.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/mutations.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/schema/queries.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/queries.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/schema/zabbix.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/zabbix.graphql" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -17,7 +28,7 @@
<execution /> <execution />
</component> </component>
<component name="EmbeddingIndexingInfo"> <component name="EmbeddingIndexingInfo">
<option name="cachedIndexableFilesCount" value="53" /> <option name="cachedIndexableFilesCount" value="57" />
<option name="fileBasedEmbeddingIndicesEnabled" value="true" /> <option name="fileBasedEmbeddingIndicesEnabled" value="true" />
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
@ -38,44 +49,44 @@
<option name="openDirectoriesWithSingleClick" value="true" /> <option name="openDirectoriesWithSingleClick" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent">{
"keyToString": { &quot;keyToString&quot;: {
"NIXITCH_NIXPKGS_CONFIG": "", &quot;NIXITCH_NIXPKGS_CONFIG&quot;: &quot;&quot;,
"NIXITCH_NIX_CONF_DIR": "", &quot;NIXITCH_NIX_CONF_DIR&quot;: &quot;&quot;,
"NIXITCH_NIX_OTHER_STORES": "", &quot;NIXITCH_NIX_OTHER_STORES&quot;: &quot;&quot;,
"NIXITCH_NIX_PATH": "", &quot;NIXITCH_NIX_PATH&quot;: &quot;&quot;,
"NIXITCH_NIX_PROFILES": "", &quot;NIXITCH_NIX_PROFILES&quot;: &quot;&quot;,
"NIXITCH_NIX_REMOTE": "", &quot;NIXITCH_NIX_REMOTE&quot;: &quot;&quot;,
"NIXITCH_NIX_USER_PROFILE_DIR": "", &quot;NIXITCH_NIX_USER_PROFILE_DIR&quot;: &quot;&quot;,
"Node.js.index.ts.executor": "Run", &quot;Node.js.index.ts.executor&quot;: &quot;Run&quot;,
"RunOnceActivity.MCP Project settings loaded": "true", &quot;RunOnceActivity.MCP Project settings loaded&quot;: &quot;true&quot;,
"RunOnceActivity.ShowReadmeOnStart": "true", &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true", &quot;RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252&quot;: &quot;true&quot;,
"RunOnceActivity.git.unshallow": "true", &quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
"RunOnceActivity.typescript.service.memoryLimit.init": "true", &quot;RunOnceActivity.typescript.service.memoryLimit.init&quot;: &quot;true&quot;,
"git-widget-placeholder": "main", &quot;git-widget-placeholder&quot;: &quot;main&quot;,
"go.import.settings.migrated": "true", &quot;go.import.settings.migrated&quot;: &quot;true&quot;,
"javascript.preferred.runtime.type.id": "node", &quot;javascript.preferred.runtime.type.id&quot;: &quot;node&quot;,
"last_opened_file_path": "//wsl.localhost/Ubuntu/home/ahilbig/git/vcr/zabbix-graphql-api/src/test", &quot;last_opened_file_path&quot;: &quot;//wsl.localhost/Ubuntu/home/ahilbig/git/vcr/zabbix-graphql-api/src/test&quot;,
"node.js.detected.package.eslint": "true", &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
"node.js.detected.package.tslint": "true", &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
"node.js.selected.package.eslint": "(autodetect)", &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
"node.js.selected.package.tslint": "(autodetect)", &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
"nodejs_interpreter_path": "wsl://Ubuntu@/home/ahilbig/.nvm/versions/node/v24.12.0/bin/node", &quot;nodejs_interpreter_path&quot;: &quot;wsl://Ubuntu@/home/ahilbig/.nvm/versions/node/v24.12.0/bin/node&quot;,
"nodejs_package_manager_path": "npm", &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
"npm.compile.executor": "Run", &quot;npm.compile.executor&quot;: &quot;Run&quot;,
"npm.prod.executor": "Run", &quot;npm.prod.executor&quot;: &quot;Run&quot;,
"settings.editor.selected.configurable": "preferences.sourceCode.TypeScript", &quot;settings.editor.selected.configurable&quot;: &quot;preferences.sourceCode.TypeScript&quot;,
"ts.external.directory.path": "\\\\wsl.localhost\\Ubuntu\\home\\ahilbig\\git\\vcr\\zabbix-graphql-api\\node_modules\\typescript\\lib", &quot;ts.external.directory.path&quot;: &quot;\\\\wsl.localhost\\Ubuntu\\home\\ahilbig\\git\\vcr\\zabbix-graphql-api\\node_modules\\typescript\\lib&quot;,
"vue.rearranger.settings.migration": "true" &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
} }
}]]></component> }</component>
<component name="RecapSpentCounter"> <component name="RecapSpentCounter">
<option name="endsOfQuotaMs" value="1768327208764" /> <option name="endsOfQuotaMs" value="1768327208764" />
<option name="spentUsd" value="0.026222099" /> <option name="spentUsd" value="0.04010335" />
</component> </component>
<component name="RecapUselessUpdatesCounter"> <component name="RecapUselessUpdatesCounter">
<option name="suspendCountdown" value="3" /> <option name="suspendCountdown" value="0" />
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
@ -83,8 +94,11 @@
<recent name="\\wsl.localhost\Ubuntu\home\ahilbig\git\vcr\zabbix-graphql-api\.forgejo\workflows" /> <recent name="\\wsl.localhost\Ubuntu\home\ahilbig\git\vcr\zabbix-graphql-api\.forgejo\workflows" />
<recent name="\\wsl.localhost\Ubuntu\home\ahilbig\git\vcr\zabbix-graphql-api" /> <recent name="\\wsl.localhost\Ubuntu\home\ahilbig\git\vcr\zabbix-graphql-api" />
</key> </key>
<key name="MoveFile.RECENT_KEYS">
<recent name="\\wsl.localhost\Ubuntu\home\ahilbig\git\vcr\zabbix-graphql-api\schema" />
</key>
</component> </component>
<component name="RunManager" selected="Node.js.index.ts"> <component name="RunManager" selected="npm.prod">
<configuration name="prod" type="js.build_tools.npm" temporary="true" nameIsGenerated="true"> <configuration name="prod" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" /> <package-json value="$PROJECT_DIR$/package.json" />
<command value="run" /> <command value="run" />
@ -92,13 +106,24 @@
<script value="prod" /> <script value="prod" />
</scripts> </scripts>
<node-interpreter value="project" /> <node-interpreter value="project" />
<envs /> <envs>
<env name="ADDITIONAL_RESOLVERS" value="SinglePanelDevice,FourPanelDevice,DistanceTrackerDevice" />
<env name="ADDITIONAL_SCHEMAS" value="./schema/extensions/display_devices.graphql,./schema/extensions/location_tracker_devices.graphql,./schema/extensions/location_tracker_commons.graphql" />
<env name="DEBUG" value="device-control-center-api:*" />
<env name="ZABBIX_AUTH_TOKEN" value="$ZABBIX_AUTH_TOKEN_VCR_DEV$" />
<env name="ZABBIX_BASE_URL" value="http://cockpit.vcr.develop.hilbigit.com/" />
<env name="ZABBIX_PERMISSION_TEMPLATE_GROUP_NAME_PREFIX" value="Permissions" />
<env name="ZABBIX_ROADWORK_BASE_GROUP" value="Roadwork/Devices" />
</envs>
<EXTENSION ID="com.intellij.javascript.debugger.execution.StartBrowserRunConfigurationExtension">
<browser with-js-debugger="true" />
</EXTENSION>
<method v="2" /> <method v="2" />
</configuration> </configuration>
<list> <list>
<item itemvalue="Node.js.index.ts" /> <item itemvalue="Node.js.index.ts" />
<item itemvalue="npm.codegen" />
<item itemvalue="npm.compile" /> <item itemvalue="npm.compile" />
<item itemvalue="npm.codegen" />
<item itemvalue="npm.prod" /> <item itemvalue="npm.prod" />
</list> </list>
<recent_temporary> <recent_temporary>
@ -121,7 +146,8 @@
<option name="number" value="Default" /> <option name="number" value="Default" />
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1768273021451</updated> <updated>1768273021451</updated>
<workItem from="1768273025985" duration="9671000" /> <workItem from="1768273025985" duration="11343000" />
<workItem from="1768380302361" duration="1020000" />
</task> </task>
<task id="LOCAL-00001" summary="chore: Update IntelliJ workspace settings and add GitHub Actions workflow for Docker deployment"> <task id="LOCAL-00001" summary="chore: Update IntelliJ workspace settings and add GitHub Actions workflow for Docker deployment">
<option name="closed" value="true" /> <option name="closed" value="true" />
@ -171,7 +197,23 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1768312304586</updated> <updated>1768312304586</updated>
</task> </task>
<option name="localTasksCounter" value="7" /> <task id="LOCAL-00007" summary="chore: Add test for Zabbix API arguments parsing">
<option name="closed" value="true" />
<created>1768312871708</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1768312871708</updated>
</task>
<task id="LOCAL-00008" summary="chore: Replace copying of `schema.graphql` with `extensions` in Dockerfile">
<option name="closed" value="true" />
<created>1768313032612</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1768313032612</updated>
</task>
<option name="localTasksCounter" value="9" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -196,6 +238,8 @@
<MESSAGE value="chore: Add missing &quot;.js&quot; extensions to imports and improve Node.js compatibility for dynamic schema loading" /> <MESSAGE value="chore: Add missing &quot;.js&quot; extensions to imports and improve Node.js compatibility for dynamic schema loading" />
<MESSAGE value="chore: Update IntelliJ workspace and fix Docker image tag in workflow" /> <MESSAGE value="chore: Update IntelliJ workspace and fix Docker image tag in workflow" />
<MESSAGE value="chore: Add dry-run mode and configure logger for operation mode logging" /> <MESSAGE value="chore: Add dry-run mode and configure logger for operation mode logging" />
<option name="LAST_COMMIT_MESSAGE" value="chore: Add dry-run mode and configure logger for operation mode logging" /> <MESSAGE value="chore: Add test for Zabbix API arguments parsing" />
<MESSAGE value="chore: Replace copying of `schema.graphql` with `extensions` in Dockerfile" />
<option name="LAST_COMMIT_MESSAGE" value="chore: Replace copying of `schema.graphql` with `extensions` in Dockerfile" />
</component> </component>
</project> </project>

View file

@ -17,7 +17,7 @@ ARG API_VERSION
ENV API_VERSION=${API_VERSION} ENV API_VERSION=${API_VERSION}
WORKDIR /usr/app WORKDIR /usr/app
COPY package*.json ./ COPY package*.json ./
COPY extensions ./ COPY schema ./
RUN npm install --production RUN npm install --production
COPY --from=builder /usr/app/dist ./dist COPY --from=builder /usr/app/dist ./dist

View file

@ -2,7 +2,7 @@ import type {CodegenConfig} from '@graphql-codegen/cli';
const config: CodegenConfig = { const config: CodegenConfig = {
overwrite: true, overwrite: true,
schema: 'src/schema/*.graphql', schema: 'schema/*.graphql',
generates: { generates: {
"src/schema/generated/graphql.ts": { "src/schema/generated/graphql.ts": {
plugins: ["typescript", "typescript-resolvers"], plugins: ["typescript", "typescript-resolvers"],

View file

@ -26,7 +26,7 @@ const createZabbixHierarchicalDeviceTagsResolver =
} }
export async function schema_loader(): Promise<GraphQLSchema> { export async function schema_loader(): Promise<GraphQLSchema> {
const resolvers = createResolvers(); const resolvers = createResolvers();
const schemaPath = process.env.SCHEMA_PATH || './src/schema/'; const schemaPath = process.env.SCHEMA_PATH || './schema/';
var schemaFiles = readdirSync(schemaPath).filter(fn => fn.endsWith('.graphql')); var schemaFiles = readdirSync(schemaPath).filter(fn => fn.endsWith('.graphql'));
let typeDefs: string = ""; let typeDefs: string = "";
for (const schemaFile of schemaFiles) { for (const schemaFile of schemaFiles) {