Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/thin-radios-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@neo4j/cypher-builder": major
---

Remove functions deprecated in Cypher 5:

- `distance` in favor of `point.distance`
- `id` in favor of `elementId`
1 change: 0 additions & 1 deletion src/expressions/functions/scalar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ describe("Scalar Functions", () => {

// 1 parameter functions
test.each([
"id",
"elementId",
"endNode",
"size",
Expand Down
10 changes: 0 additions & 10 deletions src/expressions/functions/scalar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,6 @@ export function head(expr: Expr): CypherFunction {
return new CypherFunction("head", [expr]);
}

/**
* @see {@link https://neo4j.com/docs/cypher-manual/current/functions/scalar/#functions-id | Cypher Documentation}
* @group Functions
* @category Scalar
* @deprecated Use {@link elementId} instead
*/
export function id(variable: Expr): CypherFunction {
return new CypherFunction("id", [variable]);
}

/**
* @see {@link https://neo4j.com/docs/cypher-manual/current/functions/scalar/#functions-last | Cypher Documentation}
* @group Functions
Expand Down
15 changes: 1 addition & 14 deletions src/expressions/functions/spatial.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,10 @@
* limitations under the License.
*/

import { TestClause } from "../../utils/TestClause";
import Cypher from "../..";
import { TestClause } from "../../utils/TestClause";

describe("Spatial Functions", () => {
describe("4.x deprecated functions", () => {
test.each(["distance"] as const)("%s", (value) => {
const leftExpr = new Cypher.Variable();
const rightExpr = new Cypher.Variable();
const spatialFn = Cypher[value](leftExpr, rightExpr);

const queryResult = new TestClause(spatialFn).build();

expect(queryResult.cypher).toBe(`${value}(var0, var1)`);
expect(queryResult.params).toEqual({});
});
});

test("point function", () => {
const pointFn = Cypher.point(new Cypher.Variable());

Expand Down
10 changes: 0 additions & 10 deletions src/expressions/functions/spatial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ export function point(variable: Expr): CypherFunction {
return new CypherFunction("point", [variable]);
}

/**
* @see {@link https://neo4j.com/docs/cypher-manual/4.3/functions/spatial/#functions-distance | Cypher Documentation}
* @group Functions
* @category Spatial
* @deprecated No longer supported in Neo4j 5. Use {@link point.distance} instead.
*/
export function distance(lexpr: Expr, rexpr: Expr): CypherFunction {
return new CypherFunction("distance", [lexpr, rexpr]);
}

/**
* @see {@link https://neo4j.com/docs/cypher-manual/current/functions/spatial/#functions-distance | Cypher Documentation}
* @group Functions
Expand Down