import { listInstalledVersionIdsNewestFirst } from './listInstalledVersionIdsNewestFirst.js';
import { promoteVersionedPayload } from './promoteVersionedPayload.js';
import { pruneRetainedVersions } from './pruneRetainedVersions.js';
import { syncInstalledFirstPartyShims } from './syncInstalledFirstPartyShims.js';
export async function installVersionedPayload(params) {
    const promotion = await promoteVersionedPayload({
        componentId: params.componentId,
        versionId: params.versionId,
        stagedPayloadPath: params.payloadRoot,
        channel: params.channel,
        releaseRing: params.releaseRing,
        processEnv: params.processEnv,
    });
    await syncInstalledFirstPartyShims({
        componentId: params.componentId,
        channel: params.channel,
        releaseRing: params.releaseRing,
        processEnv: params.processEnv,
    });
    const orderedVersionIdsNewestFirst = await listInstalledVersionIdsNewestFirst({
        componentId: params.componentId,
        channel: params.channel,
        releaseRing: params.releaseRing,
        processEnv: params.processEnv,
    });
    await pruneRetainedVersions({
        componentId: params.componentId,
        processEnv: params.processEnv,
        channel: params.channel,
        releaseRing: params.releaseRing,
        orderedVersionIdsNewestFirst,
        currentVersionId: promotion.currentVersionId,
        previousVersionId: promotion.previousVersionId,
    });
    return promotion;
}
//# sourceMappingURL=installVersionedPayload.js.map