@neo4j/cypher-builder
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -23,2 +23,3 @@ "use strict"; | ||
const Clause_1 = require("./Clause"); | ||
// ADD yield, where and return | ||
class CallProcedure extends Clause_1.Clause { | ||
@@ -25,0 +26,0 @@ constructor(procedure) { |
@@ -1,6 +0,5 @@ | ||
/// <reference types="node" /> | ||
import util from "util"; | ||
import { CypherASTNode } from "../CypherASTNode"; | ||
import { EnvPrefix } from "../Environment"; | ||
import type { CypherResult } from "../types"; | ||
declare const customInspectSymbol: unique symbol; | ||
/** Represents a clause AST node */ | ||
@@ -11,5 +10,6 @@ export declare abstract class Clause extends CypherASTNode { | ||
private getEnv; | ||
/** Custom log for console.log */ | ||
[util.inspect.custom](): string; | ||
toString(): string; | ||
[customInspectSymbol](): string; | ||
} | ||
export {}; | ||
//# sourceMappingURL=Clause.d.ts.map |
@@ -20,8 +20,4 @@ "use strict"; | ||
*/ | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Clause = void 0; | ||
const util_1 = __importDefault(require("util")); | ||
const CypherASTNode_1 = require("../CypherASTNode"); | ||
@@ -31,2 +27,3 @@ const Environment_1 = require("../Environment"); | ||
const utils_1 = require("../utils/utils"); | ||
const customInspectSymbol = Symbol.for("nodejs.util.inspect.custom"); | ||
/** Represents a clause AST node */ | ||
@@ -52,9 +49,13 @@ class Clause extends CypherASTNode_1.CypherASTNode { | ||
} | ||
/** Custom log for console.log */ | ||
[util_1.default.inspect.custom]() { | ||
// Custom string for browsers and templating | ||
toString() { | ||
const cypher = (0, utils_1.padBlock)(this.build().cypher); | ||
return `<Clause ${this.constructor.name}> """\n${cypher}\n"""`; | ||
} | ||
// /** Custom log for console.log in Node */ | ||
[customInspectSymbol]() { | ||
return this.toString(); | ||
} | ||
} | ||
exports.Clause = Clause; | ||
//# sourceMappingURL=Clause.js.map |
@@ -54,9 +54,5 @@ "use strict"; | ||
const setCypher = (0, compile_cypher_if_exists_1.compileCypherIfExists)(this.setSubClause, env, { prefix: "\n" }); | ||
const onCreateStatement = this.onCreateClause.getCypher(env); | ||
const separator = onCreateStatement ? "\n" : ""; | ||
let returnCypher = ""; | ||
if (this.returnStatement) { | ||
returnCypher = `\n${this.returnStatement.getCypher(env)}`; | ||
} | ||
return `${mergeStr}${separator}${setCypher}${onCreateStatement}${returnCypher}`; | ||
const onCreateStr = (0, compile_cypher_if_exists_1.compileCypherIfExists)(this.onCreateClause, env, { prefix: "\n" }); | ||
const returnStr = (0, compile_cypher_if_exists_1.compileCypherIfExists)(this.returnStatement, env, { prefix: "\n" }); | ||
return `${mergeStr}${setCypher}${onCreateStr}${returnStr}`; | ||
} | ||
@@ -63,0 +59,0 @@ }; |
@@ -33,3 +33,6 @@ "use strict"; | ||
Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => { | ||
Object.defineProperty(baseClass.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null)); | ||
if (name !== "constructor") { | ||
// Base class constructor takes precedence over mixins | ||
Object.defineProperty(baseClass.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null)); | ||
} | ||
}); | ||
@@ -36,0 +39,0 @@ }); |
@@ -20,4 +20,4 @@ export { Match, OptionalMatch } from "./clauses/Match"; | ||
export { Case } from "./expressions/Case"; | ||
export * as db from "./expressions/procedures/db"; | ||
export * as apoc from "./expressions/procedures/apoc/apoc"; | ||
export * as db from "./procedures/db"; | ||
export * as apoc from "./procedures/apoc/apoc"; | ||
export { ListComprehension } from "./expressions/list/ListComprehension"; | ||
@@ -31,3 +31,3 @@ export { PatternComprehension } from "./expressions/list/PatternComprehension"; | ||
export { plus, minus } from "./expressions/operations/math"; | ||
export { coalesce, point, distance, pointDistance, cypherDatetime as datetime, cypherDate as date, cypherLocalTime as localtime, cypherLocalDatetime as localdatetime, cypherTime as time, labels, count, min, max, avg, sum, randomUUID } from "./expressions/functions/CypherFunction"; | ||
export { coalesce, point, distance, pointDistance, cypherDatetime as datetime, cypherDate as date, cypherLocalTime as localtime, cypherLocalDatetime as localdatetime, cypherTime as time, labels, count, min, max, avg, sum, randomUUID, } from "./expressions/functions/CypherFunction"; | ||
export * from "./expressions/functions/ListFunctions"; | ||
@@ -34,0 +34,0 @@ export { any, all, exists, single } from "./expressions/functions/PredicateFunctions"; |
@@ -96,4 +96,4 @@ "use strict"; | ||
// --Procedures | ||
exports.db = __importStar(require("./expressions/procedures/db")); | ||
exports.apoc = __importStar(require("./expressions/procedures/apoc/apoc")); | ||
exports.db = __importStar(require("./procedures/db")); | ||
exports.apoc = __importStar(require("./procedures/apoc/apoc")); | ||
// --Lists | ||
@@ -159,4 +159,4 @@ var ListComprehension_1 = require("./expressions/list/ListComprehension"); | ||
exports.utils = { | ||
escapeLabel: escape_label_1.escapeLabel | ||
escapeLabel: escape_label_1.escapeLabel, | ||
}; | ||
//# sourceMappingURL=Cypher.js.map |
@@ -11,3 +11,2 @@ import type { PropertyRef } from "./variables/PropertyRef"; | ||
import type { PredicateFunction } from "./expressions/functions/PredicateFunctions"; | ||
import type { ApocExpr, ApocPredicate, ValidatePredicate } from "./expressions/procedures/apoc/apoc"; | ||
import type { Case } from "./expressions/Case"; | ||
@@ -21,2 +20,4 @@ import type { MathOp } from "./expressions/operations/math"; | ||
import type { Reference } from "./variables/Reference"; | ||
import type { ValidatePredicate } from "./procedures/apoc/ValidatePredicate"; | ||
import type { ApocExpr, ApocPredicate } from "./procedures/apoc/apoc"; | ||
export declare type Operation = BooleanOp | ComparisonOp | MathOp; | ||
@@ -27,3 +28,3 @@ export declare type VariableLike = Reference | Literal | PropertyRef; | ||
export declare type Predicate = BooleanOp | ComparisonOp | RawCypher | Exists | PredicateFunction | ApocPredicate | Literal<boolean> | Case | HasLabel; | ||
/** Represents a procedure invocable with the CALL statement */ | ||
/** Represents a procedure, invocable with the CALL statement */ | ||
export declare type Procedure = ValidatePredicate; | ||
@@ -30,0 +31,0 @@ export declare type CypherResult = { |
{ | ||
"name": "@neo4j/cypher-builder", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Neo4j Cypher query builder", | ||
@@ -35,5 +35,6 @@ "exports": "./dist/index.js", | ||
"devDependencies": { | ||
"@types/jest": "29.2.1", | ||
"@types/jest": "29.2.2", | ||
"@types/node": "18.11.5", | ||
"jest": "29.2.2", | ||
"expect-type": "0.15.0", | ||
"jest": "29.3.1", | ||
"ts-jest": "29.0.3", | ||
@@ -40,0 +41,0 @@ "typescript": "4.8.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
327573
4492
6