Skip to content

Latest commit

 

History

History
1155 lines (740 loc) · 54.6 KB

CHANGELOG.md

File metadata and controls

1155 lines (740 loc) · 54.6 KB

@neo4j/cypher-builder

1.20.1

Patch Changes

1.20.0

Minor Changes

  • #399 02c7e99 Thanks @angrykoala! - Add support for variable scope in CALL:

    const movieNode = new Cypher.Node();
    const actorNode = new Cypher.Node();
    
    const clause = new Cypher.Call(new Cypher.Create(new Cypher.Pattern(movieNode).related().to(actorNode)), [
        movieNode,
        actorNode,
    ]);
    CALL (this0, this1) {
        CREATE (this0)-[this2]->(this1)
    }

Patch Changes

  • #403 eed7686 Thanks @angrykoala! - Add support for adding Call clauses to Match and With:

    const match = new Cypher.Match(new Cypher.Pattern(movieNode, { labels: ["Movie"] }))
        .call(new Cypher.Create(new Cypher.Pattern(movieNode).related().to(actorNode)), [movieNode])
        .return(movieNode);
    MATCH (this0:Movie)
    CALL (this0) {
        CREATE (this0)-[this2]->(this1)
    }
    RETURN this0
  • #396 f39056f Thanks @angrykoala! - Add support for GQL type aliases introduced in Neo4j 5.23:

    • Cypher.TYPE.TIMESTAMP_WITHOUT_TIME_ZONE
    • Cypher.TYPE.TIME_WITHOUT_TIME_ZONE
    • Cypher.TYPE.TIMESTAMP_WITH_TIME_ZONE
    • Cypher.TYPE.TIME_WITH_TIME_ZONE

1.19.1

Patch Changes

1.19.0

Minor Changes

  • #369 3514bdd Thanks @angrykoala! - Add support for LOAD CSV:

    const row = new Cypher.Variable();
    const loadClause = new Cypher.LoadCSV("https://data.neo4j.com/bands/artists.csv", row).return(row);
  • #354 ef49a96 Thanks @angrykoala! - Add support for quantifier patterns:

    const m = new Cypher.Node();
    const m2 = new Cypher.Node();
    
    const quantifiedPath = new Cypher.QuantifiedPath(
        new Cypher.Pattern(m, { labels: ["Movie"], properties: { title: new Cypher.Param("V for Vendetta") } }),
        new Cypher.Pattern({ labels: ["Movie"] })
            .related({ type: "ACTED_IN" })
            .to({ labels: ["Person"] })
            .quantifier({ min: 1, max: 2 }),
        new Cypher.Pattern(m2, {
            labels: ["Movie"],
            properties: { title: new Cypher.Param("Something's Gotta Give") },
        })
    );
    
    const query = new Cypher.Match(quantifiedPath).return(m2);

    Cypher

    MATCH (this0:Movie { title: $param0 })
          ((:Movie)-[:ACTED_IN]->(:Person)){1,2}
          (this1:Movie { title: $param1 })
    RETURN this1

Patch Changes

1.18.1

Patch Changes

  • #366 5fa3f51 Thanks @angrykoala! - Add support for multiple expressions on the simple CASE:

    matchClause.return(
        new Cypher.Case(person.property("eyes"))
            .when(new Cypher.Literal("brown"), new Cypher.Literal("hazel"))
            .then(new Cypher.Literal(2))

1.18.0

Minor Changes

  • #365 6f20b0a Thanks @angrykoala! - Add support for CALL { …​ } IN CONCURRENT TRANSACTIONS:

    new Cypher.Call(subquery).inTransactions({
        concurrentTransactions: 3,
    });
    CALL {
        // Subquery
    } IN 3 CONCURRENT TRANSACTIONS

Patch Changes

  • #357 22f87f3 Thanks @angrykoala! - Support for procedures in the tx namespace:

    • tx.getMetaData
    • tx.setMetaData
  • #363 47ee1ef Thanks @angrykoala! - Add functions lower and upper

  • #361 e769f61 Thanks @angrykoala! - Add support for missing fulltext procedures:

    • db.index.fulltext.awaitEventuallyConsistentIndexRefresh
    • db.index.fulltext.listAvailableAnalyzers
  • #361 e769f61 Thanks @angrykoala! - Add support for missing db procedures:

    • db.ping
    • db.propertyKeys
    • db.relationshipTypes
    • db.resampleIndex
    • db.resampleOutdatedIndexes

1.17.2

Patch Changes

  • #355 acddbc3 Thanks @angrykoala! - Add the following procedures:

    • db.nameFromElementId
    • db.info
    • db.createLabel
    • db.createProperty
    • db.createRelationshipType
    • db.schema.nodeTypeProperties
    • db.schema.relTypeProperties
    • db.schema.visualization
  • #351 ef73177 Thanks @angrykoala! - Exports type ROUND_PRECISION_MODE

1.17.1

Patch Changes

  • #346 65661c3 Thanks @mjfwebb! - Add callProcedure method to With and Match clauses

    const withQuery = new Cypher.With("*").callProcedure(Cypher.db.labels()).yield("label");

1.17.0

Minor Changes

  • #340 b1b7acf Thanks @angrykoala! - Add vector similarity functions:

    Cypher.vector.similarity.euclidean(param1, param2);
    Cypher.vector.similarity.cosine(param1, param2);
  • #342 5bba4b5 Thanks @angrykoala! - Add support for FINISH clauses:

    new Cypher.Finish()
    
    new Cypher.Match(...).finish()
    new Cypher.Create(...).finish()
    new Cypher.Merge(...).finish()

1.16.0

Minor Changes

  • #333 2593296 Thanks @mjfwebb! - Adds support for genai function genai.vector.encode() and procedure genai.vector.encodeBatch()

  • #328 628ec62 Thanks @mjfwebb! - Adds support for vector index functions db.index.vector.queryNodes() and db.index.vector.queryRelationships()

  • #310 13fd317 Thanks @angrykoala! - Add support for arbitrary variables in Patterns instead of only Node and Relationship:

Patch Changes

  • #310 13fd317 Thanks @angrykoala! - The following methods in Pattern class and chains are deprecated:

    • withoutLabels
    • withoutVariable
    • withProperties
    • getVariables
    • withoutType
    • withDirection
    • withLength

    Instead, these properties should be passed as an object, for example:

    const a = new Cypher.Variable();
    const rel = new Cypher.Variable();
    const b = new Cypher.Variable();
    
    const pattern = new Cypher.Pattern(a, { labels: ["Movie"] }).related(rel, { type: "ACTED_IN" }).to(b);
  • #310 98a8b2f Thanks @angrykoala! - Deprecate using Node directly on Match, Create and Merge clauses. Use a Pattern instead

  • #310 7574aee Thanks @angrykoala! - Deprecate setting up labels and types in Node and Relationship. The following examples are now deprecated:

    new Cypher.Node({ labels: ["Movie"] });
    new Cypher.Relationship({ type: "ACTED_IN" });

    Instead, Nodes and Relationships should be created without parameters. Labels and types should be set in a Pattern:

    const n = new Cypher.Node();
    const r = new Cypher.Relationship();
    
    const pattern = new Cypher.Pattern(n, { labels: ["Movie"] }).related(r, { type: "ACTED_IN" }).to();

1.15.0

Minor Changes

  • #321 0acf69b Thanks @angrykoala! - Add support for IN TRANSACTIONS in CALL statements using the method inTransactions()

1.14.0

Minor Changes

  • #312 3060a56 Thanks @angrykoala! - Add support for normalize function:

    Cypher.normalize(new Cypher.Param("my string"), "NFC");
    
  • #314 dbb6a4a Thanks @angrykoala! - Add isNormalized and isNotNormalized operators:

    const stringLiteral = new Cypher.Literal("the \\u212B char");
    const query = new Cypher.Return([Cypher.isNormalized(stringLiteral, "NFC"), "normalized"]);
    const { cypher } = query.build();
    
    RETURN "the \u212B char" IS NFC NORMALIZED AS normalized
    

Patch Changes

  • #315 e3a7505 Thanks @angrykoala! - Deprecate Cypher.cdc Procedures in favor of Cypher.db.cdc:

    • Cypher.cdc.current in favor of Cypher.db.cdc.current
    • Cypher.cdc.earliest in favor of Cypher.db.cdc.earliest
    • Cypher.cdc.query in favor of Cypher.db.cdc.query

    This new procedures also update the generated Cypher namespace to db.cdc

1.13.0

Minor Changes

  • #301 f2f679b Thanks @angrykoala! - Add support for Collect subqueries:

    const dog = new Cypher.Node({ labels: ["Dog"] });
    const person = new Cypher.Node({ labels: ["Person"] });
    
    const subquery = new Cypher.Match(
        new Cypher.Pattern(person).related(new Cypher.Relationship({ type: "HAS_DOG" })).to(dog)
    ).return(dog.property("name"));
    
    const match = new Cypher.Match(person)
        .where(Cypher.in(new Cypher.Literal("Ozzy"), new Cypher.Collect(subquery)))
        .return(person);
    MATCH (this0:Person)
    WHERE "Ozzy" IN COLLECT {
        MATCH (this0:Person)-[this1:HAS_DOG]->(this2:Dog)
        RETURN this2.name
    }
    RETURN this0

1.12.0

Minor Changes

  • #294 07280b6 Thanks @angrykoala! - Support for WHERE predicates in patters:

    const movie = new Cypher.Node({ labels: ["Movie"] });
    
    new Cypher.Pattern(movie).where(Cypher.eq(movie.property("title"), new Cypher.Literal("The Matrix")));
    (this0:Movie WHERE this0.title = "The Matrix")

1.11.0

Minor Changes

  • #277 f97c229 Thanks @angrykoala! - Add support for type predicate expressions with the functions Cypher.isType and Cypher.isNotType:

    const variable = new Cypher.Variable();
    const unwindClause = new Cypher.Unwind([new Cypher.Literal([42, true, "abc", null]), variable]).return(
        variable,
        Cypher.isType(variable, Cypher.TYPE.INTEGER)
    );
    UNWIND [42, true, \\"abc\\", NULL] AS var0
    RETURN var0, var0 IS :: INTEGER

Patch Changes

  • #283 566e1d4 Thanks @angrykoala! - Prepends WITH on each UNION subquery when .importWith is set in parent CALL:

    const returnVar = new Cypher.Variable();
    const n1 = new Cypher.Node({ labels: ["Movie"] });
    const query1 = new Cypher.Match(n1).return([n1, returnVar]);
    const n2 = new Cypher.Node({ labels: ["Movie"] });
    const query2 = new Cypher.Match(n2).return([n2, returnVar]);
    
    const unionQuery = new Cypher.Union(query1, query2);
    const callQuery = new Cypher.Call(unionQuery).importWith(new Cypher.Variable());

    The statement WITH var0 will be added to each UNION subquery

    CALL {
        WITH var0
        MATCH (this1:Movie)
        RETURN this1 AS var2
        UNION
        WITH var0
        MATCH (this3:Movie)
        RETURN this3 AS var2
    }
  • #283 566e1d4 Thanks @angrykoala! - Deprecate Call.innerWith in favor of Call.importWith

  • #289 b9a2ad6 Thanks @angrykoala! - Deprecates the second parameter of patternComprehensions in favor of new .map method:

    old

    new Cypher.PatternComprehension(pattern, expr);

    new

    new Cypher.PatternComprehension(pattern).map(expr);

1.10.3

Patch Changes

  • #279 4620a2e Thanks @angrykoala! - Add support for "*" parameter in MapProjection:

    new Cypher.MapProjection(new Cypher.Variable(), "*");
    var0 { .* }

1.10.2

Patch Changes

1.10.1

Patch Changes

  • #271 5834c61 Thanks @angrykoala! - Add labelOperator option on build to change the default label AND operator:

    const node = new Cypher.Node({ labels: ["Movie", "Film"] });
    const query = new Cypher.Match(node);
    
    const queryResult = new TestClause(query).build(
        undefined,
        {},
        {
            labelOperator: "&",
        }
    );

    Will return:

    MATCH (this:Movie&Film)

1.10.0

Minor Changes

  • #269 6d9d3e2 Thanks @angrykoala! - Add chained clauses to Procedures after YIELD:

    • .unwind
    • .match
    • .optionalMatch
    • .delete
    • .detachDelete
    • .set
    • .merge
    • .create
    • .remove

1.9.0

Minor Changes

1.8.0

Minor Changes

  • #253 da0b3ab Thanks @angrykoala! - Add support for type filtering on relationships

    new Cypher.Match(new Cypher.Pattern().related(new Cypher.Relationship()).to()).where(
        relationship.hasType("ACTED_IN")
    );
    MATCH(this0)-[this1]->(this2)
    WHERE this1:ACTED_IN
  • #251 80e1bca Thanks @angrykoala! - Add support for label expressions on hasLabel:

    const query = new Cypher.Match(node).where(node.hasLabel(Cypher.labelExpr.or("Movie", "Film")));
    MATCH (this0:Movie)
    WHERE this0:(Movie|Film)
  • #256 602c237 Thanks @angrykoala! - Add support for ON MATCH SET after MERGE:

    const node = new Cypher.Node({
        labels: ["MyLabel"],
    });
    
    const countProp = node.property("count");
    const query = new Cypher.Merge(node)
        .onCreateSet([countProp, new Cypher.Literal(1)])
        .onMatchSet([countProp, Cypher.plus(countProp, new Cypher.Literal(1))]);
    MERGE (this0:MyLabel)
    ON MATCH SET
        this0.count = (this0.count + 1)
    ON CREATE SET
        this0.count = 1

1.7.4

Patch Changes

  • #245 a63337d Thanks @angrykoala! - Deprecate Merge.onCreate in favor of Merge.onCreateSet to better reflect the resulting Cypher ON CREATE SET

  • #244 347ae01 Thanks @angrykoala! - Fix clauses order when using Merge.onCreate along with .set

    For example:

    const query = new Cypher.Merge(node)
        .onCreate([node.property("age"), new Cypher.Param(23)])
        .set([node.property("age"), new Cypher.Param(10)]);
    MERGE (this0:MyLabel)
    ON CREATE SET
        this0.age = $param1
    SET
        this0.age = $param0

1.7.3

Patch Changes

  • #236 34552dc Thanks @angrykoala! - Support for chained .yield:

    const customProcedure = new Cypher.Procedure("customProcedure", []).yield("result1").yield(["result2", "aliased"]);

    is equivalent to:

    const customProcedure = new Cypher.Procedure("customProcedure", []).yield("result1", ["result2", "aliased"]);

    and results in the Cypher:

    CALL customProcedure() YIELD result1, result2 AS aliased

1.7.2

Patch Changes

  • #230 f37cc99 Thanks @angrykoala! - Support for passing undefined to .where:

    const n = new Cypher.Node();
    new Cypher.Match(n).where(undefined).return(n);

    This will generate the following Cypher:

    MATCH(n)
    RETURN n
    

    Note that the WHERE clause is omitted if the predicate is undefined

1.7.1

Patch Changes

  • #226 84b1534 Thanks @angrykoala! - Support for new Call().innerWith("*") to generate WITH * inside a CALL subquery

1.7.0

Minor Changes

Patch Changes

1.6.0

Minor Changes

  • #211 2e76445 Thanks @angrykoala! - Add chained clauses in unwind:

    • Unwind.return
    • Unwind.remove
    • Unwind.set
  • fa3d246 Thanks @angrykoala! - Add chained methods in Merge:

    • Merge.remove
    • Merge.with
  • #213 64edcdd Thanks @angrykoala! - Add methods for chained Merge:

    • Match.merge
    • Create.merge
    • Call.merge
    • Foreach.merge
    • Merge.merge
    • Unwind.merge
    • With.merge
  • #206 1ef6244 Thanks @angrykoala! - Add methods for chained match clauses:

    • With.match
    • With.optionalMatch
    • Unwind.match
    • Unwind.optionalMatch
    • Call.match
    • Call.optionalMatch
  • #204 8227ade Thanks @angrykoala! - Add chained clauses in CALL clause:

    • Call.remove
    • Call.set
    • Call.delete
    • Call.detachDelete
  • #212 33ceb71 Thanks @angrykoala! - Add methods for chained Create method:

    • Match.create
    • Call.create
    • Foreach.create
    • Merge.create
    • Unwind.create
    • With.create
  • #200 d582e1a Thanks @angrykoala! - Add support nested match clauses #90:

    • Match.match()
    • Match.optionalMatch()
  • #210 9388048 Thanks @angrykoala! - Add chained subclauses for foreach:

    • Foreach.return
    • Foreach.remove
    • Foreach.set
    • Foreach.delete
    • Foreach.detachDelete
  • #201 70c60b1 Thanks @angrykoala! - Support for chained unwind:

    • Unwind.unwind
    • Match.unwind
    • With.unwind
  • #203 d7d0d2f Thanks @angrykoala! - Add support for chained methods on Create clause:

    • Create.remove
    • Create.delete
    • Create.detachDelete
    • Create.with
    • Create.create

1.5.2

Patch Changes

  • #194 0c40f04 Thanks @angrykoala! - Refactors mixins. Due to this, multiple top-level clauses nested in the same clause will explicitly fail, instead of silent failing:

    The following is not supported;

    const match = new Cypher.Match();
    
    match.with();
    match.return();

    In favor of the following:

    const match = new Cypher.Match();
    
    match.with().return();
  • #195 6b24fdd Thanks @angrykoala! - Support for expressions on Pattern properties:

    const pattern = new Cypher.Pattern(node).withProperties({
        name: Cypher.plus(new Cypher.Literal("The "), new Cypher.Literal("Matrix")),
    });

    Results in:

    (this0: {name: "The " + "Matrix"})
  • #199 58dfee6 Thanks @angrykoala! - Fix RawCypher types

  • #198 bfb1c97 Thanks @angrykoala! - Deprecates using With.with when nested with already exists in favour of addColumn:

    const withQuery = new Cypher.With(node);
    
    withQuery.with(node2);
    withQuery.with("*");

    Instead, it should be:

    const withQuery = new Cypher.With(node);
    
    const nestedWith = withQuery.with(node2);
    nestedWith.addColumn("*");

1.5.1

Patch Changes

1.5.0

Minor Changes

Patch Changes

1.4.0

Minor Changes

  • #127 574f5f6 Thanks @angrykoala! - Deprecates Cypher.utils.compileCypher and .getCypher in favor of env.compile:

    Previously:

    new Cypher.RawCypher((env) => {
        const myVar = new Cypher.Variable();
        return myVar.getCypher(env);
    });

    Or

    new Cypher.RawCypher((env) => {
        const myVar = new Cypher.Variable();
        return Cypher.utils.compileCypher(myVar, env);
    });

    Now:

    new Cypher.RawCypher((env) => {
        const myVar = new Cypher.Variable();
        return env.compile(myVar);
    });

Patch Changes

1.3.0

Minor Changes

  • #106 7474e62 Thanks @angrykoala! - Add instant temporal functions:

    • time
    • localtime
    • localdatetime
    • datetime
    • date

    As well as the related nested functions:

    • *.realtime
    • *.statement
    • *.transaction
    • *.truncate
    • datetime.fromepoch
    • datetime.fromepochmillis
  • #100 73d9cba Thanks @angrykoala! - Add duration functions:

    • duration
    • duration.between
    • duration.inMonths
    • duration.inDays
    • duration.inSeconds

Patch Changes

1.2.0

Minor Changes

Patch Changes

1.1.2

Patch Changes

1.1.1

Patch Changes

  • #81 0af8a3a Thanks @angrykoala! - Reverts types for Call innerWith, With without parameters will not be rendered

1.1.0

Minor Changes

Patch Changes

1.0.0

Major Changes

Minor Changes

Patch Changes

0.6.0

Minor Changes

Patch Changes

0.5.4

Patch Changes

  • #22 9aadbad Thanks @angrykoala! - Adds @internal methods to the output .d.ts to avoid errors in client builds

0.5.3

Patch Changes

  • #17 1089034 Thanks @angrykoala! - Escapes properties in patterns.

    e.g.

    MATCH (m:Movie { `$myProp`: "Text" })
    

0.5.2

Patch Changes

0.5.1

Patch Changes

0.5.0

Minor Changes

  • #2 c2f4af7 Thanks @angrykoala! - Deprecates runFirstColumn clause in favor of apoc.cypher.runFirstColumnSingle and runFirstColumnMany function to better reflect Cypher behaviour

Patch Changes

0.4.3

Patch Changes

0.4.2

Patch Changes

0.4.1

Patch Changes

0.4.0

Minor Changes

  • #3147 2bc2c7019 Thanks @angrykoala! - Refactor Cypher.Map to use a Map internally, include .size method and remove support for undefined fields

  • #3106 bfae63097 Thanks @darrellwarde! - The type Cypher.PropertyRef is now fully exported under Cypher.Property for use with utilities such as instanceof. However, it maintains the current behaviour of not being directly instantiable.

  • #3115 a04ef4469 Thanks @angrykoala! - Map projections inject the leading dot (.) in the map fields automatically.

Patch Changes

0.3.0

Minor Changes

Patch Changes

0.2.1

Patch Changes

0.2.0

Minor Changes

Patch Changes

0.1.10

Patch Changes

0.1.9

Patch Changes

0.1.8

Patch Changes

0.1.7

Patch Changes

0.1.6

Patch Changes

0.1.5

Patch Changes

0.1.4

Patch Changes

0.1.3

Patch Changes

  • #2115 7aff0cf19 Thanks @MacondoExpress! - Included List, date, localtime, localdatetime, time, randomUUID. It's possible now to set edge properties from the Merge clause.

0.1.2

Patch Changes

0.1.0

Minor Changes