"use strict"; /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ Object.defineProperty(exports, "__esModule", { value: true }); exports.getAllChanges = exports.getChangesForTarget = void 0; const target_version_1 = require("./target-version"); /** * Gets the changes for a given target version from the specified version changes object. * * For readability and a good overview of breaking changes, the version change data always * includes the related Pull Request link. Since this data is not needed when performing the * upgrade, this unused data can be removed and the changes data can be flattened into an * easy iterable array. */ function getChangesForTarget(target, data) { if (!data) { const version = target_version_1.TargetVersion[target]; throw new Error(`No data could be found for target version: ${version}`); } return (data[target] || []).reduce((result, prData) => result.concat(prData.changes), []); } exports.getChangesForTarget = getChangesForTarget; /** * Gets all changes from the specified version changes object. This is helpful in case a migration * rule does not distinguish data based on the target version, but for readability the * upgrade data is separated for each target version. */ function getAllChanges(data) { return Object.keys(data) .map(targetVersion => getChangesForTarget(targetVersion, data)) .reduce((result, versionData) => result.concat(versionData), []); } exports.getAllChanges = getAllChanges; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi1jaGFuZ2VzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2Nkay9zY2hlbWF0aWNzL3VwZGF0ZS10b29sL3ZlcnNpb24tY2hhbmdlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7OztHQU1HOzs7QUFFSCxxREFBK0M7QUFjL0M7Ozs7Ozs7R0FPRztBQUNILFNBQWdCLG1CQUFtQixDQUFJLE1BQXFCLEVBQUUsSUFBdUI7SUFDbkYsSUFBSSxDQUFDLElBQUksRUFBRTtRQUNULE1BQU0sT0FBTyxHQUFJLDhCQUF3QyxDQUFDLE1BQU0sQ0FBQyxDQUFDO1FBQ2xFLE1BQU0sSUFBSSxLQUFLLENBQUMsOENBQThDLE9BQU8sRUFBRSxDQUFDLENBQUM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