diff --git a/CHANGELOG.md b/CHANGELOG.md index bb0993ef4d..c376c4c345 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/packages/eas-cli/graphql.schema.json b/packages/eas-cli/graphql.schema.json index 137d089ea1..ef6a2413c7 100644 --- a/packages/eas-cli/graphql.schema.json +++ b/packages/eas-cli/graphql.schema.json @@ -60914,12 +60914,6 @@ "inputFields": null, "interfaces": null, "enumValues": [ - { - "name": "GITHUB", - "description": null, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "GITHUB_PULL_REQUEST_OPENED", "description": null, diff --git a/packages/eas-cli/src/channel/queries.ts b/packages/eas-cli/src/channel/queries.ts index 165199c0f1..4bc3b77f00 100644 --- a/packages/eas-cli/src/channel/queries.ts +++ b/packages/eas-cli/src/channel/queries.ts @@ -289,7 +289,7 @@ export async function doesChannelExistAsync( { appId, channelName }: { appId: string; channelName: string } ): Promise { try { - await ChannelQuery.viewUpdateChannelAsync(graphqlClient, { + await ChannelQuery.viewUpdateChannelBasicInfoAsync(graphqlClient, { appId, channelName, }); diff --git a/packages/eas-cli/src/commands/channel/delete.ts b/packages/eas-cli/src/commands/channel/delete.ts index d62400cea6..f66fd78502 100644 --- a/packages/eas-cli/src/commands/channel/delete.ts +++ b/packages/eas-cli/src/commands/channel/delete.ts @@ -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, }); diff --git a/packages/eas-cli/src/commands/channel/edit.ts b/packages/eas-cli/src/commands/channel/edit.ts index bb08bb24bc..8deba9d9d0 100644 --- a/packages/eas-cli/src/commands/channel/edit.ts +++ b/packages/eas-cli/src/commands/channel/edit.ts @@ -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, }) diff --git a/packages/eas-cli/src/commands/channel/pause.ts b/packages/eas-cli/src/commands/channel/pause.ts index b5f64af118..2179f7d1ec 100644 --- a/packages/eas-cli/src/commands/channel/pause.ts +++ b/packages/eas-cli/src/commands/channel/pause.ts @@ -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, }) diff --git a/packages/eas-cli/src/commands/channel/resume.ts b/packages/eas-cli/src/commands/channel/resume.ts index 9990b98a7e..8430ab99c1 100644 --- a/packages/eas-cli/src/commands/channel/resume.ts +++ b/packages/eas-cli/src/commands/channel/resume.ts @@ -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, }) diff --git a/packages/eas-cli/src/graphql/generated.ts b/packages/eas-cli/src/graphql/generated.ts index 47685d3578..a71f81f8d9 100644 --- a/packages/eas-cli/src/graphql/generated.ts +++ b/packages/eas-cli/src/graphql/generated.ts @@ -8570,7 +8570,6 @@ export enum WorkflowRunStatus { } export enum WorkflowRunTriggerEventType { - Github = 'GITHUB', GithubPullRequestOpened = 'GITHUB_PULL_REQUEST_OPENED', GithubPullRequestReopened = 'GITHUB_PULL_REQUEST_REOPENED', GithubPullRequestSynchronize = 'GITHUB_PULL_REQUEST_SYNCHRONIZE', @@ -9474,6 +9473,14 @@ export type ViewBuildsOnAppQueryVariables = Exact<{ export type ViewBuildsOnAppQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, builds: Array<{ __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, channel?: string | null, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, runtimeVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, expirationDate?: any | null, isForIosSimulator: boolean, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null, buildArtifactsUrl?: string | null } | null, initiatingActor?: { __typename: 'Robot', id: string, displayName: string } | { __typename: 'SSOUser', id: string, displayName: string } | { __typename: 'User', id: string, displayName: string } | null, project: { __typename: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } } | { __typename: 'Snack', id: string, name: string, slug: string }, metrics?: { __typename?: 'BuildMetrics', buildWaitTime?: number | null, buildQueueTime?: number | null, buildDuration?: number | null } | null }> } } }; +export type ViewUpdateChannelBasicInfoOnAppQueryVariables = Exact<{ + appId: Scalars['String']['input']; + channelName: Scalars['String']['input']; +}>; + + +export type ViewUpdateChannelBasicInfoOnAppQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, updateChannelByName?: { __typename?: 'UpdateChannel', id: string, name: string, branchMapping: string } | null } } }; + export type ViewUpdateChannelOnAppQueryVariables = Exact<{ appId: Scalars['String']['input']; channelName: Scalars['String']['input']; diff --git a/packages/eas-cli/src/graphql/queries/ChannelQuery.ts b/packages/eas-cli/src/graphql/queries/ChannelQuery.ts index 8115cd0c6c..6630f7b84f 100644 --- a/packages/eas-cli/src/graphql/queries/ChannelQuery.ts +++ b/packages/eas-cli/src/graphql/queries/ChannelQuery.ts @@ -7,6 +7,8 @@ import { withErrorHandlingAsync } from '../client'; import { UpdateBranchBasicInfoFragment, UpdateFragment, + ViewUpdateChannelBasicInfoOnAppQuery, + ViewUpdateChannelBasicInfoOnAppQueryVariables, ViewUpdateChannelOnAppQuery, ViewUpdateChannelOnAppQueryVariables, ViewUpdateChannelsOnAppQuery, @@ -41,6 +43,42 @@ export function composeUpdateBranchObject( } export const ChannelQuery = { + async viewUpdateChannelBasicInfoAsync( + graphqlClient: ExpoGraphqlClient, + { appId, channelName }: ViewUpdateChannelBasicInfoOnAppQueryVariables + ): Promise< + NonNullable + > { + const response = await withErrorHandlingAsync( + graphqlClient + .query( + 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