@neo4j/cypher-builder
Advanced tools
Comparing version 1.6.0 to 1.7.0
@@ -17,8 +17,4 @@ import type { CypherEnvironment } from "../Environment"; | ||
*/ | ||
export declare class RawCypher extends Clause { | ||
private callback; | ||
constructor(callback: RawCypherCallback | string); | ||
getCypher(env: CypherEnvironment): string; | ||
private stringToCallback; | ||
export declare class RawCypher extends Raw { | ||
} | ||
export {}; |
@@ -60,30 +60,4 @@ "use strict"; | ||
*/ | ||
class RawCypher extends Clause_1.Clause { | ||
constructor(callback) { | ||
super(); | ||
if (typeof callback === "string") { | ||
this.callback = this.stringToCallback(callback); | ||
} | ||
else | ||
this.callback = callback; | ||
} | ||
getCypher(env) { | ||
const cbResult = this.callback(env); | ||
if (!cbResult) | ||
return ""; | ||
let query; | ||
let params = {}; | ||
if (typeof cbResult === "string") | ||
query = cbResult; | ||
else { | ||
[query, params] = cbResult; | ||
} | ||
const cypherParams = (0, to_cypher_params_1.toCypherParams)(params); | ||
env.addExtraParams(cypherParams); | ||
return query; | ||
} | ||
stringToCallback(str) { | ||
return () => str; | ||
} | ||
class RawCypher extends Raw { | ||
} | ||
exports.RawCypher = RawCypher; |
@@ -26,2 +26,3 @@ export { Call } from "./clauses/Call"; | ||
export * as apoc from "./namespaces/apoc/apoc"; | ||
export * as cdc from "./namespaces/cdc/cdc"; | ||
export { ListComprehension } from "./expressions/list/ListComprehension"; | ||
@@ -28,0 +29,0 @@ export { ListExpr as List } from "./expressions/list/ListExpr"; |
@@ -47,5 +47,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.in = exports.gte = exports.gt = exports.eq = exports.endsWith = exports.contains = exports.xor = exports.or = exports.not = exports.and = exports.MapProjection = exports.Map = exports.PatternComprehension = exports.List = exports.ListComprehension = exports.apoc = exports.Exists = exports.Count = exports.Case = exports.Variable = exports.NamedVariable = exports.Relationship = exports.NamedRelationship = exports.Property = exports.Path = exports.NamedPath = exports.Param = exports.NamedParam = exports.Node = exports.NamedNode = exports.true = exports.false = exports.Null = exports.Literal = exports.Pattern = exports.labelExpr = exports.concat = exports.With = exports.Use = exports.Unwind = exports.Union = exports.Return = exports.RawCypher = exports.Raw = exports.Merge = exports.OptionalMatch = exports.Match = exports.Foreach = exports.Create = exports.Call = void 0; | ||
exports.date = exports.tan = exports.sqrt = exports.sin = exports.sign = exports.round = exports.rand = exports.radians = exports.pi = exports.log10 = exports.log = exports.isNaN = exports.haversin = exports.floor = exports.exp = exports.e = exports.degrees = exports.cot = exports.cos = exports.ceil = exports.atan2 = exports.atan = exports.asin = exports.acos = exports.abs = exports.graph = exports.sum = exports.stDevP = exports.stDev = exports.percentileDisc = exports.percentileCont = exports.min = exports.max = exports.count = exports.collect = exports.avg = exports.Function = exports.pow = exports.plus = exports.multiply = exports.mod = exports.minus = exports.divide = exports.startsWith = exports.neq = exports.matches = exports.lte = exports.lt = exports.isNull = exports.isNotNull = void 0; | ||
exports.utils = exports.db = exports.VoidProcedure = exports.Procedure = exports.single = exports.none = exports.isEmpty = exports.exists = exports.any = exports.all = exports.time = exports.localtime = exports.localdatetime = exports.duration = exports.datetime = void 0; | ||
exports.gte = exports.gt = exports.eq = exports.endsWith = exports.contains = exports.xor = exports.or = exports.not = exports.and = exports.MapProjection = exports.Map = exports.PatternComprehension = exports.List = exports.ListComprehension = exports.cdc = exports.apoc = exports.Exists = exports.Count = exports.Case = exports.Variable = exports.NamedVariable = exports.Relationship = exports.NamedRelationship = exports.Property = exports.Path = exports.NamedPath = exports.Param = exports.NamedParam = exports.Node = exports.NamedNode = exports.true = exports.false = exports.Null = exports.Literal = exports.Pattern = exports.labelExpr = exports.concat = exports.With = exports.Use = exports.Unwind = exports.Union = exports.Return = exports.RawCypher = exports.Raw = exports.Merge = exports.OptionalMatch = exports.Match = exports.Foreach = exports.Create = exports.Call = void 0; | ||
exports.tan = exports.sqrt = exports.sin = exports.sign = exports.round = exports.rand = exports.radians = exports.pi = exports.log10 = exports.log = exports.isNaN = exports.haversin = exports.floor = exports.exp = exports.e = exports.degrees = exports.cot = exports.cos = exports.ceil = exports.atan2 = exports.atan = exports.asin = exports.acos = exports.abs = exports.graph = exports.sum = exports.stDevP = exports.stDev = exports.percentileDisc = exports.percentileCont = exports.min = exports.max = exports.count = exports.collect = exports.avg = exports.Function = exports.pow = exports.plus = exports.multiply = exports.mod = exports.minus = exports.divide = exports.startsWith = exports.neq = exports.matches = exports.lte = exports.lt = exports.isNull = exports.isNotNull = exports.in = void 0; | ||
exports.utils = exports.db = exports.VoidProcedure = exports.Procedure = exports.single = exports.none = exports.isEmpty = exports.exists = exports.any = exports.all = exports.time = exports.localtime = exports.localdatetime = exports.duration = exports.datetime = exports.date = void 0; | ||
// Clauses | ||
@@ -115,2 +115,4 @@ var Call_1 = require("./clauses/Call"); | ||
exports.apoc = __importStar(require("./namespaces/apoc/apoc")); | ||
// --CDC | ||
exports.cdc = __importStar(require("./namespaces/cdc/cdc")); | ||
// --Lists | ||
@@ -117,0 +119,0 @@ var ListComprehension_1 = require("./expressions/list/ListComprehension"); |
@@ -118,1 +118,19 @@ import type { Expr } from "../../types"; | ||
export declare function type(relationship: Expr): CypherFunction; | ||
/** | ||
* @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/functions/scalar/#functions-valueType) | ||
* @group Cypher Functions | ||
* @category Scalar | ||
*/ | ||
export declare function valueType(expr: Expr): CypherFunction; | ||
/** Alias of size() | ||
* @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/functions/scalar/#functions-char_length) | ||
* @group Cypher Functions | ||
* @category Scalar | ||
*/ | ||
export declare function char_length(expr: Expr): CypherFunction; | ||
/** Alias of size() | ||
* @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/functions/scalar/#functions-character_length) | ||
* @group Cypher Functions | ||
* @category Scalar | ||
*/ | ||
export declare function character_length(expr: Expr): CypherFunction; |
@@ -21,3 +21,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.type = exports.toIntegerOrNull = exports.toInteger = exports.toFloatOrNull = exports.toFloat = exports.toBooleanOrNull = exports.toBoolean = exports.timestamp = exports.startNode = exports.size = exports.randomUUID = exports.properties = exports.length = exports.last = exports.id = exports.head = exports.endNode = exports.elementId = exports.coalesce = void 0; | ||
exports.character_length = exports.char_length = exports.valueType = exports.type = exports.toIntegerOrNull = exports.toInteger = exports.toFloatOrNull = exports.toFloat = exports.toBooleanOrNull = exports.toBoolean = exports.timestamp = exports.startNode = exports.size = exports.randomUUID = exports.properties = exports.length = exports.last = exports.id = exports.head = exports.endNode = exports.elementId = exports.coalesce = void 0; | ||
const CypherFunctions_1 = require("./CypherFunctions"); | ||
@@ -196,1 +196,28 @@ /** | ||
exports.type = type; | ||
/** | ||
* @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/functions/scalar/#functions-valueType) | ||
* @group Cypher Functions | ||
* @category Scalar | ||
*/ | ||
function valueType(expr) { | ||
return new CypherFunctions_1.CypherFunction("valueType", [expr]); | ||
} | ||
exports.valueType = valueType; | ||
/** Alias of size() | ||
* @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/functions/scalar/#functions-char_length) | ||
* @group Cypher Functions | ||
* @category Scalar | ||
*/ | ||
function char_length(expr) { | ||
return new CypherFunctions_1.CypherFunction("char_length", [expr]); | ||
} | ||
exports.char_length = char_length; | ||
/** Alias of size() | ||
* @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/functions/scalar/#functions-character_length) | ||
* @group Cypher Functions | ||
* @category Scalar | ||
*/ | ||
function character_length(expr) { | ||
return new CypherFunctions_1.CypherFunction("character_length", [expr]); | ||
} | ||
exports.character_length = character_length; |
@@ -0,5 +1,6 @@ | ||
import { ListExpr } from "../expressions/list/ListExpr"; | ||
import { MapExpr } from "../expressions/map/MapExpr"; | ||
import { Literal } from "../references/Literal"; | ||
import type { Param } from "../references/Param"; | ||
import type { Variable } from "../references/Variable"; | ||
import { MapExpr } from "../expressions/map/MapExpr"; | ||
import type { Expr } from "../types"; | ||
@@ -11,2 +12,3 @@ type VariableInput = string | number | Variable | Literal | Param; | ||
export declare function normalizeMap(map: Record<string, VariableInput>): MapExpr; | ||
export declare function normalizeList(list: Array<VariableInput | Expr>): ListExpr; | ||
export {}; |
@@ -21,6 +21,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.normalizeMap = exports.normalizeExpr = exports.normalizeVariable = void 0; | ||
exports.normalizeList = exports.normalizeMap = exports.normalizeExpr = exports.normalizeVariable = void 0; | ||
const ListExpr_1 = require("../expressions/list/ListExpr"); | ||
const MapExpr_1 = require("../expressions/map/MapExpr"); | ||
const Literal_1 = require("../references/Literal"); | ||
const is_cypher_compilable_1 = require("./is-cypher-compilable"); | ||
const MapExpr_1 = require("../expressions/map/MapExpr"); | ||
function normalizeVariable(value) { | ||
@@ -46,1 +47,6 @@ if ((0, is_cypher_compilable_1.isCypherCompilable)(value)) | ||
exports.normalizeMap = normalizeMap; | ||
function normalizeList(list) { | ||
const expressions = list.map((v) => normalizeExpr(v)); | ||
return new ListExpr_1.ListExpr(expressions); | ||
} | ||
exports.normalizeList = normalizeList; |
{ | ||
"name": "@neo4j/cypher-builder", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"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
385447
205
9410