@neo4j/cypher-builder
Advanced tools
Comparing version 1.17.0 to 1.17.1
@@ -6,2 +6,3 @@ import type { CypherEnvironment } from "../Environment"; | ||
import { WithPathAssign } from "./mixins/WithPathAssign"; | ||
import { WithCallProcedure } from "./mixins/clauses/WithCallProcedure"; | ||
import { WithCreate } from "./mixins/clauses/WithCreate"; | ||
@@ -17,3 +18,3 @@ import { WithFinish } from "./mixins/clauses/WithFinish"; | ||
import { WithWhere } from "./mixins/sub-clauses/WithWhere"; | ||
export interface Match extends WithReturn, WithWhere, WithSet, WithWith, WithPathAssign, WithDelete, WithRemove, WithUnwind, WithCreate, WithMerge, WithFinish { | ||
export interface Match extends WithReturn, WithWhere, WithSet, WithWith, WithPathAssign, WithDelete, WithRemove, WithUnwind, WithCreate, WithMerge, WithFinish, WithCallProcedure { | ||
} | ||
@@ -20,0 +21,0 @@ /** |
@@ -33,2 +33,3 @@ "use strict"; | ||
const WithPathAssign_1 = require("./mixins/WithPathAssign"); | ||
const WithCallProcedure_1 = require("./mixins/clauses/WithCallProcedure"); | ||
const WithCreate_1 = require("./mixins/clauses/WithCreate"); | ||
@@ -104,3 +105,3 @@ const WithFinish_1 = require("./mixins/clauses/WithFinish"); | ||
exports.Match = Match = Match_1 = __decorate([ | ||
(0, mixin_1.mixin)(WithReturn_1.WithReturn, WithWhere_1.WithWhere, WithSet_1.WithSet, WithWith_1.WithWith, WithPathAssign_1.WithPathAssign, WithDelete_1.WithDelete, WithRemove_1.WithRemove, WithUnwind_1.WithUnwind, WithCreate_1.WithCreate, WithMerge_1.WithMerge, WithFinish_1.WithFinish) | ||
(0, mixin_1.mixin)(WithReturn_1.WithReturn, WithWhere_1.WithWhere, WithSet_1.WithSet, WithWith_1.WithWith, WithPathAssign_1.WithPathAssign, WithDelete_1.WithDelete, WithRemove_1.WithRemove, WithUnwind_1.WithUnwind, WithCreate_1.WithCreate, WithMerge_1.WithMerge, WithFinish_1.WithFinish, WithCallProcedure_1.WithCallProcedure) | ||
], Match); | ||
@@ -107,0 +108,0 @@ /** |
@@ -6,2 +6,3 @@ import type { CypherEnvironment } from "../Environment"; | ||
import { Clause } from "./Clause"; | ||
import { WithCallProcedure } from "./mixins/clauses/WithCallProcedure"; | ||
import { WithCreate } from "./mixins/clauses/WithCreate"; | ||
@@ -16,3 +17,3 @@ import { WithMatch } from "./mixins/clauses/WithMatch"; | ||
export type WithProjection = Variable | [Expr, string | Variable | Literal]; | ||
export interface With extends WithOrder, WithReturn, WithWhere, WithDelete, WithMatch, WithUnwind, WithCreate, WithMerge { | ||
export interface With extends WithOrder, WithReturn, WithWhere, WithDelete, WithMatch, WithUnwind, WithCreate, WithMerge, WithCallProcedure { | ||
} | ||
@@ -30,4 +31,2 @@ /** | ||
distinct(): this; | ||
/** @internal */ | ||
getCypher(env: CypherEnvironment): string; | ||
/** Add a {@link With} clause | ||
@@ -37,2 +36,4 @@ * @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/clauses/with/) | ||
with(...columns: ("*" | WithProjection)[]): With; | ||
/** @internal */ | ||
getCypher(env: CypherEnvironment): string; | ||
} |
@@ -31,2 +31,3 @@ "use strict"; | ||
const Clause_1 = require("./Clause"); | ||
const WithCallProcedure_1 = require("./mixins/clauses/WithCallProcedure"); | ||
const WithCreate_1 = require("./mixins/clauses/WithCreate"); | ||
@@ -60,13 +61,2 @@ const WithMatch_1 = require("./mixins/clauses/WithMatch"); | ||
} | ||
/** @internal */ | ||
getCypher(env) { | ||
const projectionStr = this.projection.getCypher(env); | ||
const orderByStr = (0, compile_cypher_if_exists_1.compileCypherIfExists)(this.orderByStatement, env, { prefix: "\n" }); | ||
const withStr = (0, compile_cypher_if_exists_1.compileCypherIfExists)(this.withStatement, env, { prefix: "\n" }); | ||
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" : ""; | ||
const nextClause = this.compileNextClause(env); | ||
return `WITH${distinctStr} ${projectionStr}${whereStr}${orderByStr}${deleteStr}${withStr}${nextClause}`; | ||
} | ||
// Cannot be part of WithWith due to dependency cycles | ||
@@ -87,6 +77,17 @@ /** Add a {@link With} clause | ||
} | ||
/** @internal */ | ||
getCypher(env) { | ||
const projectionStr = this.projection.getCypher(env); | ||
const orderByStr = (0, compile_cypher_if_exists_1.compileCypherIfExists)(this.orderByStatement, env, { prefix: "\n" }); | ||
const withStr = (0, compile_cypher_if_exists_1.compileCypherIfExists)(this.withStatement, env, { prefix: "\n" }); | ||
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" : ""; | ||
const nextClause = this.compileNextClause(env); | ||
return `WITH${distinctStr} ${projectionStr}${whereStr}${orderByStr}${deleteStr}${withStr}${nextClause}`; | ||
} | ||
}; | ||
exports.With = With; | ||
exports.With = With = With_1 = __decorate([ | ||
(0, mixin_1.mixin)(WithOrder_1.WithOrder, WithReturn_1.WithReturn, WithWhere_1.WithWhere, WithDelete_1.WithDelete, WithMatch_1.WithMatch, WithUnwind_1.WithUnwind, WithCreate_1.WithCreate, WithMerge_1.WithMerge) | ||
(0, mixin_1.mixin)(WithOrder_1.WithOrder, WithReturn_1.WithReturn, WithWhere_1.WithWhere, WithDelete_1.WithDelete, WithMatch_1.WithMatch, WithUnwind_1.WithUnwind, WithCreate_1.WithCreate, WithMerge_1.WithMerge, WithCallProcedure_1.WithCallProcedure) | ||
], With); |
{ | ||
"name": "@neo4j/cypher-builder", | ||
"version": "1.17.0", | ||
"version": "1.17.1", | ||
"description": "A programmatic API for building Cypher queries for Neo4j", | ||
@@ -5,0 +5,0 @@ "exports": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
442969
237
10766