Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@neo4j/cypher-builder

Package Overview
Dependencies
Maintainers
7
Versions
70
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 1.10.0 to 1.10.1

6

dist/clauses/Clause.d.ts
import { CypherASTNode } from "../CypherASTNode";
import type { EnvPrefix } from "../Environment";
import type { EnvConfig, EnvPrefix } from "../Environment";
import { CypherEnvironment } from "../Environment";
import type { CypherResult } from "../types";
declare const customInspectSymbol: unique symbol;
/** Config fields for the .build method */
export type BuildConfig = Partial<EnvConfig>;
/** Represents a clause AST node

@@ -12,3 +14,3 @@ * @group Internal

/** Compiles a clause into Cypher and params */
build(prefix?: string | EnvPrefix | undefined, extraParams?: Record<string, unknown>): CypherResult;
build(prefix?: string | EnvPrefix | undefined, extraParams?: Record<string, unknown>, config?: BuildConfig): CypherResult;
private getEnv;

@@ -15,0 +17,0 @@ /** Custom string for browsers and templating

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

/** Compiles a clause into Cypher and params */
build(prefix, extraParams = {}) {
build(prefix, extraParams = {}, config) {
if (this.isRoot) {
const env = this.getEnv(prefix);
const env = this.getEnv(prefix, config);
const cypher = this.getCypher(env);

@@ -51,4 +51,4 @@ const cypherParams = (0, to_cypher_params_1.toCypherParams)(extraParams);

}
getEnv(prefix) {
return new Environment_1.CypherEnvironment(prefix);
getEnv(prefix, config = {}) {
return new Environment_1.CypherEnvironment(prefix, config);
}

@@ -55,0 +55,0 @@ /** Custom string for browsers and templating

@@ -49,3 +49,3 @@ export { Call } from "./clauses/Call";

export type { CypherEnvironment as Environment } from "./Environment";
export type { Clause } from "./clauses/Clause";
export type { BuildConfig, Clause } from "./clauses/Clause";
export type { Order } from "./clauses/sub-clauses/OrderBy";

@@ -52,0 +52,0 @@ export type { ProjectionColumn } from "./clauses/sub-clauses/Projection";

@@ -8,2 +8,5 @@ import { Param } from "./references/Param";

};
export type EnvConfig = {
labelOperator: ":" | "&";
};
/** Hold the internal references of Cypher parameters and variables

@@ -16,6 +19,7 @@ * @group Internal

private params;
readonly config: EnvConfig;
/**
* @internal
*/
constructor(prefix?: string | EnvPrefix);
constructor(prefix?: string | EnvPrefix, config?: Partial<EnvConfig>);
compile(element: CypherCompilable): string;

@@ -22,0 +26,0 @@ getReferenceId(reference: Variable | NamedReference): string;

@@ -24,2 +24,5 @@ "use strict";

const is_cypher_compilable_1 = require("./utils/is-cypher-compilable");
const defaultConfig = {
labelOperator: ":",
};
/** Hold the internal references of Cypher parameters and variables

@@ -32,3 +35,3 @@ * @group Internal

*/
constructor(prefix) {
constructor(prefix, config = {}) {
this.references = new Map();

@@ -48,2 +51,6 @@ this.params = [];

}
this.config = {
...defaultConfig,
...config,
};
}

@@ -50,0 +57,0 @@ compile(element) {

@@ -53,6 +53,6 @@ "use strict";

const escapedLabels = this.expectedLabels.map((label) => (0, escape_1.escapeLabel)(label));
return (0, add_label_token_1.addLabelToken)(...escapedLabels);
return (0, add_label_token_1.addLabelToken)(env.config.labelOperator, ...escapedLabels);
}
else {
return (0, add_label_token_1.addLabelToken)(this.expectedLabels.getCypher(env));
return (0, add_label_token_1.addLabelToken)(env.config.labelOperator, this.expectedLabels.getCypher(env));
}

@@ -59,0 +59,0 @@ }

@@ -78,3 +78,3 @@ "use strict";

}
return (0, add_label_token_1.addLabelToken)(labels.getCypher(env));
return (0, add_label_token_1.addLabelToken)(env.config.labelOperator, labels.getCypher(env));
}

@@ -86,3 +86,3 @@ else {

}
return (0, add_label_token_1.addLabelToken)(...escapedLabels);
return (0, add_label_token_1.addLabelToken)(env.config.labelOperator, ...escapedLabels);
}

@@ -89,0 +89,0 @@ }

@@ -1,1 +0,1 @@

export declare function addLabelToken(...labels: string[]): string;
export declare function addLabelToken(andToken: ":" | "&", ...labels: string[]): string;

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

exports.addLabelToken = void 0;
const constants_1 = require("../constants");
function addLabelToken(...labels) {
return labels.map((label) => `${constants_1.LABEL_TOKEN}${label}`).join("");
function addLabelToken(andToken, ...labels) {
const firstLabel = labels.shift();
if (!firstLabel)
return "";
const extraLabels = labels.map((label) => `${andToken}${label}`).join("");
return `:${firstLabel}${extraLabels}`;
}
exports.addLabelToken = addLabelToken;
{
"name": "@neo4j/cypher-builder",
"version": "1.10.0",
"version": "1.10.1",
"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