diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a4274e9..09436323 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 + Delete mutations return the length of an array that is returned by a `DELETE` custom handler or 1 if a single object is returned - Don't generate fields for key elements in update input objects - Update and delete mutations have mandatory `filter` argument +- Allow services that are not instances of `cds.ApplicationService`. It is expected that the invoker provides the correct set of service providers when directly using the GraphQL protocol adpater API. ### Fixed diff --git a/lib/resolvers/root.js b/lib/resolvers/root.js index ed1192b7..63c6a8ac 100644 --- a/lib/resolvers/root.js +++ b/lib/resolvers/root.js @@ -1,4 +1,3 @@ -const cds = require('@sap/cds/lib') const { gqlName } = require('../utils') const resolveQuery = require('./query') const resolveMutation = require('./mutation') @@ -50,8 +49,6 @@ module.exports = services => { for (const key in services) { const service = services[key] - if (!(service instanceof cds.ApplicationService)) continue - const gqlServiceName = gqlName(service.name) Query[gqlServiceName] = _wrapResolver(service, resolveQuery, true) Mutation[gqlServiceName] = _wrapResolver(service, resolveMutation, false) diff --git a/lib/schema/mutation.js b/lib/schema/mutation.js index f91c07cd..95e24d8d 100644 --- a/lib/schema/mutation.js +++ b/lib/schema/mutation.js @@ -1,4 +1,3 @@ -const cds = require('@sap/cds/lib') const { GraphQLObjectType, GraphQLList, GraphQLInt, GraphQLNonNull } = require('graphql') const { gqlName } = require('../utils') const objectGenerator = require('./types/object') @@ -12,8 +11,6 @@ module.exports = cache => { for (const key in services) { const service = services[key] - if (!(service instanceof cds.ApplicationService)) continue - const serviceName = gqlName(service.name) const resolve = resolvers[serviceName] const type = _serviceToObjectType(service) diff --git a/lib/schema/query.js b/lib/schema/query.js index 43e07cdd..cef914f6 100644 --- a/lib/schema/query.js +++ b/lib/schema/query.js @@ -1,4 +1,3 @@ -const cds = require('@sap/cds/lib') const { GraphQLObjectType } = require('graphql') const { gqlName } = require('../utils') const objectGenerator = require('./types/object') @@ -10,8 +9,6 @@ module.exports = cache => { for (const key in services) { const service = services[key] - if (!(service instanceof cds.ApplicationService)) continue - const serviceName = gqlName(service.name) const resolve = resolvers[serviceName] fields[serviceName] = { type: _serviceToObjectType(service), resolve }