333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
1
{"version":3,"sources":["../browser/src/metadata/EntityMetadata.ts"],"names":[],"mappings":";AAIA,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AAEjE,OAAO,EAAC,eAAe,EAAC,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAC,4BAA4B,EAAC,MAAM,uCAAuC,CAAC;AAInF,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAe5C;;GAEG;AACH;IA+bI,wEAAwE;IACxE,cAAc;IACd,wEAAwE;IAExE,wBAAY,OAOX;QA3aD;;WAEG;QACH,yBAAoB,GAAqB,EAAE,CAAC;QAE5C;;;;WAIG;QACH,oBAAe,GAAe,EAAE,CAAC;QAEjC;;WAEG;QACH,cAAS,GAAc,SAAS,CAAC;QA6DjC;;WAEG;QACH,gBAAW,GAAY,IAAI,CAAC;QA4B5B;;WAEG;QACH,4BAAuB,GAAY,KAAK,CAAC;QAEzC;;;;;WAKG;QACH,eAAU,GAAY,KAAK,CAAC;QAO5B;;;WAGG;QACH,sBAAiB,GAAY,KAAK,CAAC;QAEnC;;WAEG;QACH,2BAAsB,GAAY,KAAK,CAAC;QAExC;;WAEG;QACH,4BAAuB,GAAY,KAAK,CAAC;QAQzC;;WAEG;QACH,eAAU,GAAqB,EAAE,CAAC;QAElC;;WAEG;QACH,YAAO,GAAqB,EAAE,CAAC;QAE/B;;WAEG;QACH,oBAAe,GAAqB,EAAE,CAAC;QAEvC;;WAEG;QACH,sBAAiB,GAAqB,EAAE,CAAC;QAEzC;;WAEG;QACH,sBAAiB,GAAqB,EAAE,CAAC;QAEzC;;;WAGG;QACH,iBAAY,GAAqB,EAAE,CAAC;QAEpC;;;WAGG;QACH,mBAAc,GAAqB,EAAE,CAAC;QAEtC;;WAEG;QACH,qBAAgB,GAAqB,EAAE,CAAC;QA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AG,GAAG,GAAG,SAAS,CAAC;aAC/C;SACJ;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;IAED;;OAEG;IACO,wCAAe,GAAzB;QACI,IAAI,CAAC,IAAI,CAAC,MAAM;YACZ,OAAO,SAAS,CAAC;QAErB,OAAO,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,YAAY,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAClI,CAAC;IAEL,qBAAC;AAAD,CAl0BA,AAk0BC,IAAA","file":"EntityMetadata.js","sourcesContent":["import {QueryRunner, SelectQueryBuilder} from \"..\";\nimport {ObjectLiteral} from \"../common/ObjectLiteral\";\nimport {Connection} from \"../connection/Connection\";\nimport {PostgresConnectionOptions} from \"../driver/postgres/PostgresConnectionOptions\";\nimport {PostgresDriver} from \"../driver/postgres/PostgresDriver\";\nimport {SqlServerConnectionOptions} from \"../driver/sqlserver/SqlServerConnectionOptions\";\nimport {SqlServerDriver} from \"../driver/sqlserver/SqlServerDriver\";\nimport {CannotCreateEntityIdMapError} from \"../error/CannotCreateEntityIdMapError\";\nimport {OrderByCondition} from \"../find-options/OrderByCondition\";\nimport {TableMetadataArgs} from \"../metadata-args/TableMetadataArgs\";\nimport {TreeMetadataArgs} from \"../metadata-args/TreeMetadataArgs\";\nimport {OrmUtils} from \"../util/OrmUtils\";\nimport {shorten} from \"../util/StringUtils\";\nimport {CheckMetadata} from \"./CheckMetadata\";\nimport {ColumnMetadata} from \"./ColumnMetadata\";\nimport {EmbeddedMetadata} from \"./EmbeddedMetadata\";\nimport {EntityListenerMetadata} from \"./EntityListenerMetadata\";\nimport {ExclusionMetadata} from \"./ExclusionMetadata\";\nimport {ForeignKeyMetadata} from \"./ForeignKeyMetadata\";\nimport {IndexMetadata} from \"./IndexMetadata\";\nimport {RelationCountMetadata} from \"./RelationCountMetadata\";\nimport {RelationIdMetadata} from \"./RelationIdMetadata\";\nimport {RelationMetadata} from \"./RelationMetadata\";\nimport {TableType} from \"./types/TableTypes\";\nimport {TreeType} from \"./types/TreeTypes\";\nimport {UniqueMetadata} from \"./UniqueMetadata\";\n\n/**\n * Contains all entity metadata.\n */\nexport class EntityMetadata {\n\n    // -------------------------------------------------------------------------\n    // Properties\n    // -------------------------------------------------------------------------\n\n    /**\n     * Connection where this entity metadata is created.\n     */\n    connection: Connection;\n\n    /**\n     * Metadata arguments used to build this entity metadata.\n     */\n    tableMetadataArgs: TableMetadataArgs;\n\n    /**\n     * If entity's table is a closure-typed table, then this entity will have a closure junction table metadata.\n     */\n    closureJunctionTable: EntityMetadata;\n\n    /**\n     * If this is entity metadata for a junction closure table then its owner closure table metadata will be set here.\n     */\n    parentClosureEntityMetadata: EntityMetadata;\n\n    /**\n     * Parent's entity metadata. Used in inheritance patterns.\n     */\n    parentEntityMetadata: EntityMetadata;\n\n    /**\n     * Children entity metadatas. Used in inheritance patterns.\n     */\n    childEntityMetadatas: EntityMetadata[] = [];\n\n    /**\n     * All \"inheritance tree\" from a target entity.\n     * For example for target Post < ContentModel < Unit it will be an array of [Post, ContentModel, Unit].\n     * It also contains child entities for single table inheritance.\n     */\n    inheritanceTree: Function[] = [];\n\n    /**\n     * Table type. Tables can be abstract, closure, junction, embedded, etc.\n     */\n    tableType: TableType = \"regular\";\n\n    /**\n     * Target class to which this entity metadata is bind.\n     * Note, that when using table inheritance patterns target can be different rather then table's target.\n     * For virtual tables which lack of real entity (like junction tables) target is equal to their table name.\n     */\n    target: Function|string;\n\n    /**\n     * Gets the name of the target.\n     */\n    targetName: string;\n\n    /**\n     * Entity's name.\n     * Equal to entity target class's name if target is set to table.\n     * If target class is not then then it equals to table name.\n     */\n    name: string;\n\n    /**\n     * View's expression.\n     * Used in views\n     */\n    expression?: string|((connection: Connection) => SelectQueryBuilder<any>);\n\n    /**\n     * Original user-given table name (taken from schema or @Entity(tableName) decorator).\n     * If user haven't specified a table name this property will be undefined.\n     */\n    givenTableName?: string;\n\n    /**\n     * Entity table name in the database.\n     * This is final table name of the entity.\n     * This name already passed naming strategy, and generated based on\n     * multiple criteria, including user table name and global table prefix.\n     */\n    tableName: string;\n\n    /**\n     * Entity table path. Contains database name, schema name and table name.\n     * E.g. myDB.mySchema.myTable\n     */\n    tablePath: string;\n\n    /**\n     * Entity schema path. Contains database name and schema name.\n     * E.g. myDB.mySchema\n     */\n    schemaPath?: string;\n\n    /**\n     * Gets the table name without global table prefix.\n     * When querying table you need a table name with prefix, but in some scenarios,\n     * for example when you want to name a junction table that contains names of two other tables,\n     * you may want a table name without prefix.\n     */\n    tableNameWithoutPrefix: string;\n\n    /**\n     * Indicates if schema will be synchronized for this entity or not.\n     */\n    synchronize: boolean = true;\n\n    /**\n     * Table's database engine type (like \"InnoDB\", \"MyISAM\", etc).\n     */\n    engine?: string;\n\n    /**\n     * Database name.\n     */\n    database?: string;\n\n    /**\n     * Schema name. Used in Postgres and Sql Server.\n     */\n    schema?: string;\n\n    /**\n     * Specifies a default order by used for queries from this table when no explicit order by is specified.\n     */\n    orderBy?: OrderByCondition;\n\n    /**\n     * If this entity metadata's table using one of the inheritance patterns,\n     * then this will contain what pattern it uses.\n     */\n    inheritancePattern?: \"STI\"/*|\"CTI\"*/;\n\n    /**\n     * Checks if there any non-nullable column exist in this entity.\n     */\n    hasNonNullableRelations: boolean = false;\n\n    /**\n     * Indicates if this entity metadata of a junction table, or not.\n     * Junction table is a table created by many-to-many relationship.\n     *\n     * Its also possible to understand if entity is junction via tableType.\n     */\n    isJunction: boolean = false;\n\n    /**\n     * Indicates if this entity is a tree, what type of tree it is.\n     */\n    treeType?: TreeType;\n\n    /**\n     * Checks if this table is a junction table of the closure table.\n     * This type is for tables that contain junction metadata of the closure tables.\n     */\n    isClosureJunction: boolean = false;\n\n    /**\n     * Checks if entity's table has multiple primary columns.\n     */\n    hasMultiplePrimaryKeys: boolean = false;\n\n    /**\n     * Indicates if this entity metadata has uuid generated columns.\n     */\n    hasUUIDGeneratedColumns: boolean = false;\n\n    /**\n     * If this entity metadata is a child table of some table, it should have a discriminator value.\n     * Used to store a value in a discriminator column.\n     */\n    discriminatorValue?: string;\n\n    /**\n     * Entity's column metadatas defined by user.\n     */\n    ownColumns: ColumnMetadata[] = [];\n\n    /**\n     * Columns of the entity, including columns that are coming from the embeddeds of this entity.\n     */\n    columns: ColumnMetadata[] = [];\n\n    /**\n     * Ancestor columns used only in closure junction tables.\n     */\n    ancestorColumns: ColumnMetadata[] = [];\n\n    /**\n     * Descendant columns used only in closure junction tables.\n     */\n    descendantColumns: ColumnMetadata[] = [];\n\n    /**\n     * All columns except for virtual columns.\n     */\n    nonVirtualColumns: ColumnMetadata[] = [];\n\n    /**\n     * In the case if this entity metadata is junction table's entity metadata,\n     * this will contain all referenced columns of owner entity.\n     */\n    ownerColumns: ColumnMetadata[] = [];\n\n    /**\n     * In the case if this entity metadata is junction table's entity metadata,\n     * this will contain all referenced columns of inverse entity.\n     */\n    inverseColumns: ColumnMetadata[] = [];\n\n    /**\n     * Gets the column with generated flag.\n     */\n    generatedColumns: ColumnMetadata[] = [];\n\n    /**\n     * Gets the object id column used with mongodb database.\n     */\n    objectIdColumn?: ColumnMetadata;\n\n    /**\n     * Gets entity column which contains a create date value.\n     */\n    createDateColumn?: ColumnMetadata;\n\n    /**\n     * Gets entity column which contains an update date value.\n     */\n    updateDateColumn?: ColumnMetadata;\n\n    /**\n     * Gets entity column which contains an entity version.\n     */\n    versionColumn?: ColumnMetadata;\n\n    /**\n     * Gets the discriminator column used to store entity identificator in single-table inheritance tables.\n     */\n    discriminatorColumn?: ColumnMetadata;\n\n    /**\n     * Special column that stores tree level in tree entities.\n     */\n    treeLevelColumn?: ColumnMetadata;\n\n    /**\n     * Nested set's left value column.\n     * Used only in tree entities with nested set pattern applied.\n     */\n    nestedSetLeftColumn?: ColumnMetadata;\n\n    /**\n     * Nested set's right value column.\n     * Used only in tree entities with nested set pattern applied.\n     */\n    nestedSetRightColumn?: ColumnMetadata;\n\n    /**\n     * Materialized path column.\n     * Used only in tree entities with materialized path pattern applied.\n     */\n    materializedPathColumn?: ColumnMetadata;\n\n    /**\n     * Gets the primary columns.\n     */\n    primaryColumns: ColumnMetadata[] = [];\n\n    /**\n     * Entity's relation metadatas.\n     */\n    ownRelations: RelationMetadata[] = [];\n\n    /**\n     * Relations of the entity, including relations that are coming from the embeddeds of this entity.\n     */\n    relations: RelationMetadata[] = [];\n\n    /**\n     * List of eager relations this metadata has.\n     */\n    eagerRelations: RelationMetadata[] = [];\n\n    /**\n     * List of eager relations this metadata has.\n     */\n    lazyRelations: RelationMetadata[] = [];\n\n    /**\n     * Gets only one-to-one relations of the entity.\n     */\n    oneToOneRelations: RelationMetadata[] = [];\n\n    /**\n     * Gets only owner one-to-one relations of the entity.\n     */\n    ownerOneToOneRelations: RelationMetadata[] = [];\n\n    /**\n     * Gets only one-to-many relations of the entity.\n     */\n    oneToManyRelations: RelationMetadata[] = [];\n\n    /**\n     * Gets only many-to-one relations of the entity.\n     */\n    manyToOneRelations: RelationMetadata[] = [];\n\n    /**\n     * Gets only many-to-many relations of the entity.\n     */\n    manyToManyRelations: RelationMetadata[] = [];\n\n    /**\n     * Gets only owner many-to-many relations of the entity.\n     */\n    ownerManyToManyRelations: RelationMetadata[] = [];\n\n    /**\n     * Gets only owner one-to-one and many-to-one relations.\n     */\n    relationsWithJoinColumns: RelationMetadata[] = [];\n\n    /**\n     * Tree parent relation. Used only in tree-tables.\n     */\n    treeParentRelation?: RelationMetadata;\n\n    /**\n     * Tree children relation. Used only in tree-tables.\n     */\n    treeChildrenRelation?: RelationMetadata;\n\n    /**\n     * Entity's relation id metadatas.\n     */\n    relationIds: RelationIdMetadata[] = [];\n\n    /**\n     * Entity's relation id metadatas.\n     */\n    relationCounts: RelationCountMetadata[] = [];\n\n    /**\n     * Entity's foreign key metadatas.\n     */\n    foreignKeys: ForeignKeyMetadata[] = [];\n\n    /**\n     * Entity's embedded metadatas.\n     */\n    embeddeds: EmbeddedMetadata[] = [];\n\n    /**\n     * All embeddeds - embeddeds from this entity metadata and from all child embeddeds, etc.\n     */\n    allEmbeddeds: EmbeddedMetadata[] = [];\n\n    /**\n     * Entity's own indices.\n     */\n    ownIndices: IndexMetadata[] = [];\n\n    /**\n     * Entity's index metadatas.\n     */\n    indices: IndexMetadata[] = [];\n\n    /**\n     * Entity's unique metadatas.\n     */\n    uniques: UniqueMetadata[] = [];\n\n    /**\n     * Entity's own uniques.\n     */\n    ownUniques: UniqueMetadata[] = [];\n\n    /**\n     * Entity's check metadatas.\n     */\n    checks: CheckMetadata[] = [];\n\n    /**\n     * Entity's exclusion metadatas.\n     */\n    exclusions: ExclusionMetadata[] = [];\n\n    /**\n     * Entity's own listener metadatas.\n     */\n    ownListeners: EntityListenerMetadata[] = [];\n\n    /**\n     * Entity listener metadatas.\n     */\n    listeners: EntityListenerMetadata[] = [];\n\n    /**\n     * Listener metadatas with \"AFTER LOAD\" type.\n     */\n    afterLoadListeners: EntityListenerMetadata[] = [];\n\n    /**\n     * Listener metadatas with \"AFTER INSERT\" type.\n     */\n    beforeInsertListeners: EntityListenerMetadata[] = [];\n\n    /**\n     * Listener metadatas with \"AFTER INSERT\" type.\n     */\n    afterInsertListeners: EntityListenerMetadata[] = [];\n\n    /**\n     * Listener metadatas with \"AFTER UPDATE\" type.\n     */\n    beforeUpdateListeners: EntityListenerMetadata[] = [];\n\n    /**\n     * Listener metadatas with \"AFTER UPDATE\" type.\n     */\n    afterUpdateListeners: EntityListenerMetadata[] = [];\n\n    /**\n     * Listener metadatas with \"AFTER REMOVE\" type.\n     */\n    beforeRemoveListeners: EntityListenerMetadata[] = [];\n\n    /**\n     * Listener metadatas with \"AFTER REMOVE\" type.\n     */\n    afterRemoveListeners: EntityListenerMetadata[] = [];\n\n    /**\n     * Map of columns and relations of the entity.\n     *\n     * example: Post{ id: number, name: string, counterEmbed: { count: number }, category: Category }.\n     * This method will create following object:\n     * { id: \"id\", counterEmbed: { count: \"counterEmbed.count\" }, category: \"category\" }\n     */\n    propertiesMap: ObjectLiteral;\n\n    // ---------------------------------------------------------------------\n    // Constructor\n    // ---------------------------------------------------------------------\n\n    constructor(options: {\n        connection: Connection,\n        inheritanceTree?: Function[],\n        inheritancePattern?: \"STI\"/*|\"CTI\"*/,\n        tableTree?: TreeMetadataArgs,\n        parentClosureEntityMetadata?: EntityMetadata,\n        args: TableMetadataArgs\n    }) {\n        this.connection = options.connection;\n        this.inheritanceTree = options.inheritanceTree || [];\n        this.inheritancePattern = options.inheritancePattern;\n        this.treeType = options.tableTree ? options.tableTree.type : undefined;\n        this.parentClosureEntityMetadata = options.parentClosureEntityMetadata!;\n        this.tableMetadataArgs = options.args;\n        this.target = this.tableMetadataArgs.target;\n        this.tableType = this.tableMetadataArgs.type;\n        this.expression = this.tableMetadataArgs.expression;\n    }\n\n    // -------------------------------------------------------------------------\n    // Public Methods\n    // -------------------------------------------------------------------------\n\n    /**\n     * Creates a new entity.\n     */\n    create(queryRunner?: QueryRunner): any {\n        // if target is set to a function (e.g. class) that can be created then create it\n        let ret: any;\n        if (this.target instanceof Function) {\n            ret = new (<any> this.target)();\n            this.lazyRelations.forEach(relation => this.connection.relationLoader.enableLazyLoad(relation, ret, queryRunner));\n            return ret;\n        }\n\n        // otherwise simply return a new empty object\n        const newObject = {};\n        this.lazyRelations.forEach(relation => this.connection.relationLoader.enableLazyLoad(relation, newObject, queryRunner));\n        return newObject;\n    }\n\n    /**\n     * Checks if given entity has an id.\n     */\n    hasId(entity: ObjectLiteral): boolean {\n        if (!entity)\n            return false;\n\n        return this.primaryColumns.every(primaryColumn => {\n            const value = primaryColumn.getEntityValue(entity);\n            return value !== null && value !== undefined && value !== \"\";\n        });\n    }\n\n    /**\n     * Checks if given entity / object contains ALL primary keys entity must have.\n     * Returns true if it contains all of them, false if at least one of them is not defined.\n     */\n    hasAllPrimaryKeys(entity: ObjectLiteral): boolean {\n        return this.primaryColumns.every(primaryColumn => {\n            const value = primaryColumn.getEntityValue(entity);\n            return value !== null && value !== undefined;\n        });\n    }\n\n    /**\n     * Ensures that given object is an entity id map.\n     * If given id is an object then it means its already id map.\n     * If given id isn't an object then it means its a value of the id column\n     * and it creates a new id map with this value and name of the primary column.\n     */\n    ensureEntityIdMap(id: any): ObjectLiteral {\n        if (id instanceof Object)\n            return id;\n\n        if (this.hasMultiplePrimaryKeys)\n            throw new CannotCreateEntityIdMapError(this, id);\n\n        return this.primaryColumns[0].createValueMap(id);\n    }\n\n    /**\n     * Gets primary keys of the entity and returns them in a literal object.\n     * For example, for Post{ id: 1, title: \"hello\" } where id is primary it will return { id: 1 }\n     * For multiple primary keys it returns multiple keys in object.\n     * For primary keys inside embeds it returns complex object literal with keys in them.\n     */\n    getEntityIdMap(entity: ObjectLiteral|undefined): ObjectLiteral|undefined {\n        if (!entity)\n            return undefined;\n\n        return EntityMetadata.getValueMap(entity, this.primaryColumns, { skipNulls: true });\n    }\n\n    /**\n     * Creates a \"mixed id map\".\n     * If entity has multiple primary keys (ids) then it will return just regular id map, like what getEntityIdMap returns.\n     * But if entity has a single primary key then it will return just value of the id column of the entity, just value.\n     * This is called mixed id map.\n     */\n    getEntityIdMixedMap(entity: ObjectLiteral|undefined): ObjectLiteral|undefined {\n        if (!entity)\n            return entity;\n\n        const idMap = this.getEntityIdMap(entity);\n        if (this.hasMultiplePrimaryKeys) {\n            return idMap;\n\n        } else if (idMap) {\n            return this.primaryColumns[0].getEntityValue(idMap); // todo: what about parent primary column?\n        }\n\n        return idMap;\n    }\n\n    /**\n     * Compares two different entities by their ids.\n     * Returns true if they match, false otherwise.\n     */\n    compareEntities(firstEntity: ObjectLiteral, secondEntity: ObjectLiteral): boolean {\n\n        const firstEntityIdMap = this.getEntityIdMap(firstEntity);\n        if (!firstEntityIdMap) return false;\n\n        const secondEntityIdMap = this.getEntityIdMap(secondEntity);\n        if (!secondEntityIdMap) return false;\n\n        return EntityMetadata.compareIds(firstEntityIdMap, secondEntityIdMap);\n    }\n\n    /**\n     * Finds column with a given property name.\n     */\n    findColumnWithPropertyName(propertyName: string): ColumnMetadata|undefined {\n        return this.columns.find(column => column.propertyName === propertyName);\n    }\n\n    /**\n     * Finds column with a given database name.\n     */\n    findColumnWithDatabaseName(databaseName: string): ColumnMetadata|undefined {\n        return this.columns.find(column => column.databaseName === databaseName);\n    }\n\n    /**\n     * Finds column with a given property path.\n     */\n    findColumnWithPropertyPath(propertyPath: string): ColumnMetadata|undefined {\n        const column = this.columns.find(column => column.propertyPath === propertyPath);\n        if (column)\n            return column;\n\n        // in the case if column with property path was not found, try to find a relation with such property path\n        // if we find relation and it has a single join column then its the column user was seeking\n        const relation = this.relations.find(relation => relation.propertyPath === propertyPath);\n        if (relation && relation.joinColumns.length === 1)\n            return relation.joinColumns[0];\n\n        return undefined;\n    }\n\n    /**\n     * Finds columns with a given property path.\n     * Property path can match a relation, and relations can contain multiple columns.\n     */\n    findColumnsWithPropertyPath(propertyPath: string): ColumnMetadata[] {\n        const column = this.columns.find(column => column.propertyPath === propertyPath);\n        if (column)\n            return [column];\n\n        // in the case if column with property path was not found, try to find a relation with such property path\n        // if we find relation and it has a single join column then its the column user was seeking\n        const relation = this.relations.find(relation => relation.propertyPath === propertyPath);\n        if (relation && relation.joinColumns)\n            return relation.joinColumns;\n\n        return [];\n    }\n\n    /**\n     * Finds relation with the given property path.\n     */\n    findRelationWithPropertyPath(propertyPath: string): RelationMetadata|undefined {\n        return this.relations.find(relation => relation.propertyPath === propertyPath);\n    }\n\n    /**\n     * Checks if there is an embedded with a given property path.\n     */\n    hasEmbeddedWithPropertyPath(propertyPath: string): boolean {\n        return this.allEmbeddeds.some(embedded => embedded.propertyPath === propertyPath);\n    }\n\n    /**\n     * Finds embedded with a given property path.\n     */\n    findEmbeddedWithPropertyPath(propertyPath: string): EmbeddedMetadata|undefined {\n        return this.allEmbeddeds.find(embedded => embedded.propertyPath === propertyPath);\n    }\n\n    /**\n     * Iterates through entity and finds and extracts all values from relations in the entity.\n     * If relation value is an array its being flattened.\n     */\n    extractRelationValuesFromEntity(entity: ObjectLiteral, relations: RelationMetadata[]): [RelationMetadata, any, EntityMetadata][] {\n        const relationsAndValues: [RelationMetadata, any, EntityMetadata][] = [];\n        relations.forEach(relation => {\n            const value = relation.getEntityValue(entity);\n            if (value instanceof Array) {\n                value.forEach(subValue => relationsAndValues.push([relation, subValue, relation.inverseEntityMetadata]));\n            } else if (value) {\n                relationsAndValues.push([relation, value, relation.inverseEntityMetadata]);\n            }\n        });\n        return relationsAndValues;\n    }\n\n    // -------------------------------------------------------------------------\n    // Public Static Methods\n    // -------------------------------------------------------------------------\n\n    /**\n     * Creates a property paths for a given entity.\n     */\n    static createPropertyPath(metadata: EntityMetadata, entity: ObjectLiteral, prefix: string = \"\") {\n        const paths: string[] = [];\n        Object.keys(entity).forEach(key => {\n\n            // check for function is needed in the cases when createPropertyPath used on values containg a function as a value\n            // example: .update().set({ name: () => `SUBSTR('', 1, 2)` })\n            const parentPath = prefix ? prefix + \".\" + key : key;\n            if (metadata.hasEmbeddedWithPropertyPath(parentPath)) {\n                const subPaths = this.createPropertyPath(metadata, entity[key], parentPath);\n                paths.push(...subPaths);\n            } else {\n                const path = prefix ? prefix + \".\" + key : key;\n                paths.push(path);\n            }\n        });\n        return paths;\n    }\n\n    /**\n     * Finds difference between two entity id maps.\n     * Returns items that exist in the first array and absent in the second array.\n     */\n    static difference(firstIdMaps: ObjectLiteral[], secondIdMaps: ObjectLiteral[]): ObjectLiteral[] {\n        return firstIdMaps.filter(firstIdMap => {\n            return !secondIdMaps.find(secondIdMap => OrmUtils.deepCompare(firstIdMap, secondIdMap));\n        });\n    }\n\n    /**\n     * Compares ids of the two entities.\n     * Returns true if they match, false otherwise.\n     */\n    static compareIds(firstId: ObjectLiteral|undefined, secondId: ObjectLiteral|undefined): boolean {\n        if (firstId === undefined || firstId === null || secondId === undefined || secondId === null)\n            return false;\n\n        return OrmUtils.deepCompare(firstId, secondId);\n    }\n\n    /**\n     * Creates value map from the given values and columns.\n     * Examples of usages are primary columns map and join columns map.\n     */\n    static getValueMap(entity: ObjectLiteral, columns: ColumnMetadata[], options?: { skipNulls?: boolean }): ObjectLiteral|undefined {\n        return columns.reduce((map, column) => {\n            const value = column.getEntityValueMap(entity, options);\n\n            // make sure that none of the values of the columns are not missing\n            if (map === undefined || value === null || value === undefined)\n                return undefined;\n\n            return column.isObjectId ? Object.assign(map, value) : OrmUtils.mergeDeep(map, value);\n        }, {} as ObjectLiteral|undefined);\n    }\n\n    // ---------------------------------------------------------------------\n    // Public Builder Methods\n    // ---------------------------------------------------------------------\n\n    build() {\n        const namingStrategy = this.connection.namingStrategy;\n        const entityPrefix = this.connection.options.entityPrefix;\n        this.engine = this.tableMetadataArgs.engine;\n        this.database = this.tableMetadataArgs.type === \"entity-child\" && this.parentEntityMetadata ? this.parentEntityMetadata.database : this.tableMetadataArgs.database;\n        if (this.tableMetadataArgs.schema) {\n            this.schema = this.tableMetadataArgs.schema;\n        }\n        else if ((this.tableMetadataArgs.type === \"entity-child\") && this.parentEntityMetadata) {\n            this.schema = this.parentEntityMetadata.schema;\n        }\n        else {\n            this.schema = (this.connection.options as PostgresConnectionOptions|SqlServerConnectionOptions).schema;\n        }\n        this.givenTableName = this.tableMetadataArgs.type === \"entity-child\" && this.parentEntityMetadata ? this.parentEntityMetadata.givenTableName : this.tableMetadataArgs.name;\n        this.synchronize = this.tableMetadataArgs.synchronize === false ? false : true;\n        this.targetName = this.tableMetadataArgs.target instanceof Function ? (this.tableMetadataArgs.target as any).name : this.tableMetadataArgs.target;\n        if (this.tableMetadataArgs.type === \"closure-junction\") {\n            this.tableNameWithoutPrefix = namingStrategy.closureJunctionTableName(this.givenTableName!);\n        } else if (this.tableMetadataArgs.type === \"entity-child\" && this.parentEntityMetadata) {\n            this.tableNameWithoutPrefix = namingStrategy.tableName(this.parentEntityMetadata.targetName, this.parentEntityMetadata.givenTableName);\n        } else {\n            this.tableNameWithoutPrefix = namingStrategy.tableName(this.targetName, this.givenTableName);\n\n            if (this.connection.driver.maxAliasLength && this.connection.driver.maxAliasLength > 0 && this.tableNameWithoutPrefix.length > this.connection.driver.maxAliasLength) {\n                this.tableNameWithoutPrefix = shorten(this.tableNameWithoutPrefix, { separator: \"_\", segmentLength: 3 });\n            }\n        }\n        this.tableName = entityPrefix ? namingStrategy.prefixTableName(entityPrefix, this.tableNameWithoutPrefix) : this.tableNameWithoutPrefix;\n        this.target = this.target ? this.target : this.tableName;\n        this.name = this.targetName ? this.targetName : this.tableName;\n        this.expression = this.tableMetadataArgs.expression;\n        this.tablePath = this.buildTablePath();\n        this.schemaPath = this.buildSchemaPath();\n        this.orderBy = (this.tableMetadataArgs.orderBy instanceof Function) ? this.tableMetadataArgs.orderBy(this.propertiesMap) : this.tableMetadataArgs.orderBy; // todo: is propertiesMap available here? Looks like its not\n\n        this.isJunction = this.tableMetadataArgs.type === \"closure-junction\" || this.tableMetadataArgs.type === \"junction\";\n        this.isClosureJunction = this.tableMetadataArgs.type === \"closure-junction\";\n    }\n\n    /**\n     * Registers a new column in the entity and recomputes all depend properties.\n     */\n    registerColumn(column: ColumnMetadata) {\n        if (this.ownColumns.indexOf(column) !== -1)\n            return;\n\n        this.ownColumns.push(column);\n        this.columns = this.embeddeds.reduce((columns, embedded) => columns.concat(embedded.columnsFromTree), this.ownColumns);\n        this.primaryColumns = this.columns.filter(column => column.isPrimary);\n        this.hasMultiplePrimaryKeys = this.primaryColumns.length > 1;\n        this.hasUUIDGeneratedColumns = this.columns.filter(column => column.isGenerated || column.generationStrategy === \"uuid\").length > 0;\n        this.propertiesMap = this.createPropertiesMap();\n        if (this.childEntityMetadatas)\n            this.childEntityMetadatas.forEach(entityMetadata => entityMetadata.registerColumn(column));\n    }\n\n    /**\n     * Creates a special object - all columns and relations of the object (plus columns and relations from embeds)\n     * in a special format - { propertyName: propertyName }.\n     *\n     * example: Post{ id: number, name: string, counterEmbed: { count: number }, category: Category }.\n     * This method will create following object:\n     * { id: \"id\", counterEmbed: { count: \"counterEmbed.count\" }, category: \"category\" }\n     */\n    createPropertiesMap(): { [name: string]: string|any } {\n        const map: { [name: string]: string|any } = {};\n        this.columns.forEach(column => OrmUtils.mergeDeep(map, column.createValueMap(column.propertyPath)));\n        this.relations.forEach(relation => OrmUtils.mergeDeep(map, relation.createValueMap(relation.propertyPath)));\n        return map;\n    }\n\n    /**\n     * Builds table path using database name, schema name and table name.\n     */\n    protected buildTablePath(): string {\n        let tablePath = this.tableName;\n        if (this.schema)\n            tablePath = this.schema + \".\" + tablePath;\n        if (this.database && !(this.connection.driver instanceof PostgresDriver)) {\n            if (!this.schema && this.connection.driver instanceof SqlServerDriver) {\n                tablePath = this.database + \"..\" + tablePath;\n            } else {\n                tablePath = this.database + \".\" + tablePath;\n            }\n        }\n\n        return tablePath;\n    }\n\n    /**\n     * Builds table path using schema name and database name.\n     */\n    protected buildSchemaPath(): string|undefined {\n        if (!this.schema)\n            return undefined;\n\n        return this.database && !(this.connection.driver instanceof PostgresDriver) ? this.database + \".\" + this.schema : this.schema;\n    }\n\n}\n"],"sourceRoot":".."}