"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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi1jaGFuZ2VzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2Nkay9zY2hlbWF0aWNzL3VwZGF0ZS10b29sL3ZlcnNpb24tY2hhbmdlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7OztHQU1HOzs7QUFFSCxxREFBK0M7QUFhL0M7Ozs7Ozs7R0FPRztBQUNILFNBQWdCLG1CQUFtQixDQUFJLE1BQXFCLEVBQUUsSUFBdUI7SUFDbkYsSUFBSSxDQUFDLElBQUksRUFBRTtRQUNULE1BQU0sT0FBTyxHQUFJLDhCQUF3QyxDQUFDLE1BQU0sQ0FBQyxDQUFDO1FBQ2xFLE1BQU0sSUFBSSxLQUFLLENBQUMsOENBQThDLE9BQU8sRUFBRSxDQUFDLENBQUM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