@mikro-orm/sql
Advanced tools
+2
-2
| { | ||
| "name": "@mikro-orm/sql", | ||
| "version": "7.0.0-dev.121", | ||
| "version": "7.0.0-dev.122", | ||
| "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.", | ||
@@ -59,4 +59,4 @@ "type": "module", | ||
| "peerDependencies": { | ||
| "@mikro-orm/core": "7.0.0-dev.121" | ||
| "@mikro-orm/core": "7.0.0-dev.122" | ||
| } | ||
| } |
@@ -24,3 +24,6 @@ import { type EntityKey, type EntityProperty, type MetadataStorage, type RawQueryFragmentSymbol, type EntityName } from '@mikro-orm/core'; | ||
| renameFieldToPK<T>(qb: IQueryBuilder<T>, ownerAlias?: string): string; | ||
| getPath(addIndex?: boolean): string; | ||
| getPath(opts?: { | ||
| addIndex?: boolean; | ||
| parentPath?: string; | ||
| }): string; | ||
| private isPivotJoin; | ||
@@ -27,0 +30,0 @@ getPivotPath(path: string): string; |
@@ -79,7 +79,7 @@ import { RawQueryFragment, ReferenceKind, Utils, inspect, } from '@mikro-orm/core'; | ||
| } | ||
| getPath(addIndex = false) { | ||
| getPath(opts) { | ||
| // use index on parent only if we are processing to-many relation | ||
| const addParentIndex = this.prop && [ReferenceKind.ONE_TO_MANY, ReferenceKind.MANY_TO_MANY].includes(this.prop.kind); | ||
| const parentPath = this.parent?.getPath(addParentIndex) ?? Utils.className(this.entityName); | ||
| const index = addIndex && this.index != null ? `[${this.index}]` : ''; | ||
| const parentPath = opts?.parentPath ?? this.parent?.getPath({ addIndex: addParentIndex }) ?? Utils.className(this.entityName); | ||
| const index = opts?.addIndex && this.index != null ? `[${this.index}]` : ''; | ||
| // ignore group operators to allow easier mapping (e.g. for orderBy) | ||
@@ -86,0 +86,0 @@ const key = this.key && !RawQueryFragment.isKnownFragmentSymbol(this.key) && !['$and', '$or', '$not'].includes(this.key) ? '.' + this.key : ''; |
@@ -10,3 +10,3 @@ import { ALIAS_REPLACEMENT, GroupOperator, QueryFlag, raw, RawQueryFragment, ReferenceKind, Utils, } from '@mikro-orm/core'; | ||
| const matchPopulateJoins = options?.matchPopulateJoins || (this.prop && [ReferenceKind.MANY_TO_ONE, ReferenceKind.ONE_TO_ONE].includes(this.prop.kind)); | ||
| const nestedAlias = qb.getAliasForJoinPath(this.getPath(), { ...options, matchPopulateJoins }); | ||
| const nestedAlias = qb.getAliasForJoinPath(this.getPath(options), { ...options, matchPopulateJoins }); | ||
| const ownerAlias = options?.alias || qb.alias; | ||
@@ -121,3 +121,3 @@ const keys = Utils.getObjectQueryKeys(this.payload); | ||
| willAutoJoin(qb, alias, options) { | ||
| const nestedAlias = qb.getAliasForJoinPath(this.getPath(), options); | ||
| const nestedAlias = qb.getAliasForJoinPath(this.getPath(options), options); | ||
| const ownerAlias = alias || qb.alias; | ||
@@ -124,0 +124,0 @@ const keys = Utils.getObjectQueryKeys(this.payload); |
@@ -277,3 +277,5 @@ import { helper, inspect, isRaw, LoadStrategy, LockMode, PopulateHint, QueryFlag, QueryHelper, raw, RawQueryFragment, Reference, ReferenceKind, serialize, Utils, ValidationError, } from '@mikro-orm/core'; | ||
| filterOptions = QueryHelper.mergePropertyFilters(join.prop.filters, filterOptions); | ||
| const cond = await em.applyFilters(join.prop.targetMeta.class, join.cond, filterOptions, 'read'); | ||
| let cond = await em.applyFilters(join.prop.targetMeta.class, join.cond, filterOptions, 'read'); | ||
| const criteriaNode = CriteriaNodeFactory.createNode(this.metadata, join.prop.targetMeta.class, cond); | ||
| cond = criteriaNode.process(this, { matchPopulateJoins: true, filter: true, alias: join.alias, ignoreBranching: true, parentPath: join.path }); | ||
| if (Utils.hasObjectKeys(cond) || RawQueryFragment.hasObjectFragments(cond)) { | ||
@@ -280,0 +282,0 @@ // remove nested filters, we only care about scalars here, nesting would require another join branch |
@@ -11,3 +11,3 @@ import { ARRAY_OPERATORS, ReferenceKind } from '@mikro-orm/core'; | ||
| const matchPopulateJoins = options?.matchPopulateJoins || (this.prop && [ReferenceKind.MANY_TO_ONE, ReferenceKind.ONE_TO_ONE].includes(this.prop.kind)); | ||
| const nestedAlias = qb.getAliasForJoinPath(this.getPath(), { ...options, matchPopulateJoins }); | ||
| const nestedAlias = qb.getAliasForJoinPath(this.getPath(options), { ...options, matchPopulateJoins }); | ||
| if (this.shouldJoin(qb, nestedAlias)) { | ||
@@ -14,0 +14,0 @@ const path = this.getPath(); |
+4
-1
@@ -179,2 +179,3 @@ import type { Generated, Kysely } from 'kysely'; | ||
| filter?: boolean; | ||
| parentPath?: string; | ||
| } | ||
@@ -194,3 +195,5 @@ export interface ICriteriaNode<T extends object> { | ||
| renameFieldToPK<T>(qb: IQueryBuilder<T>, ownerAlias?: string): string; | ||
| getPath(addIndex?: boolean): string; | ||
| getPath(opts?: { | ||
| addIndex?: boolean; | ||
| }): string; | ||
| getPivotPath(path: string): string; | ||
@@ -197,0 +200,0 @@ } |
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
811042
0.05%13320
0.06%