eas-cli 3.0.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +82 -103
  2. package/build/branch/queries.d.ts +2 -1
  3. package/build/build/ios/credentials.d.ts +3 -0
  4. package/build/build/ios/credentials.js +16 -1
  5. package/build/build/ios/graphql.d.ts +4 -1
  6. package/build/build/ios/graphql.js +2 -1
  7. package/build/build/ios/prepareJob.d.ts +2 -0
  8. package/build/build/ios/prepareJob.js +17 -1
  9. package/build/build/queries.d.ts +6 -0
  10. package/build/build/queries.js +25 -1
  11. package/build/channel/errors.d.ts +3 -0
  12. package/build/channel/errors.js +9 -0
  13. package/build/channel/queries.js +1 -1
  14. package/build/commands/branch/delete.js +1 -1
  15. package/build/commands/branch/view.js +3 -1
  16. package/build/commands/build/index.d.ts +1 -0
  17. package/build/commands/build/index.js +2 -0
  18. package/build/commands/build/resign.d.ts +55 -0
  19. package/build/commands/build/resign.js +207 -0
  20. package/build/commands/channel/edit.js +1 -1
  21. package/build/commands/update/configure.js +15 -2
  22. package/build/commands/update/index.d.ts +1 -0
  23. package/build/commands/update/index.js +22 -7
  24. package/build/commands/update/list.js +3 -1
  25. package/build/devices/queries.js +8 -4
  26. package/build/graphql/generated.d.ts +136 -5
  27. package/build/graphql/generated.js +9 -2
  28. package/build/graphql/mutations/BuildMutation.d.ts +5 -1
  29. package/build/graphql/mutations/BuildMutation.js +17 -0
  30. package/build/graphql/queries/ChannelQuery.js +2 -1
  31. package/build/update/configure.d.ts +1 -1
  32. package/build/update/configure.js +52 -5
  33. package/build/update/getBranchNameFromChannelNameAsync.d.ts +2 -0
  34. package/build/update/getBranchNameFromChannelNameAsync.js +45 -0
  35. package/build/update/queries.js +3 -1
  36. package/build/utils/queries.d.ts +5 -1
  37. package/build/utils/queries.js +1 -1
  38. package/oclif.manifest.json +1 -1
  39. package/package.json +2 -2
@@ -343,7 +343,6 @@ export declare type AccountSsoConfiguration = {
343
343
  id: Scalars['ID'];
344
344
  issuer?: Maybe<Scalars['String']>;
345
345
  jwksEndpoint?: Maybe<Scalars['String']>;
346
- redirectUri: Scalars['String'];
347
346
  revokeEndpoint?: Maybe<Scalars['String']>;
348
347
  tokenEndpoint?: Maybe<Scalars['String']>;
349
348
  updatedAt: Scalars['DateTime'];
@@ -357,7 +356,6 @@ export declare type AccountSsoConfigurationData = {
357
356
  clientSecret: Scalars['String'];
358
357
  issuer?: InputMaybe<Scalars['String']>;
359
358
  jwksEndpoint?: InputMaybe<Scalars['String']>;
360
- redirectUri: Scalars['String'];
361
359
  revokeEndpoint?: InputMaybe<Scalars['String']>;
362
360
  tokenEndpoint?: InputMaybe<Scalars['String']>;
363
361
  userInfoEndpoint?: InputMaybe<Scalars['String']>;
@@ -392,7 +390,6 @@ export declare type AccountSsoConfigurationPublicData = {
392
390
  id: Scalars['ID'];
393
391
  issuer?: Maybe<Scalars['String']>;
394
392
  jwksEndpoint?: Maybe<Scalars['String']>;
395
- redirectUri: Scalars['String'];
396
393
  revokeEndpoint?: Maybe<Scalars['String']>;
397
394
  tokenEndpoint?: Maybe<Scalars['String']>;
398
395
  userInfoEndpoint?: Maybe<Scalars['String']>;
@@ -664,6 +661,7 @@ export declare type AndroidJobInput = {
664
661
  developmentClient?: InputMaybe<Scalars['Boolean']>;
665
662
  experimental?: InputMaybe<Scalars['JSONObject']>;
666
663
  gradleCommand?: InputMaybe<Scalars['String']>;
664
+ mode?: InputMaybe<BuildMode>;
667
665
  projectArchive: ProjectArchiveSourceInput;
668
666
  projectRootDirectory: Scalars['String'];
669
667
  releaseChannel?: InputMaybe<Scalars['String']>;
@@ -690,6 +688,7 @@ export declare type AndroidJobOverridesInput = {
690
688
  developmentClient?: InputMaybe<Scalars['Boolean']>;
691
689
  experimental?: InputMaybe<Scalars['JSONObject']>;
692
690
  gradleCommand?: InputMaybe<Scalars['String']>;
691
+ mode?: InputMaybe<BuildMode>;
693
692
  releaseChannel?: InputMaybe<Scalars['String']>;
694
693
  secrets?: InputMaybe<AndroidJobSecretsInput>;
695
694
  updates?: InputMaybe<BuildUpdatesInput>;
@@ -784,6 +783,7 @@ export declare type App = Project & {
784
783
  /** Classic update release channel names that have at least one build */
785
784
  buildsReleaseChannels: Array<Scalars['String']>;
786
785
  deployment?: Maybe<Deployment>;
786
+ deploymentNew?: Maybe<DeploymentNew>;
787
787
  /** Deployments associated with this app */
788
788
  deployments: Array<Deployment>;
789
789
  description: Scalars['String'];
@@ -900,6 +900,11 @@ export declare type AppDeploymentArgs = {
900
900
  runtimeVersion: Scalars['String'];
901
901
  };
902
902
  /** Represents an Exponent App (or Experience in legacy terms) */
903
+ export declare type AppDeploymentNewArgs = {
904
+ channel: Scalars['String'];
905
+ runtimeVersion: Scalars['String'];
906
+ };
907
+ /** Represents an Exponent App (or Experience in legacy terms) */
903
908
  export declare type AppDeploymentsArgs = {
904
909
  limit: Scalars['Int'];
905
910
  mostRecentlyUpdatedAt?: InputMaybe<Scalars['DateTime']>;
@@ -1511,6 +1516,10 @@ export declare type Build = ActivityTimelineProjectActivity & BuildOrBuildJob &
1511
1516
  updatedAt: Scalars['DateTime'];
1512
1517
  workerStartedAt?: Maybe<Scalars['DateTime']>;
1513
1518
  };
1519
+ /** Represents an EAS Build */
1520
+ export declare type BuildCanRetryArgs = {
1521
+ newMode?: InputMaybe<BuildMode>;
1522
+ };
1514
1523
  export declare type BuildArtifact = {
1515
1524
  __typename?: 'BuildArtifact';
1516
1525
  manifestPlistUrl?: Maybe<Scalars['String']>;
@@ -1652,6 +1661,10 @@ export declare type BuildMetrics = {
1652
1661
  buildQueueTime?: Maybe<Scalars['Int']>;
1653
1662
  buildWaitTime?: Maybe<Scalars['Int']>;
1654
1663
  };
1664
+ export declare enum BuildMode {
1665
+ Build = "BUILD",
1666
+ Resign = "RESIGN"
1667
+ }
1655
1668
  export declare type BuildMutation = {
1656
1669
  __typename?: 'BuildMutation';
1657
1670
  /**
@@ -1776,6 +1789,9 @@ export declare type BuildQueryAllForAppArgs = {
1776
1789
  export declare type BuildQueryByIdArgs = {
1777
1790
  buildId: Scalars['ID'];
1778
1791
  };
1792
+ export declare type BuildResignInput = {
1793
+ applicationArchiveSource?: InputMaybe<ProjectArchiveSourceInput>;
1794
+ };
1779
1795
  export declare enum BuildResourceClass {
1780
1796
  AndroidDefault = "ANDROID_DEFAULT",
1781
1797
  AndroidLarge = "ANDROID_LARGE",
@@ -1798,7 +1814,8 @@ export declare type BuildUpdatesInput = {
1798
1814
  };
1799
1815
  export declare enum BuildWorkflow {
1800
1816
  Generic = "GENERIC",
1801
- Managed = "MANAGED"
1817
+ Managed = "MANAGED",
1818
+ Unknown = "UNKNOWN"
1802
1819
  }
1803
1820
  export declare enum CacheControlScope {
1804
1821
  Private = "PRIVATE",
@@ -1998,6 +2015,31 @@ export declare type Deployment = {
1998
2015
  recentBuilds: Array<Build>;
1999
2016
  runtimeVersion: Scalars['String'];
2000
2017
  };
2018
+ export declare type DeploymentBuildEdge = {
2019
+ __typename?: 'DeploymentBuildEdge';
2020
+ cursor: Scalars['String'];
2021
+ node: Build;
2022
+ };
2023
+ export declare type DeploymentBuildsConnection = {
2024
+ __typename?: 'DeploymentBuildsConnection';
2025
+ edges: Array<DeploymentBuildEdge>;
2026
+ pageInfo: PageInfo;
2027
+ };
2028
+ /** Represents a Deployment - a set of Builds with the same Runtime Version and Channel */
2029
+ export declare type DeploymentNew = {
2030
+ __typename?: 'DeploymentNew';
2031
+ builds: DeploymentBuildsConnection;
2032
+ channel: UpdateChannel;
2033
+ id: Scalars['ID'];
2034
+ runtime: Runtime;
2035
+ };
2036
+ /** Represents a Deployment - a set of Builds with the same Runtime Version and Channel */
2037
+ export declare type DeploymentNewBuildsArgs = {
2038
+ after?: InputMaybe<Scalars['String']>;
2039
+ before?: InputMaybe<Scalars['String']>;
2040
+ first?: InputMaybe<Scalars['Int']>;
2041
+ last?: InputMaybe<Scalars['Int']>;
2042
+ };
2001
2043
  export declare type DeploymentOptions = {
2002
2044
  /** Max number of associated builds to return */
2003
2045
  buildListMaxSize?: InputMaybe<Scalars['Int']>;
@@ -2134,7 +2176,7 @@ export declare type GitHubAppInstallationAccessibleRepositoriesArgs = {
2134
2176
  };
2135
2177
  export declare type GitHubAppInstallationAccessibleRepository = {
2136
2178
  __typename?: 'GitHubAppInstallationAccessibleRepository';
2137
- defaultBranch: Scalars['String'];
2179
+ defaultBranch?: Maybe<Scalars['String']>;
2138
2180
  description?: Maybe<Scalars['String']>;
2139
2181
  id: Scalars['Int'];
2140
2182
  name: Scalars['String'];
@@ -2488,6 +2530,7 @@ export declare type IosJobInput = {
2488
2530
  /** @deprecated */
2489
2531
  distribution?: InputMaybe<DistributionType>;
2490
2532
  experimental?: InputMaybe<Scalars['JSONObject']>;
2533
+ mode?: InputMaybe<BuildMode>;
2491
2534
  projectArchive: ProjectArchiveSourceInput;
2492
2535
  projectRootDirectory: Scalars['String'];
2493
2536
  releaseChannel?: InputMaybe<Scalars['String']>;
@@ -2513,10 +2556,13 @@ export declare type IosJobOverridesInput = {
2513
2556
  /** @deprecated */
2514
2557
  distribution?: InputMaybe<DistributionType>;
2515
2558
  experimental?: InputMaybe<Scalars['JSONObject']>;
2559
+ mode?: InputMaybe<BuildMode>;
2516
2560
  releaseChannel?: InputMaybe<Scalars['String']>;
2561
+ resign?: InputMaybe<BuildResignInput>;
2517
2562
  scheme?: InputMaybe<Scalars['String']>;
2518
2563
  secrets?: InputMaybe<IosJobSecretsInput>;
2519
2564
  simulator?: InputMaybe<Scalars['Boolean']>;
2565
+ type?: InputMaybe<BuildWorkflow>;
2520
2566
  updates?: InputMaybe<BuildUpdatesInput>;
2521
2567
  username?: InputMaybe<Scalars['String']>;
2522
2568
  version?: InputMaybe<IosJobVersionInput>;
@@ -2702,6 +2748,13 @@ export declare enum Order {
2702
2748
  Asc = "ASC",
2703
2749
  Desc = "DESC"
2704
2750
  }
2751
+ export declare type PageInfo = {
2752
+ __typename?: 'PageInfo';
2753
+ endCursor?: Maybe<Scalars['String']>;
2754
+ hasNextPage: Scalars['Boolean'];
2755
+ hasPreviousPage: Scalars['Boolean'];
2756
+ startCursor?: Maybe<Scalars['String']>;
2757
+ };
2705
2758
  export declare type PartialManifest = {
2706
2759
  assets: Array<InputMaybe<PartialManifestAsset>>;
2707
2760
  extra?: InputMaybe<Scalars['JSONObject']>;
@@ -2745,6 +2798,7 @@ export declare type ProjectArchiveSourceInput = {
2745
2798
  };
2746
2799
  export declare enum ProjectArchiveSourceType {
2747
2800
  Gcs = "GCS",
2801
+ None = "NONE",
2748
2802
  S3 = "S3",
2749
2803
  Url = "URL"
2750
2804
  }
@@ -3035,6 +3089,13 @@ export declare type RootQueryUserByUserIdArgs = {
3035
3089
  export declare type RootQueryUserByUsernameArgs = {
3036
3090
  username: Scalars['String'];
3037
3091
  };
3092
+ export declare type Runtime = {
3093
+ __typename?: 'Runtime';
3094
+ app: App;
3095
+ firstBuildCreatedAt: Scalars['DateTime'];
3096
+ id: Scalars['ID'];
3097
+ version: Scalars['String'];
3098
+ };
3038
3099
  export declare type SecondFactorBooleanResult = {
3039
3100
  __typename?: 'SecondFactorBooleanResult';
3040
3101
  success: Scalars['Boolean'];
@@ -6835,6 +6896,76 @@ export declare type CreateIosBuildMutation = {
6835
6896
  };
6836
6897
  };
6837
6898
  };
6899
+ export declare type RetryIosBuildMutationVariables = Exact<{
6900
+ buildId: Scalars['ID'];
6901
+ jobOverrides: IosJobOverridesInput;
6902
+ }>;
6903
+ export declare type RetryIosBuildMutation = {
6904
+ __typename?: 'RootMutation';
6905
+ build: {
6906
+ __typename?: 'BuildMutation';
6907
+ retryIosBuild: {
6908
+ __typename?: 'Build';
6909
+ id: string;
6910
+ status: BuildStatus;
6911
+ platform: AppPlatform;
6912
+ channel?: string | null;
6913
+ releaseChannel?: string | null;
6914
+ distribution?: DistributionType | null;
6915
+ iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null;
6916
+ buildProfile?: string | null;
6917
+ sdkVersion?: string | null;
6918
+ appVersion?: string | null;
6919
+ appBuildVersion?: string | null;
6920
+ runtimeVersion?: string | null;
6921
+ gitCommitHash?: string | null;
6922
+ gitCommitMessage?: string | null;
6923
+ initialQueuePosition?: number | null;
6924
+ queuePosition?: number | null;
6925
+ estimatedWaitTimeLeftSeconds?: number | null;
6926
+ priority: BuildPriority;
6927
+ createdAt: any;
6928
+ updatedAt: any;
6929
+ error?: {
6930
+ __typename?: 'BuildError';
6931
+ errorCode: string;
6932
+ message: string;
6933
+ docsUrl?: string | null;
6934
+ } | null;
6935
+ artifacts?: {
6936
+ __typename?: 'BuildArtifacts';
6937
+ buildUrl?: string | null;
6938
+ xcodeBuildLogsUrl?: string | null;
6939
+ applicationArchiveUrl?: string | null;
6940
+ } | null;
6941
+ initiatingActor?: {
6942
+ __typename: 'Robot';
6943
+ id: string;
6944
+ displayName: string;
6945
+ } | {
6946
+ __typename: 'User';
6947
+ id: string;
6948
+ displayName: string;
6949
+ } | null;
6950
+ project: {
6951
+ __typename: 'App';
6952
+ id: string;
6953
+ name: string;
6954
+ slug: string;
6955
+ ownerAccount: {
6956
+ __typename?: 'Account';
6957
+ id: string;
6958
+ name: string;
6959
+ };
6960
+ } | {
6961
+ __typename: 'Snack';
6962
+ id: string;
6963
+ name: string;
6964
+ slug: string;
6965
+ };
6966
+ };
6967
+ };
6968
+ };
6838
6969
  export declare type CreateEnvironmentSecretForAccountMutationVariables = Exact<{
6839
6970
  input: CreateEnvironmentSecretInput;
6840
6971
  accountId: Scalars['String'];
@@ -6,8 +6,8 @@
6
6
  * For more info and docs, visit https://graphql-code-generator.com/
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.SubmissionArchiveSourceType = exports.SubmissionAndroidTrack = exports.SubmissionAndroidReleaseStatus = exports.SubmissionAndroidArchiveType = exports.StatuspageServiceStatus = exports.StatuspageServiceName = exports.StatuspageIncidentStatus = exports.StatuspageIncidentImpact = exports.StandardOffer = exports.SecondFactorMethod = exports.Role = exports.ProjectArchiveSourceType = exports.Permission = exports.Order = exports.OfferType = exports.MailchimpTag = exports.MailchimpAudience = exports.IosSchemeBuildConfiguration = exports.IosManagedBuildType = exports.IosDistributionType = exports.IosBuildType = exports.InvoiceDiscountType = exports.GitHubAppInstallationStatus = exports.GitHubAppEnvironment = exports.Feature = exports.EnvironmentSecretType = exports.EasServiceMetric = exports.EasBuildDeprecationInfoType = exports.DistributionType = exports.CacheControlScope = exports.BuildWorkflow = exports.BuildStatus = exports.BuildResourceClass = exports.BuildPriority = exports.BuildJobStatus = exports.BuildJobLogsFormat = exports.BuildIosEnterpriseProvisioning = exports.BuildCredentialsSource = exports.AuthProtocolType = exports.AssetMetadataStatus = exports.AppsFilter = exports.AppleDeviceClass = exports.AppStoreConnectUserRole = exports.AppSort = exports.AppPrivacy = exports.AppPlatform = exports.AndroidKeystoreType = exports.AndroidFcmVersion = exports.AndroidBuildType = exports.ActivityTimelineProjectActivityType = void 0;
10
- exports.WebhookType = exports.UsageMetricsGranularity = exports.UsageMetricType = exports.UploadSessionType = exports.SubmissionStatus = void 0;
9
+ exports.SubmissionAndroidTrack = exports.SubmissionAndroidReleaseStatus = exports.SubmissionAndroidArchiveType = exports.StatuspageServiceStatus = exports.StatuspageServiceName = exports.StatuspageIncidentStatus = exports.StatuspageIncidentImpact = exports.StandardOffer = exports.SecondFactorMethod = exports.Role = exports.ProjectArchiveSourceType = exports.Permission = exports.Order = exports.OfferType = exports.MailchimpTag = exports.MailchimpAudience = exports.IosSchemeBuildConfiguration = exports.IosManagedBuildType = exports.IosDistributionType = exports.IosBuildType = exports.InvoiceDiscountType = exports.GitHubAppInstallationStatus = exports.GitHubAppEnvironment = exports.Feature = exports.EnvironmentSecretType = exports.EasServiceMetric = exports.EasBuildDeprecationInfoType = exports.DistributionType = exports.CacheControlScope = exports.BuildWorkflow = exports.BuildStatus = exports.BuildResourceClass = exports.BuildPriority = exports.BuildMode = exports.BuildJobStatus = exports.BuildJobLogsFormat = exports.BuildIosEnterpriseProvisioning = exports.BuildCredentialsSource = exports.AuthProtocolType = exports.AssetMetadataStatus = exports.AppsFilter = exports.AppleDeviceClass = exports.AppStoreConnectUserRole = exports.AppSort = exports.AppPrivacy = exports.AppPlatform = exports.AndroidKeystoreType = exports.AndroidFcmVersion = exports.AndroidBuildType = exports.ActivityTimelineProjectActivityType = void 0;
10
+ exports.WebhookType = exports.UsageMetricsGranularity = exports.UsageMetricType = exports.UploadSessionType = exports.SubmissionStatus = exports.SubmissionArchiveSourceType = void 0;
11
11
  var ActivityTimelineProjectActivityType;
12
12
  (function (ActivityTimelineProjectActivityType) {
13
13
  ActivityTimelineProjectActivityType["Build"] = "BUILD";
@@ -115,6 +115,11 @@ var BuildJobStatus;
115
115
  BuildJobStatus["SentToQueue"] = "SENT_TO_QUEUE";
116
116
  BuildJobStatus["Started"] = "STARTED";
117
117
  })(BuildJobStatus = exports.BuildJobStatus || (exports.BuildJobStatus = {}));
118
+ var BuildMode;
119
+ (function (BuildMode) {
120
+ BuildMode["Build"] = "BUILD";
121
+ BuildMode["Resign"] = "RESIGN";
122
+ })(BuildMode = exports.BuildMode || (exports.BuildMode = {}));
118
123
  var BuildPriority;
119
124
  (function (BuildPriority) {
120
125
  BuildPriority["High"] = "HIGH";
@@ -144,6 +149,7 @@ var BuildWorkflow;
144
149
  (function (BuildWorkflow) {
145
150
  BuildWorkflow["Generic"] = "GENERIC";
146
151
  BuildWorkflow["Managed"] = "MANAGED";
152
+ BuildWorkflow["Unknown"] = "UNKNOWN";
147
153
  })(BuildWorkflow = exports.BuildWorkflow || (exports.BuildWorkflow = {}));
148
154
  var CacheControlScope;
149
155
  (function (CacheControlScope) {
@@ -260,6 +266,7 @@ var Permission;
260
266
  var ProjectArchiveSourceType;
261
267
  (function (ProjectArchiveSourceType) {
262
268
  ProjectArchiveSourceType["Gcs"] = "GCS";
269
+ ProjectArchiveSourceType["None"] = "NONE";
263
270
  ProjectArchiveSourceType["S3"] = "S3";
264
271
  ProjectArchiveSourceType["Url"] = "URL";
265
272
  })(ProjectArchiveSourceType = exports.ProjectArchiveSourceType || (exports.ProjectArchiveSourceType = {}));
@@ -1,5 +1,5 @@
1
1
  import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
2
- import { AndroidJobInput, BuildFragment, BuildMetadataInput, BuildParamsInput, EasBuildDeprecationInfo, IosJobInput } from '../generated';
2
+ import { AndroidJobInput, BuildFragment, BuildMetadataInput, BuildParamsInput, EasBuildDeprecationInfo, IosJobInput, IosJobOverridesInput } from '../generated';
3
3
  export interface BuildResult {
4
4
  build: BuildFragment;
5
5
  deprecationInfo?: EasBuildDeprecationInfo | null;
@@ -17,4 +17,8 @@ export declare const BuildMutation: {
17
17
  metadata: BuildMetadataInput;
18
18
  buildParams: BuildParamsInput;
19
19
  }): Promise<BuildResult>;
20
+ retryIosBuildAsync(graphqlClient: ExpoGraphqlClient, input: {
21
+ buildId: string;
22
+ jobOverrides: IosJobOverridesInput;
23
+ }): Promise<BuildFragment>;
20
24
  };
@@ -74,4 +74,21 @@ exports.BuildMutation = {
74
74
  .toPromise());
75
75
  return (0, nullthrows_1.default)((_a = data.build) === null || _a === void 0 ? void 0 : _a.createIosBuild);
76
76
  },
77
+ async retryIosBuildAsync(graphqlClient, input) {
78
+ var _a;
79
+ const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
80
+ .mutation((0, graphql_tag_1.default) `
81
+ mutation RetryIosBuildMutation($buildId: ID!, $jobOverrides: IosJobOverridesInput!) {
82
+ build {
83
+ retryIosBuild(buildId: $buildId, jobOverrides: $jobOverrides) {
84
+ id
85
+ ...BuildFragment
86
+ }
87
+ }
88
+ }
89
+ ${(0, graphql_1.print)(Build_1.BuildFragmentNode)}
90
+ `, input, { noRetry: true })
91
+ .toPromise());
92
+ return (0, nullthrows_1.default)((_a = data.build) === null || _a === void 0 ? void 0 : _a.retryIosBuild);
93
+ },
77
94
  };
@@ -4,6 +4,7 @@ exports.ChannelQuery = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const graphql_1 = require("graphql");
6
6
  const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
7
+ const errors_1 = require("../../channel/errors");
7
8
  const client_1 = require("../client");
8
9
  const Update_1 = require("../types/Update");
9
10
  exports.ChannelQuery = {
@@ -36,7 +37,7 @@ exports.ChannelQuery = {
36
37
  .toPromise());
37
38
  const { updateChannelByName } = response.app.byId;
38
39
  if (!updateChannelByName) {
39
- throw new Error(`Could not find channel with the name ${channelName}`);
40
+ throw new errors_1.ChannelNotFoundError(`Could not find channel with the name ${channelName}`);
40
41
  }
41
42
  return updateChannelByName;
42
43
  },
@@ -14,7 +14,7 @@ export declare const DEFAULT_BARE_RUNTIME_VERSION: "1.0.0";
14
14
  * - Sets `updates.url` if not set
15
15
  * - Ensure latest changes are reflected in the native config, if any
16
16
  */
17
- export declare function ensureEASUpdatesIsConfiguredAsync(graphqlClient: ExpoGraphqlClient, { exp: expWithoutUpdates, projectId, projectDir, platform, }: {
17
+ export declare function ensureEASUpdateIsConfiguredAsync(graphqlClient: ExpoGraphqlClient, { exp: expWithoutUpdates, projectId, projectDir, platform, }: {
18
18
  exp: ExpoConfig;
19
19
  projectId: string;
20
20
  projectDir: string;
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ensureEASUpdatesIsConfiguredAsync = exports.DEFAULT_BARE_RUNTIME_VERSION = exports.DEFAULT_MANAGED_RUNTIME_VERSION = void 0;
3
+ exports.ensureEASUpdateIsConfiguredAsync = exports.DEFAULT_BARE_RUNTIME_VERSION = exports.DEFAULT_MANAGED_RUNTIME_VERSION = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const config_1 = require("@expo/config");
6
6
  const eas_build_job_1 = require("@expo/eas-build-job");
7
+ const eas_json_1 = require("@expo/eas-json");
7
8
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
9
+ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
8
10
  const api_1 = require("../api");
9
11
  const generated_1 = require("../graphql/generated");
10
12
  const log_1 = tslib_1.__importStar(require("../log"));
@@ -144,7 +146,7 @@ function warnEASUpdatesManualConfig({ modifyConfig, workflows, }) {
144
146
  /**
145
147
  * Make sure that the current `app.json` configuration for EAS Updates is set natively.
146
148
  */
147
- async function ensureEASUpdatesIsConfiguredNativelyAsync(graphqlClient, { exp, projectId, projectDir, platform, workflows, }) {
149
+ async function ensureEASUpdateIsConfiguredNativelyAsync(graphqlClient, { exp, projectId, projectDir, platform, workflows, }) {
148
150
  if (['all', 'android'].includes(platform) && workflows.android === eas_build_job_1.Workflow.GENERIC) {
149
151
  await (0, UpdatesModule_1.syncUpdatesConfigurationAsync)(graphqlClient, projectDir, exp, projectId);
150
152
  log_1.default.withTick(`Configured ${chalk_1.default.bold('AndroidManifest.xml')} for EAS Update`);
@@ -154,6 +156,50 @@ async function ensureEASUpdatesIsConfiguredNativelyAsync(graphqlClient, { exp, p
154
156
  log_1.default.withTick(`Configured ${chalk_1.default.bold('Expo.plist')} for EAS Update`);
155
157
  }
156
158
  }
159
+ /**
160
+ * Make sure EAS Build profiles are configured to work with EAS Update by adding channels to build profiles.
161
+ */
162
+ async function ensureEASUpdateIsConfiguredInEasJsonAsync(projectDir) {
163
+ const easJsonPath = eas_json_1.EasJsonAccessor.formatEasJsonPath(projectDir);
164
+ if (!(await fs_extra_1.default.pathExists(easJsonPath))) {
165
+ log_1.default.warn(`EAS Build is not configured. If you'd like to use EAS Build with EAS Update, run ${chalk_1.default.bold('eas build:configure')}, then re-run ${chalk_1.default.bold('eas update:configure')} to configure ${chalk_1.default.bold('eas.json')} with EAS Update.`);
166
+ return;
167
+ }
168
+ try {
169
+ const easJsonAccessor = new eas_json_1.EasJsonAccessor(projectDir);
170
+ await easJsonAccessor.readRawJsonAsync();
171
+ easJsonAccessor.patch(easJsonRawObject => {
172
+ const easBuildProfilesWithChannels = Object.keys(easJsonRawObject.build).reduce((acc, profileNameKey) => {
173
+ const buildProfile = easJsonRawObject.build[profileNameKey];
174
+ const isNotAlreadyConfigured = !buildProfile.channel && !buildProfile.releaseChannel;
175
+ if (isNotAlreadyConfigured) {
176
+ return {
177
+ ...acc,
178
+ [profileNameKey]: {
179
+ ...buildProfile,
180
+ channel: profileNameKey,
181
+ },
182
+ };
183
+ }
184
+ return {
185
+ ...acc,
186
+ [profileNameKey]: {
187
+ ...easJsonRawObject.build[profileNameKey],
188
+ },
189
+ };
190
+ }, {});
191
+ return {
192
+ ...easJsonRawObject,
193
+ build: easBuildProfilesWithChannels,
194
+ };
195
+ });
196
+ await easJsonAccessor.writeAsync();
197
+ log_1.default.withTick(`Configured ${chalk_1.default.bold('eas.json')}.`);
198
+ }
199
+ catch (error) {
200
+ log_1.default.error(`We were not able to configure ${chalk_1.default.bold('eas.json')}. Error: ${error}.`);
201
+ }
202
+ }
157
203
  /**
158
204
  * Make sure EAS Update is fully configured in the current project.
159
205
  * This goes over a checklist and performs the following checks or changes:
@@ -163,7 +209,7 @@ async function ensureEASUpdatesIsConfiguredNativelyAsync(graphqlClient, { exp, p
163
209
  * - Sets `updates.url` if not set
164
210
  * - Ensure latest changes are reflected in the native config, if any
165
211
  */
166
- async function ensureEASUpdatesIsConfiguredAsync(graphqlClient, { exp: expWithoutUpdates, projectId, projectDir, platform, }) {
212
+ async function ensureEASUpdateIsConfiguredAsync(graphqlClient, { exp: expWithoutUpdates, projectId, projectDir, platform, }) {
167
213
  const hasExpoUpdates = (0, projectUtils_1.isExpoUpdatesInstalledOrAvailable)(projectDir, expWithoutUpdates.sdkVersion);
168
214
  if (!hasExpoUpdates) {
169
215
  await (0, projectUtils_1.installExpoUpdatesAsync)(projectDir, { silent: !log_1.default.isDebug });
@@ -182,8 +228,9 @@ async function ensureEASUpdatesIsConfiguredAsync(graphqlClient, { exp: expWithou
182
228
  platform,
183
229
  workflows,
184
230
  });
231
+ await ensureEASUpdateIsConfiguredInEasJsonAsync(projectDir);
185
232
  if (projectChanged || !hasExpoUpdates) {
186
- await ensureEASUpdatesIsConfiguredNativelyAsync(graphqlClient, {
233
+ await ensureEASUpdateIsConfiguredNativelyAsync(graphqlClient, {
187
234
  exp: expWithUpdates,
188
235
  projectDir,
189
236
  projectId,
@@ -197,4 +244,4 @@ async function ensureEASUpdatesIsConfiguredAsync(graphqlClient, { exp: expWithou
197
244
  log_1.default.newLine();
198
245
  }
199
246
  }
200
- exports.ensureEASUpdatesIsConfiguredAsync = ensureEASUpdatesIsConfiguredAsync;
247
+ exports.ensureEASUpdateIsConfiguredAsync = ensureEASUpdateIsConfiguredAsync;
@@ -0,0 +1,2 @@
1
+ import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
2
+ export declare function getBranchNameFromChannelNameAsync(graphqlClient: ExpoGraphqlClient, projectId: string, channelName: string): Promise<string>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBranchNameFromChannelNameAsync = void 0;
4
+ const queries_1 = require("../branch/queries");
5
+ const errors_1 = require("../channel/errors");
6
+ const queries_2 = require("../channel/queries");
7
+ const ChannelQuery_1 = require("../graphql/queries/ChannelQuery");
8
+ async function getBranchNameFromChannelNameAsync(graphqlClient, projectId, channelName) {
9
+ let branchName;
10
+ try {
11
+ const channel = await ChannelQuery_1.ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
12
+ appId: projectId,
13
+ channelName,
14
+ });
15
+ if (channel.updateBranches.length === 1) {
16
+ branchName = channel.updateBranches[0].name;
17
+ }
18
+ else if (channel.updateBranches.length === 0) {
19
+ throw new Error("Channel has no branches associated with it. Run 'eas channel:edit' to map a branch");
20
+ }
21
+ else {
22
+ throw new Error("Channel has multiple branches associated with it. Instead, use 'eas update --branch'");
23
+ }
24
+ }
25
+ catch (error) {
26
+ if (!(error instanceof errors_1.ChannelNotFoundError)) {
27
+ throw error;
28
+ }
29
+ const { branchId } = await (0, queries_1.ensureBranchExistsAsync)(graphqlClient, {
30
+ appId: projectId,
31
+ branchName: channelName,
32
+ });
33
+ const { updateChannel: { createUpdateChannelForApp: newChannel }, } = await (0, queries_2.createChannelOnAppAsync)(graphqlClient, {
34
+ appId: projectId,
35
+ channelName,
36
+ branchId,
37
+ });
38
+ if (!newChannel) {
39
+ throw new Error(`Could not create channel with name ${channelName} on project with id ${projectId}`);
40
+ }
41
+ branchName = channelName;
42
+ }
43
+ return branchName;
44
+ }
45
+ exports.getBranchNameFromChannelNameAsync = getBranchNameFromChannelNameAsync;
@@ -80,7 +80,9 @@ async function selectUpdateGroupOnBranchAsync(graphqlClient, { projectId, branch
80
80
  }),
81
81
  promptOptions: {
82
82
  title: 'Load more update groups?',
83
- createDisplayTextForSelectionPromptListItem: updateGroup => (0, utils_1.formatUpdateTitle)(updateGroup[0]),
83
+ createDisplayTextForSelectionPromptListItem: updateGroup => ({
84
+ title: (0, utils_1.formatUpdateTitle)(updateGroup[0]),
85
+ }),
84
86
  getIdentifierForQueryItem: updateGroup => updateGroup[0].group,
85
87
  },
86
88
  });
@@ -1,3 +1,7 @@
1
+ export interface SelectPromptEntry {
2
+ title: string;
3
+ description?: string;
4
+ }
1
5
  declare type BasePaginatedQueryArgs<QueryReturnType extends Record<string, any>> = {
2
6
  limit: number;
3
7
  offset: number;
@@ -12,7 +16,7 @@ declare type PaginatedQueryWithConfirmPromptArgs<QueryReturnType extends Record<
12
16
  declare type PaginatedQueryWithSelectPromptArgs<QueryReturnType extends Record<string, any>> = BasePaginatedQueryArgs<QueryReturnType> & {
13
17
  promptOptions: {
14
18
  readonly title: string;
15
- createDisplayTextForSelectionPromptListItem: (queryItem: QueryReturnType) => string;
19
+ createDisplayTextForSelectionPromptListItem: (queryItem: QueryReturnType) => SelectPromptEntry;
16
20
  getIdentifierForQueryItem: (queryItem: QueryReturnType) => string;
17
21
  };
18
22
  };
@@ -45,7 +45,7 @@ async function paginatedQueryWithSelectPromptInternalAsync({ limit, offset, quer
45
45
  const currentPage = paginatedItems.slice(0, limit);
46
46
  const newAccumulator = [...accumulator, ...currentPage];
47
47
  const selectionPromptListItems = (0, uniqBy_1.default)(newAccumulator, queryItem => promptOptions.getIdentifierForQueryItem(queryItem)).map(queryItem => ({
48
- title: promptOptions.createDisplayTextForSelectionPromptListItem(queryItem),
48
+ ...promptOptions.createDisplayTextForSelectionPromptListItem(queryItem),
49
49
  value: promptOptions.getIdentifierForQueryItem(queryItem),
50
50
  }));
51
51
  if (areMorePagesAvailable) {