From 7a3c782bb55916a2eca878b03e165294473004eb Mon Sep 17 00:00:00 2001 From: Quinlan Jung Date: Tue, 25 Jul 2023 16:16:33 -0700 Subject: [PATCH 1/2] [eas-ci] revert UpdateBranchWithCurrentGroupFragment --- packages/eas-cli/graphql.schema.json | 464 ++++++++++++++++++ .../eas-cli/src/channel/__tests__/fixtures.ts | 7 +- packages/eas-cli/src/channel/utils.ts | 7 +- packages/eas-cli/src/graphql/generated.ts | 58 ++- .../src/graphql/queries/ChannelQuery.ts | 37 +- .../types/UpdateBranchWithCurrentUpdate.ts | 16 - 6 files changed, 548 insertions(+), 41 deletions(-) delete mode 100644 packages/eas-cli/src/graphql/types/UpdateBranchWithCurrentUpdate.ts diff --git a/packages/eas-cli/graphql.schema.json b/packages/eas-cli/graphql.schema.json index 79d6c3cb46..89502d2f21 100644 --- a/packages/eas-cli/graphql.schema.json +++ b/packages/eas-cli/graphql.schema.json @@ -15554,6 +15554,80 @@ ], "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "BuildLimitThresholdExceededMetadata", + "description": null, + "fields": [ + { + "name": "account", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Account", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "thresholdsExceeded", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "NotificationThresholdExceeded", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "BuildLimitThresholdExceededMetadataType", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "IOS", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "TOTAL", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, { "kind": "OBJECT", "name": "BuildLogs", @@ -16520,6 +16594,81 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "BuildPlanCreditThresholdExceededMetadata", + "description": null, + "fields": [ + { + "name": "account", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Account", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "buildCreditUsage", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "planLimit", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "threshold", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "ENUM", "name": "BuildPriority", @@ -25965,6 +26114,109 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "Notification", + "description": null, + "fields": [ + { + "name": "createdAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "event", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "NotificationEvent", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "metadata", + "description": null, + "args": [], + "type": { + "kind": "UNION", + "name": "NotificationMetadata", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "NotificationType", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "ENUM", "name": "NotificationEvent", @@ -25996,10 +26248,42 @@ "description": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "TEST", + "description": null, + "isDeprecated": false, + "deprecationReason": null } ], "possibleTypes": null }, + { + "kind": "UNION", + "name": "NotificationMetadata", + "description": null, + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "BuildLimitThresholdExceededMetadata", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "BuildPlanCreditThresholdExceededMetadata", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "TestNotificationMetadata", + "ofType": null + } + ] + }, { "kind": "OBJECT", "name": "NotificationSubscription", @@ -26280,6 +26564,81 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "NotificationThresholdExceeded", + "description": null, + "fields": [ + { + "name": "count", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "limit", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "threshold", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "BuildLimitThresholdExceededMetadataType", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "ENUM", "name": "NotificationType", @@ -26293,6 +26652,12 @@ "description": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "WEB", + "description": null, + "isDeprecated": false, + "deprecationReason": null } ], "possibleTypes": null @@ -30078,6 +30443,30 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "webNotifications", + "description": "Web notifications linked to a user", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Notification", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -32672,6 +33061,33 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "TestNotificationMetadata", + "description": null, + "fields": [ + { + "name": "message", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "TimelineActivityConnection", @@ -35289,6 +35705,30 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "webNotifications", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Notification", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -35892,6 +36332,30 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "webNotifications", + "description": "Web notifications linked to a user", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Notification", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, diff --git a/packages/eas-cli/src/channel/__tests__/fixtures.ts b/packages/eas-cli/src/channel/__tests__/fixtures.ts index dc02ccf155..bdada8fd82 100644 --- a/packages/eas-cli/src/channel/__tests__/fixtures.ts +++ b/packages/eas-cli/src/channel/__tests__/fixtures.ts @@ -1,7 +1,6 @@ -import { UpdateBranchWithCurrentGroupFragment } from '../../graphql/generated'; -import { UpdateChannelObject } from '../../graphql/queries/ChannelQuery'; +import { UpdateBranchObject, UpdateChannelObject } from '../../graphql/queries/ChannelQuery'; -export const testUpdateBranch1: UpdateBranchWithCurrentGroupFragment = { +export const testUpdateBranch1: UpdateBranchObject = { id: '754bf17f-efc0-46ab-8a59-a03f20e53e9b', name: 'wrong-channel', updateGroups: [ @@ -61,7 +60,7 @@ export const testUpdateBranch1: UpdateBranchWithCurrentGroupFragment = { __typename: 'UpdateBranch', }; -const testUpdateBranch2: UpdateBranchWithCurrentGroupFragment = { +const testUpdateBranch2: UpdateBranchObject = { id: '6941a8dd-5c0a-48bc-8876-f49c88ed419f', name: 'production', updateGroups: [ diff --git a/packages/eas-cli/src/channel/utils.ts b/packages/eas-cli/src/channel/utils.ts index 70938cd68a..2a56500423 100644 --- a/packages/eas-cli/src/channel/utils.ts +++ b/packages/eas-cli/src/channel/utils.ts @@ -1,8 +1,7 @@ import assert from 'assert'; import chalk from 'chalk'; -import { UpdateBranchWithCurrentGroupFragment } from '../graphql/generated'; -import { UpdateChannelObject } from '../graphql/queries/ChannelQuery'; +import { UpdateBranchObject, UpdateChannelObject } from '../graphql/queries/ChannelQuery'; import Log from '../log'; import { FormattedBranchDescription, @@ -114,7 +113,7 @@ export function logChannelDetails(channel: UpdateChannelObject): void { function getUpdateBranchNullable( channel: UpdateChannelObject, branchId: string -): UpdateBranchWithCurrentGroupFragment | null { +): UpdateBranchObject | null { const updateBranches = channel.updateBranches; const updateBranch = updateBranches.find(branch => branch.id === branchId); return updateBranch ?? null; @@ -123,7 +122,7 @@ function getUpdateBranchNullable( export function getUpdateBranch( channel: UpdateChannelObject, branchId: string -): UpdateBranchWithCurrentGroupFragment { +): UpdateBranchObject { const updateBranch = getUpdateBranchNullable(channel, branchId); if (!updateBranch) { throw new Error( diff --git a/packages/eas-cli/src/graphql/generated.ts b/packages/eas-cli/src/graphql/generated.ts index 615ef845a4..8e01267092 100644 --- a/packages/eas-cli/src/graphql/generated.ts +++ b/packages/eas-cli/src/graphql/generated.ts @@ -2236,6 +2236,17 @@ export enum BuildJobStatus { Started = 'STARTED' } +export type BuildLimitThresholdExceededMetadata = { + __typename?: 'BuildLimitThresholdExceededMetadata'; + account: Account; + thresholdsExceeded: Array; +}; + +export enum BuildLimitThresholdExceededMetadataType { + Ios = 'IOS', + Total = 'TOTAL' +} + export type BuildLogs = { __typename?: 'BuildLogs'; format?: Maybe; @@ -2381,6 +2392,14 @@ export type BuildParamsInput = { sdkVersion?: InputMaybe; }; +export type BuildPlanCreditThresholdExceededMetadata = { + __typename?: 'BuildPlanCreditThresholdExceededMetadata'; + account: Account; + buildCreditUsage: Scalars['Int']; + planLimit: Scalars['Int']; + threshold: Scalars['Int']; +}; + export enum BuildPriority { High = 'HIGH', Normal = 'NORMAL', @@ -3758,13 +3777,26 @@ export type MeteredBillingStatus = { EAS_UPDATE: Scalars['Boolean']; }; +export type Notification = { + __typename?: 'Notification'; + createdAt: Scalars['DateTime']; + event: NotificationEvent; + id: Scalars['ID']; + metadata?: Maybe; + type: NotificationType; + updatedAt: Scalars['DateTime']; +}; + export enum NotificationEvent { BuildComplete = 'BUILD_COMPLETE', BuildLimitThresholdExceeded = 'BUILD_LIMIT_THRESHOLD_EXCEEDED', BuildPlanCreditThresholdExceeded = 'BUILD_PLAN_CREDIT_THRESHOLD_EXCEEDED', - SubmissionComplete = 'SUBMISSION_COMPLETE' + SubmissionComplete = 'SUBMISSION_COMPLETE', + Test = 'TEST' } +export type NotificationMetadata = BuildLimitThresholdExceededMetadata | BuildPlanCreditThresholdExceededMetadata | TestNotificationMetadata; + export type NotificationSubscription = { __typename?: 'NotificationSubscription'; account?: Maybe; @@ -3805,8 +3837,17 @@ export type NotificationSubscriptionMutationUnsubscribeArgs = { id: Scalars['ID']; }; +export type NotificationThresholdExceeded = { + __typename?: 'NotificationThresholdExceeded'; + count: Scalars['Int']; + limit: Scalars['Int']; + threshold: Scalars['Int']; + type: BuildLimitThresholdExceededMetadataType; +}; + export enum NotificationType { - Email = 'EMAIL' + Email = 'EMAIL', + Web = 'WEB' } export type Offer = { @@ -4309,6 +4350,8 @@ export type SsoUser = Actor & UserActor & { /** @deprecated No longer supported */ twitterUsername?: Maybe; username: Scalars['String']; + /** Web notifications linked to a user */ + webNotifications: Array; }; @@ -4745,6 +4788,11 @@ export type SubscriptionDetailsPlanEnablementArgs = { serviceMetric: EasServiceMetric; }; +export type TestNotificationMetadata = { + __typename?: 'TestNotificationMetadata'; + message: Scalars['String']; +}; + export type TimelineActivityConnection = { __typename?: 'TimelineActivityConnection'; edges: Array; @@ -5062,6 +5110,7 @@ export type User = Actor & UserActor & { /** @deprecated No longer supported */ twitterUsername?: Maybe; username: Scalars['String']; + webNotifications: Array; }; @@ -5150,6 +5199,8 @@ export type UserActor = { /** @deprecated No longer supported */ twitterUsername?: Maybe; username: Scalars['String']; + /** Web notifications linked to a user */ + webNotifications: Array; }; @@ -6173,6 +6224,7 @@ export type ViewBuildsOnAppQuery = { __typename?: 'RootQuery', app: { __typename export type ViewUpdateChannelOnAppQueryVariables = Exact<{ appId: Scalars['String']; channelName: Scalars['String']; + filter?: InputMaybe; }>; @@ -6308,8 +6360,6 @@ export type UpdateFragment = { __typename?: 'Update', id: string, group: string, export type UpdateBranchFragment = { __typename?: 'UpdateBranch', id: string, name: string, updates: Array<{ __typename?: 'Update', id: string, group: string, message?: string | null, createdAt: any, runtimeVersion: string, platform: string, manifestFragment: string, isRollBackToEmbedded: boolean, manifestPermalink: string, gitCommitHash?: string | null, actor?: { __typename: 'Robot', firstName?: string | null, id: string } | { __typename: 'SSOUser', username: string, id: string } | { __typename: 'User', username: string, id: string } | null, branch: { __typename?: 'UpdateBranch', id: string, name: string }, codeSigningInfo?: { __typename?: 'CodeSigningInfo', keyid: string, sig: string, alg: string } | null }> }; -export type UpdateBranchWithCurrentGroupFragment = { __typename?: 'UpdateBranch', id: string, name: string, updateGroups: Array> }; - export type UpdateChannelBasicInfoFragment = { __typename?: 'UpdateChannel', id: string, name: string, branchMapping: string }; export type WebhookFragment = { __typename?: 'Webhook', id: string, event: WebhookType, url: string, createdAt: any, updatedAt: any }; diff --git a/packages/eas-cli/src/graphql/queries/ChannelQuery.ts b/packages/eas-cli/src/graphql/queries/ChannelQuery.ts index 5b60828a81..7cb495db2c 100644 --- a/packages/eas-cli/src/graphql/queries/ChannelQuery.ts +++ b/packages/eas-cli/src/graphql/queries/ChannelQuery.ts @@ -5,8 +5,6 @@ import { ChannelNotFoundError } from '../../channel/errors'; import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient'; import { withErrorHandlingAsync } from '../client'; import { - PageInfo, - UpdateChannelBasicInfoFragment, ViewUpdateChannelOnAppQuery, ViewUpdateChannelOnAppQueryVariables, ViewUpdateChannelsOnAppQuery, @@ -14,7 +12,7 @@ import { ViewUpdateChannelsPaginatedOnAppQuery, ViewUpdateChannelsPaginatedOnAppQueryVariables, } from '../generated'; -import { UpdateBranchWithCurrentGroupFragmentNode } from '../types/UpdateBranchWithCurrentUpdate'; +import { UpdateFragmentNode } from '../types/Update'; import { UpdateChannelBasicInfoFragmentNode } from '../types/UpdateChannelBasicInfo'; type ViewUpdateChannelsOnAppObject = NonNullable< @@ -28,16 +26,22 @@ type UpdateChannelByNameObject = NonNullable< // these types should have the same fields export type UpdateChannelObject = ViewUpdateChannelsOnAppObject & UpdateChannelByNameObject; +export type UpdateBranchObject = UpdateChannelObject['updateBranches'][number]; + export const ChannelQuery = { async viewUpdateChannelAsync( graphqlClient: ExpoGraphqlClient, - { appId, channelName }: ViewUpdateChannelOnAppQueryVariables + { appId, channelName, filter }: ViewUpdateChannelOnAppQueryVariables ): Promise { const response = await withErrorHandlingAsync( graphqlClient .query( gql` - query ViewUpdateChannelOnApp($appId: String!, $channelName: String!) { + query ViewUpdateChannelOnApp( + $appId: String! + $channelName: String! + $filter: UpdatesFilter + ) { app { byId(appId: $appId) { id @@ -48,15 +52,19 @@ export const ChannelQuery = { branchMapping updateBranches(offset: 0, limit: 5) { id - ...UpdateBranchWithCurrentGroupFragment + name + updateGroups(offset: 0, limit: 1, filter: $filter) { + id + ...UpdateFragment + } } } } } } - ${print(UpdateBranchWithCurrentGroupFragmentNode)} + ${print(UpdateFragmentNode)} `, - { appId, channelName }, + { appId, channelName, filter }, { additionalTypenames: ['UpdateChannel', 'UpdateBranch', 'Update'] } ) .toPromise() @@ -88,13 +96,17 @@ export const ChannelQuery = { branchMapping updateBranches(offset: 0, limit: 5) { id - ...UpdateBranchWithCurrentGroupFragment + name + updateGroups(offset: 0, limit: 1) { + id + ...UpdateFragment + } } } } } } - ${print(UpdateBranchWithCurrentGroupFragmentNode)} + ${print(UpdateFragmentNode)} `, { appId, offset, limit }, { additionalTypenames: ['UpdateChannel', 'UpdateBranch', 'Update'] } @@ -112,7 +124,7 @@ export const ChannelQuery = { async viewUpdateChannelsBasicInfoPaginatedOnAppAsync( graphqlClient: ExpoGraphqlClient, { appId, first, after }: ViewUpdateChannelsPaginatedOnAppQueryVariables - ): Promise<[UpdateChannelBasicInfoFragment[], PageInfo]> { + ): Promise { const response = await withErrorHandlingAsync( graphqlClient .query< @@ -153,7 +165,6 @@ export const ChannelQuery = { if (!channelsPaginated) { throw new Error(`Could not find channels on project with id ${appId}`); } - - return [channelsPaginated.edges.map(edge => edge.node) ?? [], channelsPaginated.pageInfo]; + return channelsPaginated; }, }; diff --git a/packages/eas-cli/src/graphql/types/UpdateBranchWithCurrentUpdate.ts b/packages/eas-cli/src/graphql/types/UpdateBranchWithCurrentUpdate.ts deleted file mode 100644 index 9c9dfe1bf9..0000000000 --- a/packages/eas-cli/src/graphql/types/UpdateBranchWithCurrentUpdate.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { print } from 'graphql'; -import gql from 'graphql-tag'; - -import { UpdateFragmentNode } from './Update'; - -export const UpdateBranchWithCurrentGroupFragmentNode = gql` - fragment UpdateBranchWithCurrentGroupFragment on UpdateBranch { - id - name - updateGroups(offset: 0, limit: 1) { - id - ...UpdateFragment - } - } - ${print(UpdateFragmentNode)} -`; From 27e06032fee14f07f5ff84d94df2297b23128b95 Mon Sep 17 00:00:00 2001 From: Quinlan Jung Date: Wed, 26 Jul 2023 01:25:06 +0000 Subject: [PATCH 2/2] update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03d9d63ae5..2e1be5a0f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ This is the log of notable changes to EAS CLI and related packages. ### 🧹 Chores - Unify channel graphql query types. ([#1949](https://github.com/expo/eas-cli/pull/1949) by [@quinlanj](https://github.com/quinlanj)) +- Revert UpdateBranchWithCurrentGroupFragment. ([#1952](https://github.com/expo/eas-cli/pull/1952) by [@quinlanj](https://github.com/quinlanj)) ## [3.17.0](https://github.com/expo/eas-cli/releases/tag/v3.17.0) - 2023-07-24