File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
src/core/database/query-augmentation Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 1
- import { ClauseCollection , Query } from 'cypher-query-builder' ;
1
+ import { Clause , ClauseCollection , Query } from 'cypher-query-builder' ;
2
+ import type { ParameterBag } from 'cypher-query-builder/dist/typings/parameter-bag' ;
2
3
3
4
export class SubClauseCollection extends ClauseCollection {
5
+ useParameterBag ( newBag : ParameterBag ) {
6
+ super . useParameterBag ( newBag ) ;
7
+ this . assignBagRecursive ( this , newBag ) ;
8
+ }
9
+
10
+ private assignBagRecursive ( clause : Clause , newBag : ParameterBag ) {
11
+ // @ts -expect-error protected, but we want it to reference the outer one
12
+ // without having to import the parameters.
13
+ clause . parameterBag = newBag ;
14
+ if ( clause instanceof ClauseCollection ) {
15
+ for ( const sub of clause . getClauses ( ) ) {
16
+ this . assignBagRecursive ( sub , newBag ) ;
17
+ }
18
+ }
19
+ }
20
+
4
21
build ( ) {
5
22
return this . clauses
6
23
. flatMap ( ( clause ) => {
You can’t perform that action at this time.
0 commit comments