@mikro-orm/knex 6.0.2-dev.8 → 6.0.2-dev.9

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/knex",
3
- "version": "6.0.2-dev.8",
3
+ "version": "6.0.2-dev.9",
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,6 +66,6 @@
66
66
  "@mikro-orm/core": "^6.0.1"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "6.0.2-dev.8"
69
+ "@mikro-orm/core": "6.0.2-dev.9"
70
70
  }
71
71
  }
@@ -27,8 +27,11 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
27
27
  throw new Error('Mixing collection operators with other filters is not allowed.');
28
28
  }
29
29
  const payload = this.payload[key].unwrap();
30
- const sub = qb.clone(true).innerJoin(this.key, qb.getNextAlias(this.prop.type));
31
- sub.select(this.prop.targetMeta.primaryKeys);
30
+ const sub = qb
31
+ .clone(true)
32
+ .from(this.parent.entityName)
33
+ .innerJoin(this.key, qb.getNextAlias(this.prop.type))
34
+ .select(this.prop.targetMeta.primaryKeys);
32
35
  if (key === '$every') {
33
36
  sub.where({ $not: { [this.key]: payload } });
34
37
  }
package/typings.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Knex } from 'knex';
2
- import type { CheckCallback, Dictionary, EntityProperty, GroupOperator, RawQueryFragment, QBFilterQuery, QueryOrderMap, Type, QueryFlag } from '@mikro-orm/core';
2
+ import type { CheckCallback, Dictionary, EntityProperty, GroupOperator, RawQueryFragment, QBFilterQuery, QueryOrderMap, Type, QueryFlag, AnyEntity, EntityName } from '@mikro-orm/core';
3
3
  import type { JoinType, QueryType } from './query/enums';
4
4
  import type { DatabaseSchema, DatabaseTable } from './schema';
5
5
  export interface Table {
@@ -120,6 +120,7 @@ export interface IQueryBuilder<T> {
120
120
  _fields?: Field<T>[];
121
121
  select(fields: Field<T> | Field<T>[], distinct?: boolean): this;
122
122
  addSelect(fields: string | string[]): this;
123
+ from<T extends AnyEntity<T> = AnyEntity>(target: EntityName<T> | IQueryBuilder<T>, aliasName?: string): IQueryBuilder<T>;
123
124
  insert(data: any): this;
124
125
  update(data: any): this;
125
126
  delete(cond?: QBFilterQuery): this;