New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@neo4j/cypher-builder

Package Overview
Dependencies
Maintainers
7
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@neo4j/cypher-builder - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

1

dist/Cypher.d.ts

@@ -55,2 +55,3 @@ export { Match, OptionalMatch } from "./clauses/Match";

export type { CypherAggregationFunction as AggregationFunction } from "./expressions/functions/AggregationFunctions";
export { InputArgument } from "./utils/normalize-variable";
export * as utils from "./utils/utils";
import { CypherProcedure } from "./CypherProcedure";
import type { Literal } from "../references/Literal";
import { Literal } from "../references/Literal";
import type { Param } from "../references/Param";
import type { Variable } from "../references/Variable";
import { InputArgument } from "../utils/normalize-variable";
type FulltextPhrase = string | Literal<string> | Param | Variable;

@@ -13,3 +14,12 @@ /**

fulltext: {
queryNodes(indexName: string | Literal<string>, phrase: FulltextPhrase): CypherProcedure<"node" | "score">;
queryNodes(indexName: string | Literal<string>, queryString: FulltextPhrase, options?: {
skip?: InputArgument<number>;
limit?: InputArgument<number>;
analyser?: InputArgument<string>;
}): CypherProcedure<"node" | "score">;
queryRelationships(indexName: string | Literal<string>, queryString: FulltextPhrase, options?: {
skip?: InputArgument<number>;
limit?: InputArgument<number>;
analyser?: InputArgument<string>;
}): CypherProcedure<"relationship" | "score">;
};

@@ -16,0 +26,0 @@ };

@@ -31,8 +31,22 @@ "use strict";

fulltext: {
queryNodes(indexName, phrase) {
// TODO: add options, skip limit, analyzer
const phraseVar = (0, normalize_variable_1.normalizeVariable)(phrase);
queryNodes(indexName, queryString, options) {
const phraseVar = (0, normalize_variable_1.normalizeVariable)(queryString);
const indexNameVar = (0, normalize_variable_1.normalizeVariable)(indexName);
return new CypherProcedure_1.CypherProcedure("db.index.fulltext.queryNodes", [indexNameVar, phraseVar]);
const procedureArgs = [indexNameVar, phraseVar];
if (options) {
const optionsMap = (0, normalize_variable_1.normalizeMap)(options);
procedureArgs.push(optionsMap);
}
return new CypherProcedure_1.CypherProcedure("db.index.fulltext.queryNodes", procedureArgs);
},
queryRelationships(indexName, queryString, options) {
const phraseVar = (0, normalize_variable_1.normalizeVariable)(queryString);
const indexNameVar = (0, normalize_variable_1.normalizeVariable)(indexName);
const procedureArgs = [indexNameVar, phraseVar];
if (options) {
const optionsMap = (0, normalize_variable_1.normalizeMap)(options);
procedureArgs.push(optionsMap);
}
return new CypherProcedure_1.CypherProcedure("db.index.fulltext.queryRelationships", procedureArgs);
},
},

@@ -39,0 +53,0 @@ };

4

dist/references/Reference.d.ts

@@ -8,4 +8,4 @@ import { PropertyRef } from "./PropertyRef";

constructor(prefix?: string);
/** Access individual property via the PropertyRef class, using the dot notation */
property(path: string | Expr): PropertyRef;
/** Access individual property via the PropertyRef class */
property(...path: Array<string | Expr>): PropertyRef;
index(index: number): ListIndex;

@@ -12,0 +12,0 @@ }

@@ -34,5 +34,5 @@ "use strict";

}
/** Access individual property via the PropertyRef class, using the dot notation */
property(path) {
return new PropertyRef_1.PropertyRef(this, path);
/** Access individual property via the PropertyRef class */
property(...path) {
return new PropertyRef_1.PropertyRef(this, ...path);
}

@@ -39,0 +39,0 @@ /* Access individual elements via the ListIndex class, using the square bracket notation */

import type { CypherEnvironment } from "../Environment";
import type { CypherCompilable } from "../types";
import { CypherCompilable } from "../types";
/** Compiles the cypher of an element, if the resulting cypher is not empty adds a prefix */
export declare function compileCypherIfExists(element: CypherCompilable | undefined, env: CypherEnvironment, options?: {
export declare function compileCypherIfExists(element: CypherCompilable | undefined, env: CypherEnvironment, { prefix, suffix }?: {
prefix?: string;
suffix?: string;
}): string;

@@ -22,9 +22,11 @@ "use strict";

exports.compileCypherIfExists = void 0;
const compile_cypher_1 = require("./compile-cypher");
/** Compiles the cypher of an element, if the resulting cypher is not empty adds a prefix */
function compileCypherIfExists(element, env, options = {}) {
function compileCypherIfExists(element, env, { prefix = "", suffix = "" } = {}) {
if (!element)
return "";
return (0, compile_cypher_1.compileCypher)(element, env, options);
const cypher = element.getCypher(env);
if (!cypher)
return "";
return `${prefix}${cypher}${suffix}`;
}
exports.compileCypherIfExists = compileCypherIfExists;
import type { CypherEnvironment } from "../Environment";
import type { CypherCompilable } from "../types";
import { Clause } from "../clauses/Clause";
import type { Expr } from "../types";
/** Compiles a clause or expression to a Cypher string, adding optional prefix or suffix. To be used in a RawCypher callback

@@ -7,5 +8,5 @@ *

*/
export declare function compileCypher(element: CypherCompilable, env: CypherEnvironment, { prefix, suffix }?: {
export declare function compileCypher(element: Expr | Clause, env: CypherEnvironment, { prefix, suffix }?: {
prefix?: string;
suffix?: string;
}): string;
import { Literal } from "../references/Literal";
import type { Param } from "../references/Param";
import type { Variable } from "../references/Variable";
export declare function normalizeVariable(value: string | number | Variable | Literal | Param): Variable | Literal | Param;
import { MapExpr } from "../expressions/map/MapExpr";
type VariableInput = string | number | Variable | Literal | Param;
export type InputArgument<T extends string | number> = T | Variable | Literal<T> | Param<T>;
export declare function normalizeVariable(value: VariableInput): Variable | Literal | Param;
export declare function normalizeMap(map: Record<string, VariableInput>): MapExpr;
export {};

@@ -21,5 +21,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizeVariable = void 0;
exports.normalizeMap = exports.normalizeVariable = void 0;
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) {

@@ -31,1 +32,8 @@ if ((0, is_cypher_compilable_1.isCypherCompilable)(value))

exports.normalizeVariable = normalizeVariable;
function normalizeMap(map) {
return Object.entries(map).reduce((mapExpr, [key, value]) => {
mapExpr.set(key, normalizeVariable(value));
return mapExpr;
}, new MapExpr_1.MapExpr());
}
exports.normalizeMap = normalizeMap;
{
"name": "@neo4j/cypher-builder",
"version": "0.5.1",
"version": "0.5.2",
"description": "A programmatic API for building Cypher queries for Neo4j",

@@ -5,0 +5,0 @@ "exports": "./dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc