- computedField<T, P1, P2>(options: {
compute: ((record: Selector<{ [ Field in string | number | symbol]?: true | (T["ast"][T["entity"]]["fields"][Field]["type"] extends "embedded" | "relation" ? ({ [Field in keyof T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"]]?: true | (T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"][Field]["type"] extends "embedded" | "relation" ? { [Field in keyof T["ast"][T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"][Fi...) : never) }, P1> extends S ? S extends "empty" ? {
__projection: "empty";
} : S extends "unknown" ? PartialDeep<DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][T["entity"]]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, T["entity"], T["ast"]>>, {}> & {
__projection: "unknown";
} : S extends "all" ? DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][T["entity"]]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, T["entity"], T["ast"]>> & {
__projection: "all";
} : DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ K in string | number | symbol]: K extends keyof T["ast"][T["entity"]]["fields"] ? T["ast"][T["entity"]]["fields"][K] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? P1[K] extends true ? Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>> : Selector<{ [ Field in string | number | symbol]?: true | (T["ast"][ASTName]["fields"][Field]["type"] extends "embedded" | "relation" ? ({ [Field in keyof T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"]]?: true | (T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"][Field]["type"] extends "embedded" | "relation" ? { [Field in keyof T["ast"][T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"][Field]["astNam...) : never) }, P1[K]> extends S ? S extends "empty" ? {
__projection: "empty";
} : S extends "unknown" ? PartialDeep<DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>>, {}> & {
__projection: "unknown";
} : S extends "all" ? DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>> & {
__projection: "all";
} : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [K in keyof P1[K]]: K extends keyof T["ast"][ASTName]["fields"] ? T["ast"][ASTName]["fields"][K] extends { astName: infer ASTName; type: infer Type; } ? ASTName extends string ? P1[K][K] extends true ? Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : Selector<...> extends in...)>, ASTName, T["ast"]>> & {
__projection: P1[K];
} : never : never : never : never }>, T["entity"], T["ast"]>> & {
__projection: P1;
} : never, params: FindParams<T, T["projection"]>, context: MiddlewareContext<T>) => Promise<PartialDeep<T["model"], {}>>);
fieldsProjection: P2;
requiredProjection: P1;
}): DAOMiddleware<T>
-
Type Parameters
-
T extends DAOGenerics<any, any, any, any, any, any, any, any, any, any, any, any, any, AbstractEntityManager<string, string, any, any>, T>
-
P1 extends any
-
P2 extends any
Parameters
-
options: {
compute: ((record: Selector<{ [ Field in string | number | symbol]?: true | (T["ast"][T["entity"]]["fields"][Field]["type"] extends "embedded" | "relation" ? ({ [Field in keyof T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"]]?: true | (T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"][Field]["type"] extends "embedded" | "relation" ? { [Field in keyof T["ast"][T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"][Fi...) : never) }, P1> extends S ? S extends "empty" ? {
__projection: "empty";
} : S extends "unknown" ? PartialDeep<DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][T["entity"]]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, T["entity"], T["ast"]>>, {}> & {
__projection: "unknown";
} : S extends "all" ? DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][T["entity"]]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, T["entity"], T["ast"]>> & {
__projection: "all";
} : DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ K in string | number | symbol]: K extends keyof T["ast"][T["entity"]]["fields"] ? T["ast"][T["entity"]]["fields"][K] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? P1[K] extends true ? Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>> : Selector<{ [ Field in string | number | symbol]?: true | (T["ast"][ASTName]["fields"][Field]["type"] extends "embedded" | "relation" ? ({ [Field in keyof T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"]]?: true | (T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"][Field]["type"] extends "embedded" | "relation" ? { [Field in keyof T["ast"][T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"][Field]["astNam...) : never) }, P1[K]> extends S ? S extends "empty" ? {
__projection: "empty";
} : S extends "unknown" ? PartialDeep<DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>>, {}> & {
__projection: "unknown";
} : S extends "all" ? DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>> & {
__projection: "all";
} : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [K in keyof P1[K]]: K extends keyof T["ast"][ASTName]["fields"] ? T["ast"][ASTName]["fields"][K] extends { astName: infer ASTName; type: infer Type; } ? ASTName extends string ? P1[K][K] extends true ? Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : Selector<...> extends in...)>, ASTName, T["ast"]>> & {
__projection: P1[K];
} : never : never : never : never }>, T["entity"], T["ast"]>> & {
__projection: P1;
} : never, params: FindParams<T, T["projection"]>, context: MiddlewareContext<T>) => Promise<PartialDeep<T["model"], {}>>);
fieldsProjection: P2;
requiredProjection: P1;
}
-
compute: ((record: Selector<{ [ Field in string | number | symbol]?: true | (T["ast"][T["entity"]]["fields"][Field]["type"] extends "embedded" | "relation" ? ({ [Field in keyof T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"]]?: true | (T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"][Field]["type"] extends "embedded" | "relation" ? { [Field in keyof T["ast"][T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"][Fi...) : never) }, P1> extends S ? S extends "empty" ? {
__projection: "empty";
} : S extends "unknown" ? PartialDeep<DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][T["entity"]]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, T["entity"], T["ast"]>>, {}> & {
__projection: "unknown";
} : S extends "all" ? DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][T["entity"]]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, T["entity"], T["ast"]>> & {
__projection: "all";
} : DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ K in string | number | symbol]: K extends keyof T["ast"][T["entity"]]["fields"] ? T["ast"][T["entity"]]["fields"][K] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? P1[K] extends true ? Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>> : Selector<{ [ Field in string | number | symbol]?: true | (T["ast"][ASTName]["fields"][Field]["type"] extends "embedded" | "relation" ? ({ [Field in keyof T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"]]?: true | (T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"][Field]["type"] extends "embedded" | "relation" ? { [Field in keyof T["ast"][T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"][Field]["astNam...) : never) }, P1[K]> extends S ? S extends "empty" ? {
__projection: "empty";
} : S extends "unknown" ? PartialDeep<DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>>, {}> & {
__projection: "unknown";
} : S extends "all" ? DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>> & {
__projection: "all";
} : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [K in keyof P1[K]]: K extends keyof T["ast"][ASTName]["fields"] ? T["ast"][ASTName]["fields"][K] extends { astName: infer ASTName; type: infer Type; } ? ASTName extends string ? P1[K][K] extends true ? Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : Selector<...> extends in...)>, ASTName, T["ast"]>> & {
__projection: P1[K];
} : never : never : never : never }>, T["entity"], T["ast"]>> & {
__projection: P1;
} : never, params: FindParams<T, T["projection"]>, context: MiddlewareContext<T>) => Promise<PartialDeep<T["model"], {}>>)
-
- (record: Selector<{ [ Field in string | number | symbol]?: true | (T["ast"][T["entity"]]["fields"][Field]["type"] extends "embedded" | "relation" ? ({ [Field in keyof T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"]]?: true | (T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"][Field]["type"] extends "embedded" | "relation" ? { [Field in keyof T["ast"][T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"][Fi...) : never) }, P1> extends S ? S extends "empty" ? {
__projection: "empty";
} : S extends "unknown" ? PartialDeep<DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][T["entity"]]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, T["entity"], T["ast"]>>, {}> & {
__projection: "unknown";
} : S extends "all" ? DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][T["entity"]]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, T["entity"], T["ast"]>> & {
__projection: "all";
} : DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ K in string | number | symbol]: K extends keyof T["ast"][T["entity"]]["fields"] ? T["ast"][T["entity"]]["fields"][K] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? P1[K] extends true ? Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>> : Selector<{ [ Field in string | number | symbol]?: true | (T["ast"][ASTName]["fields"][Field]["type"] extends "embedded" | "relation" ? ({ [Field in keyof T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"]]?: true | (T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"][Field]["type"] extends "embedded" | "relation" ? { [Field in keyof T["ast"][T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"][Field]["astNam...) : never) }, P1[K]> extends S ? S extends "empty" ? {
__projection: "empty";
} : S extends "unknown" ? PartialDeep<DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>>, {}> & {
__projection: "unknown";
} : S extends "all" ? DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>> & {
__projection: "all";
} : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [K in keyof P1[K]]: K extends keyof T["ast"][ASTName]["fields"] ? T["ast"][ASTName]["fields"][K] extends { astName: infer ASTName; type: infer Type; } ? ASTName extends string ? P1[K][K] extends true ? Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : Selector<...> extends in...)>, ASTName, T["ast"]>> & {
__projection: P1[K];
} : never : never : never : never }>, T["entity"], T["ast"]>> & {
__projection: P1;
} : never, params: FindParams<T, T["projection"]>, context: MiddlewareContext<T>): Promise<PartialDeep<T["model"], {}>>
-
Parameters
-
record: Selector<{ [ Field in string | number | symbol]?: true | (T["ast"][T["entity"]]["fields"][Field]["type"] extends "embedded" | "relation" ? ({ [Field in keyof T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"]]?: true | (T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"][Field]["type"] extends "embedded" | "relation" ? { [Field in keyof T["ast"][T["ast"][T["ast"][T["entity"]]["fields"][Field]["astName"]]["fields"][Fi...) : never) }, P1> extends S ? S extends "empty" ? {
__projection: "empty";
} : S extends "unknown" ? PartialDeep<DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][T["entity"]]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, T["entity"], T["ast"]>>, {}> & {
__projection: "unknown";
} : S extends "all" ? DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][T["entity"]]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, T["entity"], T["ast"]>> & {
__projection: "all";
} : DecorateModelWithOptional<NotRequiredFields<T["entity"], T["ast"]>, DecorateModelWithArray<OmitNever<{ [ K in string | number | symbol]: K extends keyof T["ast"][T["entity"]]["fields"] ? T["ast"][T["entity"]]["fields"][K] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? P1[K] extends true ? Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>> : Selector<{ [ Field in string | number | symbol]?: true | (T["ast"][ASTName]["fields"][Field]["type"] extends "embedded" | "relation" ? ({ [Field in keyof T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"]]?: true | (T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"][Field]["type"] extends "embedded" | "relation" ? { [Field in keyof T["ast"][T["ast"][T["ast"][ASTName]["fields"][Field]["astName"]]["fields"][Field]["astNam...) : never) }, P1[K]> extends S ? S extends "empty" ? {
__projection: "empty";
} : S extends "unknown" ? PartialDeep<DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>>, {}> & {
__projection: "unknown";
} : S extends "all" ? DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<{ [ Field in string | number | symbol]: T["ast"][ASTName]["fields"][Field] extends {
astName: ASTName;
type: Type;
} ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [Field in keyof T["ast"][ASTName]["fields"]]: T["ast"][ASTName]["fields"][Field] extends { type: infer Type; astName: infer ASTName; } ? ASTName extends string ? Type extends "relation" ? never : Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : never : never; })>, ASTName, T["ast"]>> : never : never }>, ASTName, T["ast"]>> & {
__projection: "all";
} : DecorateModelWithOptional<NotRequiredFields<ASTName, T["ast"]>, DecorateModelWithArray<OmitNever<({ [K in keyof P1[K]]: K extends keyof T["ast"][ASTName]["fields"] ? T["ast"][ASTName]["fields"][K] extends { astName: infer ASTName; type: infer Type; } ? ASTName extends string ? P1[K][K] extends true ? Type extends "scalar" ? T["scalars"][ASTName]["type"] : DecorateModelWithOptional<...> : Selector<...> extends in...)>, ASTName, T["ast"]>> & {
__projection: P1[K];
} : never : never : never : never }>, T["entity"], T["ast"]>> & {
__projection: P1;
} : never
-
params: FindParams<T, T["projection"]>
-
Returns Promise<PartialDeep<T["model"], {}>>
-
fieldsProjection: P2
-
requiredProjection: P1