Skip to content

Commit 225e29b

Browse files
authored
Merge pull request #589 from neo4j/remove-apoc
Remove apoc functions and procedures
2 parents 8495323 + 2fe15f6 commit 225e29b

File tree

11 files changed

+35
-577
lines changed

11 files changed

+35
-577
lines changed

.changeset/fine-roses-film.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
"@neo4j/cypher-builder": major
3+
---
4+
5+
Remove all apoc functions and procedures:
6+
7+
- `apoc.util.validate`
8+
- `apoc.util.validatePredicate`
9+
- `apoc.date.convertFormat`
10+
- `apoc.cypher.runFirstColumnMany`
11+
- `apoc.cypher.runFirstColumnSingle`
12+
13+
In order to use apoc methods, create a custom function or procedure. For example:
14+
15+
```js
16+
function validate(
17+
predicate: Predicate,
18+
message: string,
19+
params: List | Literal | Map
20+
): VoidCypherProcedure {
21+
return new VoidCypherProcedure("apoc.util.validate", [predicate, new Literal(message), params]);
22+
}
23+
```
24+
25+
```js
26+
function validatePredicate(predicate: Predicate, message: string): CypherFunction {
27+
return new CypherFunction("apoc.util.validatePredicate", [predicate, new Literal(message), new Literal([0])]);
28+
}
29+
30+
```

src/Cypher.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ export { Collect } from "./expressions/subquery/Collect";
6363
export { Count } from "./expressions/subquery/Count";
6464
export { Exists } from "./expressions/subquery/Exists";
6565

66-
/**
67-
* @hideGroups
68-
*/
69-
export * as apoc from "./namespaces/apoc/apoc";
70-
7166
export * as db from "./namespaces/db/db";
7267
/**
7368
* @hideGroups

src/clauses/With.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,15 @@ CALL db.labels() YIELD label"
286286
});
287287

288288
test("With * and cypher void procedure", () => {
289-
const withQuery = new Cypher.With("*").callProcedure(Cypher.apoc.util.validate(Cypher.true, "message"));
289+
const targetNode = new Cypher.Node();
290+
const customProcedure = new Cypher.VoidProcedure("customProcedure", [targetNode]);
291+
292+
const withQuery = new Cypher.With("*").callProcedure(customProcedure);
290293

291294
const queryResult = withQuery.build();
292295
expect(queryResult.cypher).toMatchInlineSnapshot(`
293296
"WITH *
294-
CALL apoc.util.validate(true, \\"message\\", [0])"
297+
CALL customProcedure(this0)"
295298
`);
296299
expect(queryResult.params).toMatchInlineSnapshot(`{}`);
297300
});

src/namespaces/apoc/apoc.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/namespaces/apoc/cypher/cypher.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/namespaces/apoc/cypher/run-first-column.test.ts

Lines changed: 0 additions & 191 deletions
This file was deleted.

0 commit comments

Comments
 (0)