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
69
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.3.0 to 1.4.0

dist/clauses/mixins/clauses/WithReturn.d.ts

6

dist/clauses/Call.d.ts
import type { CypherEnvironment } from "../Environment";
import type { Variable } from "../references/Variable";
import { Clause } from "./Clause";
import { WithReturn } from "./mixins/WithReturn";
import { WithWith } from "./mixins/WithWith";
import { WithUnwind } from "./mixins/WithUnwind";
import { WithReturn } from "./mixins/clauses/WithReturn";
import { WithWith } from "./mixins/clauses/WithWith";
import { WithUnwind } from "./mixins/clauses/WithUnwind";
export interface Call extends WithReturn, WithWith, WithUnwind {

@@ -8,0 +8,0 @@ }

@@ -31,7 +31,7 @@ "use strict";

const ImportWith_1 = require("./sub-clauses/ImportWith");
const WithReturn_1 = require("./mixins/WithReturn");
const WithReturn_1 = require("./mixins/clauses/WithReturn");
const mixin_1 = require("./utils/mixin");
const WithWith_1 = require("./mixins/WithWith");
const WithWith_1 = require("./mixins/clauses/WithWith");
const compile_cypher_if_exists_1 = require("../utils/compile-cypher-if-exists");
const WithUnwind_1 = require("./mixins/WithUnwind");
const WithUnwind_1 = require("./mixins/clauses/WithUnwind");
/**

@@ -41,3 +41,3 @@ * @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/clauses/call-subquery/)

*/
let Call = exports.Call = class Call extends Clause_1.Clause {
let Call = class Call extends Clause_1.Clause {
constructor(subQuery) {

@@ -69,4 +69,5 @@ super();

};
exports.Call = Call;
exports.Call = Call = __decorate([
(0, mixin_1.mixin)(WithReturn_1.WithReturn, WithWith_1.WithWith, WithUnwind_1.WithUnwind)
], Call);

@@ -5,4 +5,4 @@ import type { CypherEnvironment } from "../Environment";

import { Clause } from "./Clause";
import { WithReturn } from "./mixins/WithReturn";
import { WithSet } from "./mixins/WithSet";
import { WithReturn } from "./mixins/clauses/WithReturn";
import { WithSet } from "./mixins/sub-clauses/WithSet";
import { WithPathAssign } from "./mixins/WithPathAssign";

@@ -9,0 +9,0 @@ export interface Create extends WithReturn, WithSet, WithPathAssign {

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

const compile_cypher_if_exists_1 = require("../utils/compile-cypher-if-exists");
const WithReturn_1 = require("./mixins/WithReturn");
const WithReturn_1 = require("./mixins/clauses/WithReturn");
const mixin_1 = require("./utils/mixin");
const WithSet_1 = require("./mixins/WithSet");
const WithSet_1 = require("./mixins/sub-clauses/WithSet");
const WithPathAssign_1 = require("./mixins/WithPathAssign");

@@ -41,3 +41,3 @@ /**

*/
let Create = exports.Create = class Create extends Clause_1.Clause {
let Create = class Create extends Clause_1.Clause {
constructor(pattern) {

@@ -62,4 +62,5 @@ super();

};
exports.Create = Create;
exports.Create = Create = __decorate([
(0, mixin_1.mixin)(WithReturn_1.WithReturn, WithSet_1.WithSet, WithPathAssign_1.WithPathAssign)
], Create);
import type { CypherEnvironment } from "../Environment";
import { Clause } from "./Clause";
import { WithWith } from "./mixins/WithWith";
import { WithWith } from "./mixins/clauses/WithWith";
import type { DeleteClause } from "./sub-clauses/Delete";

@@ -5,0 +5,0 @@ import type { SetClause } from "./sub-clauses/Set";

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

const Clause_1 = require("./Clause");
const WithWith_1 = require("./mixins/WithWith");
const WithWith_1 = require("./mixins/clauses/WithWith");
const mixin_1 = require("./utils/mixin");

@@ -38,3 +38,3 @@ const pad_block_1 = require("../utils/pad-block");

*/
let Foreach = exports.Foreach = class Foreach extends Clause_1.Clause {
let Foreach = class Foreach extends Clause_1.Clause {
constructor(variable, listExpr, mapClause) {

@@ -56,4 +56,5 @@ super();

};
exports.Foreach = Foreach;
exports.Foreach = Foreach = __decorate([
(0, mixin_1.mixin)(WithWith_1.WithWith)
], Foreach);
import { Pattern } from "../pattern/Pattern";
import { Clause } from "./Clause";
import { WithReturn } from "./mixins/WithReturn";
import { WithWhere } from "./mixins/WithWhere";
import { WithSet } from "./mixins/WithSet";
import { WithWith } from "./mixins/WithWith";
import { WithReturn } from "./mixins/clauses/WithReturn";
import { WithWhere } from "./mixins/sub-clauses/WithWhere";
import { WithSet } from "./mixins/sub-clauses/WithSet";
import { WithWith } from "./mixins/clauses/WithWith";
import { WithPathAssign } from "./mixins/WithPathAssign";

@@ -11,3 +11,3 @@ import type { PropertyRef } from "../references/PropertyRef";

import type { NodeRef } from "../references/NodeRef";
import { WithDelete } from "./mixins/WithDelete";
import { WithDelete } from "./mixins/sub-clauses/WithDelete";
export interface Match extends WithReturn, WithWhere, WithSet, WithWith, WithPathAssign, WithDelete {

@@ -14,0 +14,0 @@ }

@@ -31,10 +31,10 @@ "use strict";

const compile_cypher_if_exists_1 = require("../utils/compile-cypher-if-exists");
const WithReturn_1 = require("./mixins/WithReturn");
const WithReturn_1 = require("./mixins/clauses/WithReturn");
const mixin_1 = require("./utils/mixin");
const WithWhere_1 = require("./mixins/WithWhere");
const WithSet_1 = require("./mixins/WithSet");
const WithWith_1 = require("./mixins/WithWith");
const WithWhere_1 = require("./mixins/sub-clauses/WithWhere");
const WithSet_1 = require("./mixins/sub-clauses/WithSet");
const WithWith_1 = require("./mixins/clauses/WithWith");
const WithPathAssign_1 = require("./mixins/WithPathAssign");
const Remove_1 = require("./sub-clauses/Remove");
const WithDelete_1 = require("./mixins/WithDelete");
const WithDelete_1 = require("./mixins/sub-clauses/WithDelete");
/**

@@ -44,3 +44,3 @@ * @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/clauses/match/)

*/
let Match = exports.Match = class Match extends Clause_1.Clause {
let Match = class Match extends Clause_1.Clause {
constructor(pattern) {

@@ -89,2 +89,3 @@ super();

};
exports.Match = Match;
exports.Match = Match = __decorate([

@@ -91,0 +92,0 @@ (0, mixin_1.mixin)(WithReturn_1.WithReturn, WithWhere_1.WithWhere, WithSet_1.WithSet, WithWith_1.WithWith, WithPathAssign_1.WithPathAssign, WithDelete_1.WithDelete)

@@ -5,7 +5,7 @@ import type { CypherEnvironment } from "../Environment";

import type { OnCreateParam } from "./sub-clauses/OnCreate";
import { WithReturn } from "./mixins/WithReturn";
import { WithSet } from "./mixins/WithSet";
import { WithReturn } from "./mixins/clauses/WithReturn";
import { WithSet } from "./mixins/sub-clauses/WithSet";
import type { NodeRef } from "../references/NodeRef";
import { WithPathAssign } from "./mixins/WithPathAssign";
import { WithDelete } from "./mixins/WithDelete";
import { WithDelete } from "./mixins/sub-clauses/WithDelete";
export interface Merge extends WithReturn, WithSet, WithPathAssign, WithDelete {

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

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

const OnCreate_1 = require("./sub-clauses/OnCreate");
const WithReturn_1 = require("./mixins/WithReturn");
const WithReturn_1 = require("./mixins/clauses/WithReturn");
const mixin_1 = require("./utils/mixin");
const WithSet_1 = require("./mixins/WithSet");
const WithSet_1 = require("./mixins/sub-clauses/WithSet");
const compile_cypher_if_exists_1 = require("../utils/compile-cypher-if-exists");
const WithPathAssign_1 = require("./mixins/WithPathAssign");
const WithDelete_1 = require("./mixins/WithDelete");
const WithDelete_1 = require("./mixins/sub-clauses/WithDelete");
/**

@@ -42,3 +42,3 @@ * @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/clauses/merge/)

*/
let Merge = exports.Merge = class Merge extends Clause_1.Clause {
let Merge = class Merge extends Clause_1.Clause {
constructor(pattern) {

@@ -69,4 +69,5 @@ super();

};
exports.Merge = Merge;
exports.Merge = Merge = __decorate([
(0, mixin_1.mixin)(WithReturn_1.WithReturn, WithSet_1.WithSet, WithPathAssign_1.WithPathAssign, WithDelete_1.WithDelete)
], Merge);

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

import { ClauseMixin } from "./ClauseMixin";
import type { Path } from "../../references/Path";
import type { CypherEnvironment } from "../../Environment";
export declare abstract class WithPathAssign extends ClauseMixin {
import { Mixin } from "./Mixin";
export declare abstract class WithPathAssign extends Mixin {
private pathVariable;

@@ -6,0 +6,0 @@ /** Add a path assignment to the pattern

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

exports.WithPathAssign = void 0;
const ClauseMixin_1 = require("./ClauseMixin");
const compile_cypher_if_exists_1 = require("../../utils/compile-cypher-if-exists");
class WithPathAssign extends ClauseMixin_1.ClauseMixin {
const Mixin_1 = require("./Mixin");
class WithPathAssign extends Mixin_1.Mixin {
/** Add a path assignment to the pattern

@@ -27,0 +27,0 @@ * @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/syntax/patterns/#cypher-pattern-path-variables)

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

import { WithOrder } from "./mixins/WithOrder";
import { WithOrder } from "./mixins/sub-clauses/WithOrder";
import type { ProjectionColumn } from "./sub-clauses/Projection";

@@ -3,0 +3,0 @@ import type { CypherEnvironment } from "../Environment";

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

exports.Return = void 0;
const WithOrder_1 = require("./mixins/WithOrder");
const WithOrder_1 = require("./mixins/sub-clauses/WithOrder");
const mixin_1 = require("./utils/mixin");

@@ -38,3 +38,3 @@ const Projection_1 = require("./sub-clauses/Projection");

*/
let Return = exports.Return = class Return extends Clause_1.Clause {
let Return = class Return extends Clause_1.Clause {
constructor(...columns) {

@@ -61,4 +61,5 @@ super();

};
exports.Return = Return;
exports.Return = Return = __decorate([
(0, mixin_1.mixin)(WithOrder_1.WithOrder)
], Return);
import type { CypherEnvironment } from "../Environment";
import type { ProjectionColumn } from "./sub-clauses/Projection";
import { Clause } from "./Clause";
import { WithWith } from "./mixins/WithWith";
import { WithDelete } from "./mixins/WithDelete";
import { WithWith } from "./mixins/clauses/WithWith";
import { WithDelete } from "./mixins/sub-clauses/WithDelete";
export interface Unwind extends WithWith, WithDelete {

@@ -7,0 +7,0 @@ }

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

const Clause_1 = require("./Clause");
const WithWith_1 = require("./mixins/WithWith");
const WithWith_1 = require("./mixins/clauses/WithWith");
const mixin_1 = require("./utils/mixin");
const WithDelete_1 = require("./mixins/WithDelete");
const WithDelete_1 = require("./mixins/sub-clauses/WithDelete");
/**

@@ -39,3 +39,3 @@ * @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/clauses/unwind/)

*/
let Unwind = exports.Unwind = class Unwind extends Clause_1.Clause {
let Unwind = class Unwind extends Clause_1.Clause {
constructor(...columns) {

@@ -56,4 +56,5 @@ super();

};
exports.Unwind = Unwind;
exports.Unwind = Unwind = __decorate([
(0, mixin_1.mixin)(WithWith_1.WithWith, WithDelete_1.WithDelete)
], Unwind);

@@ -1,4 +0,18 @@

import type { ClauseMixin } from "../mixins/ClauseMixin";
type ConstructorType<T> = new (...args: any[]) => T;
type AbstractConstructorType<T> = abstract new (...args: any[]) => T;
export declare function mixin(...mixins: AbstractConstructorType<ClauseMixin>[]): any;
/**
* Decorator for mixins. Support for adding mixins into classes
* Based on https://www.typescriptlang.org/docs/handbook/mixins.html
*
* All "Mixin" classes will be inherited by the decorated class. Note that mixin classes must be abstract
* Typings will not automatically be updated, but exporting an interface with the same name will fix typings
*
* @example
* ```ts
* export interface MyClass extends WithName, WithAge
* \@mixin(WithName, WithAge)
* export class MyClass{}
* ```
*/
export declare function mixin(...mixins: AbstractConstructorType<any>[]): (constructor: ConstructorType<any>) => ConstructorType<any>;
export {};

@@ -22,2 +22,16 @@ "use strict";

exports.mixin = void 0;
/**
* Decorator for mixins. Support for adding mixins into classes
* Based on https://www.typescriptlang.org/docs/handbook/mixins.html
*
* All "Mixin" classes will be inherited by the decorated class. Note that mixin classes must be abstract
* Typings will not automatically be updated, but exporting an interface with the same name will fix typings
*
* @example
* ```ts
* export interface MyClass extends WithName, WithAge
* \@mixin(WithName, WithAge)
* export class MyClass{}
* ```
*/
function mixin(...mixins) {

@@ -29,4 +43,5 @@ return (constructor) => {

exports.mixin = mixin;
// Based on https://www.typescriptlang.org/docs/handbook/mixins.html
/** Applies mixins into a class */
/** Applies mixins into a class
* Based on https://www.typescriptlang.org/docs/handbook/mixins.html
*/
function applyMixins(baseClass, mixins) {

@@ -33,0 +48,0 @@ mixins.forEach((baseCtor) => {

@@ -6,6 +6,6 @@ import type { CypherEnvironment } from "../Environment";

import { Clause } from "./Clause";
import { WithOrder } from "./mixins/WithOrder";
import { WithReturn } from "./mixins/WithReturn";
import { WithWhere } from "./mixins/WithWhere";
import { WithDelete } from "./mixins/WithDelete";
import { WithOrder } from "./mixins/sub-clauses/WithOrder";
import { WithReturn } from "./mixins/clauses/WithReturn";
import { WithWhere } from "./mixins/sub-clauses/WithWhere";
import { WithDelete } from "./mixins/sub-clauses/WithDelete";
export type WithProjection = Variable | [Expr, string | Variable | Literal];

@@ -12,0 +12,0 @@ export interface With extends WithOrder, WithReturn, WithWhere, WithDelete {

@@ -32,7 +32,7 @@ "use strict";

const Clause_1 = require("./Clause");
const WithOrder_1 = require("./mixins/WithOrder");
const WithReturn_1 = require("./mixins/WithReturn");
const WithWhere_1 = require("./mixins/WithWhere");
const WithOrder_1 = require("./mixins/sub-clauses/WithOrder");
const WithReturn_1 = require("./mixins/clauses/WithReturn");
const WithWhere_1 = require("./mixins/sub-clauses/WithWhere");
const mixin_1 = require("./utils/mixin");
const WithDelete_1 = require("./mixins/WithDelete");
const WithDelete_1 = require("./mixins/sub-clauses/WithDelete");
/**

@@ -42,3 +42,3 @@ * @see [Cypher Documentation](https://neo4j.com/docs/cypher-manual/current/clauses/with/)

*/
let With = exports.With = With_1 = class With extends Clause_1.Clause {
let With = With_1 = class With extends Clause_1.Clause {
constructor(...columns) {

@@ -80,4 +80,5 @@ super();

};
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)
], With);
import { Param } from "./references/Param";
import type { NamedReference, Variable } from "./references/Variable";
import type { CypherCompilable } from "./types";
export type EnvPrefix = {

@@ -18,2 +19,3 @@ params?: string;

constructor(prefix?: string | EnvPrefix);
compile(element: CypherCompilable): string;
getReferenceId(reference: Variable | NamedReference): string;

@@ -20,0 +22,0 @@ getParams(): Record<string, unknown>;

@@ -23,2 +23,3 @@ "use strict";

const Param_1 = require("./references/Param");
const is_cypher_compilable_1 = require("./utils/is-cypher-compilable");
/** Hold the internal references of Cypher parameters and variables

@@ -47,2 +48,7 @@ * @group Internal

}
compile(element) {
if (!(0, is_cypher_compilable_1.isCypherCompilable)(element))
throw new Error("Can't compile. Passing a non Cypher Builder element to env.compile");
return element.getCypher(this);
}
getReferenceId(reference) {

@@ -49,0 +55,0 @@ if (this.isNamedReference(reference))

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

import { WithWhere } from "../../clauses/mixins/WithWhere";
import { WithWhere } from "../../clauses/mixins/sub-clauses/WithWhere";
import { CypherASTNode } from "../../CypherASTNode";

@@ -3,0 +3,0 @@ import type { CypherEnvironment } from "../../Environment";

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

exports.ListComprehension = void 0;
const WithWhere_1 = require("../../clauses/mixins/WithWhere");
const WithWhere_1 = require("../../clauses/mixins/sub-clauses/WithWhere");
const mixin_1 = require("../../clauses/utils/mixin");

@@ -37,3 +37,3 @@ const CypherASTNode_1 = require("../../CypherASTNode");

*/
let ListComprehension = exports.ListComprehension = class ListComprehension extends CypherASTNode_1.CypherASTNode {
let ListComprehension = class ListComprehension extends CypherASTNode_1.CypherASTNode {
constructor(variable, listExpr) {

@@ -67,4 +67,5 @@ super();

};
exports.ListComprehension = ListComprehension;
exports.ListComprehension = ListComprehension = __decorate([
(0, mixin_1.mixin)(WithWhere_1.WithWhere)
], ListComprehension);

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

import { WithWhere } from "../../clauses/mixins/WithWhere";
import { WithWhere } from "../../clauses/mixins/sub-clauses/WithWhere";
import { CypherASTNode } from "../../CypherASTNode";

@@ -3,0 +3,0 @@ import type { CypherEnvironment } from "../../Environment";

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

exports.PatternComprehension = void 0;
const WithWhere_1 = require("../../clauses/mixins/WithWhere");
const WithWhere_1 = require("../../clauses/mixins/sub-clauses/WithWhere");
const mixin_1 = require("../../clauses/utils/mixin");

@@ -38,3 +38,3 @@ const CypherASTNode_1 = require("../../CypherASTNode");

*/
let PatternComprehension = exports.PatternComprehension = class PatternComprehension extends CypherASTNode_1.CypherASTNode {
let PatternComprehension = class PatternComprehension extends CypherASTNode_1.CypherASTNode {
constructor(pattern, mapExpr) {

@@ -60,4 +60,5 @@ super();

};
exports.PatternComprehension = PatternComprehension;
exports.PatternComprehension = PatternComprehension = __decorate([
(0, mixin_1.mixin)(WithWhere_1.WithWhere)
], PatternComprehension);
import { Clause } from "../clauses/Clause";
import { WithReturn } from "../clauses/mixins/WithReturn";
import { WithWhere } from "../clauses/mixins/WithWhere";
import { WithWith } from "../clauses/mixins/WithWith";
import { WithReturn } from "../clauses/mixins/clauses/WithReturn";
import { WithWhere } from "../clauses/mixins/sub-clauses/WithWhere";
import { WithWith } from "../clauses/mixins/clauses/WithWith";
import { Projection } from "../clauses/sub-clauses/Projection";

@@ -6,0 +6,0 @@ import type { CypherEnvironment } from "../Environment";

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

const Clause_1 = require("../clauses/Clause");
const WithReturn_1 = require("../clauses/mixins/WithReturn");
const WithWhere_1 = require("../clauses/mixins/WithWhere");
const WithWith_1 = require("../clauses/mixins/WithWith");
const WithReturn_1 = require("../clauses/mixins/clauses/WithReturn");
const WithWhere_1 = require("../clauses/mixins/sub-clauses/WithWhere");
const WithWith_1 = require("../clauses/mixins/clauses/WithWith");
const Projection_1 = require("../clauses/sub-clauses/Projection");

@@ -42,3 +42,3 @@ const mixin_1 = require("../clauses/utils/mixin");

*/
let Yield = exports.Yield = class Yield extends Clause_1.Clause {
let Yield = class Yield extends Clause_1.Clause {
constructor(yieldColumns) {

@@ -64,2 +64,3 @@ super();

};
exports.Yield = Yield;
exports.Yield = Yield = __decorate([

@@ -66,0 +67,0 @@ (0, mixin_1.mixin)(WithReturn_1.WithReturn, WithWhere_1.WithWhere, WithWith_1.WithWith)

@@ -7,2 +7,3 @@ import type { CypherEnvironment } from "../Environment";

* The prefix and suffix will only be added if the resulting Cypher is **not** an empty string
* @deprecated Use `env.compile` in a RawCypher callback instead
*/

@@ -9,0 +10,0 @@ export declare function compileCypher(element: Expr | Clause, env: CypherEnvironment, { prefix, suffix }?: {

@@ -26,2 +26,3 @@ "use strict";

* The prefix and suffix will only be added if the resulting Cypher is **not** an empty string
* @deprecated Use `env.compile` in a RawCypher callback instead
*/

@@ -28,0 +29,0 @@ function compileCypher(element, env, { prefix = "", suffix = "" } = {}) {

{
"name": "@neo4j/cypher-builder",
"version": "1.3.0",
"version": "1.4.0",
"description": "A programmatic API for building Cypher queries for Neo4j",

@@ -47,4 +47,4 @@ "exports": "./dist/index.js",

"@tsconfig/node16": "^16.1.0",
"@types/jest": "29.5.3",
"@types/node": "20.4.9",
"@types/jest": "29.5.4",
"@types/node": "20.5.9",
"@typescript-eslint/eslint-plugin": "^6.0.0",

@@ -55,9 +55,9 @@ "@typescript-eslint/parser": "^6.0.0",

"expect-type": "0.16.0",
"jest": "29.6.2",
"jest": "29.6.4",
"jest-extended": "4.0.1",
"neo4j-driver": "^5.9.2",
"ts-jest": "29.1.1",
"typedoc": "0.24.8",
"typedoc": "0.25.1",
"typescript": "^5.1.6"
}
}

@@ -34,3 +34,3 @@ # Cypher Builder

```cypher
MATCH (this0:`Movie`)
MATCH (this0:Movie)
WHERE this0.title = $param0

@@ -37,0 +37,0 @@ RETURN this0.title

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