@neo4j/cypher-builder
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -8,7 +8,7 @@ import { Pattern } from "../pattern/Pattern"; | ||
import { WithPathAssign } from "./mixins/WithPathAssign"; | ||
import type { DeleteInput } from "./sub-clauses/Delete"; | ||
import type { PropertyRef } from "../references/PropertyRef"; | ||
import type { CypherEnvironment } from "../Environment"; | ||
import type { NodeRef } from "../references/NodeRef"; | ||
export interface Match extends WithReturn, WithWhere, WithSet, WithWith, WithPathAssign { | ||
import { WithDelete } from "./mixins/WithDelete"; | ||
export interface Match extends WithReturn, WithWhere, WithSet, WithWith, WithPathAssign, WithDelete { | ||
} | ||
@@ -21,14 +21,5 @@ /** | ||
private pattern; | ||
private deleteClause; | ||
private removeClause; | ||
private _optional; | ||
constructor(pattern: NodeRef | Pattern); | ||
/** Attach a DELETE subclause | ||
* @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/clauses/delete/) | ||
*/ | ||
delete(...deleteInput: DeleteInput): this; | ||
/** Attach a DETACH DELETE subclause | ||
* @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/clauses/delete/) | ||
*/ | ||
detachDelete(...deleteInput: DeleteInput): this; | ||
remove(...properties: PropertyRef[]): this; | ||
@@ -49,3 +40,2 @@ /** Makes the clause an OPTIONAL MATCH | ||
getCypher(env: CypherEnvironment): string; | ||
private createDeleteClause; | ||
} | ||
@@ -52,0 +42,0 @@ /** |
@@ -37,4 +37,4 @@ "use strict"; | ||
const WithPathAssign_1 = require("./mixins/WithPathAssign"); | ||
const Delete_1 = require("./sub-clauses/Delete"); | ||
const Remove_1 = require("./sub-clauses/Remove"); | ||
const WithDelete_1 = require("./mixins/WithDelete"); | ||
/** | ||
@@ -55,17 +55,2 @@ * @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/clauses/match/) | ||
} | ||
/** Attach a DELETE subclause | ||
* @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/clauses/delete/) | ||
*/ | ||
delete(...deleteInput) { | ||
this.createDeleteClause(deleteInput); | ||
return this; | ||
} | ||
/** Attach a DETACH DELETE subclause | ||
* @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/clauses/delete/) | ||
*/ | ||
detachDelete(...deleteInput) { | ||
const deleteClause = this.createDeleteClause(deleteInput); | ||
deleteClause.detach(); | ||
return this; | ||
} | ||
remove(...properties) { | ||
@@ -103,9 +88,5 @@ this.removeClause = new Remove_1.RemoveClause(this, properties); | ||
} | ||
createDeleteClause(deleteInput) { | ||
this.deleteClause = new Delete_1.DeleteClause(this, deleteInput); | ||
return this.deleteClause; | ||
} | ||
}; | ||
Match = __decorate([ | ||
(0, mixin_1.mixin)(WithReturn_1.WithReturn, WithWhere_1.WithWhere, WithSet_1.WithSet, WithWith_1.WithWith, WithPathAssign_1.WithPathAssign) | ||
(0, mixin_1.mixin)(WithReturn_1.WithReturn, WithWhere_1.WithWhere, WithSet_1.WithSet, WithWith_1.WithWith, WithPathAssign_1.WithPathAssign, WithDelete_1.WithDelete) | ||
], Match); | ||
@@ -112,0 +93,0 @@ exports.Match = Match; |
@@ -9,3 +9,4 @@ import type { CypherEnvironment } from "../Environment"; | ||
import { WithPathAssign } from "./mixins/WithPathAssign"; | ||
export interface Merge extends WithReturn, WithSet, WithPathAssign { | ||
import { WithDelete } from "./mixins/WithDelete"; | ||
export interface Merge extends WithReturn, WithSet, WithPathAssign, WithDelete { | ||
} | ||
@@ -12,0 +13,0 @@ /** |
@@ -36,2 +36,3 @@ "use strict"; | ||
const WithPathAssign_1 = require("./mixins/WithPathAssign"); | ||
const WithDelete_1 = require("./mixins/WithDelete"); | ||
/** | ||
@@ -63,9 +64,10 @@ * @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/clauses/merge/) | ||
const returnStr = (0, compile_cypher_if_exists_1.compileCypherIfExists)(this.returnStatement, env, { prefix: "\n" }); | ||
return `${mergeStr}${setCypher}${onCreateStr}${returnStr}`; | ||
const deleteStr = (0, compile_cypher_if_exists_1.compileCypherIfExists)(this.deleteClause, env, { prefix: "\n" }); | ||
return `${mergeStr}${setCypher}${onCreateStr}${deleteStr}${returnStr}`; | ||
} | ||
}; | ||
Merge = __decorate([ | ||
(0, mixin_1.mixin)(WithReturn_1.WithReturn, WithSet_1.WithSet, WithPathAssign_1.WithPathAssign) | ||
(0, mixin_1.mixin)(WithReturn_1.WithReturn, WithSet_1.WithSet, WithPathAssign_1.WithPathAssign, WithDelete_1.WithDelete) | ||
], Merge); | ||
exports.Merge = Merge; | ||
//# sourceMappingURL=Merge.js.map |
@@ -6,4 +6,4 @@ import { ClauseMixin } from "./ClauseMixin"; | ||
protected unwindStatement: Unwind | undefined; | ||
unwind(...columns: Array<"*" | ProjectionColumn>): Unwind; | ||
unwind(...columns: Array<ProjectionColumn>): Unwind; | ||
} | ||
//# sourceMappingURL=WithUnwind.d.ts.map |
@@ -5,3 +5,4 @@ import { CypherASTNode } from "../../CypherASTNode"; | ||
import type { RelationshipRef } from "../../references/RelationshipRef"; | ||
export type DeleteInput = Array<NodeRef | RelationshipRef>; | ||
import type { Variable } from "../../references/Variable"; | ||
export type DeleteInput = Array<NodeRef | RelationshipRef | Variable>; | ||
export declare class DeleteClause extends CypherASTNode { | ||
@@ -8,0 +9,0 @@ private deleteInput; |
@@ -5,3 +5,4 @@ import type { CypherEnvironment } from "../Environment"; | ||
import { WithWith } from "./mixins/WithWith"; | ||
export interface Unwind extends WithWith { | ||
import { WithDelete } from "./mixins/WithDelete"; | ||
export interface Unwind extends WithWith, WithDelete { | ||
} | ||
@@ -14,3 +15,3 @@ /** | ||
private projection; | ||
constructor(...columns: Array<"*" | ProjectionColumn>); | ||
constructor(...columns: Array<ProjectionColumn>); | ||
addColumns(...columns: Array<"*" | ProjectionColumn>): void; | ||
@@ -17,0 +18,0 @@ /** @internal */ |
@@ -33,2 +33,3 @@ "use strict"; | ||
const mixin_1 = require("./utils/mixin"); | ||
const WithDelete_1 = require("./mixins/WithDelete"); | ||
/** | ||
@@ -49,10 +50,11 @@ * @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/clauses/unwind/) | ||
const projectionStr = this.projection.getCypher(env); | ||
const withCypher = (0, compile_cypher_if_exists_1.compileCypherIfExists)(this.withStatement, env, { prefix: "\n" }); | ||
return `UNWIND ${projectionStr}${withCypher}`; | ||
const withStr = (0, compile_cypher_if_exists_1.compileCypherIfExists)(this.withStatement, env, { prefix: "\n" }); | ||
const deleteStr = (0, compile_cypher_if_exists_1.compileCypherIfExists)(this.deleteClause, env, { prefix: "\n" }); | ||
return `UNWIND ${projectionStr}${deleteStr}${withStr}`; | ||
} | ||
}; | ||
Unwind = __decorate([ | ||
(0, mixin_1.mixin)(WithWith_1.WithWith) | ||
(0, mixin_1.mixin)(WithWith_1.WithWith, WithDelete_1.WithDelete) | ||
], Unwind); | ||
exports.Unwind = Unwind; | ||
//# sourceMappingURL=Unwind.js.map |
@@ -9,4 +9,5 @@ import type { CypherEnvironment } from "../Environment"; | ||
import { WithWhere } from "./mixins/WithWhere"; | ||
import { WithDelete } from "./mixins/WithDelete"; | ||
export type WithProjection = Variable | [Expr, string | Variable | Literal]; | ||
export interface With extends WithOrder, WithReturn, WithWhere { | ||
export interface With extends WithOrder, WithReturn, WithWhere, WithDelete { | ||
} | ||
@@ -13,0 +14,0 @@ /** |
@@ -36,2 +36,3 @@ "use strict"; | ||
const mixin_1 = require("./utils/mixin"); | ||
const WithDelete_1 = require("./mixins/WithDelete"); | ||
/** | ||
@@ -62,4 +63,5 @@ * @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/clauses/with/) | ||
const whereStr = (0, compile_cypher_if_exists_1.compileCypherIfExists)(this.whereSubClause, env, { prefix: "\n" }); | ||
const deleteStr = (0, compile_cypher_if_exists_1.compileCypherIfExists)(this.deleteClause, env, { prefix: "\n" }); | ||
const distinctStr = this.isDistinct ? " DISTINCT" : ""; | ||
return `WITH${distinctStr} ${projectionStr}${whereStr}${orderByStr}${withStr}${returnStr}`; | ||
return `WITH${distinctStr} ${projectionStr}${whereStr}${orderByStr}${deleteStr}${withStr}${returnStr}`; | ||
} | ||
@@ -79,5 +81,5 @@ // Cannot be part of WithWith due to dependency cycles | ||
With = With_1 = __decorate([ | ||
(0, mixin_1.mixin)(WithOrder_1.WithOrder, WithReturn_1.WithReturn, WithWhere_1.WithWhere) | ||
(0, mixin_1.mixin)(WithOrder_1.WithOrder, WithReturn_1.WithReturn, WithWhere_1.WithWhere, WithDelete_1.WithDelete) | ||
], With); | ||
exports.With = With; | ||
//# sourceMappingURL=With.js.map |
{ | ||
"name": "@neo4j/cypher-builder", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Neo4j Cypher query builder", | ||
@@ -39,3 +39,3 @@ "exports": "./dist/index.js", | ||
"devDependencies": { | ||
"@types/jest": "29.5.0", | ||
"@types/jest": "29.5.1", | ||
"@types/node": "18.15.1", | ||
@@ -46,5 +46,5 @@ "expect-type": "0.15.0", | ||
"ts-jest": "29.1.0", | ||
"typedoc": "0.24.1", | ||
"typedoc": "0.24.5", | ||
"typescript": "5.0.4" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
428604
355
6909