@mikro-orm/sql 7.2.6-dev.31 → 7.2.6-dev.33
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/sql",
|
|
3
|
-
"version": "7.2.6-dev.
|
|
3
|
+
"version": "7.2.6-dev.33",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@mikro-orm/core": "^7.2.5"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.2.6-dev.
|
|
56
|
+
"@mikro-orm/core": "7.2.6-dev.33"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|
|
@@ -121,6 +121,8 @@ export declare class NativeQueryBuilder implements Subquery {
|
|
|
121
121
|
lockMode(lockMode: LockMode, lockTables?: string[]): this;
|
|
122
122
|
comment(comment: string | string[]): this;
|
|
123
123
|
hintComment(comment: string | string[]): this;
|
|
124
|
+
/** Comments are interpolated verbatim, so a terminator or a `?` placeholder inside one would corrupt the query. */
|
|
125
|
+
private validateComments;
|
|
124
126
|
setFlags(flags: Set<QueryFlag>): this;
|
|
125
127
|
clear(clause: keyof Options): this;
|
|
126
128
|
wrap(prefix: string, suffix: string): this;
|
|
@@ -258,14 +258,23 @@ export class NativeQueryBuilder {
|
|
|
258
258
|
}
|
|
259
259
|
comment(comment) {
|
|
260
260
|
this.options.comment ??= [];
|
|
261
|
-
this.options.comment.push(...
|
|
261
|
+
this.options.comment.push(...this.validateComments(comment));
|
|
262
262
|
return this;
|
|
263
263
|
}
|
|
264
264
|
hintComment(comment) {
|
|
265
265
|
this.options.hintComment ??= [];
|
|
266
|
-
this.options.hintComment.push(...
|
|
266
|
+
this.options.hintComment.push(...this.validateComments(comment));
|
|
267
267
|
return this;
|
|
268
268
|
}
|
|
269
|
+
/** Comments are interpolated verbatim, so a terminator or a `?` placeholder inside one would corrupt the query. */
|
|
270
|
+
validateComments(comment) {
|
|
271
|
+
const comments = Utils.asArray(comment);
|
|
272
|
+
const invalid = comments.find(c => c.includes('/*') || c.includes('*/') || c.includes('?'));
|
|
273
|
+
if (invalid != null) {
|
|
274
|
+
throw new Error(`Query comments cannot contain '/*', '*/' or '?', got: '${invalid}'`);
|
|
275
|
+
}
|
|
276
|
+
return comments;
|
|
277
|
+
}
|
|
269
278
|
setFlags(flags) {
|
|
270
279
|
this.options.flags = flags;
|
|
271
280
|
return this;
|