Skip to content

Releases: neo4j/graphql

@neo4j/[email protected]

13 Dec 18:22
Compare
Choose a tag to compare

Updates the @neo4j/graphql dependency, and introduces the changes listed below (if any).

@neo4j/[email protected] 🎉

01 Dec 15:33
Compare
Choose a tag to compare

Introducing @neo4j/introspector

The purpose for this tool is to generate a starting point for putting a GraphQL schema in front of Neo4j and to save developers time.
This is via introspecting the Neo4j data shape and generating GraphQL Type Definitions from it.

After generating the typedefs developers probably want to continue to work on it manually to add @auth etc and maybe remove fields to only expose what's intended.

The docs: https://neo4j.com/docs/graphql-manual/current/introspector/

API

At this point we expose the feature only through a programatic node API. We do aim to expose this through a CLI in the future, but no promises 🤞

There's also a readonly flag to have all types being annotated with a @exclude(operations: [CREATE, DELETE, UPDATE]) directive.

Sample usage

From the docs example:

const { toGraphQLTypeDefs } = require("@neo4j/introspector")
const neo4j = require("neo4j-driver");
const fs = require('fs');

const driver = neo4j.driver(
    "neo4j://localhost:7687",
    neo4j.auth.basic("neo4j", "password")
);

const sessionFactory = () => driver.session({ defaultAccessMode: neo4j.session.READ, database: "neo4j" })

// We create a async function here until "top level await" has landed
// so we can use async/await
async function main() {
    const typeDefs = await toGraphQLTypeDefs(sessionFactory)
    fs.writeFileSync('schema.graphql', typeDefs)
    await driver.close();
}
main()

Generated example

A database with this data:

CREATE (m:Movie {title: "Title"})
CREATE (a:Actor {name: "Actor Name"})
CREATE (a2:Actor {name: "Actor 2 Name"})
MERGE (a)-[:ACTED_IN {roles: ["Role 1", "Role 2"], pay: toFloat(200), amb: "string"}]->(m)
MERGE (a2)-[:ACTED_IN {roles: ["Palm tree"], amb: toInteger(3)}]->(m)
MERGE (a)-[:DIRECTED {skill: toInteger(4)}]->(m)
MERGE (a)<-[:WON_PRIZE_FOR]-(m)

would generate these GraphQL typedefs:

interface ActedInProperties @relationshipProperties {
    pay: Float
    roles: [String]!
}

type Actor {
    actedInMovies: [Movie!]! @relationship(type: "ACTED_IN", direction: OUT, properties: "ActedInProperties")
    directedMovies: [Movie!]! @relationship(type: "DIRECTED", direction: OUT, properties: "DirectedProperties")
    moviesWonPrizeFor: [Movie!]! @relationship(type: "WON_PRIZE_FOR", direction: IN)
    name: String!
}

interface DirectedProperties @relationshipProperties {
    skill: BigInt!
}

type Movie {
    actorsActedIn: [Actor!]! @relationship(type: "ACTED_IN", direction: IN, properties: "ActedInProperties")
    actorsDirected: [Actor!]! @relationship(type: "DIRECTED", direction: IN, properties: "DirectedProperties")
    title: String!
    wonPrizeForActors: [Actor!]! @relationship(type: "WON_PRIZE_FOR", direction: OUT)
}

@neo4j/[email protected]

01 Dec 13:39
Compare
Choose a tag to compare

🚀 Features

  • Feat/fulltext
  • Sorting by relationship properties for union and interface fields
  • Feat/Aggregate Sum
  • Feature/connectOrCreate

🐛 Fixes

  • Fixed edge updates on one to one relationships
  • fix/559: add subscription type fields to resolve tree field resolver
  • Querying DateTime in the edge of a connection throws an error
  • Generate scalar typedefs before extra definitions
  • Fix/564: Async error when reading from JWKS endpoint
  • Fix for missing auth parameter
  • Fix: Project All Interface Fields For Types Implementing @relationship Interface
  • Fix: Escape all @node directive labels

@neo4j/[email protected]

01 Dec 13:39
Compare
Choose a tag to compare

Updates the @neo4j/graphql dependency, and introduces the changes listed below (if any).

🚀 Features

  • Feat/fulltext
  • Feat: Autogenerated Typescript for OGM
  • Feat/Aggregate Sum
  • Feature/connectOrCreate

@neo4j/[email protected]

09 Nov 10:26
Compare
Choose a tag to compare

🚀 Features

  • Feature: Support Order By for Primitive @cypher Fields
  • Inject context in additional labels
  • Interface relationship fields
  • Field-level aggregations
  • Feature/unique directive
  • Added OpenID Json Web Key Sets for verification via the @auth directive

🐛 Fixes

  • Fix: Project Interface Fields In Union Relationship
  • Solution for operations being duplicated following multiple deletes
  • Fix fieldAggregation types
  • Test the right thing in multi-database integration tests
  • Fix issue 488 handle union where on connections
  • Bugfix/dbms version check
  • Fix: call new on GraphQLString
  • Fix/null points
  • fix: error when only selecting info on update and create operations

@neo4j/[email protected]

09 Nov 10:26
Compare
Choose a tag to compare

Updates the @neo4j/graphql dependency, and introduces the changes listed below (if any).

@neo4j/[email protected]

12 Oct 10:10
Compare
Choose a tag to compare

🚀 Features

  • Specify mapping of GraphQL type -> Neo4j node label using @node directive
  • Custom pluralization
  • Feat/where aggregations
  • Feat/top level aggregations
  • Refactor: dateTimeFields to temporalFields

🐛 Fixes

  • Fix missing subscription payload
  • Fix: Creation of Empty {Create,Update}Input for Relationship Properties
  • Fix: Filter Null Values In Union Relationship
  • fix: wrap auth sub clauses in parentheses to preserve precedence
  • Fix transformation of arguments to @cypher directives
  • Top level string aggregations length
  • Fix: Alias count top level
  • Add remaining node input types into validation

@neo4j/[email protected]

12 Oct 10:10
Compare
Choose a tag to compare

Updates the @neo4j/graphql dependency, and introduces the changes listed below (if any).

🚀 Features

  • Feat/top level aggregations
  • Refactor: dateTimeFields to temporalFields

@neo4j/[email protected]

14 Sep 08:57
Compare
Choose a tag to compare

🚀 Features

  • @alias directive - map a GraphQL field to a Neo4j node/relationship property under a different name
  • Feature: Add Duration Scalar

🐛 Fixes

  • Fix: Project Interface Fields

@neo4j/[email protected]

14 Sep 08:57
Compare
Choose a tag to compare

Updates the @neo4j/graphql dependency, and introduces the changes listed below (if any).