UNPKG

@neo4j/cypher-builder

Version:

A programmatic API for building Cypher queries for Neo4j

65 lines (64 loc) 2.95 kB
import type { CypherEnvironment } from "../Environment"; import type { Variable } from "../references/Variable"; import { Clause } from "./Clause"; import { WithCreate } from "./mixins/clauses/WithCreate"; import { WithMatch } from "./mixins/clauses/WithMatch"; import { WithMerge } from "./mixins/clauses/WithMerge"; import { WithReturn } from "./mixins/clauses/WithReturn"; import { WithUnwind } from "./mixins/clauses/WithUnwind"; import { WithWith } from "./mixins/clauses/WithWith"; import { WithDelete } from "./mixins/sub-clauses/WithDelete"; import { WithOrder } from "./mixins/sub-clauses/WithOrder"; import { WithSetRemove } from "./mixins/sub-clauses/WithSetRemove"; export interface Call extends WithReturn, WithWith, WithUnwind, WithSetRemove, WithDelete, WithMatch, WithCreate, WithMerge, WithOrder { } /** @group Subqueries */ export type CallInTransactionOptions = { ofRows?: number; onError?: "continue" | "break" | "fail"; concurrentTransactions?: number; /** Adds `ON ERROR RETRY`, if using number, it will generate `ON ERROR RETRY FOR x SECONDS` * @since Neo4j 2025.03 */ retry?: number | boolean; }; /** Adds a `CALL` subquery * @param subquery - A clause to be wrapped in a `CALL` clause * @param variableScope - A list of variables to pass to the scope of the clause: `CALL (var0) {` * @see {@link https://neo4j.com/docs/cypher-manual/current/clauses/call-subquery/ | Cypher Documentation} * @group Subqueries */ export declare class Call extends Clause { private readonly subquery; private _importWith?; private inTransactionsConfig?; private readonly variableScope?; private _optional; constructor(subquery: Clause, variableScope?: Variable[] | "*"); /** Adds a `WITH` statement inside `CALL {`, this `WITH` can is used to import variables outside of the subquery * @see {@link https://neo4j.com/docs/cypher-manual/current/subqueries/call-subquery/#call-importing-variables | Cypher Documentation} * @deprecated Use constructor parameter `variableScope` instead */ importWith(...params: Array<Variable | "*">): this; inTransactions(config?: CallInTransactionOptions): this; /** Makes the subquery an OPTIONAL CALL * @see {@link https://neo4j.com/docs/cypher-manual/current/subqueries/call-subquery/#optional-call | Cypher Documentation} * @since Neo4j 5.24 */ optional(): this; /** @internal */ getCypher(env: CypherEnvironment): string; private getSubqueryCypher; private generateVariableScopeStr; private generateInTransactionsStr; private generateRetryErrorStr; private getOnErrorStr; } /** * @see {@link https://neo4j.com/docs/cypher-manual/current/subqueries/call-subquery/#optional-call | Cypher Documentation} * @group Subqueries * @since Neo4j 5.24 */ export declare class OptionalCall extends Call { constructor(subquery: Clause, variableScope?: Variable[] | "*"); }