Skip to content

Commit

Permalink
[menu-bar] Configure Apollo possibleTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieldonadel committed Sep 15, 2023
1 parent 929fd67 commit 823ade8
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apps/menu-bar/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const config: CodegenConfig = {
'./src/generated/schema.graphql': {
plugins: ['schema-ast'],
},
'./src/generated/graphql.possibleTypes.json': {
plugins: ['fragment-matcher'],
},
},
};

Expand Down
1 change: 1 addition & 0 deletions apps/menu-bar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@babel/preset-env": "^7.22.10",
"@babel/runtime": "^7.22.11",
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/fragment-matcher": "^5.0.0",
"@graphql-codegen/schema-ast": "^4.0.0",
"@graphql-codegen/typescript-operations": "^4.0.1",
"@graphql-codegen/typescript-react-apollo": "^3.3.7",
Expand Down
6 changes: 6 additions & 0 deletions apps/menu-bar/src/api/ApolloClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { MMKVWrapper, persistCache } from 'apollo3-cache-persist';
import { useEffect, useState } from 'react';

import Config from './Config';
import possibleTypesData from '../generated/graphql.possibleTypes.json';
import { storage } from '../modules/Storage';

const httpLink = new HttpLink({
Expand All @@ -27,8 +28,13 @@ const mergeBasedOnOffset = (existing: any[], incoming: any[], { args }: FieldFun
return merged;
};

const { possibleTypes } = possibleTypesData;
const cache = new InMemoryCache({
possibleTypes,
typePolicies: {
UserActor: {
keyFields: ['id'],
},
AppQuery: {
keyFields: ['byId', ['id']],
},
Expand Down
47 changes: 47 additions & 0 deletions apps/menu-bar/src/generated/graphql.possibleTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"possibleTypes": {
"AccountUsageMetadata": [
"AccountUsageEASBuildMetadata"
],
"ActivityTimelineProjectActivity": [
"Build",
"BuildJob",
"Submission",
"Update"
],
"Actor": [
"Robot",
"SSOUser",
"User"
],
"BuildOrBuildJob": [
"Build",
"BuildJob"
],
"EASBuildOrClassicBuildJob": [
"Build",
"BuildJob"
],
"FcmSnippet": [
"FcmSnippetLegacy",
"FcmSnippetV1"
],
"NotificationMetadata": [
"BuildLimitThresholdExceededMetadata",
"BuildPlanCreditThresholdExceededMetadata",
"TestNotificationMetadata"
],
"PlanEnablement": [
"Concurrencies",
"EASTotalPlanEnablement"
],
"Project": [
"App",
"Snack"
],
"UserActor": [
"SSOUser",
"User"
]
}
}
44 changes: 44 additions & 0 deletions apps/menu-bar/src/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,7 @@ enum BuildCredentialsSource {
}

type BuildError {
buildPhase: BuildPhase
docsUrl: String
errorCode: String!
message: String!
Expand Down Expand Up @@ -1615,6 +1616,49 @@ input BuildParamsInput {
sdkVersion: String
}

enum BuildPhase {
BUILDER_INFO
CLEAN_UP_CREDENTIALS
COMPLETE_BUILD
CONFIGURE_EXPO_UPDATES
CONFIGURE_XCODE_PROJECT
CUSTOM
DOWNLOAD_APPLICATION_ARCHIVE
EAS_BUILD_INTERNAL
FAIL_BUILD
FIX_GRADLEW
INSTALL_CUSTOM_TOOLS
INSTALL_DEPENDENCIES
INSTALL_PODS
ON_BUILD_CANCEL_HOOK
ON_BUILD_COMPLETE_HOOK
ON_BUILD_ERROR_HOOK
ON_BUILD_SUCCESS_HOOK
PARSE_CUSTOM_WORKFLOW_CONFIG
POST_INSTALL_HOOK
PREBUILD
PREPARE_ARTIFACTS
PREPARE_CREDENTIALS
PREPARE_PROJECT
PRE_INSTALL_HOOK
PRE_UPLOAD_ARTIFACTS_HOOK
QUEUE
READ_APP_CONFIG
READ_PACKAGE_JSON
RESTORE_CACHE
RUN_EXPO_DOCTOR
RUN_FASTLANE
RUN_GRADLEW
SAVE_CACHE
SET_UP_BUILD_ENVIRONMENT
SPIN_UP_BUILDER
START_BUILD
UNKNOWN
UPLOAD_APPLICATION_ARCHIVE
UPLOAD_ARTIFACTS @deprecated
UPLOAD_BUILD_ARTIFACTS
}

type BuildPlanCreditThresholdExceededMetadata {
account: Account!
buildCreditUsage: Int!
Expand Down

0 comments on commit 823ade8

Please sign in to comment.