@carbonorm/carbonnode 3.5.1 → 3.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,4 @@
1
1
  import {C6C} from "api/C6Constants";
2
- import isVerbose from "../../../variables/isVerbose";
3
2
  import {OrmGenerics} from "../../types/ormGenerics";
4
3
  import {DetermineResponseDataType} from "../../types/ormInterfaces";
5
4
  import {convertHexIfBinary, SqlBuilderResult} from "../utils/sqlUtils";
@@ -111,7 +110,7 @@ export abstract class ConditionBuilder<
111
110
  throw new Error(`MATCH_AGAINST requires a table reference as the left operand. Column '${column}' is not a valid table reference.`);
112
111
  }
113
112
  const matchClause = `(MATCH(${column}) ${againstClause})`;
114
- isVerbose() && console.log(`[MATCH_AGAINST] ${matchClause}`);
113
+ this.config.verbose && console.log(`[MATCH_AGAINST] ${matchClause}`);
115
114
  return matchClause;
116
115
  }
117
116
 
@@ -141,6 +140,10 @@ export abstract class ConditionBuilder<
141
140
  return `(${column}) ${op} ${value}`;
142
141
  }
143
142
 
143
+ if (leftIsRef && !rightIsRef) {
144
+ return `(${column}) ${op} ${this.addParam(params, column, value)}`;
145
+ }
146
+
144
147
  if (rightIsRef) {
145
148
  return `(${this.addParam(params, column, column)}) ${op} ${value}`;
146
149
  }
@@ -195,7 +198,7 @@ export abstract class ConditionBuilder<
195
198
  const clause = this.buildBooleanJoinedConditions(whereArg, true, params);
196
199
  if (!clause) return '';
197
200
  const trimmed = clause.replace(/^\((.*)\)$/, '$1');
198
- isVerbose() && console.log(`[WHERE] ${trimmed}`);
201
+ this.config.verbose && console.log(`[WHERE] ${trimmed}`);
199
202
  return ` WHERE ${trimmed}`;
200
203
  }
201
204
  }
@@ -1,4 +1,3 @@
1
- import isVerbose from "../../../variables/isVerbose";
2
1
  import {OrmGenerics} from "../../types/ormGenerics";
3
2
  import {ConditionBuilder} from "./ConditionBuilder";
4
3
 
@@ -18,7 +17,7 @@ export abstract class JoinBuilder<G extends OrmGenerics> extends ConditionBuilde
18
17
  }
19
18
  }
20
19
 
21
- isVerbose() && console.log(`[JOIN] ${sql.trim()}`);
20
+ this.config.verbose && console.log(`[JOIN] ${sql.trim()}`);
22
21
 
23
22
  return sql;
24
23
  }
@@ -1,5 +1,4 @@
1
1
  import {C6Constants} from "api/C6Constants";
2
- import isVerbose from "../../../variables/isVerbose";
3
2
  import {OrmGenerics} from "../../types/ormGenerics";
4
3
  import {JoinBuilder} from "./JoinBuilder";
5
4
 
@@ -50,7 +49,7 @@ export abstract class PaginationBuilder<G extends OrmGenerics> extends JoinBuild
50
49
  sql += ` LIMIT ${offset}, ${lim}`;
51
50
  }
52
51
 
53
- isVerbose() && console.log(`[PAGINATION] ${sql.trim()}`);
52
+ this.config.verbose && console.log(`[PAGINATION] ${sql.trim()}`);
54
53
  return sql;
55
54
  }
56
55
  }
@@ -32,6 +32,8 @@ export default function restRequest<
32
32
 
33
33
  const config = typeof configX === "function" ? configX() : configX;
34
34
 
35
+ config.verbose ??= true; // Default to verbose logging if not set
36
+
35
37
  // SQL path if on Node with a provided pool
36
38
  if (isNode() && config.mysqlPool) {
37
39
  const {SqlExecutor} = await import('./executors/SqlExecutor');
@@ -1,17 +1,13 @@
1
- import isVerbose from "variables/isVerbose";
2
-
3
1
  /**
4
2
  * Conditionally group a log if verbose.
5
3
  */
6
4
  export function group(title: string, data?: any): void {
7
- if (!isVerbose()) return;
8
5
  console.groupCollapsed(`%c${title}`, "color: #007acc");
9
6
  if (data !== undefined) console.log(data);
10
7
  console.groupEnd();
11
8
  }
12
9
 
13
10
  export function info(message: string, ...optional: any[]): void {
14
- if (!isVerbose()) return;
15
11
  console.info(`%cINFO: ${message}`, "color: #0a0", ...optional);
16
12
  }
17
13