diff --git a/packages/backend/src/graphql/queries/healthcheck.ts b/packages/backend/src/graphql/queries/healthcheck.ts new file mode 100644 index 00000000..5606fd79 --- /dev/null +++ b/packages/backend/src/graphql/queries/healthcheck.ts @@ -0,0 +1,7 @@ +const healthcheck = () => { + return { + version: process.env.npm_package_version, + } +}; + +export default healthcheck; diff --git a/packages/backend/src/graphql/query-resolvers.ts b/packages/backend/src/graphql/query-resolvers.ts index 6dded11e..b3125274 100644 --- a/packages/backend/src/graphql/query-resolvers.ts +++ b/packages/backend/src/graphql/query-resolvers.ts @@ -9,6 +9,7 @@ import getExecutions from './queries/get-executions'; import getExecutionSteps from './queries/get-execution-steps'; import getData from './queries/get-data'; import getCurrentUser from './queries/get-current-user'; +import healthcheck from './queries/healthcheck'; const queryResolvers = { getApps, @@ -22,6 +23,7 @@ const queryResolvers = { getExecutionSteps, getData, getCurrentUser, + healthcheck, }; export default queryResolvers; diff --git a/packages/backend/src/graphql/schema.graphql b/packages/backend/src/graphql/schema.graphql index b72d8f21..3d5eeffa 100644 --- a/packages/backend/src/graphql/schema.graphql +++ b/packages/backend/src/graphql/schema.graphql @@ -14,6 +14,7 @@ type Query { ): ExecutionStepConnection getData(stepId: String!, key: String!, parameters: JSONObject): JSONObject getCurrentUser: User + healthcheck: AppHealth } type Mutation { @@ -424,6 +425,10 @@ type ExecutionStepConnection { pageInfo: PageInfo } +type AppHealth { + version: String +} + schema { query: Query mutation: Mutation diff --git a/packages/backend/src/helpers/authentication.ts b/packages/backend/src/helpers/authentication.ts index 3f5b9da0..037f6baa 100644 --- a/packages/backend/src/helpers/authentication.ts +++ b/packages/backend/src/helpers/authentication.ts @@ -24,6 +24,7 @@ const authentication = shield( { Query: { '*': isAuthenticated, + healthcheck: allow, }, Mutation: { '*': isAuthenticated,