Libraries
    Preparing search index...

    Type Alias SaveGraph<TEntity>

    SaveGraph: Partial<EntityResult<TEntity>> & {
        [K in keyof EntityRelations<TEntity>]?: EntityRelations<TEntity>[K] extends RelationInfo<
            infer Kind,
            infer F,
        >
            ? Kind extends "hasMany"
            | "belongsToMany"
                ? ReadonlyArray<SaveGraph<EntityFromForeign<F>>>
                : SaveGraph<EntityFromForeign<F>>
            : never
    }

    Shape accepted by DbSet.save(graph) — a partial of the entity row plus optional nested relation values:

    • belongsTo / hasOne relations accept a single nested object.
    • hasMany / belongsToMany relations accept an array of nested objects.

    Each nested object is itself a SaveGraph of the foreign entity, so belongsToMany can pass { id } to attach an existing row, or a full nested graph to create a new row and link it.

    Type Parameters

    • TEntity extends Entity<any, any, any>