Comparing version 3.0.46 to 3.0.47
@@ -56,6 +56,7 @@ import { EntityMeta, RadsDb } from '_rads-db'; | ||
type RelationData<EN extends keyof EntityMeta, K extends keyof EntityMeta[EN]['relations']> = Pick<EntityMeta[EN]['relations'][K]['entity'], EntityMeta[EN]['relations'][K]['denormFields']>; | ||
type KeepArray<TMaybeArray, TType> = NonNullable<TMaybeArray> extends any[] ? TType[] : TType; | ||
type GetResponseInclude<E, EN extends keyof EntityMeta, I extends GetArgsInclude<E, EN>> = I extends { | ||
_pick: string[]; | ||
} ? GetResponseIncludeSelect<E, I> : { | ||
[K in keyof E]: K extends keyof EntityMeta[EN]['relations'] ? K extends keyof I ? GetResponseInclude<EntityMeta[EN]['relations'][K]['entity'], EntityMeta[EN]['relations'][K]['entityName'], I[K]> : RelationData<EN, K> : E[K]; | ||
[K in keyof E]: K extends keyof EntityMeta[EN]['relations'] ? K extends keyof I ? KeepArray<E[K], GetResponseInclude<EntityMeta[EN]['relations'][K]['entity'], EntityMeta[EN]['relations'][K]['entityName'], I[K]>> : KeepArray<E[K], RelationData<EN, K>> : E[K]; | ||
}; | ||
@@ -65,3 +66,3 @@ interface GetResponseIncludeSelect<E, I> { | ||
type GetResponseNoInclude<E, EN extends keyof EntityMeta> = { | ||
[K in keyof E]: K extends keyof EntityMeta[EN]['relations'] ? E[K] extends any[] ? RelationData<EN, K>[] : RelationData<EN, K> : E[K]; | ||
[K in keyof E]: K extends keyof EntityMeta[EN]['relations'] ? KeepArray<E[K], RelationData<EN, K>> : E[K]; | ||
}; | ||
@@ -68,0 +69,0 @@ type DeepPartial<T> = { |
{ | ||
"name": "rads-db", | ||
"version": "3.0.46", | ||
"version": "3.0.47", | ||
"packageManager": "pnpm@8.6.1", | ||
@@ -5,0 +5,0 @@ "description": "Say goodbye to boilerplate code and hello to efficient and elegant syntax.", |
354969
9840