@mikro-orm/knex 6.4.1-dev.1 → 6.4.1-dev.11
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.
|
@@ -10,7 +10,7 @@ export declare class PivotCollectionPersister<Entity extends object> {
|
|
|
10
10
|
private readonly deletes;
|
|
11
11
|
private readonly batchSize;
|
|
12
12
|
private order;
|
|
13
|
-
constructor(meta: EntityMetadata<Entity>, driver: AbstractSqlDriver, ctx?: Transaction, schema?: string | undefined);
|
|
13
|
+
constructor(meta: EntityMetadata<Entity>, driver: AbstractSqlDriver, ctx?: Transaction | undefined, schema?: string | undefined);
|
|
14
14
|
enqueueUpdate(prop: EntityProperty<Entity>, insertDiff: Primary<Entity>[][], deleteDiff: Primary<Entity>[][] | boolean, pks: Primary<Entity>[]): void;
|
|
15
15
|
private enqueueInsert;
|
|
16
16
|
private enqueueDelete;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.4.1-dev.
|
|
3
|
+
"version": "6.4.1-dev.11",
|
|
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
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@mikro-orm/core": "^6.4.0"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.4.1-dev.
|
|
69
|
+
"@mikro-orm/core": "6.4.1-dev.11",
|
|
70
70
|
"better-sqlite3": "*",
|
|
71
71
|
"libsql": "*",
|
|
72
72
|
"mariadb": "*"
|
|
@@ -49,6 +49,9 @@ class CriteriaNodeFactory {
|
|
|
49
49
|
static createObjectItemNode(metadata, entityName, node, payload, key, meta) {
|
|
50
50
|
const prop = meta?.properties[key];
|
|
51
51
|
const childEntity = prop && prop.kind !== core_1.ReferenceKind.SCALAR ? prop.type : entityName;
|
|
52
|
+
if (prop?.customType instanceof core_1.JsonType) {
|
|
53
|
+
return this.createScalarNode(metadata, childEntity, payload[key], node, key);
|
|
54
|
+
}
|
|
52
55
|
if (prop?.kind !== core_1.ReferenceKind.EMBEDDED) {
|
|
53
56
|
return this.createNode(metadata, childEntity, payload[key], node, key);
|
|
54
57
|
}
|
package/query/QueryBuilder.js
CHANGED
|
@@ -529,7 +529,7 @@ class QueryBuilder {
|
|
|
529
529
|
core_1.Utils.runIfNotEmpty(() => qb.offset(this._offset), this._offset);
|
|
530
530
|
core_1.Utils.runIfNotEmpty(() => this._comments.forEach(comment => qb.comment(comment)), this._comments);
|
|
531
531
|
core_1.Utils.runIfNotEmpty(() => this._hintComments.forEach(comment => qb.hintComment(comment)), this._hintComments);
|
|
532
|
-
core_1.Utils.runIfNotEmpty(() => this.helper.appendOnConflictClause(
|
|
532
|
+
core_1.Utils.runIfNotEmpty(() => this.helper.appendOnConflictClause(enums_1.QueryType.UPSERT, this._onConflict, qb), this._onConflict);
|
|
533
533
|
if (this.type === enums_1.QueryType.TRUNCATE && this.platform.usesCascadeStatement()) {
|
|
534
534
|
return this._query.qb = this.knex.raw(qb.toSQL().toNative().sql + ' cascade');
|
|
535
535
|
}
|
|
@@ -768,6 +768,7 @@ class QueryBuilder {
|
|
|
768
768
|
case enums_1.QueryType.INSERT:
|
|
769
769
|
case enums_1.QueryType.UPDATE:
|
|
770
770
|
case enums_1.QueryType.DELETE:
|
|
771
|
+
case enums_1.QueryType.UPSERT:
|
|
771
772
|
case enums_1.QueryType.TRUNCATE:
|
|
772
773
|
return this.execute('run').then(onfulfilled, onrejected);
|
|
773
774
|
case enums_1.QueryType.COUNT:
|
|
@@ -93,7 +93,7 @@ class QueryBuilderHelper {
|
|
|
93
93
|
}
|
|
94
94
|
return this.knex.raw(`${value}${as}`);
|
|
95
95
|
}
|
|
96
|
-
if (prop?.hasConvertToJSValueSQL) {
|
|
96
|
+
if (prop?.hasConvertToJSValueSQL && type !== enums_1.QueryType.UPSERT) {
|
|
97
97
|
let valueSQL;
|
|
98
98
|
if (prop.fieldNames.length > 1 && fkIdx !== -1) {
|
|
99
99
|
const fk = prop.targetMeta.getPrimaryProps()[fkIdx];
|
|
@@ -736,7 +736,7 @@ class QueryBuilderHelper {
|
|
|
736
736
|
const meta = this.metadata.get(this.entityName);
|
|
737
737
|
const tableName = this.driver.getTableName(meta, { schema }, false);
|
|
738
738
|
for (const key of Object.keys(cond)) {
|
|
739
|
-
const mapped = this.mapper(key, enums_1.QueryType.
|
|
739
|
+
const mapped = this.mapper(key, enums_1.QueryType.UPSERT);
|
|
740
740
|
core_1.Utils.renameKey(cond, key, tableName + '.' + mapped);
|
|
741
741
|
}
|
|
742
742
|
return cond;
|
package/query/enums.d.ts
CHANGED
package/query/enums.js
CHANGED