@mikro-orm/sql
Advanced tools
+2
-2
| { | ||
| "name": "@mikro-orm/sql", | ||
| "version": "7.0.0-dev.256", | ||
| "version": "7.0.0-dev.257", | ||
| "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.256" | ||
| "@mikro-orm/core": "7.0.0-dev.257" | ||
| } | ||
| } |
@@ -1,2 +0,2 @@ | ||
| import { type AnyEntity, type AutoPath, type ConnectionType, type Dictionary, type EntityData, type EntityKey, type EntityManager, type EntityMetadata, type EntityName, type EntityProperty, type ExpandProperty, type FilterObject, type FilterOptions, type FilterValue, type FlushMode, type GroupOperator, type Loaded, LockMode, type LoggingOptions, type MetadataStorage, type ObjectQuery, PopulateHint, type PopulateOptions, type PopulatePath, QueryFlag, type QueryOrderKeysFlat, type QueryOrderMap, type QueryResult, RawQueryFragment, type Raw, type RequiredEntityData, type Scalar, type Subquery, type Transaction } from '@mikro-orm/core'; | ||
| import { type AnyEntity, type AutoPath, type Collection, type ConnectionType, type Dictionary, type EntityData, type EntityDTOFlat, type EntityDTOProp, type EntityKey, type EntityManager, type EntityMetadata, type EntityName, type EntityProperty, type ExpandProperty, type FilterObject, type FilterOptions, type FilterValue, type FlushMode, type GroupOperator, type Loaded, LockMode, type LoggingOptions, type MetadataStorage, type PrimaryProperty, type ObjectQuery, PopulateHint, type PopulateOptions, type PopulatePath, QueryFlag, type QueryOrderKeysFlat, type QueryOrderMap, type QueryResult, RawQueryFragment, type Raw, type RequiredEntityData, type Scalar, type SerializeDTO, type Subquery, type Transaction } from '@mikro-orm/core'; | ||
| import { JoinType, QueryType } from './enums.js'; | ||
@@ -851,6 +851,32 @@ import type { AbstractSqlDriver } from '../AbstractSqlDriver.js'; | ||
| } | ||
| /** | ||
| * @internal Optimized DTO type for execute(). | ||
| * Bypasses the double mapped type of EntityDTO<Loaded<T, H, F>> by using DirectDTO | ||
| * which only iterates selected keys instead of all entity keys. | ||
| * | ||
| * - Wildcard, no joins: EntityDTO<T> | ||
| * - Selected fields, no joins: DirectDTO<T, F> (~132x faster than Pick<EntityDTO<T>, F>) | ||
| * - Wildcard + single-level join: Omit<EntityDTO<T>> + override populated relations | ||
| * - Selected fields + single-level join: DirectDTO for root + DirectDTO for joined (~60x faster) | ||
| * - Wildcard + nested joins: uses SerializeDTO<T, H> (~40x faster than EntityDTO<Loaded<T, H>>) | ||
| * - Fields + nested joins: falls back to EntityDTO<Loaded<T, H, F>> | ||
| */ | ||
| type DirectDTO<T, F extends keyof T> = { | ||
| [K in F]: EntityDTOProp<T, NonNullable<T[K]>> | Extract<T[K], null | undefined>; | ||
| }; | ||
| type PopulatedDTO<T, K extends keyof T> = NonNullable<T[K]> extends Collection<infer U> ? EntityDTOFlat<U & object>[] : EntityDTOFlat<ExpandProperty<T[K]>>; | ||
| type SubFields<F extends string, Rel extends string> = F extends `${Rel}.${infer Sub}` ? Sub : never; | ||
| type RootFields<F extends string, H extends string> = F extends `${string}.${string}` ? F extends `${H}.${string}` ? never : F : F; | ||
| type JoinDTO<T, K extends keyof T, F extends string> = NonNullable<T[K]> extends Collection<infer U> ? SubFields<F, K & string> extends never ? EntityDTOProp<T, Collection<U>> : DirectDTO<U, (SubFields<F, K & string> | PrimaryProperty<U>) & keyof U>[] : SubFields<F, K & string> extends never ? EntityDTOProp<T, T[K]> : DirectDTO<NonNullable<T[K]>, (SubFields<F, K & string> | PrimaryProperty<NonNullable<T[K]>>) & keyof NonNullable<T[K]>> | Extract<T[K], null | undefined>; | ||
| type ExecuteDTO<T, H extends string, F extends string> = [ | ||
| H | ||
| ] extends [never] ? [F] extends ['*'] ? EntityDTOFlat<T> : DirectDTO<T, F & keyof T> : [F] extends ['*'] ? true extends (H extends `${string}.${string}` ? true : false) ? SerializeDTO<T, H> : Omit<EntityDTOFlat<T>, H & keyof EntityDTOFlat<T>> & { | ||
| [K in H & keyof T as K & keyof EntityDTOFlat<T>]: PopulatedDTO<T, K> | Extract<T[K], null | undefined>; | ||
| } : true extends (H extends `${string}.${string}` ? true : false) ? EntityDTOFlat<Loaded<T, H, F>> : DirectDTO<T, (RootFields<F, H> | PrimaryProperty<T>) & keyof T> & { | ||
| [K in H & keyof T]: JoinDTO<T, K, F>; | ||
| }; | ||
| export interface SelectQueryBuilder<Entity extends object = AnyEntity, RootAlias extends string = never, Hint extends string = never, Context extends object = never, RawAliases extends string = never, Fields extends string = '*'> extends QueryBuilder<Entity, RootAlias, Hint, Context, RawAliases, Fields> { | ||
| execute<Result = Entity[]>(method?: 'all' | 'get' | 'run', mapResults?: boolean): Promise<Result>; | ||
| execute<Result = Entity[]>(method: 'all', mapResults?: boolean): Promise<Result>; | ||
| execute<Result = Entity>(method: 'get', mapResults?: boolean): Promise<Result>; | ||
| execute<Result = ExecuteDTO<Entity, Hint, Fields>[]>(method?: 'all' | 'get' | 'run', mapResults?: boolean): Promise<Result>; | ||
| execute<Result = ExecuteDTO<Entity, Hint, Fields>[]>(method: 'all', mapResults?: boolean): Promise<Result>; | ||
| execute<Result = ExecuteDTO<Entity, Hint, Fields>>(method: 'get', mapResults?: boolean): Promise<Result>; | ||
| execute<Result = QueryResult<Entity>>(method: 'run', mapResults?: boolean): Promise<Result>; | ||
@@ -857,0 +883,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
909214
0.27%16125
0.17%89
1.14%