Compare commits

..
Author SHA1 Message Date
Quinlan Jung 8c8f64accb [eas-cli] unify channel graphql query types 2023-07-24 16:42:36 -07:00
+1 -23
View File
@@ -1,7 +1,7 @@
import assert from 'assert';
import chalk from 'chalk';
import { UpdateBranchObject, UpdateChannelObject } from '../graphql/queries/ChannelQuery';
import { UpdateChannelObject } from '../graphql/queries/ChannelQuery';
import Log from '../log';
import {
FormattedBranchDescription,
@@ -109,25 +109,3 @@ export function logChannelDetails(channel: UpdateChannelObject): void {
);
}
}
function getUpdateBranchNullable(
channel: UpdateChannelObject,
branchId: string
): UpdateBranchObject | null {
const updateBranches = channel.updateBranches;
const updateBranch = updateBranches.find(branch => branch.id === branchId);
return updateBranch ?? null;
}
export function getUpdateBranch(
channel: UpdateChannelObject,
branchId: string
): UpdateBranchObject {
const updateBranch = getUpdateBranchNullable(channel, branchId);
if (!updateBranch) {
throw new Error(
`Could not find branch with id "${branchId}" in branch-mapping of channel "${channel.name}"`
);
}
return updateBranch;
}