Skip to content

Commit

Permalink
[eas-cli] Narrow amount of data queried for basic update channel oper…
Browse files Browse the repository at this point in the history
…ations
  • Loading branch information
wschurman committed Feb 12, 2025
1 parent 911cc90 commit 2a5a88d
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ This is the log of notable changes to EAS CLI and related packages.

### 🧹 Chores

- Narrow amount of data queried for basic update channel operations. ([#2901](https://github.com/expo/eas-cli/pull/2901) by [@wschurman](https://github.com/wschurman))

## [15.0.10](https://github.com/expo/eas-cli/releases/tag/v15.0.10) - 2025-02-11

### 🐛 Bug fixes
Expand Down
6 changes: 0 additions & 6 deletions packages/eas-cli/graphql.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/eas-cli/src/channel/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export async function doesChannelExistAsync(
{ appId, channelName }: { appId: string; channelName: string }
): Promise<boolean> {
try {
await ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
await ChannelQuery.viewUpdateChannelBasicInfoAsync(graphqlClient, {
appId,
channelName,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/eas-cli/src/commands/channel/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class ChannelDelete extends EasCommand {

let channelId, channelName;
if (nameArg) {
const { id, name } = await ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
const { id, name } = await ChannelQuery.viewUpdateChannelBasicInfoAsync(graphqlClient, {
appId: projectId,
channelName: nameArg,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/eas-cli/src/commands/channel/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default class ChannelEdit extends EasCommand {
}

const existingChannel = args.name
? await ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
? await ChannelQuery.viewUpdateChannelBasicInfoAsync(graphqlClient, {
appId: projectId,
channelName: args.name,
})
Expand Down
2 changes: 1 addition & 1 deletion packages/eas-cli/src/commands/channel/pause.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default class ChannelPause extends EasCommand {
}

const existingChannel = args.name
? await ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
? await ChannelQuery.viewUpdateChannelBasicInfoAsync(graphqlClient, {
appId: projectId,
channelName: args.name,
})
Expand Down
2 changes: 1 addition & 1 deletion packages/eas-cli/src/commands/channel/resume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default class ChannelResume extends EasCommand {
}

const existingChannel = args.name
? await ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
? await ChannelQuery.viewUpdateChannelBasicInfoAsync(graphqlClient, {
appId: projectId,
channelName: args.name,
})
Expand Down
9 changes: 8 additions & 1 deletion packages/eas-cli/src/graphql/generated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions packages/eas-cli/src/graphql/queries/ChannelQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { withErrorHandlingAsync } from '../client';
import {
UpdateBranchBasicInfoFragment,
UpdateFragment,
ViewUpdateChannelBasicInfoOnAppQuery,
ViewUpdateChannelBasicInfoOnAppQueryVariables,
ViewUpdateChannelOnAppQuery,
ViewUpdateChannelOnAppQueryVariables,
ViewUpdateChannelsOnAppQuery,
Expand Down Expand Up @@ -41,6 +43,42 @@ export function composeUpdateBranchObject(
}

export const ChannelQuery = {
async viewUpdateChannelBasicInfoAsync(
graphqlClient: ExpoGraphqlClient,
{ appId, channelName }: ViewUpdateChannelBasicInfoOnAppQueryVariables
): Promise<
NonNullable<ViewUpdateChannelBasicInfoOnAppQuery['app']['byId']['updateChannelByName']>
> {
const response = await withErrorHandlingAsync(
graphqlClient
.query<ViewUpdateChannelBasicInfoOnAppQuery, ViewUpdateChannelBasicInfoOnAppQueryVariables>(
gql`
query ViewUpdateChannelBasicInfoOnApp($appId: String!, $channelName: String!) {
app {
byId(appId: $appId) {
id
updateChannelByName(name: $channelName) {
id
...UpdateChannelBasicInfoFragment
}
}
}
}
${print(UpdateChannelBasicInfoFragmentNode)}
`,
{ appId, channelName },
{ additionalTypenames: ['UpdateChannel', 'UpdateBranch', 'Update'] }
)
.toPromise()
);

const { updateChannelByName } = response.app.byId;
if (!updateChannelByName) {
throw new ChannelNotFoundError(`Could not find channel with the name ${channelName}`);
}

return updateChannelByName;
},
async viewUpdateChannelAsync(
graphqlClient: ExpoGraphqlClient,
{ appId, channelName, filter }: ViewUpdateChannelOnAppQueryVariables
Expand Down

0 comments on commit 2a5a88d

Please sign in to comment.