Skip to content

Commit

Permalink
Merge pull request #17 from 365talents/fix/fetch-strategy
Browse files Browse the repository at this point in the history
fix: add fetch strategy type
  • Loading branch information
ducher authored Nov 8, 2024
2 parents 246817e + 6c1707d commit eb6de22
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions typings/objection/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ declare namespace Objection {
: ObjectType[KeyType]
: ObjectType[KeyType];
};

/**
* A Pojo version of model.
*/
type ModelObject<M extends Model, O extends ToJsonOptions | undefined = { shallow: false }> =
type ModelObject<M extends Model, O extends ToJsonOptions | undefined = { shallow: false }> =
O extends { shallow: true } ? ShallowModelObject<M> : DeepModelObject<M>;
type DeepModelObject<T extends Model> = ExceptTypeDeep<T, Model>;
type ShallowModelObject<T extends Model> = Pick<T, ShallowDataPropertyNames<T>>;
Expand Down Expand Up @@ -790,6 +790,8 @@ declare namespace Objection {
(cb: OnErrorCallback<QB>): QB;
}

export type FetchStrategy = 'OnlyIdentifiers' | 'Everything' | 'OnlyNeeded';

export interface InsertGraphOptions {
relate?: boolean | string[];
allowRefs?: boolean;
Expand Down Expand Up @@ -820,6 +822,7 @@ declare namespace Objection {
noRelate?: boolean | string[];
noUnrelate?: boolean | string[];
allowRefs?: boolean;
fetchStrategy?: FetchStrategy;
}

interface UpsertGraphMethod<M extends Model> {
Expand Down

0 comments on commit eb6de22

Please sign in to comment.