Repository: typeorm/typeorm
File: src/driver/DriverUtils.ts (TypeScript)

Code before:
    }

    /**
     * Joins and shortens alias if needed.
     *
     * If the alias length is greater than the limit allowed by the current
     * driver, replaces it with a shortend string, if the shortend string
     * is still too long, it will then hash the alias.
     *
     * @param driver Current `Driver`.
     * @param buildOptions Optional settings.
     * @param alias Alias parts.
     *
     * @return An alias that is no longer than the divers max alias length.
     */
    static buildAlias(
        { maxAliasLength }: Driver,
        buildOptions: { shorten?: boolean; joiner?: string } | undefined,
        ...alias: string[]
    ): string {
        const joiner =
            buildOptions && buildOptions.joiner ? buildOptions.joiner : "_"

        let newAlias = alias.length === 1 ? alias[0] : alias.join(joiner)

        const hasNestedRelations = newAlias.includes(".")
        if (hasNestedRelations) {
            newAlias = newAlias.replace(/\./g, joiner)
        }

        if (
            maxAliasLength &&
            maxAliasLength > 0 &&
            newAlias.length > maxAliasLength
        ) {
            if (buildOptions && buildOptions.shorten === true) {
                const shortenedAlias = shorten(newAlias)
                if (shortenedAlias.length < maxAliasLength) {
                    return shortenedAlias
                }
            }

            return hash(newAlias, { length: maxAliasLength })
        }

        return newAlias
    }

    /**
     * @deprecated use `buildAlias` instead.
     */

Review comment (suggestion):
Is there some kind of constant that defines this as the relations joiner in typeorm? I've skimmed through the repo and didn't find one. Maybe you have more insight. 😊 

Code after:
    }

    /**
     * Joins and shortens alias if needed.
     *
     * If the alias length is greater than the limit allowed by the current
     * driver, replaces it with a shortend string, if the shortend string
     * is still too long, it will then hash the alias.
     *
     * @param driver Current `Driver`.
     * @param buildOptions Optional settings.
     * @param alias Alias parts.
     *
     * @return An alias that is no longer than the divers max alias length.
     */
    static buildAlias(
        { maxAliasLength }: Driver,
        buildOptions: { shorten?: boolean; joiner?: string } | undefined,
        ...alias: string[]
    ): string {
        const joiner =
            buildOptions && buildOptions.joiner ? buildOptions.joiner : "_"

        let newAlias = alias.length === 1 ? alias[0] : alias.join(joiner)

        if (
            maxAliasLength &&
            maxAliasLength > 0 &&
            newAlias.length > maxAliasLength
        ) {
            if (buildOptions && buildOptions.shorten === true) {
                const shortenedAlias = shorten(newAlias)
                if (shortenedAlias.length < maxAliasLength) {
                    return shortenedAlias
                }
            }

            return hash(newAlias, { length: maxAliasLength })
        }

        return newAlias
    }

    /**
     * @deprecated use `buildAlias` instead.
     */
    static buildColumnAlias(
        { maxAliasLength }: Driver,
        buildOptions: { shorten?: boolean; joiner?: string } | string,
        ...alias: string[]
    ) {