eas-cli 0.34.1 → 0.37.0

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 (152) hide show
  1. package/README.md +27 -27
  2. package/build/analytics/common.d.ts +8 -0
  3. package/build/analytics/common.js +19 -0
  4. package/build/analytics/events.d.ts +43 -0
  5. package/build/analytics/events.js +51 -0
  6. package/build/{analytics.d.ts → analytics/rudderstackClient.d.ts} +0 -0
  7. package/build/{analytics.js → analytics/rudderstackClient.js} +2 -2
  8. package/build/api.js +3 -3
  9. package/build/build/build.js +18 -27
  10. package/build/build/context.d.ts +1 -1
  11. package/build/build/context.js +2 -2
  12. package/build/build/ios/UpdatesModule.js +3 -2
  13. package/build/build/ios/credentials.js +3 -3
  14. package/build/build/ios/version.js +7 -3
  15. package/build/build/local.js +18 -27
  16. package/build/build/types.d.ts +0 -1
  17. package/build/build/utils/devClient.d.ts +1 -2
  18. package/build/build/utils/formatBuild.js +1 -9
  19. package/build/build/utils/repository.js +1 -0
  20. package/build/build/utils/url.js +1 -1
  21. package/build/commandUtils/EasCommand.js +4 -4
  22. package/build/commands/branch/publish.js +24 -2
  23. package/build/commands/build/index.js +15 -12
  24. package/build/commands/channel/create.d.ts +6 -0
  25. package/build/commands/channel/create.js +2 -0
  26. package/build/commands/secret/create.js +0 -6
  27. package/build/commands/secret/delete.js +1 -7
  28. package/build/commands/secret/list.js +0 -6
  29. package/build/commands/submit.js +2 -11
  30. package/build/credentials/android/AndroidCredentialsProvider.js +2 -2
  31. package/build/credentials/android/actions/RemoveFcm.js +4 -4
  32. package/build/credentials/android/actions/{SetupBuildCredentials.d.ts → SetUpBuildCredentials.d.ts} +1 -1
  33. package/build/credentials/android/actions/{SetupBuildCredentials.js → SetUpBuildCredentials.js} +3 -3
  34. package/build/credentials/android/actions/{SetupBuildCredentialsFromCredentialsJson.d.ts → SetUpBuildCredentialsFromCredentialsJson.d.ts} +1 -1
  35. package/build/credentials/android/actions/{SetupBuildCredentialsFromCredentialsJson.js → SetUpBuildCredentialsFromCredentialsJson.js} +3 -3
  36. package/build/credentials/android/actions/{SetupGoogleServiceAccountKey.d.ts → SetUpGoogleServiceAccountKey.d.ts} +1 -1
  37. package/build/credentials/android/actions/{SetupGoogleServiceAccountKey.js → SetUpGoogleServiceAccountKey.js} +3 -3
  38. package/build/credentials/android/utils/keystore.js +67 -32
  39. package/build/credentials/errors.d.ts +4 -0
  40. package/build/credentials/errors.js +8 -1
  41. package/build/credentials/ios/IosCredentialsProvider.js +4 -4
  42. package/build/credentials/ios/actions/AscApiKeyUtils.d.ts +17 -1
  43. package/build/credentials/ios/actions/AscApiKeyUtils.js +158 -24
  44. package/build/credentials/ios/actions/AssignAscApiKey.d.ts +9 -0
  45. package/build/credentials/ios/actions/AssignAscApiKey.js +29 -0
  46. package/build/credentials/ios/actions/CreateAscApiKey.d.ts +9 -0
  47. package/build/credentials/ios/actions/CreateAscApiKey.js +21 -0
  48. package/build/credentials/ios/actions/DistributionCertificateUtils.js +1 -1
  49. package/build/credentials/ios/actions/PushKeyUtils.js +1 -1
  50. package/build/credentials/ios/actions/RemoveAscApiKey.d.ts +14 -0
  51. package/build/credentials/ios/actions/RemoveAscApiKey.js +55 -0
  52. package/build/credentials/ios/actions/{SetupAdhocProvisioningProfile.d.ts → SetUpAdhocProvisioningProfile.d.ts} +1 -1
  53. package/build/credentials/ios/actions/{SetupAdhocProvisioningProfile.js → SetUpAdhocProvisioningProfile.js} +5 -5
  54. package/build/credentials/ios/actions/SetUpAscApiKey.d.ts +21 -0
  55. package/build/credentials/ios/actions/SetUpAscApiKey.js +114 -0
  56. package/build/credentials/ios/actions/{SetupBuildCredentials.d.ts → SetUpBuildCredentials.d.ts} +1 -1
  57. package/build/credentials/ios/actions/{SetupBuildCredentials.js → SetUpBuildCredentials.js} +5 -5
  58. package/build/credentials/ios/actions/{SetupBuildCredentialsFromCredentialsJson.d.ts → SetUpBuildCredentialsFromCredentialsJson.d.ts} +1 -1
  59. package/build/credentials/ios/actions/{SetupBuildCredentialsFromCredentialsJson.js → SetUpBuildCredentialsFromCredentialsJson.js} +5 -5
  60. package/build/credentials/ios/actions/{SetupDistributionCertificate.d.ts → SetUpDistributionCertificate.d.ts} +1 -1
  61. package/build/credentials/ios/actions/{SetupDistributionCertificate.js → SetUpDistributionCertificate.js} +3 -3
  62. package/build/credentials/ios/actions/{SetupInternalProvisioningProfile.d.ts → SetUpInternalProvisioningProfile.d.ts} +1 -1
  63. package/build/credentials/ios/actions/{SetupInternalProvisioningProfile.js → SetUpInternalProvisioningProfile.js} +7 -7
  64. package/build/credentials/ios/actions/{SetupProvisioningProfile.d.ts → SetUpProvisioningProfile.d.ts} +1 -1
  65. package/build/credentials/ios/actions/{SetupProvisioningProfile.js → SetUpProvisioningProfile.js} +5 -5
  66. package/build/credentials/ios/actions/{SetupPushKey.d.ts → SetUpPushKey.d.ts} +1 -1
  67. package/build/credentials/ios/actions/{SetupPushKey.js → SetUpPushKey.js} +3 -3
  68. package/build/credentials/ios/actions/SetUpSubmissionCredentials.d.ts +10 -0
  69. package/build/credentials/ios/actions/SetUpSubmissionCredentials.js +53 -0
  70. package/build/credentials/ios/actions/{SetupTargetBuildCredentials.d.ts → SetUpTargetBuildCredentials.d.ts} +1 -1
  71. package/build/credentials/ios/actions/{SetupTargetBuildCredentials.js → SetUpTargetBuildCredentials.js} +10 -10
  72. package/build/credentials/ios/actions/{SetupTargetBuildCredentialsFromCredentialsJson.d.ts → SetUpTargetBuildCredentialsFromCredentialsJson.d.ts} +1 -1
  73. package/build/credentials/ios/actions/{SetupTargetBuildCredentialsFromCredentialsJson.js → SetUpTargetBuildCredentialsFromCredentialsJson.js} +3 -3
  74. package/build/credentials/ios/api/GraphqlClient.d.ts +8 -2
  75. package/build/credentials/ios/api/GraphqlClient.js +74 -2
  76. package/build/credentials/ios/api/graphql/mutations/AppStoreConnectApiKeyMutation.d.ts +5 -0
  77. package/build/credentials/ios/api/graphql/mutations/AppStoreConnectApiKeyMutation.js +54 -0
  78. package/build/credentials/ios/api/graphql/mutations/IosAppCredentialsMutation.d.ts +1 -0
  79. package/build/credentials/ios/api/graphql/mutations/IosAppCredentialsMutation.js +25 -0
  80. package/build/credentials/ios/api/graphql/queries/AppStoreConnectApiKeyQuery.d.ts +4 -0
  81. package/build/credentials/ios/api/graphql/queries/AppStoreConnectApiKeyQuery.js +33 -0
  82. package/build/credentials/ios/appstore/AppStoreApi.d.ts +1 -1
  83. package/build/credentials/ios/appstore/Credentials.types.d.ts +1 -0
  84. package/build/credentials/ios/appstore/ascApiKey.d.ts +1 -1
  85. package/build/credentials/ios/appstore/ascApiKey.js +11 -1
  86. package/build/credentials/ios/appstore/entitlements.d.ts +2 -2
  87. package/build/credentials/ios/appstore/entitlements.js +28 -21
  88. package/build/credentials/ios/credentials.d.ts +2 -1
  89. package/build/credentials/ios/credentials.js +7 -2
  90. package/build/credentials/ios/utils/printCredentials.js +1 -1
  91. package/build/credentials/ios/validators/validateAscApiKey.d.ts +5 -0
  92. package/build/credentials/ios/validators/validateAscApiKey.js +21 -0
  93. package/build/credentials/manager/Actions.d.ts +20 -15
  94. package/build/credentials/manager/Actions.js +20 -15
  95. package/build/credentials/manager/AndroidActions.js +6 -6
  96. package/build/credentials/manager/IosActions.d.ts +1 -0
  97. package/build/credentials/manager/IosActions.js +40 -5
  98. package/build/credentials/manager/ManageAndroid.js +6 -6
  99. package/build/credentials/manager/ManageIos.js +56 -17
  100. package/build/credentials/utils/promptForCredentials.d.ts +2 -1
  101. package/build/credentials/utils/promptForCredentials.js +3 -2
  102. package/build/graphql/client.js +1 -1
  103. package/build/graphql/generated.d.ts +208 -55
  104. package/build/graphql/mutations/KeystoreGenerationUrlMutation.d.ts +3 -0
  105. package/build/graphql/mutations/KeystoreGenerationUrlMutation.js +23 -0
  106. package/build/graphql/types/Build.js +1 -6
  107. package/build/project/android/applicationId.d.ts +6 -0
  108. package/build/project/android/applicationId.js +39 -29
  109. package/build/project/android/gradle.js +3 -2
  110. package/build/project/android/gradleUtils.d.ts +1 -0
  111. package/build/project/ios/bundleIdentifier.d.ts +6 -1
  112. package/build/project/ios/bundleIdentifier.js +29 -18
  113. package/build/submit/ArchiveSource.js +2 -1
  114. package/build/submit/BaseSubmitter.d.ts +20 -4
  115. package/build/submit/BaseSubmitter.js +34 -1
  116. package/build/submit/android/AndroidSubmitCommand.d.ts +1 -2
  117. package/build/submit/android/AndroidSubmitCommand.js +22 -35
  118. package/build/submit/android/AndroidSubmitter.d.ts +12 -8
  119. package/build/submit/android/AndroidSubmitter.js +30 -21
  120. package/build/submit/android/ServiceAccountSource.d.ts +3 -2
  121. package/build/submit/android/ServiceAccountSource.js +18 -6
  122. package/build/submit/context.d.ts +2 -0
  123. package/build/submit/context.js +14 -0
  124. package/build/submit/ios/AppSpecificPasswordSource.d.ts +9 -6
  125. package/build/submit/ios/AppSpecificPasswordSource.js +42 -20
  126. package/build/submit/ios/AscApiKeySource.d.ts +9 -3
  127. package/build/submit/ios/AscApiKeySource.js +10 -10
  128. package/build/submit/ios/CredentialsServiceSource.d.ts +18 -0
  129. package/build/submit/ios/CredentialsServiceSource.js +63 -0
  130. package/build/submit/ios/IosSubmitCommand.d.ts +2 -2
  131. package/build/submit/ios/IosSubmitCommand.js +56 -56
  132. package/build/submit/ios/IosSubmitter.d.ts +20 -7
  133. package/build/submit/ios/IosSubmitter.js +79 -43
  134. package/build/submit/submit.js +13 -4
  135. package/build/submit/utils/errors.js +2 -0
  136. package/build/user/User.js +1 -1
  137. package/build/{build/ios → utils}/plist.d.ts +1 -1
  138. package/build/{build/ios → utils}/plist.js +8 -2
  139. package/build/utils/profiles.d.ts +9 -4
  140. package/build/utils/profiles.js +14 -7
  141. package/build/vcs/clients/git.d.ts +2 -1
  142. package/build/vcs/clients/git.js +83 -5
  143. package/build/vcs/vcs.d.ts +4 -3
  144. package/build/vcs/vcs.js +3 -3
  145. package/oclif.manifest.json +1 -1
  146. package/package.json +4 -4
  147. package/build/build/utils/analytics.d.ts +0 -22
  148. package/build/build/utils/analytics.js +0 -28
  149. package/build/project/isEasEnabledForProject.d.ts +0 -8
  150. package/build/project/isEasEnabledForProject.js +0 -33
  151. package/build/submit/android/AndroidPackageSource.d.ts +0 -17
  152. package/build/submit/android/AndroidPackageSource.js +0 -27
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.warnIfAndroidPackageDefinedInAppConfigForBareWorkflowProject = exports.getApplicationIdAsync = exports.ensureApplicationIdIsDefinedForManagedProjectAsync = void 0;
3
+ exports.warnIfAndroidPackageDefinedInAppConfigForBareWorkflowProject = exports.isApplicationIdValid = exports.getApplicationIdAsync = exports.getApplicationIdFromBareAsync = exports.AmbiguousApplicationIdError = exports.ensureApplicationIdIsDefinedForManagedProjectAsync = exports.INVALID_APPLICATION_ID_MESSAGE = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const config_1 = require("@expo/config");
6
6
  const config_plugins_1 = require("@expo/config-plugins");
@@ -16,7 +16,7 @@ const prompts_1 = require("../../prompts");
16
16
  const actions_1 = require("../../user/actions");
17
17
  const workflow_1 = require("../workflow");
18
18
  const gradleUtils = (0, tslib_1.__importStar)(require("./gradleUtils"));
19
- const INVALID_APPLICATION_ID_MESSAGE = `Invalid format of Android applicationId. Only alphanumeric characters, '.' and '_' are allowed, and each '.' must be followed by a letter.`;
19
+ exports.INVALID_APPLICATION_ID_MESSAGE = `Invalid format of Android applicationId. Only alphanumeric characters, '.' and '_' are allowed, and each '.' must be followed by a letter.`;
20
20
  async function ensureApplicationIdIsDefinedForManagedProjectAsync(projectDir, exp) {
21
21
  const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.ANDROID);
22
22
  (0, assert_1.default)(workflow === eas_build_job_1.Workflow.MANAGED, 'This function should be called only for managed projects');
@@ -30,40 +30,49 @@ async function ensureApplicationIdIsDefinedForManagedProjectAsync(projectDir, ex
30
30
  }
31
31
  }
32
32
  exports.ensureApplicationIdIsDefinedForManagedProjectAsync = ensureApplicationIdIsDefinedForManagedProjectAsync;
33
+ class AmbiguousApplicationIdError extends Error {
34
+ constructor(message) {
35
+ super(message !== null && message !== void 0 ? message : 'Could not resolve applicationId.');
36
+ }
37
+ }
38
+ exports.AmbiguousApplicationIdError = AmbiguousApplicationIdError;
39
+ async function getApplicationIdFromBareAsync(projectDir, gradleContext) {
40
+ const errorMessage = 'Could not read applicationId from Android project.';
41
+ if (gradleContext) {
42
+ const buildGradle = await gradleUtils.getAppBuildGradleAsync(projectDir);
43
+ const applicationIdSuffix = gradleUtils.resolveConfigValue(buildGradle, 'applicationIdSuffix', gradleContext.flavor);
44
+ if (applicationIdSuffix) {
45
+ throw new Error('"applicationIdSuffix" in app/build.gradle is not supported.');
46
+ }
47
+ const applicationId = gradleUtils.resolveConfigValue(buildGradle, 'applicationId', gradleContext.flavor);
48
+ return (0, nullthrows_1.default)(applicationId, errorMessage);
49
+ }
50
+ else {
51
+ // should return value only if productFlavors are not used
52
+ const buildGradlePath = config_plugins_1.AndroidConfig.Paths.getAppBuildGradleFilePath(projectDir);
53
+ const buildGradle = await fs_extra_1.default.readFile(buildGradlePath, 'utf8');
54
+ const matchResult = buildGradle.match(/applicationId ['"](.*)['"]/);
55
+ if (buildGradle.match(/applicationIdSuffix/)) {
56
+ throw new Error('"applicationIdSuffix" in app/build.gradle is not supported.');
57
+ }
58
+ if (buildGradle.match(/productFlavors/)) {
59
+ throw new AmbiguousApplicationIdError('Failed to autodetect applicationId in multi-flavor project.');
60
+ }
61
+ return (0, nullthrows_1.default)(matchResult === null || matchResult === void 0 ? void 0 : matchResult[1], errorMessage);
62
+ }
63
+ }
64
+ exports.getApplicationIdFromBareAsync = getApplicationIdFromBareAsync;
33
65
  async function getApplicationIdAsync(projectDir, exp, gradleContext) {
34
66
  const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.ANDROID);
35
67
  if (workflow === eas_build_job_1.Workflow.GENERIC) {
36
68
  warnIfAndroidPackageDefinedInAppConfigForBareWorkflowProject(projectDir, exp);
37
- const errorMessage = 'Could not read application id from Android project.';
38
- if (gradleContext) {
39
- const buildGradle = await gradleUtils.getAppBuildGradleAsync(projectDir);
40
- const applicationId = gradleUtils.resolveConfigValue(buildGradle, 'applicationId', gradleContext.flavor);
41
- return (0, nullthrows_1.default)(applicationId, errorMessage);
42
- }
43
- else {
44
- // fallback to best effort approach, this logic can be dropped when we start supporting
45
- // modules different than 'app' and 'flavorDimensions'
46
- let buildGradlePath = null;
47
- try {
48
- buildGradlePath = config_plugins_1.AndroidConfig.Paths.getAppBuildGradleFilePath(projectDir);
49
- }
50
- catch { }
51
- if (!buildGradlePath || !(await fs_extra_1.default.pathExists(buildGradlePath))) {
52
- throw new Error(errorMessage);
53
- }
54
- const buildGradle = await fs_extra_1.default.readFile(buildGradlePath, 'utf8');
55
- const matchResult = buildGradle.match(/applicationId ['"](.*)['"]/);
56
- const applicationId = (0, nullthrows_1.default)(matchResult === null || matchResult === void 0 ? void 0 : matchResult[1], errorMessage);
57
- log_1.default.warn(`Unable to detect applicationId`);
58
- log_1.default.warn(`Falling back to best effort approach, using applicationId ${applicationId}`);
59
- return applicationId;
60
- }
69
+ return getApplicationIdFromBareAsync(projectDir, gradleContext);
61
70
  }
62
71
  else {
63
72
  const applicationId = config_plugins_1.AndroidConfig.Package.getPackage(exp);
64
73
  if (!applicationId || !isApplicationIdValid(applicationId)) {
65
74
  if (applicationId) {
66
- log_1.default.warn(INVALID_APPLICATION_ID_MESSAGE);
75
+ log_1.default.warn(exports.INVALID_APPLICATION_ID_MESSAGE);
67
76
  }
68
77
  throw new Error(`Specify "android.package" in ${(0, projectUtils_1.getProjectConfigDescription)(projectDir)} and run this command again.`);
69
78
  }
@@ -78,7 +87,7 @@ async function configureApplicationIdAsync(projectDir, exp) {
78
87
  const paths = (0, config_1.getConfigFilePaths)(projectDir);
79
88
  // we can't automatically update app.config.js
80
89
  if (paths.dynamicConfigPath) {
81
- throw new Error(`"android.package" is not defined in your app.config.js and we can't update this file programatically. Add the value on your own and run this command again.`);
90
+ throw new Error(`"android.package" is not defined in your app.config.js and we can't update this file programmatically. Add the value on your own and run this command again.`);
82
91
  }
83
92
  (0, assert_1.default)(paths.staticConfigPath, 'app.json must exist');
84
93
  log_1.default.addNewLineIfNone();
@@ -89,7 +98,7 @@ async function configureApplicationIdAsync(projectDir, exp) {
89
98
  type: 'text',
90
99
  message: `What would you like your Android application id to be?`,
91
100
  initial: suggestedAndroidApplicationId,
92
- validate: value => (isApplicationIdValid(value) ? true : INVALID_APPLICATION_ID_MESSAGE),
101
+ validate: value => (isApplicationIdValid(value) ? true : exports.INVALID_APPLICATION_ID_MESSAGE),
93
102
  });
94
103
  const rawStaticConfig = (0, appJson_1.readAppJson)(paths.staticConfigPath);
95
104
  rawStaticConfig.expo = {
@@ -103,6 +112,7 @@ async function configureApplicationIdAsync(projectDir, exp) {
103
112
  function isApplicationIdValid(applicationId) {
104
113
  return /^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(applicationId);
105
114
  }
115
+ exports.isApplicationIdValid = isApplicationIdValid;
106
116
  let warnPrinted = false;
107
117
  function warnIfAndroidPackageDefinedInAppConfigForBareWorkflowProject(projectDir, exp) {
108
118
  if (config_plugins_1.AndroidConfig.Package.getPackage(exp) && !warnPrinted) {
@@ -18,7 +18,7 @@ async function resolveGradleBuildContextAsync(projectDir, buildProfile) {
18
18
  : undefined;
19
19
  if ((parsedGradleCommand === null || parsedGradleCommand === void 0 ? void 0 : parsedGradleCommand.moduleName) &&
20
20
  parsedGradleCommand.moduleName !== gradleUtils.DEFAULT_MODULE_NAME) {
21
- log_1.default.warn(`Building modules different than "${gradleUtils.DEFAULT_MODULE_NAME}" might result in unexpected behavior`);
21
+ log_1.default.warn(`Building modules different than "${gradleUtils.DEFAULT_MODULE_NAME}" might result in unexpected behavior.`);
22
22
  }
23
23
  return {
24
24
  moduleName: (_a = parsedGradleCommand === null || parsedGradleCommand === void 0 ? void 0 : parsedGradleCommand.moduleName) !== null && _a !== void 0 ? _a : gradleUtils.DEFAULT_MODULE_NAME,
@@ -30,7 +30,8 @@ async function resolveGradleBuildContextAsync(projectDir, buildProfile) {
30
30
  }
31
31
  }
32
32
  catch (err) {
33
- log_1.default.warn(`Unable to read project config from app/build.gradle: ${err.message}`);
33
+ log_1.default.warn(`Unable to read gradle project config: ${err.message}.`);
34
+ log_1.default.warn('Values from app/build.gradle might be resolved incorrectly.');
34
35
  return undefined;
35
36
  }
36
37
  }
@@ -5,6 +5,7 @@ interface GradleCommand {
5
5
  }
6
6
  interface Config {
7
7
  applicationId?: string;
8
+ applicationIdSuffix?: string;
8
9
  versionCode?: string;
9
10
  versionName?: string;
10
11
  }
@@ -1,8 +1,13 @@
1
1
  import { ExpoConfig } from '@expo/config';
2
+ export declare const INVALID_BUNDLE_IDENTIFIER_MESSAGE = "Invalid format of iOS bundle identifier. Only alphanumeric characters, '.' and '-' are allowed, and each '.' must be followed by a letter.";
2
3
  export declare function ensureBundleIdentifierIsDefinedForManagedProjectAsync(projectDir: string, exp: ExpoConfig): Promise<string>;
3
- export declare function getBundleIdentifierAsync(projectDir: string, exp: ExpoConfig, { targetName, buildConfiguration }?: {
4
+ export declare class AmbiguousBundleIdentifierError extends Error {
5
+ constructor(message?: string);
6
+ }
7
+ export declare function getBundleIdentifierAsync(projectDir: string, exp: ExpoConfig, xcodeContext?: {
4
8
  targetName?: string;
5
9
  buildConfiguration?: string;
6
10
  }): Promise<string>;
11
+ export declare function isBundleIdentifierValid(bundleIdentifier: string): boolean;
7
12
  export declare function warnIfBundleIdentifierDefinedInAppConfigForBareWorkflowProject(projectDir: string, exp: ExpoConfig): void;
8
13
  export declare function isWildcardBundleIdentifier(bundleIdentifier: string): boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isWildcardBundleIdentifier = exports.warnIfBundleIdentifierDefinedInAppConfigForBareWorkflowProject = exports.getBundleIdentifierAsync = exports.ensureBundleIdentifierIsDefinedForManagedProjectAsync = void 0;
3
+ exports.isWildcardBundleIdentifier = exports.warnIfBundleIdentifierDefinedInAppConfigForBareWorkflowProject = exports.isBundleIdentifierValid = exports.getBundleIdentifierAsync = exports.AmbiguousBundleIdentifierError = exports.ensureBundleIdentifierIsDefinedForManagedProjectAsync = exports.INVALID_BUNDLE_IDENTIFIER_MESSAGE = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const config_1 = require("@expo/config");
6
6
  const config_plugins_1 = require("@expo/config-plugins");
@@ -14,7 +14,7 @@ const prompts_1 = require("../../prompts");
14
14
  const actions_1 = require("../../user/actions");
15
15
  const projectUtils_1 = require("../projectUtils");
16
16
  const workflow_1 = require("../workflow");
17
- const INVALID_BUNDLE_IDENTIFIER_MESSAGE = `Invalid format of iOS bundle identifier. Only alphanumeric characters, '.' and '-' are allowed, and each '.' must be followed by a letter.`;
17
+ exports.INVALID_BUNDLE_IDENTIFIER_MESSAGE = `Invalid format of iOS bundle identifier. Only alphanumeric characters, '.' and '-' are allowed, and each '.' must be followed by a letter.`;
18
18
  async function ensureBundleIdentifierIsDefinedForManagedProjectAsync(projectDir, exp) {
19
19
  const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.IOS);
20
20
  (0, assert_1.default)(workflow === eas_build_job_1.Workflow.MANAGED, 'This function should be called only for managed projects');
@@ -26,16 +26,25 @@ async function ensureBundleIdentifierIsDefinedForManagedProjectAsync(projectDir,
26
26
  }
27
27
  }
28
28
  exports.ensureBundleIdentifierIsDefinedForManagedProjectAsync = ensureBundleIdentifierIsDefinedForManagedProjectAsync;
29
- async function getBundleIdentifierAsync(projectDir, exp, { targetName, buildConfiguration } = {}) {
29
+ class AmbiguousBundleIdentifierError extends Error {
30
+ constructor(message) {
31
+ super(message !== null && message !== void 0 ? message : 'Could not resolve bundle identifier.');
32
+ }
33
+ }
34
+ exports.AmbiguousBundleIdentifierError = AmbiguousBundleIdentifierError;
35
+ async function getBundleIdentifierAsync(projectDir, exp, xcodeContext) {
30
36
  const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.IOS);
31
37
  if (workflow === eas_build_job_1.Workflow.GENERIC) {
32
38
  warnIfBundleIdentifierDefinedInAppConfigForBareWorkflowProject(projectDir, exp);
33
- const bundleIdentifier = config_plugins_1.IOSConfig.BundleIdentifier.getBundleIdentifierFromPbxproj(projectDir, {
34
- targetName,
35
- buildConfiguration,
36
- });
37
- const buildConfigurationDesc = targetName && buildConfiguration
38
- ? ` (target = ${targetName}, build configuration = ${buildConfiguration})`
39
+ const xcodeProject = config_plugins_1.IOSConfig.XcodeUtils.getPbxproj(projectDir);
40
+ const isMultiScheme = config_plugins_1.IOSConfig.BuildScheme.getSchemesFromXcodeproj(projectDir).length > 1;
41
+ const isMultiTarget = config_plugins_1.IOSConfig.Target.getNativeTargets(xcodeProject).filter(([, target]) => config_plugins_1.IOSConfig.Target.isTargetOfType(target, config_plugins_1.IOSConfig.Target.TargetType.APPLICATION)).length > 1;
42
+ if (!xcodeContext && isMultiScheme && isMultiTarget) {
43
+ throw new AmbiguousBundleIdentifierError("Multiple schemes and targets found in Xcode project, bundle identifier couldn't be resolved.");
44
+ }
45
+ const bundleIdentifier = config_plugins_1.IOSConfig.BundleIdentifier.getBundleIdentifierFromPbxproj(projectDir, xcodeContext !== null && xcodeContext !== void 0 ? xcodeContext : {});
46
+ const buildConfigurationDesc = (xcodeContext === null || xcodeContext === void 0 ? void 0 : xcodeContext.targetName) && (xcodeContext === null || xcodeContext === void 0 ? void 0 : xcodeContext.buildConfiguration)
47
+ ? ` (target = ${xcodeContext.targetName}, build configuration = ${xcodeContext.buildConfiguration})`
39
48
  : '';
40
49
  (0, assert_1.default)(bundleIdentifier, `Could not read bundle identifier from Xcode project${buildConfigurationDesc}.`);
41
50
  if (!isBundleIdentifierValid(bundleIdentifier)) {
@@ -45,17 +54,18 @@ async function getBundleIdentifierAsync(projectDir, exp, { targetName, buildConf
45
54
  }
46
55
  else {
47
56
  // TODO: the following asserts are only temporary until we support app extensions in managed projects
48
- (0, assert_1.default)(!targetName || targetName === config_plugins_1.IOSConfig.XcodeUtils.sanitizedName(exp.name), 'targetName cannot be set to an arbitrary value for managed projects');
49
- (0, assert_1.default)(!buildConfiguration, 'buildConfiguration cannot be passed for managed projects');
50
- const bundleIdentifer = config_plugins_1.IOSConfig.BundleIdentifier.getBundleIdentifier(exp);
51
- if (!bundleIdentifer || !isBundleIdentifierValid(bundleIdentifer)) {
52
- if (bundleIdentifer) {
53
- log_1.default.warn(INVALID_BUNDLE_IDENTIFIER_MESSAGE);
57
+ (0, assert_1.default)(!(xcodeContext === null || xcodeContext === void 0 ? void 0 : xcodeContext.targetName) ||
58
+ (xcodeContext === null || xcodeContext === void 0 ? void 0 : xcodeContext.targetName) === config_plugins_1.IOSConfig.XcodeUtils.sanitizedName(exp.name), 'targetName cannot be set to an arbitrary value for managed projects.');
59
+ (0, assert_1.default)(!(xcodeContext === null || xcodeContext === void 0 ? void 0 : xcodeContext.buildConfiguration), 'buildConfiguration cannot be passed for managed projects.');
60
+ const bundleIdentifier = config_plugins_1.IOSConfig.BundleIdentifier.getBundleIdentifier(exp);
61
+ if (!bundleIdentifier || !isBundleIdentifierValid(bundleIdentifier)) {
62
+ if (bundleIdentifier) {
63
+ log_1.default.warn(exports.INVALID_BUNDLE_IDENTIFIER_MESSAGE);
54
64
  }
55
65
  throw new Error(`Specify "ios.bundleIdentifier" in ${(0, projectUtils_1.getProjectConfigDescription)(projectDir)} and run this command again.`);
56
66
  }
57
67
  else {
58
- return bundleIdentifer;
68
+ return bundleIdentifier;
59
69
  }
60
70
  }
61
71
  }
@@ -65,7 +75,7 @@ async function configureBundleIdentifierAsync(projectDir, exp) {
65
75
  const paths = (0, config_1.getConfigFilePaths)(projectDir);
66
76
  // we can't automatically update app.config.js
67
77
  if (paths.dynamicConfigPath) {
68
- throw new Error(`"ios.bundleIdentifier" is not defined in your app.config.js and we can't update this file programatically. Add the value on your own and run this command again.`);
78
+ throw new Error(`"ios.bundleIdentifier" is not defined in your app.config.js and we can't update this file programmatically. Add the value on your own and run this command again.`);
69
79
  }
70
80
  (0, assert_1.default)(paths.staticConfigPath, 'app.json must exist');
71
81
  log_1.default.addNewLineIfNone();
@@ -76,7 +86,7 @@ async function configureBundleIdentifierAsync(projectDir, exp) {
76
86
  type: 'text',
77
87
  message: `What would you like your iOS bundle identifier to be?`,
78
88
  initial: suggestedBundleIdentifier,
79
- validate: value => (isBundleIdentifierValid(value) ? true : INVALID_BUNDLE_IDENTIFIER_MESSAGE),
89
+ validate: value => (isBundleIdentifierValid(value) ? true : exports.INVALID_BUNDLE_IDENTIFIER_MESSAGE),
80
90
  });
81
91
  const rawStaticConfig = (0, appJson_1.readAppJson)(paths.staticConfigPath);
82
92
  rawStaticConfig.expo = {
@@ -90,6 +100,7 @@ async function configureBundleIdentifierAsync(projectDir, exp) {
90
100
  function isBundleIdentifierValid(bundleIdentifier) {
91
101
  return /^[a-zA-Z0-9-.]+$/.test(bundleIdentifier);
92
102
  }
103
+ exports.isBundleIdentifierValid = isBundleIdentifierValid;
93
104
  let warnPrinted = false;
94
105
  function warnIfBundleIdentifierDefinedInAppConfigForBareWorkflowProject(projectDir, exp) {
95
106
  if (config_plugins_1.IOSConfig.BundleIdentifier.getBundleIdentifier(exp) && !warnPrinted) {
@@ -188,7 +188,7 @@ async function handleBuildListSourceAsync(source) {
188
188
  }
189
189
  }
190
190
  function formatBuildChoice(build, expiryDate) {
191
- const { id, platform, updatedAt, appVersion, sdkVersion, runtimeVersion, buildProfile, appBuildVersion, releaseChannel, } = build;
191
+ const { id, platform, updatedAt, appVersion, sdkVersion, runtimeVersion, buildProfile, appBuildVersion, releaseChannel, initiatingActor, } = build;
192
192
  const formatValue = (field) => field ? chalk_1.default.bold(field) : chalk_1.default.dim('Unknown');
193
193
  const buildDate = new Date(updatedAt);
194
194
  const maybeRuntimeVersion = runtimeVersion ? `Runtime: ${formatValue(runtimeVersion)}` : null;
@@ -204,6 +204,7 @@ function formatBuildChoice(build, expiryDate) {
204
204
  .filter(it => it != null)
205
205
  .join(', '),
206
206
  `\tProfile: ${formatValue(buildProfile)}, Release channel: ${formatValue(releaseChannel)}`,
207
+ `\tAuthored by: ${formatValue(initiatingActor === null || initiatingActor === void 0 ? void 0 : initiatingActor.displayName)}`,
207
208
  ].join('\n');
208
209
  return {
209
210
  title,
@@ -1,4 +1,5 @@
1
1
  import { Platform } from '@expo/eas-build-job';
2
+ import { Event } from '../analytics/events';
2
3
  import { AndroidSubmissionConfigInput, IosSubmissionConfigInput, SubmissionFragment } from '../graphql/generated';
3
4
  import { SubmissionContext } from './context';
4
5
  export interface SubmissionInput<P extends Platform> {
@@ -6,11 +7,26 @@ export interface SubmissionInput<P extends Platform> {
6
7
  submissionConfig: P extends Platform.ANDROID ? AndroidSubmissionConfigInput : IosSubmissionConfigInput;
7
8
  buildId?: string;
8
9
  }
9
- export default abstract class BaseSubmitter<P extends Platform, SubmissionOptions> {
10
+ interface AnalyticEvents {
11
+ attemptEvent: Event;
12
+ successEvent: Event;
13
+ failureEvent: Event;
14
+ }
15
+ export default abstract class BaseSubmitter<P extends Platform, ResolvedSourceOptions, SubmissionOptions> {
10
16
  protected ctx: SubmissionContext<P>;
11
17
  protected options: SubmissionOptions;
12
- constructor(ctx: SubmissionContext<P>, options: SubmissionOptions);
13
- abstract submitAsync(): Promise<SubmissionFragment>;
14
- protected createSubmissionAsync(submissionInput: SubmissionInput<P>): Promise<SubmissionFragment>;
18
+ protected sourceOptionResolver: {
19
+ [K in keyof ResolvedSourceOptions]: () => Promise<ResolvedSourceOptions[K]>;
20
+ };
21
+ protected sourceOptionAnalytics: Record<keyof ResolvedSourceOptions, AnalyticEvents>;
22
+ constructor(ctx: SubmissionContext<P>, options: SubmissionOptions, sourceOptionResolver: {
23
+ [K in keyof ResolvedSourceOptions]: () => Promise<ResolvedSourceOptions[K]>;
24
+ }, sourceOptionAnalytics: Record<keyof ResolvedSourceOptions, AnalyticEvents>);
25
+ private getSourceOptionsAsync;
26
+ submitAsync(): Promise<SubmissionFragment>;
27
+ abstract createSubmissionInputAsync(resolvedOptions: ResolvedSourceOptions): Promise<SubmissionInput<P>>;
28
+ private createSubmissionAsync;
29
+ private createSubmissionWithAnalyticsAsync;
15
30
  protected abstract createPlatformSubmissionAsync(input: SubmissionInput<P>): Promise<SubmissionFragment>;
16
31
  }
32
+ export {};
@@ -1,14 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ const common_1 = require("../analytics/common");
5
+ const events_1 = require("../analytics/events");
4
6
  const AppPlatform_1 = require("../graphql/types/AppPlatform");
5
7
  const log_1 = (0, tslib_1.__importDefault)(require("../log"));
6
8
  const ora_1 = require("../ora");
7
9
  const platform_1 = require("../platform");
8
10
  class BaseSubmitter {
9
- constructor(ctx, options) {
11
+ constructor(ctx, options, sourceOptionResolver, sourceOptionAnalytics) {
10
12
  this.ctx = ctx;
11
13
  this.options = options;
14
+ this.sourceOptionResolver = sourceOptionResolver;
15
+ this.sourceOptionAnalytics = sourceOptionAnalytics;
16
+ }
17
+ async getSourceOptionsAsync() {
18
+ const resolvedSourceOptions = {};
19
+ // Do not perform this in parallel as some of these require user interaction
20
+ for (const key in this.sourceOptionResolver) {
21
+ const sourceOptionKey = key;
22
+ const sourceOptionAnalytics = this.sourceOptionAnalytics[sourceOptionKey];
23
+ const sourceOption = await (0, common_1.withAnalyticsAsync)(async () => await this.sourceOptionResolver[sourceOptionKey](), {
24
+ attemptEvent: sourceOptionAnalytics.attemptEvent,
25
+ successEvent: sourceOptionAnalytics.successEvent,
26
+ failureEvent: sourceOptionAnalytics.failureEvent,
27
+ trackingCtx: this.ctx.trackingCtx,
28
+ });
29
+ resolvedSourceOptions[sourceOptionKey] = sourceOption;
30
+ }
31
+ return resolvedSourceOptions;
32
+ }
33
+ async submitAsync() {
34
+ const resolvedSourceOptions = await this.getSourceOptionsAsync();
35
+ const input = await this.createSubmissionInputAsync(resolvedSourceOptions);
36
+ return await this.createSubmissionWithAnalyticsAsync(input);
12
37
  }
13
38
  async createSubmissionAsync(submissionInput) {
14
39
  log_1.default.addNewLineIfNone();
@@ -24,5 +49,13 @@ class BaseSubmitter {
24
49
  throw err;
25
50
  }
26
51
  }
52
+ async createSubmissionWithAnalyticsAsync(submissionInput) {
53
+ return await (0, common_1.withAnalyticsAsync)(async () => this.createSubmissionAsync(submissionInput), {
54
+ attemptEvent: events_1.SubmissionEvent.SUBMIT_REQUEST_ATTEMPT,
55
+ successEvent: events_1.SubmissionEvent.SUBMIT_REQUEST_SUCCESS,
56
+ failureEvent: events_1.SubmissionEvent.SUBMIT_REQUEST_FAIL,
57
+ trackingCtx: this.ctx.trackingCtx,
58
+ });
59
+ }
27
60
  }
28
61
  exports.default = BaseSubmitter;
@@ -7,9 +7,8 @@ export default class AndroidSubmitCommand {
7
7
  runAsync(): Promise<SubmissionFragment>;
8
8
  private getAndroidSubmissionOptionsAsync;
9
9
  private maybeGetAndroidPackageFromCurrentProjectAsync;
10
- private resolveAndroidPackageSourceAsync;
11
10
  private resolveTrack;
12
11
  private resolveReleaseStatus;
13
12
  private resolveArchiveSource;
14
- private resolveServiceAccountSource;
13
+ private resolveServiceAccountSourceAsync;
15
14
  }
@@ -7,10 +7,8 @@ const results_1 = require("@expo/results");
7
7
  const generated_1 = require("../../graphql/generated");
8
8
  const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
9
9
  const applicationId_1 = require("../../project/android/applicationId");
10
- const gradleUtils = (0, tslib_1.__importStar)(require("../../project/android/gradleUtils"));
11
10
  const capitalize_1 = (0, tslib_1.__importDefault)(require("../../utils/expodash/capitalize"));
12
11
  const commons_1 = require("../commons");
13
- const AndroidPackageSource_1 = require("./AndroidPackageSource");
14
12
  const AndroidSubmitter_1 = (0, tslib_1.__importDefault)(require("./AndroidSubmitter"));
15
13
  const ServiceAccountSource_1 = require("./ServiceAccountSource");
16
14
  class AndroidSubmitCommand {
@@ -24,18 +22,11 @@ class AndroidSubmitCommand {
24
22
  return await submitter.submitAsync();
25
23
  }
26
24
  async getAndroidSubmissionOptionsAsync() {
27
- const androidPackageSource = await this.resolveAndroidPackageSourceAsync();
28
25
  const track = this.resolveTrack();
29
26
  const releaseStatus = this.resolveReleaseStatus();
30
27
  const archiveSource = this.resolveArchiveSource();
31
- const serviceAccountSource = this.resolveServiceAccountSource();
32
- const errored = [
33
- androidPackageSource,
34
- track,
35
- releaseStatus,
36
- archiveSource,
37
- serviceAccountSource,
38
- ].filter(r => !r.ok);
28
+ const serviceAccountSource = await this.resolveServiceAccountSourceAsync();
29
+ const errored = [track, releaseStatus, archiveSource, serviceAccountSource].filter(r => !r.ok);
39
30
  if (errored.length > 0) {
40
31
  const message = errored.map(err => { var _a; return (_a = err.reason) === null || _a === void 0 ? void 0 : _a.message; }).join('\n');
41
32
  log_1.default.error(message);
@@ -43,7 +34,6 @@ class AndroidSubmitCommand {
43
34
  }
44
35
  return {
45
36
  projectId: this.ctx.projectId,
46
- androidPackageSource: androidPackageSource.enforceValue(),
47
37
  track: track.enforceValue(),
48
38
  releaseStatus: releaseStatus.enforceValue(),
49
39
  archiveSource: archiveSource.enforceValue(),
@@ -53,29 +43,14 @@ class AndroidSubmitCommand {
53
43
  }
54
44
  async maybeGetAndroidPackageFromCurrentProjectAsync() {
55
45
  try {
56
- return await (0, applicationId_1.getApplicationIdAsync)(this.ctx.projectDir, this.ctx.exp, {
57
- moduleName: gradleUtils.DEFAULT_MODULE_NAME,
58
- });
46
+ return (0, results_1.result)(await (0, applicationId_1.getApplicationIdAsync)(this.ctx.projectDir, this.ctx.exp));
59
47
  }
60
- catch {
61
- return undefined;
62
- }
63
- }
64
- async resolveAndroidPackageSourceAsync() {
65
- const androidPackage = await this.maybeGetAndroidPackageFromCurrentProjectAsync();
66
- if (androidPackage) {
67
- return (0, results_1.result)({
68
- sourceType: AndroidPackageSource_1.AndroidPackageSourceType.userDefined,
69
- androidPackage,
70
- });
71
- }
72
- else if (this.ctx.nonInteractive) {
73
- return (0, results_1.result)(new Error("Couldn't resolve the Android package."));
74
- }
75
- else {
76
- return (0, results_1.result)({
77
- sourceType: AndroidPackageSource_1.AndroidPackageSourceType.prompt,
78
- });
48
+ catch (error) {
49
+ if (error instanceof applicationId_1.AmbiguousApplicationIdError) {
50
+ log_1.default.warn('"applicationId" is ambiguous, specify it via "applicationId" field in the submit profile in the eas.json.');
51
+ return (0, results_1.result)(null);
52
+ }
53
+ return (0, results_1.result)(new Error(`Failed to resolve applicationId in Android project: ${error.message}.`));
79
54
  }
80
55
  }
81
56
  resolveTrack() {
@@ -112,7 +87,7 @@ class AndroidSubmitCommand {
112
87
  return (0, results_1.result)(err);
113
88
  }
114
89
  }
115
- resolveServiceAccountSource() {
90
+ async resolveServiceAccountSourceAsync() {
116
91
  const { serviceAccountKeyPath } = this.ctx.profile;
117
92
  if (serviceAccountKeyPath) {
118
93
  return (0, results_1.result)({
@@ -120,8 +95,20 @@ class AndroidSubmitCommand {
120
95
  path: serviceAccountKeyPath,
121
96
  });
122
97
  }
98
+ let androidApplicationIdentifier = this.ctx.profile.applicationId;
99
+ if (!androidApplicationIdentifier) {
100
+ const androidApplicationIdentifierResult = await this.maybeGetAndroidPackageFromCurrentProjectAsync();
101
+ if (!androidApplicationIdentifierResult.ok) {
102
+ return (0, results_1.result)(androidApplicationIdentifierResult.reason);
103
+ }
104
+ const androidApplicationIdentifierValue = androidApplicationIdentifierResult.enforceValue();
105
+ if (androidApplicationIdentifierValue) {
106
+ androidApplicationIdentifier = androidApplicationIdentifierValue;
107
+ }
108
+ }
123
109
  return (0, results_1.result)({
124
110
  sourceType: ServiceAccountSource_1.ServiceAccountSourceType.credentialsService,
111
+ androidApplicationIdentifier,
125
112
  });
126
113
  }
127
114
  }
@@ -1,19 +1,23 @@
1
1
  import { Platform } from '@expo/eas-build-job';
2
2
  import { AndroidSubmissionConfigInput, SubmissionFragment } from '../../graphql/generated';
3
- import { ArchiveSource } from '../ArchiveSource';
3
+ import { Archive, ArchiveSource } from '../ArchiveSource';
4
4
  import BaseSubmitter, { SubmissionInput } from '../BaseSubmitter';
5
- import { AndroidPackageSource } from './AndroidPackageSource';
6
- import { ServiceAccountSource } from './ServiceAccountSource';
5
+ import { SubmissionContext } from '../context';
6
+ import { ServiceAccountKeyResult, ServiceAccountSource } from './ServiceAccountSource';
7
7
  export interface AndroidSubmissionOptions extends Pick<AndroidSubmissionConfigInput, 'track' | 'releaseStatus' | 'changesNotSentForReview'> {
8
8
  projectId: string;
9
- androidPackageSource: AndroidPackageSource;
10
9
  archiveSource: ArchiveSource;
11
10
  serviceAccountSource: ServiceAccountSource;
12
11
  }
13
- export default class AndroidSubmitter extends BaseSubmitter<Platform.ANDROID, AndroidSubmissionOptions> {
14
- submitAsync(): Promise<SubmissionFragment>;
12
+ interface ResolvedSourceOptions {
13
+ archive: Archive;
14
+ serviceAccountKeyResult: ServiceAccountKeyResult;
15
+ }
16
+ export default class AndroidSubmitter extends BaseSubmitter<Platform.ANDROID, ResolvedSourceOptions, AndroidSubmissionOptions> {
17
+ constructor(ctx: SubmissionContext<Platform.ANDROID>, options: AndroidSubmissionOptions);
18
+ createSubmissionInputAsync(resolvedSourceOptions: ResolvedSourceOptions): Promise<SubmissionInput<Platform.ANDROID>>;
15
19
  protected createPlatformSubmissionAsync({ projectId, submissionConfig, buildId, }: SubmissionInput<Platform.ANDROID>): Promise<SubmissionFragment>;
16
- private resolveSourceOptionsAsync;
17
- private formatSubmissionConfigAsync;
20
+ private formatSubmissionConfig;
18
21
  private prepareSummaryData;
19
22
  }
23
+ export {};
@@ -2,24 +2,46 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
5
+ const events_1 = require("../../analytics/events");
5
6
  const SubmissionMutation_1 = require("../../graphql/mutations/SubmissionMutation");
6
7
  const formatFields_1 = (0, tslib_1.__importDefault)(require("../../utils/formatFields"));
7
8
  const ArchiveSource_1 = require("../ArchiveSource");
8
9
  const BaseSubmitter_1 = (0, tslib_1.__importDefault)(require("../BaseSubmitter"));
9
10
  const summary_1 = require("../utils/summary");
10
- const AndroidPackageSource_1 = require("./AndroidPackageSource");
11
11
  const ServiceAccountSource_1 = require("./ServiceAccountSource");
12
12
  class AndroidSubmitter extends BaseSubmitter_1.default {
13
- async submitAsync() {
13
+ constructor(ctx, options) {
14
+ const sourceOptionsResolver = {
15
+ // eslint-disable-next-line async-protect/async-suffix
16
+ archive: async () => await (0, ArchiveSource_1.getArchiveAsync)(this.options.archiveSource),
17
+ // eslint-disable-next-line async-protect/async-suffix
18
+ serviceAccountKeyResult: async () => {
19
+ return await (0, ServiceAccountSource_1.getServiceAccountKeyResultAsync)(this.ctx, this.options.serviceAccountSource);
20
+ },
21
+ };
22
+ const sourceOptionsAnalytics = {
23
+ archive: {
24
+ attemptEvent: events_1.SubmissionEvent.GATHER_ARCHIVE_ATTEMPT,
25
+ successEvent: events_1.SubmissionEvent.GATHER_ARCHIVE_SUCCESS,
26
+ failureEvent: events_1.SubmissionEvent.GATHER_ARCHIVE_FAIL,
27
+ },
28
+ serviceAccountKeyResult: {
29
+ attemptEvent: events_1.SubmissionEvent.GATHER_CREDENTIALS_ATTEMPT,
30
+ successEvent: events_1.SubmissionEvent.GATHER_CREDENTIALS_SUCCESS,
31
+ failureEvent: events_1.SubmissionEvent.GATHER_CREDENTIALS_FAIL,
32
+ },
33
+ };
34
+ super(ctx, options, sourceOptionsResolver, sourceOptionsAnalytics);
35
+ }
36
+ async createSubmissionInputAsync(resolvedSourceOptions) {
14
37
  var _a;
15
- const resolvedSourceOptions = await this.resolveSourceOptionsAsync();
16
- const submissionConfig = await this.formatSubmissionConfigAsync(this.options, resolvedSourceOptions);
38
+ const submissionConfig = await this.formatSubmissionConfig(this.options, resolvedSourceOptions);
17
39
  (0, summary_1.printSummary)(this.prepareSummaryData(this.options, resolvedSourceOptions), SummaryHumanReadableKeys);
18
- return await this.createSubmissionAsync({
40
+ return {
19
41
  projectId: this.options.projectId,
20
42
  submissionConfig,
21
43
  buildId: (_a = resolvedSourceOptions.archive.build) === null || _a === void 0 ? void 0 : _a.id,
22
- });
44
+ };
23
45
  }
24
46
  async createPlatformSubmissionAsync({ projectId, submissionConfig, buildId, }) {
25
47
  return await SubmissionMutation_1.SubmissionMutation.createAndroidSubmissionAsync({
@@ -28,20 +50,9 @@ class AndroidSubmitter extends BaseSubmitter_1.default {
28
50
  submittedBuildId: buildId,
29
51
  });
30
52
  }
31
- async resolveSourceOptionsAsync() {
32
- const androidPackage = await (0, AndroidPackageSource_1.getAndroidPackageAsync)(this.options.androidPackageSource);
33
- const archive = await (0, ArchiveSource_1.getArchiveAsync)(this.options.archiveSource);
34
- const serviceAccountKeyResult = await (0, ServiceAccountSource_1.getServiceAccountKeyResultAsync)(this.ctx, this.options.serviceAccountSource, androidPackage);
35
- return {
36
- androidPackage,
37
- archive,
38
- serviceAccountKeyResult,
39
- };
40
- }
41
- async formatSubmissionConfigAsync(options, { archive, androidPackage, serviceAccountKeyResult }) {
53
+ formatSubmissionConfig(options, { archive, serviceAccountKeyResult }) {
42
54
  const { track, releaseStatus, changesNotSentForReview } = options;
43
55
  return {
44
- applicationIdentifier: androidPackage,
45
56
  archiveUrl: archive.url,
46
57
  track,
47
58
  changesNotSentForReview,
@@ -49,12 +60,11 @@ class AndroidSubmitter extends BaseSubmitter_1.default {
49
60
  ...serviceAccountKeyResult.result,
50
61
  };
51
62
  }
52
- prepareSummaryData(options, { archive, androidPackage, serviceAccountKeyResult }) {
63
+ prepareSummaryData(options, { archive, serviceAccountKeyResult }) {
53
64
  const { projectId, track, releaseStatus, changesNotSentForReview } = options;
54
65
  // structuring order affects table rows order
55
66
  return {
56
67
  projectId,
57
- androidPackage,
58
68
  track,
59
69
  changesNotSentForReview: changesNotSentForReview !== null && changesNotSentForReview !== void 0 ? changesNotSentForReview : undefined,
60
70
  releaseStatus: releaseStatus !== null && releaseStatus !== void 0 ? releaseStatus : undefined,
@@ -65,7 +75,6 @@ class AndroidSubmitter extends BaseSubmitter_1.default {
65
75
  }
66
76
  exports.default = AndroidSubmitter;
67
77
  const SummaryHumanReadableKeys = {
68
- androidPackage: 'Android package',
69
78
  archivePath: 'Archive path',
70
79
  archiveUrl: 'Download URL',
71
80
  changesNotSentForReview: 'Changes not sent for a review',
@@ -17,6 +17,7 @@ interface ServiceAccountPromptSource extends ServiceAccountSourceBase {
17
17
  }
18
18
  export interface ServiceAccountCredentialsServiceSource extends ServiceAccountSourceBase {
19
19
  sourceType: ServiceAccountSourceType.credentialsService;
20
+ androidApplicationIdentifier?: string;
20
21
  }
21
22
  export declare type ServiceAccountKeyResult = {
22
23
  result: ServiceAccountKeyFile | ServiceAccountKeyFromExpoServers;
@@ -34,7 +35,7 @@ declare type ServiceAccountKeyFromExpoServers = {
34
35
  googleServiceAccountKeyId: string;
35
36
  };
36
37
  export declare type ServiceAccountSource = ServiceAccountPathSource | ServiceAccountPromptSource | ServiceAccountCredentialsServiceSource;
37
- export declare function getServiceAccountKeyResultAsync(ctx: SubmissionContext<Platform.ANDROID>, source: ServiceAccountSource, androidApplicationIdentifier: string): Promise<ServiceAccountKeyResult>;
38
+ export declare function getServiceAccountKeyResultAsync(ctx: SubmissionContext<Platform.ANDROID>, source: ServiceAccountSource): Promise<ServiceAccountKeyResult>;
38
39
  export declare function getServiceAccountKeyPathAsync(source: ServiceAccountSource): Promise<string>;
39
- export declare function getServiceAccountFromCredentialsServiceAsync(ctx: SubmissionContext<Platform.ANDROID>, androidApplicationIdentifier: string): Promise<ServiceAccountKeyResult>;
40
+ export declare function getServiceAccountFromCredentialsServiceAsync(ctx: SubmissionContext<Platform.ANDROID>, source: ServiceAccountCredentialsServiceSource): Promise<ServiceAccountKeyResult>;
40
41
  export {};