hunk.code_window:     "tslint-stylish": "^2.1.0",
       "typescript": "^2.8.1"
     },
     "dependencies": {
       "app-root-path": "^2.0.1",
       "chalk": "^2.3.2",
       "cli-highlight": "^1.2.3",
       "debug": "^3.1.0",
  
hunk.labels: keep keep keep keep add keep keep keep
hunk.after_edit:     "buffer": "^5.1.0",
  
hunk.file_path: package.json
hunk.type: add
file: import {ColumnMetadata} from "./ColumnMetadata";
  import {EntityMetadata} from "./EntityMetadata";
  import {NamingStrategyInterface} from "../naming-strategy/NamingStrategyInterface";
  import {OnDeleteType} from "./types/OnDeleteType";
  
  /**
   * Contains all information about entity's foreign key.
   */
  export class ForeignKeyMetadata {
  
      // -------------------------------------------------------------------------
      // Public Properties
      // -------------------------------------------------------------------------
  
      /**
       * Entity metadata where this foreign key is.
       */
      entityMetadata: EntityMetadata;
  
      /**
       * Entity metadata which this foreign key references.
       */
      referencedEntityMetadata: EntityMetadata;
  
      /**
       * Array of columns of this foreign key.
       */
      columns: ColumnMetadata[] = [];
  
      /**
       * Array of referenced columns.
       */
      referencedColumns: ColumnMetadata[] = [];
  
      /**
       * What to do with a relation on deletion of the row containing a foreign key.
       */
      onDelete?: OnDeleteType;
  
      /**
       * What to do with a relation on update of the row containing a foreign key.
       */
      onUpdate?: string; // TODO think about string literal type
  
      /**
       * Gets the table name to which this foreign key is referenced.
       */
      referencedTablePath: string;
  
      /**
       * Gets foreign key name.
       */
      name: string;
  
      /**
       * Gets array of column names.
       */
      columnNames: string[] = [];
  
      /**
       * Gets array of referenced column names.
       */
      referencedColumnNames: string[] = [];
  
      // ---------------------------------------------------------------------
      // Constructor
      // ---------------------------------------------------------------------
  
      constructor(options: {
          entityMetadata: EntityMetadata,
          referencedEntityMetadata: EntityMetadata,
          namingStrategy?: NamingStrategyInterface,
          columns: ColumnMetadata[],
          referencedColumns: ColumnMetadata[],
          onDelete?: OnDeleteType,
          onUpdate?: string
      }) {
          this.entityMetadata = options.entityMetadata;
          this.referencedEntityMetadata = options.referencedEntityMetadata;
          this.columns = options.columns;
          this.referencedColumns = options.referencedColumns;
          this.onDelete = options.onDelete;
          this.onUpdate = options.onUpdate;
          if (options.namingStrategy)
              this.build(options.namingStrategy);
      }
  
      // ---------------------------------------------------------------------
      // Public Methods
      // ---------------------------------------------------------------------
  
      /**
       * Builds some depend foreign key properties.
       * Must be called after all entity metadatas and their columns are built.
       */
      build(namingStrategy: NamingStrategyInterface) {
          this.columnNames = this.columns.map(column => column.databaseName);
          this.referencedColumnNames = this.referencedColumns.map(column => column.databaseName);
          this.referencedTablePath = this.referencedEntityMetadata.tablePath;
          this.name = namingStrategy.foreignKeyName(this.entityMetadata.tablePath, this.columnNames);
      }
  
  }