@carbonorm/carbonnode 3.5.2 → 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.
- package/dist/index.cjs.js +39 -36
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +39 -36
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/api/executors/Executor.ts +1 -2
- package/src/api/executors/HttpExecutor.ts +1 -2
- package/src/api/executors/SqlExecutor.ts +4 -1
- package/src/api/orm/builders/AggregateBuilder.ts +1 -2
- package/src/api/orm/builders/ConditionBuilder.ts +6 -3
- package/src/api/orm/builders/JoinBuilder.ts +1 -2
- package/src/api/orm/builders/PaginationBuilder.ts +1 -2
- package/src/api/restRequest.ts +2 -0
- package/src/api/utils/logger.ts +0 -4
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
52
|
+
this.config.verbose && console.log(`[PAGINATION] ${sql.trim()}`);
|
|
54
53
|
return sql;
|
|
55
54
|
}
|
|
56
55
|
}
|
package/src/api/restRequest.ts
CHANGED
|
@@ -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');
|
package/src/api/utils/logger.ts
CHANGED
|
@@ -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
|
|