chore: Add missing ".js" extensions to imports and improve Node.js compatibility for dynamic schema loading
This commit is contained in:
parent
1c1aeb4519
commit
98c612fc56
15 changed files with 121 additions and 70 deletions
3
.idea/compiler.xml
generated
3
.idea/compiler.xml
generated
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="TypeScriptCompiler">
|
<component name="TypeScriptCompiler">
|
||||||
<option name="nodeInterpreterTextField" value="wsl://Ubuntu@/home/ahilbig/.nvm/versions/node/v22.14.0/bin/node" />
|
<option name="memoryAutoIncrease" value="true" />
|
||||||
|
<option name="nodeInterpreterTextField" value="wsl://Ubuntu@/home/ahilbig/.nvm/versions/node/v24.12.0/bin/node" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
6
.idea/runConfigurations/index_ts.xml
generated
6
.idea/runConfigurations/index_ts.xml
generated
|
|
@ -1,8 +1,8 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="index.ts" type="NodeJSConfigurationType" path-to-node="wsl://Ubuntu@/home/ahilbig/.nvm/versions/node/v22.14.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,DistanceTracker" />
|
<env name="ADDITIONAL_RESOLVERS" value="SinglePanelDevice,FourPanelDevice,DistanceTrackerDevice" />
|
||||||
<env name="ADDITIONAL_SCHEMAS" value="./extensions/display_devices.graphql,./extensions/location_tracker_devices.graphql" />
|
<env name="ADDITIONAL_SCHEMAS" value="./extensions/display_devices.graphql,./extensions/location_tracker_devices.graphql,./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/" />
|
||||||
|
|
|
||||||
69
.idea/workspace.xml
generated
69
.idea/workspace.xml
generated
|
|
@ -4,9 +4,21 @@
|
||||||
<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="refactor!: Update Node.js version to 24.12.0, enhance GraphQL schema structure, and improve dynamic schema loading logic">
|
<list default="true" id="d7a71994-2699-4ae4-9fd2-ee13b7f33d35" name="Changes" comment="chore: Add missing ".js" extensions to imports and improve Node.js compatibility for dynamic schema loading">
|
||||||
<change afterPath="$PROJECT_DIR$/.forgejo/workflows/deploy-docker.yaml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/runConfigurations/index_ts.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/runConfigurations/index_ts.xml" 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$/extensions/location_tracker_commons.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/extensions/location_tracker_commons.graphql" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/extensions/location_tracker_devices.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/extensions/location_tracker_devices.graphql" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/api/resolver_helpers.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/resolver_helpers.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/api/resolvers.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/resolvers.ts" 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/api/start.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/start.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/datasources/zabbix-hostgroups.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/datasources/zabbix-hostgroups.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/datasources/zabbix-items.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/datasources/zabbix-items.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/datasources/zabbix-permissions.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/datasources/zabbix-permissions.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/execution/host_exporter.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/execution/host_exporter.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/execution/host_importer.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/execution/host_importer.ts" 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" />
|
||||||
|
|
@ -63,7 +75,9 @@
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_interpreter_path": "wsl://Ubuntu@/home/ahilbig/.nvm/versions/node/v24.12.0/bin/node",
|
"nodejs_interpreter_path": "wsl://Ubuntu@/home/ahilbig/.nvm/versions/node/v24.12.0/bin/node",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"settings.editor.selected.configurable": "settings.typescriptcompiler",
|
"npm.compile.executor": "Run",
|
||||||
|
"npm.prod.executor": "Run",
|
||||||
|
"settings.editor.selected.configurable": "preferences.sourceCode.TypeScript",
|
||||||
"ts.external.directory.path": "\\\\wsl.localhost\\Ubuntu\\home\\ahilbig\\git\\vcr\\zabbix-graphql-api\\node_modules\\typescript\\lib",
|
"ts.external.directory.path": "\\\\wsl.localhost\\Ubuntu\\home\\ahilbig\\git\\vcr\\zabbix-graphql-api\\node_modules\\typescript\\lib",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
|
|
@ -82,11 +96,27 @@
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="Node.js.index.ts">
|
<component name="RunManager" selected="Node.js.index.ts">
|
||||||
|
<configuration name="prod" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
||||||
|
<package-json value="$PROJECT_DIR$/package.json" />
|
||||||
|
<command value="run" />
|
||||||
|
<scripts>
|
||||||
|
<script value="prod" />
|
||||||
|
</scripts>
|
||||||
|
<node-interpreter value="project" />
|
||||||
|
<envs />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
<list>
|
<list>
|
||||||
<item itemvalue="Node.js.index.ts" />
|
<item itemvalue="Node.js.index.ts" />
|
||||||
<item itemvalue="npm.codegen" />
|
<item itemvalue="npm.codegen" />
|
||||||
<item itemvalue="npm.compile" />
|
<item itemvalue="npm.compile" />
|
||||||
|
<item itemvalue="npm.prod" />
|
||||||
</list>
|
</list>
|
||||||
|
<recent_temporary>
|
||||||
|
<list>
|
||||||
|
<item itemvalue="npm.prod" />
|
||||||
|
</list>
|
||||||
|
</recent_temporary>
|
||||||
</component>
|
</component>
|
||||||
<component name="SharedIndexes">
|
<component name="SharedIndexes">
|
||||||
<attachedChunks>
|
<attachedChunks>
|
||||||
|
|
@ -102,8 +132,33 @@
|
||||||
<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="6749000" />
|
<workItem from="1768273025985" duration="8303000" />
|
||||||
</task>
|
</task>
|
||||||
|
<task id="LOCAL-00001" summary="chore: Update IntelliJ workspace settings and add GitHub Actions workflow for Docker deployment">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1768310046741</created>
|
||||||
|
<option name="number" value="00001" />
|
||||||
|
<option name="presentableId" value="LOCAL-00001" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1768310046741</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00002" summary="chore: Update IntelliJ workspace settings and add GitHub Actions workflow for Docker deployment">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1768310076697</created>
|
||||||
|
<option name="number" value="00002" />
|
||||||
|
<option name="presentableId" value="LOCAL-00002" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1768310076697</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00003" summary="chore: Update IntelliJ workspace settings and add GitHub Actions workflow for Docker deployment">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1768310176163</created>
|
||||||
|
<option name="number" value="00003" />
|
||||||
|
<option name="presentableId" value="LOCAL-00003" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1768310176163</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="4" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
|
@ -121,9 +176,11 @@
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="refactor!: Update Node.js version to 24.12.0, enhance GraphQL schema structure, and improve dynamic schema loading logic" />
|
|
||||||
<MESSAGE value="refactor!: Cleanup zabbix api access and remove unused classes; Restructure grapqhl-schema to better align with clean code and project structure principles;Rename "devices" to "hosts" in "exportHistory" - operation. Prepare extraction of device specific types and alignment with integration layer" />
|
<MESSAGE value="refactor!: Cleanup zabbix api access and remove unused classes; Restructure grapqhl-schema to better align with clean code and project structure principles;Rename "devices" to "hosts" in "exportHistory" - operation. Prepare extraction of device specific types and alignment with integration layer" />
|
||||||
<MESSAGE value="refactor!: Rename "devices" to "hosts" in "exportHistory" - operation. Cleanup zabbix api access and remove unused classes Restructure grapqhl-schema to better align with clean code and project structure principles" />
|
<MESSAGE value="refactor!: Rename "devices" to "hosts" in "exportHistory" - operation. Cleanup zabbix api access and remove unused classes Restructure grapqhl-schema to better align with clean code and project structure principles" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="refactor!: Rename "devices" to "hosts" in "exportHistory" - operation. Cleanup zabbix api access and remove unused classes Restructure grapqhl-schema to better align with clean code and project structure principles" />
|
<MESSAGE value="refactor!: Update Node.js version to 24.12.0, enhance GraphQL schema structure, and improve dynamic schema loading logic" />
|
||||||
|
<MESSAGE value="chore: Update IntelliJ workspace settings and add GitHub Actions workflow for Docker deployment" />
|
||||||
|
<MESSAGE value="chore: Add missing ".js" extensions to imports and improve Node.js compatibility for dynamic schema loading" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="chore: Add missing ".js" extensions to imports and improve Node.js compatibility for dynamic schema loading" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -1,17 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
Concrete implementation of a DeviceValueMessage for sensor distance data.
|
|
||||||
"""
|
|
||||||
type SensorDistanceMessage implements DeviceValueMessage {
|
|
||||||
deviceKey: String
|
|
||||||
timestamp: String
|
|
||||||
attributeName: String
|
|
||||||
topicName: String
|
|
||||||
deviceType: String
|
|
||||||
value: SensorDistanceValue
|
|
||||||
}
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Represents the payload for a sensor distance measurement.
|
Represents the payload for a sensor distance measurement.
|
||||||
"""
|
"""
|
||||||
|
|
@ -58,3 +46,15 @@ type PositionCalculatorResult {
|
||||||
position: Position
|
position: Position
|
||||||
accuracy: Float
|
accuracy: Float
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
Concrete implementation of a DeviceValueMessage for sensor distance data.
|
||||||
|
"""
|
||||||
|
type SensorDistanceMessage implements DeviceValueMessage {
|
||||||
|
deviceKey: String
|
||||||
|
timestamp: String
|
||||||
|
attributeName: String
|
||||||
|
topicName: String
|
||||||
|
deviceType: String
|
||||||
|
value: SensorDistanceValue
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,30 +18,13 @@ type DistanceTrackerDevice implements Host & Device {
|
||||||
|
|
||||||
type DistanceTrackerState implements DeviceState {
|
type DistanceTrackerState implements DeviceState {
|
||||||
operational: OperationalDeviceData
|
operational: OperationalDeviceData
|
||||||
current: DistanceTrackerCurrentState
|
current: DistanceTrackerValues
|
||||||
}
|
}
|
||||||
|
|
||||||
type DistanceTrackerCurrentState {
|
|
||||||
values: DistanceTrackerValues
|
|
||||||
}
|
|
||||||
|
|
||||||
type DistanceTrackerValues {
|
|
||||||
"""
|
"""
|
||||||
Aggregated information of devices detected around the tracker
|
Aggregated information of devices detected around the tracker
|
||||||
"""
|
"""
|
||||||
countValues: DeviceCountValues
|
type DistanceTrackerValues {
|
||||||
"""
|
|
||||||
Information about devices detected nearby
|
|
||||||
"""
|
|
||||||
distanceValues: String
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
type DeviceCountValues {
|
|
||||||
"""
|
|
||||||
Number of unique deviceKeys detected between timeFrom and timeUnti
|
|
||||||
"""
|
|
||||||
count: Int
|
|
||||||
"""
|
"""
|
||||||
Start of time interval for the delivered device counting value
|
Start of time interval for the delivered device counting value
|
||||||
"""
|
"""
|
||||||
|
|
@ -50,19 +33,13 @@ type DeviceCountValues {
|
||||||
End of time interval for the delivered device counting value
|
End of time interval for the delivered device counting value
|
||||||
"""
|
"""
|
||||||
timeUntil: Time
|
timeUntil: Time
|
||||||
}
|
|
||||||
|
|
||||||
type DeviceDistanceValues {
|
|
||||||
"""
|
"""
|
||||||
Number of unique deviceKeys detected between timeFrom and timeUnti
|
Number of unique deviceKeys detected between timeFrom and timeUnti
|
||||||
"""
|
"""
|
||||||
count: Int
|
count: Int
|
||||||
"""
|
"""
|
||||||
Start of time interval for the delivered device counting value
|
Detailed information about devices detected nearby
|
||||||
"""
|
"""
|
||||||
timeFrom: Time
|
distances: [SensorDistanceValue!]
|
||||||
"""
|
|
||||||
End of time interval for the delivered device counting value
|
|
||||||
"""
|
|
||||||
timeUntil: Time
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import {isObjectType} from "graphql";
|
import {isObjectType} from "graphql";
|
||||||
import {logger} from "../logging/logger.js";
|
import {logger} from "../logging/logger.js";
|
||||||
import {Device, Host} from "../schema/generated/graphql";
|
import {Device, Host} from "../schema/generated/graphql.js";
|
||||||
|
|
||||||
export const isDevice = (value: Host): value is Device => !!(value as Device).deviceType;
|
export const isDevice = (value: Host): value is Device => !!(value as Device).deviceType;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ import {
|
||||||
StorageItemType,
|
StorageItemType,
|
||||||
} from "../schema/generated/graphql.js";
|
} from "../schema/generated/graphql.js";
|
||||||
|
|
||||||
import {HostImporter} from "../execution/host_importer";
|
import {HostImporter} from "../execution/host_importer.js";
|
||||||
import {HostValueExporter} from "../execution/host_exporter";
|
import {HostValueExporter} from "../execution/host_exporter.js";
|
||||||
import {logger} from "../logging/logger.js";
|
import {logger} from "../logging/logger.js";
|
||||||
import {ParsedArgs, ZabbixRequest} from "../datasources/zabbix-request.js";
|
import {ParsedArgs, ZabbixRequest} from "../datasources/zabbix-request.js";
|
||||||
import {ZabbixCreateHostRequest, ZabbixQueryHostsRequestWithItemsAndInventory,} from "../datasources/zabbix-hosts.js";
|
import {ZabbixCreateHostRequest, ZabbixQueryHostsRequestWithItemsAndInventory,} from "../datasources/zabbix-hosts.js";
|
||||||
|
|
@ -34,10 +34,10 @@ import {
|
||||||
ZabbixImportUserRolesRequest,
|
ZabbixImportUserRolesRequest,
|
||||||
ZabbixQueryUserRolesRequest
|
ZabbixQueryUserRolesRequest
|
||||||
} from "../datasources/zabbix-userroles.js";
|
} from "../datasources/zabbix-userroles.js";
|
||||||
import {ZABBIX_EDGE_DEVICE_BASE_GROUP, zabbixAPI} from "../datasources/zabbix-api";
|
import {ZABBIX_EDGE_DEVICE_BASE_GROUP, zabbixAPI} from "../datasources/zabbix-api.js";
|
||||||
import {GraphQLInterfaceType, GraphQLList} from "graphql/type";
|
import {GraphQLInterfaceType, GraphQLList} from "graphql/type/index.js";
|
||||||
import {isDevice} from "./resolver_helpers";
|
import {isDevice} from "./resolver_helpers.js";
|
||||||
import {ZabbixPermissionsHelper} from "../datasources/zabbix-permissions";
|
import {ZabbixPermissionsHelper} from "../datasources/zabbix-permissions.js";
|
||||||
|
|
||||||
|
|
||||||
export function createResolvers(): Resolvers {
|
export function createResolvers(): Resolvers {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import {makeExecutableSchema, mergeSchemas} from "@graphql-tools/schema";
|
||||||
import {readFileSync} from "fs";
|
import {readFileSync} from "fs";
|
||||||
import {GraphQLSchema} from "graphql/type";
|
import {GraphQLSchema} from "graphql/type";
|
||||||
import {createResolvers} from "./resolvers.js";
|
import {createResolvers} from "./resolvers.js";
|
||||||
|
import {readdirSync} from "node:fs";
|
||||||
|
|
||||||
|
|
||||||
const createZabbixHierarchicalDeviceFieldResolver =
|
const createZabbixHierarchicalDeviceFieldResolver =
|
||||||
|
|
@ -25,7 +26,12 @@ const createZabbixHierarchicalDeviceTagsResolver =
|
||||||
}
|
}
|
||||||
export async function schema_loader(): Promise<GraphQLSchema> {
|
export async function schema_loader(): Promise<GraphQLSchema> {
|
||||||
const resolvers = createResolvers();
|
const resolvers = createResolvers();
|
||||||
let typeDefs: string = readFileSync('./src/schema/*.graphql', {encoding: 'utf-8'});
|
const schemaPath = process.env.SCHEMA_PATH || './src/schema/';
|
||||||
|
var schemaFiles = readdirSync(schemaPath).filter(fn => fn.endsWith('.graphql'));
|
||||||
|
let typeDefs: string = "";
|
||||||
|
for (const schemaFile of schemaFiles) {
|
||||||
|
typeDefs += readFileSync(schemaPath + schemaFile, {encoding: 'utf-8'});
|
||||||
|
}
|
||||||
if (process.env.ADDITIONAL_SCHEMAS) {
|
if (process.env.ADDITIONAL_SCHEMAS) {
|
||||||
for (const schema of process.env.ADDITIONAL_SCHEMAS.split(",")){
|
for (const schema of process.env.ADDITIONAL_SCHEMAS.split(",")){
|
||||||
typeDefs += readFileSync(schema, {encoding: 'utf-8'});
|
typeDefs += readFileSync(schema, {encoding: 'utf-8'});
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import express from 'express';
|
||||||
import cors from "cors";
|
import cors from "cors";
|
||||||
import {ApolloServerPluginDrainHttpServer} from '@apollo/server/plugin/drainHttpServer';
|
import {ApolloServerPluginDrainHttpServer} from '@apollo/server/plugin/drainHttpServer';
|
||||||
import {logger} from "../logging/logger.js";
|
import {logger} from "../logging/logger.js";
|
||||||
import {zabbixAPI, zabbixRequestAuthToken} from "../datasources/zabbix-api";
|
import {zabbixAPI, zabbixRequestAuthToken} from "../datasources/zabbix-api.js";
|
||||||
import {WebSocketServer} from "ws";
|
import {WebSocketServer} from "ws";
|
||||||
import {useServer} from "graphql-ws/lib/use/ws";
|
import {useServer} from "graphql-ws/lib/use/ws";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
import {isZabbixErrorResult, ParsedArgs, ZabbixParams, ZabbixRequest} from "./zabbix-request.js";
|
import {isZabbixErrorResult, ParsedArgs, ZabbixParams} from "./zabbix-request.js";
|
||||||
import {Permission} from "../schema/generated/graphql.js";
|
import {Permission} from "../schema/generated/graphql.js";
|
||||||
import {
|
import {
|
||||||
FIND_ZABBIX_EDGE_DEVICE_BASE_GROUP_PREFIX,
|
FIND_ZABBIX_EDGE_DEVICE_BASE_GROUP_PREFIX,
|
||||||
ZABBIX_EDGE_DEVICE_BASE_GROUP,
|
ZABBIX_EDGE_DEVICE_BASE_GROUP,
|
||||||
ZabbixAPI,
|
ZabbixAPI,
|
||||||
zabbixSuperAuthToken
|
zabbixSuperAuthToken
|
||||||
} from "./zabbix-api";
|
} from "./zabbix-api.js";
|
||||||
import {logger} from "../logging/logger";
|
import {logger} from "../logging/logger.js";
|
||||||
import {ZabbixRequestWithPermissions} from "./zabbix-permissions";
|
import {ZabbixRequestWithPermissions} from "./zabbix-permissions.js";
|
||||||
|
|
||||||
export interface CreateHostGroupResult {
|
export interface CreateHostGroupResult {
|
||||||
groupids: string[]
|
groupids: string[]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {ParsedArgs, ZabbixRequest} from "./zabbix-request.js";
|
import {ParsedArgs, ZabbixRequest} from "./zabbix-request.js";
|
||||||
import {ZabbixItem} from "../schema/generated/graphql";
|
import {ZabbixItem} from "../schema/generated/graphql.js";
|
||||||
|
|
||||||
|
|
||||||
export class ZabbixQueryItemsRequest extends ZabbixRequest<ZabbixItem[]> {
|
export class ZabbixQueryItemsRequest extends ZabbixRequest<ZabbixItem[]> {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {ParsedArgs, ZabbixErrorResult, ZabbixRequest, ZabbixResult} from "./zabbix-request.js";
|
import {ParsedArgs, ZabbixErrorResult, ZabbixRequest, ZabbixResult} from "./zabbix-request.js";
|
||||||
import {ZabbixAPI} from "./zabbix-api";
|
import {ZabbixAPI} from "./zabbix-api.js";
|
||||||
import {InputMaybe, Permission, QueryHasPermissionsArgs, UserPermission} from "../schema/generated/graphql";
|
import {InputMaybe, Permission, QueryHasPermissionsArgs, UserPermission} from "../schema/generated/graphql.js";
|
||||||
import {ApiErrorCode, PermissionNumber} from "../model/model_enum_values";
|
import {ApiErrorCode, PermissionNumber} from "../model/model_enum_values.js";
|
||||||
|
|
||||||
|
|
||||||
export class ZabbixRequestWithPermissions<T extends ZabbixResult, A extends ParsedArgs = ParsedArgs> extends ZabbixRequest<T, A> {
|
export class ZabbixRequestWithPermissions<T extends ZabbixResult, A extends ParsedArgs = ParsedArgs> extends ZabbixRequest<T, A> {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import {ApiErrorCode, ApiErrorMessage} from "../model/model_enum_values.js";
|
||||||
import {ZabbixQueryItemsRequest} from "../datasources/zabbix-items.js";
|
import {ZabbixQueryItemsRequest} from "../datasources/zabbix-items.js";
|
||||||
import {isZabbixErrorResult, ParsedArgs, ZabbixErrorResult} from "../datasources/zabbix-request.js";
|
import {isZabbixErrorResult, ParsedArgs, ZabbixErrorResult} from "../datasources/zabbix-request.js";
|
||||||
import {ZabbixHistoryGetParams, ZabbixQueryHistoryRequest} from "../datasources/zabbix-history.js";
|
import {ZabbixHistoryGetParams, ZabbixQueryHistoryRequest} from "../datasources/zabbix-history.js";
|
||||||
import {zabbixAPI} from "../datasources/zabbix-api";
|
import {zabbixAPI} from "../datasources/zabbix-api.js";
|
||||||
|
|
||||||
type FilterCombo = {
|
type FilterCombo = {
|
||||||
deviceKey: string,
|
deviceKey: string,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import {logger} from "../logging/logger.js";
|
||||||
import {ZabbixQueryTemplatesRequest} from "../datasources/zabbix-templates.js";
|
import {ZabbixQueryTemplatesRequest} from "../datasources/zabbix-templates.js";
|
||||||
import {isZabbixErrorResult, ParsedArgs, ZabbixErrorResult} from "../datasources/zabbix-request.js";
|
import {isZabbixErrorResult, ParsedArgs, ZabbixErrorResult} from "../datasources/zabbix-request.js";
|
||||||
import {CreateHostGroupResult, GroupHelper, ZabbixCreateHostGroupRequest} from "../datasources/zabbix-hostgroups.js";
|
import {CreateHostGroupResult, GroupHelper, ZabbixCreateHostGroupRequest} from "../datasources/zabbix-hostgroups.js";
|
||||||
import {ZABBIX_EDGE_DEVICE_BASE_GROUP, zabbixAPI} from "../datasources/zabbix-api";
|
import {ZABBIX_EDGE_DEVICE_BASE_GROUP, zabbixAPI} from "../datasources/zabbix-api.js";
|
||||||
|
|
||||||
export class HostImporter {
|
export class HostImporter {
|
||||||
public static getHostGroupHierarchyNames(hostGroups: Array<CreateHostGroup>) {
|
public static getHostGroupHierarchyNames(hostGroups: Array<CreateHostGroup>) {
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,11 @@ interface Host {
|
||||||
hostgroups: [HostGroup!]
|
hostgroups: [HostGroup!]
|
||||||
name: String
|
name: String
|
||||||
tags: JSONObject
|
tags: JSONObject
|
||||||
|
"""
|
||||||
|
Specifies the type or category of the device. Used to define the classification
|
||||||
|
of a device in the system (capabilities, functionalities, or purpose).
|
||||||
|
"""
|
||||||
|
deviceType: String
|
||||||
}
|
}
|
||||||
|
|
||||||
type ZabbixItem {
|
type ZabbixItem {
|
||||||
|
|
@ -56,6 +61,11 @@ type ZabbixHost implements Host {
|
||||||
name: String
|
name: String
|
||||||
tags: JSONObject
|
tags: JSONObject
|
||||||
|
|
||||||
|
"""
|
||||||
|
Specifies the type or category of the device. Used to define the classification
|
||||||
|
of a device in the system (capabilities, functionalities, or purpose).
|
||||||
|
"""
|
||||||
|
deviceType: String
|
||||||
|
|
||||||
items: [ZabbixItem!]
|
items: [ZabbixItem!]
|
||||||
inventory: Inventory
|
inventory: Inventory
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue