diff --git a/packages/repository/src/query.ts b/packages/repository/src/query.ts index 822792206201..7ee845a9973d 100644 --- a/packages/repository/src/query.ts +++ b/packages/repository/src/query.ts @@ -169,9 +169,7 @@ export type Fields = {[P in keyof MT]?: boolean}; * Example: * `{relation: 'aRelationName', scope: {}}` */ -export interface Inclusion { - // ^^^ TODO(semver-major): remove the generic argument - +export interface Inclusion { relation: string; // Technically, we should restrict the filter to target model. @@ -220,7 +218,7 @@ export interface Filter { /** * To include related objects */ - include?: Inclusion[]; + include?: Inclusion[]; } /** @@ -561,7 +559,7 @@ export class FilterBuilder { * @param i - A relation name, an array of relation names, or an `Inclusion` * object for the relation/scope definitions */ - include(...i: (string | string[] | Inclusion)[]): this { + include(...i: (string | string[] | Inclusion)[]): this { if (this.filter.include == null) { this.filter.include = []; } diff --git a/packages/repository/src/relations/has-many/has-many.inclusion-resolver.ts b/packages/repository/src/relations/has-many/has-many.inclusion-resolver.ts index 12b5449c14a5..7114cb68807b 100644 --- a/packages/repository/src/relations/has-many/has-many.inclusion-resolver.ts +++ b/packages/repository/src/relations/has-many/has-many.inclusion-resolver.ts @@ -42,7 +42,7 @@ export function createHasManyInclusionResolver< return async function fetchHasManyModels( entities: Entity[], - inclusion: Inclusion, + inclusion: Inclusion, options?: Options, ): Promise<((Target & TargetRelations)[] | undefined)[]> { if (!entities.length) return []; diff --git a/packages/repository/src/relations/has-one/has-one.inclusion-resolver.ts b/packages/repository/src/relations/has-one/has-one.inclusion-resolver.ts index 975223ceede0..15fca5a14af2 100644 --- a/packages/repository/src/relations/has-one/has-one.inclusion-resolver.ts +++ b/packages/repository/src/relations/has-one/has-one.inclusion-resolver.ts @@ -39,7 +39,7 @@ export function createHasOneInclusionResolver< return async function fetchHasOneModel( entities: Entity[], - inclusion: Inclusion, + inclusion: Inclusion, options?: Options, ): Promise<((Target & TargetRelations) | undefined)[]> { if (!entities.length) return []; diff --git a/packages/repository/src/relations/relation.helpers.ts b/packages/repository/src/relations/relation.helpers.ts index 492ab71d2cc1..9c2d82de73a7 100644 --- a/packages/repository/src/relations/relation.helpers.ts +++ b/packages/repository/src/relations/relation.helpers.ts @@ -11,10 +11,10 @@ import { Entity, EntityCrudRepository, Filter, + FilterBuilder, Inclusion, Options, Where, - FilterBuilder, } from '..'; const debug = debugFactory('loopback:repository:relation-helpers'); @@ -84,7 +84,7 @@ export async function includeRelatedModels< >( targetRepository: EntityCrudRepository, entities: T[], - include?: Inclusion[], + include?: Inclusion[], options?: Options, ): Promise<(T & Relations)[]> { const result = entities as (T & Relations)[]; diff --git a/packages/repository/src/relations/relation.types.ts b/packages/repository/src/relations/relation.types.ts index b8f81dc67b92..07dfc0f96058 100644 --- a/packages/repository/src/relations/relation.types.ts +++ b/packages/repository/src/relations/relation.types.ts @@ -3,7 +3,7 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -import {AnyObject, Options} from '../common-types'; +import {Options} from '../common-types'; import {Entity} from '../model'; import {Inclusion} from '../query'; import {TypeResolver} from '../type-resolver'; @@ -180,7 +180,7 @@ export type InclusionResolver = ( /** * Inclusion requested by the user (e.g. scope constraints to apply). */ - inclusion: Inclusion, + inclusion: Inclusion, /** * Generic options object, e.g. carrying the Transaction object. */ diff --git a/packages/repository/src/repositories/legacy-juggler-bridge.ts b/packages/repository/src/repositories/legacy-juggler-bridge.ts index d94a60c7f15e..041fbbba587c 100644 --- a/packages/repository/src/repositories/legacy-juggler-bridge.ts +++ b/packages/repository/src/repositories/legacy-juggler-bridge.ts @@ -530,7 +530,7 @@ export class DefaultCrudRepository< */ protected async includeRelatedModels( entities: T[], - include?: Inclusion[], + include?: Inclusion[], options?: Options, ): Promise<(T & Relations)[]> { return includeRelatedModels(this, entities, include, options);