Skip to content

Releases: cap-js/graphql

v0.6.1

05 Jul 08:51
c657d69

Choose a tag to compare

Changed

  • Improved query logging:
    • Don't log queries that are undefined
    • Log operationName
    • Log variables when not in production
    • Sanitize arguments and their values in queries when in production

Fixed

  • Changed GraphiQL Explorer Plugin CDN URL due to upstream renaming

v0.6.0

23 Jun 11:24
2bb6894

Choose a tag to compare

Added

  • Support for @sap/cds^7 middlewares and protocols. Note: services now need to be annotated with protocol annotations such as @graphql or @protocol: 'graphql'.

Changed

  • Bump required @sap/cds version to >=7
  • @cap-js/graphql/index.js now collects individual services and mounts the adapter as a protocol middleware on the cds.on('served', ...) event
  • Moved the GraphQLAdapter module to lib/GraphQLAdapter.js and merged it with CDSGraphQLAdapter previously found in index.js in the root directory
  • Don't generate fields that represent compositions of aspects within mutation types that represent services
  • Disabled conjunction on the same field for the following operators:
    • eq (Equal)
    • gt (Greater Than)
    • ge (Greater Than or Equal)
    • le (Less Than or Equal)
    • lt (Less Than)
    • startswith
    • endswith

v0.5.0

04 May 07:51
7e7b190

Choose a tag to compare

Changed

  • Improved consistency of handling results of different types returned by custom handlers in CRUD resolvers:
    • Wrap only objects (i.e. not primitive types or arrays) returned by custom handlers in arrays in create, read, and update resolvers
    • 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 adapter API.

Fixed

  • Aligned cds.Request instantiation with other protocols for more consistent usage in custom handlers

v0.4.1

30 Mar 09:12
650894d

Choose a tag to compare

Fixed

  • cds-plugin.js was missing in files property of package.json

v0.4.0

29 Mar 13:25
4a93c5c

Choose a tag to compare

Added

  • Supporting new cds-plugin technique for zero configuration
  • Support for filtering by null values
  • Allow multiple filters on the same field, with the same operator, that are logically joined by AND. For example, filtering for all books with titles that contain both strings, "Wuthering" and "Heights":
    {
      AdminService {
        Books(filter: { title: { contains: ["Wuthering", "Heights"] } }) {
          nodes {
            title
          }
        }
      }
    }

Changed

  • Improved handling of null and undefined values in query arguments
  • Empty filter lists resolve to false and empty filter objects resolve to true

Fixed

  • Handling of GraphQL queries that are sent via GET requests using the query URL parameter if GraphiQL is enabled

v0.3.1

28 Feb 09:32
e083639

Choose a tag to compare

Fixed

  • Add app folder to files property of package.json to be included for publishing to npm

v0.3.0

27 Feb 12:14
fab3661

Choose a tag to compare

Changed

  • Replaced deprecated GraphQL HTTP server express-graphql with graphql-http
  • Serve GraphiQL 2 via included HTML instead of relying on the server framework (express-graphql included GraphiQL 1)
  • Bump graphql version to 16
  • Execute query resolvers in parallel and mutation resolvers serially

v0.2.0

30 Jan 09:22
4ed17f8

Choose a tag to compare

Changed

  • Register aliasFieldResolver during schema generation instead of passing it to the GraphQL server
  • The filters contains, startswith, and endswith now generate CQN function calls instead of generating like expressions directly

Fixed

  • Schema generation crash that occurred if an entity property is named localized
  • The field totalCount could not be queried on its own

v0.1.0

08 Dec 09:34
a1f103b

Choose a tag to compare

Added

  • To-many relationships are now represented by an additional nesting level which contains the fields totalCount and nodes. totalCount is similar to OData $count. nodes contains the fields belonging to the entity. This is similar to the GraphQL cursor connection specification, but without an additional second edges nesting level. The following shows an example query using the new schema structure:
    {
      AdminService {
        Books {
          totalCount
          nodes {
            title
          }
        }
      }
    }
  • Support for aliases on fields returned by mutations
  • Improved support for aliases on fields that represent compositions and associations (some limitations still apply)
  • Include localized texts fields of entities in schema generation
  • Improve check to skip field localized during schema generation

Changed

  • The GraphQL protocol adapter now uses a new middlewares mechanism instead of cds.plugins which requires @sap/cds version 6.3 to run. Enable the cds.requires.middlewares flag and register the GraphQL protocol adapter in cds.env.protocols to get started.
  • Replaced debug level query and mutation logging with improved info level request logging