function inferAliasForInclude(include, source) {
    var hasModelOptionWithoutAsOption = !!(include.model && !include.as);
    var hasIncludeOptions = !!include.include;
    var isConstructorFn = include instanceof Function;
    if (isConstructorFn || hasModelOptionWithoutAsOption) {
        if (isConstructorFn) {
            include = { model: include };
        }
        var targetPrototype = (source[exports.PROPERTY_LINK_TO_ORIG] || source).prototype || source;
        var relatedClass = include.model;
        var associations = association_1.getAssociationsByRelation(targetPrototype, relatedClass);
        if (associations.length > 0) {
            if (associations.length > 1) {
                throw new Error("Alias cannot be inferred: \"" + source.name + "\" has multiple " +
                    ("relations with \"" + include.model.name + "\""));
            }
            include.as = associations[0].getSequelizeOptions().as;
        }
    }
    if (!isConstructorFn && hasIncludeOptions) {
        include = inferAlias(include, include.model);
    }
    return include;
}
/**
 * Pre conform include, so that alias ("as") value can be inferred from source class
 */
Pre conform include, so that alias ("as") value can be inferred from source class
Pre conform include so that alias ( " as " ) value can be inferred from source class
function inferAliasForInclude(include, source) {
    var hasModelOptionWithoutAsOption = !!(include.model && !include.as);
    var hasIncludeOptions = !!include.include;
    var isConstructorFn = include instanceof Function;
    if (isConstructorFn || hasModelOptionWithoutAsOption) {
        if (isConstructorFn) {
            include = { model: include };
        }
        var targetPrototype = (source[exports.PROPERTY_LINK_TO_ORIG] || source).prototype || source;
        var relatedClass = include.model;
        var associations = association_1.getAssociationsByRelation(targetPrototype, relatedClass);
        if (associations.length > 0) {
            if (associations.length > 1) {
                throw new Error("Alias cannot be inferred: \"" + source.name + "\" has multiple " +
                    ("relations with \"" + include.model.name + "\""));
            }
            include.as = associations[0].getSequelizeOptions().as;
        }
    }
    if (!isConstructorFn && hasIncludeOptions) {
        include = inferAlias(include, include.model);
    }
    return include;
}
function inferAliasForInclude ( include , source ) { var hasModelOptionWithoutAsOption = ! ! ( include . model && ! include . as ) ; var hasIncludeOptions = ! ! include . include ; var isConstructorFn = include instanceof Function ; if ( isConstructorFn || hasModelOptionWithoutAsOption ) { if ( isConstructorFn ) { include = { model : include } ; } var targetPrototype = ( source [ exports . PROPERTY_LINK_TO_ORIG ] || source ) . prototype || source ; var relatedClass = include . model ; var associations = association_1 . getAssociationsByRelation ( targetPrototype , relatedClass ) ; if ( associations . length > 0 ) { if ( associations . length > 1 ) { throw new Error ( "Alias cannot be inferred: \"" + source . name + "\" has multiple " + ( "relations with \"" + include . model . name + "\"" ) ) ; } include . as = associations [ 0 ] . getSequelizeOptions ( ) . as ; } } if ( ! isConstructorFn && hasIncludeOptions ) { include = inferAlias ( include , include . model ) ; } return include ; }
Pre conform include, so that alias ("as") value can be inferred from source class
Pre conform include so that alias ( " as " ) value can be inferred from source class