eas-cli 20.1.0 → 20.3.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 (46) hide show
  1. package/README.md +223 -120
  2. package/build/commandUtils/posthog.d.ts +4 -0
  3. package/build/commandUtils/posthog.js +23 -0
  4. package/build/commands/account/audit.d.ts +17 -0
  5. package/build/commands/account/audit.js +112 -0
  6. package/build/commands/integrations/posthog/connect.d.ts +27 -0
  7. package/build/commands/integrations/posthog/connect.js +432 -0
  8. package/build/commands/integrations/posthog/dashboard.d.ts +13 -0
  9. package/build/commands/integrations/posthog/dashboard.js +66 -0
  10. package/build/commands/integrations/posthog/disconnect.d.ts +14 -0
  11. package/build/commands/integrations/posthog/disconnect.js +80 -0
  12. package/build/commands/simulator/start.d.ts +1 -0
  13. package/build/commands/simulator/start.js +5 -0
  14. package/build/commands/update/rollback.d.ts +11 -0
  15. package/build/commands/update/rollback.js +117 -14
  16. package/build/commands/update/view.d.ts +7 -0
  17. package/build/commands/update/view.js +30 -3
  18. package/build/credentials/ios/actions/AscApiKeyUtils.d.ts +20 -0
  19. package/build/credentials/ios/actions/AscApiKeyUtils.js +64 -0
  20. package/build/credentials/ios/actions/ConfigureProvisioningProfile.js +2 -4
  21. package/build/credentials/ios/actions/CreateProvisioningProfile.js +2 -4
  22. package/build/credentials/ios/actions/SetUpAdhocProvisioningProfile.js +3 -20
  23. package/build/credentials/ios/actions/SetUpProvisioningProfile.d.ts +10 -0
  24. package/build/credentials/ios/actions/SetUpProvisioningProfile.js +39 -5
  25. package/build/credentials/ios/appstore/resolveCredentials.d.ts +1 -0
  26. package/build/credentials/ios/appstore/resolveCredentials.js +1 -0
  27. package/build/graphql/generated.d.ts +611 -30
  28. package/build/graphql/generated.js +29 -5
  29. package/build/graphql/mutations/PostHogMutation.d.ts +8 -0
  30. package/build/graphql/mutations/PostHogMutation.js +55 -0
  31. package/build/graphql/queries/AuditLogQuery.d.ts +6 -0
  32. package/build/graphql/queries/AuditLogQuery.js +57 -0
  33. package/build/graphql/queries/DeviceRunSessionQuery.js +1 -0
  34. package/build/graphql/queries/PostHogQuery.d.ts +6 -0
  35. package/build/graphql/queries/PostHogQuery.js +49 -0
  36. package/build/graphql/queries/UpdateQuery.d.ts +2 -1
  37. package/build/graphql/queries/UpdateQuery.js +52 -0
  38. package/build/graphql/types/AuditLog.d.ts +1 -0
  39. package/build/graphql/types/AuditLog.js +18 -0
  40. package/build/graphql/types/PostHogConnection.d.ts +7 -0
  41. package/build/graphql/types/PostHogConnection.js +30 -0
  42. package/build/simulator/utils.js +28 -5
  43. package/build/user/SessionManager.d.ts +1 -22
  44. package/build/user/SessionManager.js +7 -89
  45. package/oclif.manifest.json +920 -488
  46. package/package.json +5 -2
@@ -11,16 +11,15 @@ const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
11
11
  const AppleTeamUtils_1 = require("./AppleTeamUtils");
12
12
  const BuildCredentialsUtils_1 = require("./BuildCredentialsUtils");
13
13
  const DeviceUtils_1 = require("./DeviceUtils");
14
+ const AscApiKeyUtils_1 = require("./AscApiKeyUtils");
14
15
  const SetUpDistributionCertificate_1 = require("./SetUpDistributionCertificate");
15
16
  const action_1 = tslib_1.__importStar(require("../../../devices/actions/create/action"));
16
17
  const generated_1 = require("../../../graphql/generated");
17
- const AppStoreConnectApiKeyQuery_1 = require("../../../graphql/queries/AppStoreConnectApiKeyQuery");
18
18
  const log_1 = tslib_1.__importDefault(require("../../../log"));
19
19
  const target_1 = require("../../../project/ios/target");
20
20
  const prompts_1 = require("../../../prompts");
21
21
  const differenceBy_1 = tslib_1.__importDefault(require("../../../utils/expodash/differenceBy"));
22
22
  const errors_1 = require("../../errors");
23
- const GraphqlClient_1 = require("../api/GraphqlClient");
24
23
  const authenticateTypes_1 = require("../appstore/authenticateTypes");
25
24
  const constants_1 = require("../appstore/constants");
26
25
  const resolveCredentials_1 = require("../appstore/resolveCredentials");
@@ -263,7 +262,7 @@ class SetUpAdhocProvisioningProfile {
263
262
  await ctx.appStore.ensureAuthenticatedAsync({ mode: authenticateTypes_1.AuthenticationMode.API_KEY });
264
263
  return;
265
264
  }
266
- const resolvedKey = await resolveAscApiKeyForAppCredentialsAsync({
265
+ const resolvedKey = await (0, AscApiKeyUtils_1.resolveAscApiKeyForAppCredentialsAsync)({
267
266
  graphqlClient: ctx.graphqlClient,
268
267
  app,
269
268
  });
@@ -272,6 +271,7 @@ class SetUpAdhocProvisioningProfile {
272
271
  ' - Environment variables: EXPO_ASC_API_KEY_PATH, EXPO_ASC_KEY_ID, EXPO_ASC_ISSUER_ID\n' +
273
272
  ' - EAS credentials service: configure an App Store Connect API Key for submissions on this app');
274
273
  }
274
+ log_1.default.log('Using App Store Connect API Key from EAS credentials service.');
275
275
  await ctx.appStore.ensureAuthenticatedAsync({
276
276
  mode: authenticateTypes_1.AuthenticationMode.API_KEY,
277
277
  ascApiKey: resolvedKey.ascApiKey,
@@ -284,23 +284,6 @@ class SetUpAdhocProvisioningProfile {
284
284
  }
285
285
  }
286
286
  exports.SetUpAdhocProvisioningProfile = SetUpAdhocProvisioningProfile;
287
- async function resolveAscApiKeyForAppCredentialsAsync({ graphqlClient, app, }) {
288
- const ascKeyFragment = await (0, GraphqlClient_1.getAscApiKeyForAppSubmissionsAsync)(graphqlClient, app);
289
- if (!ascKeyFragment) {
290
- return null;
291
- }
292
- log_1.default.log('Using App Store Connect API Key from EAS credentials service.');
293
- const fullKey = await AppStoreConnectApiKeyQuery_1.AppStoreConnectApiKeyQuery.getByIdAsync(graphqlClient, ascKeyFragment.id);
294
- return {
295
- ascApiKey: {
296
- keyP8: fullKey.keyP8,
297
- keyId: fullKey.keyIdentifier,
298
- issuerId: fullKey.issuerIdentifier,
299
- },
300
- teamId: ascKeyFragment.appleTeam?.appleTeamIdentifier,
301
- teamName: ascKeyFragment.appleTeam?.appleTeamName ?? undefined,
302
- };
303
- }
304
287
  function doUDIDsMatch(udidsA, udidsB) {
305
288
  const setA = new Set(udidsA);
306
289
  const setB = new Set(udidsB);
@@ -15,5 +15,15 @@ export declare class SetUpProvisioningProfile {
15
15
  createAndAssignProfileAsync(ctx: CredentialsContext, distCert: AppleDistributionCertificateFragment): Promise<IosAppBuildCredentialsFragment>;
16
16
  configureAndAssignProfileAsync(ctx: CredentialsContext, distCert: AppleDistributionCertificateFragment, originalProvisioningProfile: AppleProvisioningProfileFragment): Promise<IosAppBuildCredentialsFragment | null>;
17
17
  runAsync(ctx: CredentialsContext): Promise<IosAppBuildCredentialsFragment>;
18
+ /**
19
+ * The team type determines `team.inHouse`, which in turn selects the Apple profile
20
+ * type used for every subsequent profile lookup and creation (IOS_APP_INHOUSE for
21
+ * enterprise vs IOS_APP_STORE otherwise). We derive it from the distribution
22
+ * type, which is exactly what the requested operation needs: enterprise
23
+ * builds require an in-house team, other distribution types don't.
24
+ * A genuine team/distribution mismatch is rejected by Apple regardless of this value.
25
+ */
26
+ private getDerivedTeamTypeForAuthentication;
27
+ private resolveTeamTypeForAuthentication;
18
28
  private getCurrentProfileStoreInfo;
19
29
  }
@@ -3,15 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SetUpProvisioningProfile = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
6
+ const AscApiKeyUtils_1 = require("./AscApiKeyUtils");
6
7
  const BuildCredentialsUtils_1 = require("./BuildCredentialsUtils");
7
8
  const ConfigureProvisioningProfile_1 = require("./ConfigureProvisioningProfile");
8
9
  const CreateProvisioningProfile_1 = require("./CreateProvisioningProfile");
9
10
  const ProvisioningProfileUtils_1 = require("./ProvisioningProfileUtils");
10
11
  const SetUpDistributionCertificate_1 = require("./SetUpDistributionCertificate");
11
- const log_1 = require("../../../log");
12
+ const generated_1 = require("../../../graphql/generated");
13
+ const log_1 = tslib_1.__importStar(require("../../../log"));
12
14
  const target_1 = require("../../../project/ios/target");
13
15
  const prompts_1 = require("../../../prompts");
14
16
  const errors_1 = require("../../errors");
17
+ const resolveCredentials_1 = require("../appstore/resolveCredentials");
15
18
  const authenticateTypes_1 = require("../appstore/authenticateTypes");
16
19
  const validateProvisioningProfile_1 = require("../validators/validateProvisioningProfile");
17
20
  /**
@@ -50,16 +53,31 @@ class SetUpProvisioningProfile {
50
53
  }
51
54
  async runAsync(ctx) {
52
55
  const distCert = await new SetUpDistributionCertificate_1.SetUpDistributionCertificate(this.app, this.distributionType).runAsync(ctx);
53
- const areBuildCredentialsSetup = await this.areBuildCredentialsSetupAsync(ctx);
56
+ if (ctx.nonInteractive && !ctx.appStore.authCtx) {
57
+ await (0, AscApiKeyUtils_1.tryAuthenticateAppStoreWithEasAscApiKeyAsync)(ctx, this.app, this.resolveTeamTypeForAuthentication());
58
+ }
59
+ let areBuildCredentialsSetup;
60
+ try {
61
+ areBuildCredentialsSetup = await this.areBuildCredentialsSetupAsync(ctx);
62
+ }
63
+ catch (error) {
64
+ if (ctx.nonInteractive) {
65
+ log_1.default.warn('Skipping Provisioning Profile validation on Apple servers due to an unexpected validation error. Continuing with local validation result.');
66
+ log_1.default.debug('Provisioning profile validation on Apple servers failed:', error);
67
+ areBuildCredentialsSetup = true;
68
+ }
69
+ else {
70
+ throw error;
71
+ }
72
+ }
54
73
  if (areBuildCredentialsSetup) {
55
74
  return (0, nullthrows_1.default)(await (0, BuildCredentialsUtils_1.getBuildCredentialsAsync)(ctx, this.app, this.distributionType));
56
75
  }
57
76
  if (ctx.freezeCredentials) {
58
77
  throw new errors_1.ForbidCredentialModificationError('Provisioning profile is not configured correctly. Remove the --freeze-credentials flag to configure it.');
59
78
  }
60
- else if (ctx.nonInteractive &&
61
- ctx.appStore.defaultAuthenticationMode !== authenticateTypes_1.AuthenticationMode.API_KEY) {
62
- throw new errors_1.InsufficientAuthenticationNonInteractiveError(`In order to configure your Provisioning Profile, authentication with an ASC API key is required in non-interactive mode. ${(0, log_1.learnMore)('https://docs.expo.dev/build/building-on-ci/#optional-provide-an-asc-api-token-for-your-apple-team')}`);
79
+ if (ctx.nonInteractive && !ctx.appStore.authCtx) {
80
+ throw new errors_1.InsufficientAuthenticationNonInteractiveError(`In order to configure your Provisioning Profile, authentication with an ASC API key is required in non-interactive mode. Either set the EXPO_ASC_API_KEY_PATH/EXPO_ASC_KEY_ID/EXPO_ASC_ISSUER_ID environment variables, or configure an App Store Connect API Key for submissions for bundle identifier ${this.app.bundleIdentifier} on EAS. ${(0, log_1.learnMore)('https://docs.expo.dev/build/building-on-ci/#optional-provide-an-asc-api-token-for-your-apple-team')}`);
63
81
  }
64
82
  const currentProfile = await (0, BuildCredentialsUtils_1.getProvisioningProfileAsync)(ctx, this.app, this.distributionType);
65
83
  if (!currentProfile) {
@@ -93,6 +111,22 @@ class SetUpProvisioningProfile {
93
111
  }
94
112
  return updatedProfile;
95
113
  }
114
+ /**
115
+ * The team type determines `team.inHouse`, which in turn selects the Apple profile
116
+ * type used for every subsequent profile lookup and creation (IOS_APP_INHOUSE for
117
+ * enterprise vs IOS_APP_STORE otherwise). We derive it from the distribution
118
+ * type, which is exactly what the requested operation needs: enterprise
119
+ * builds require an in-house team, other distribution types don't.
120
+ * A genuine team/distribution mismatch is rejected by Apple regardless of this value.
121
+ */
122
+ getDerivedTeamTypeForAuthentication() {
123
+ return this.distributionType === generated_1.IosDistributionType.Enterprise
124
+ ? authenticateTypes_1.AppleTeamType.IN_HOUSE
125
+ : authenticateTypes_1.AppleTeamType.COMPANY_OR_ORGANIZATION;
126
+ }
127
+ resolveTeamTypeForAuthentication() {
128
+ return (0, resolveCredentials_1.resolveAppleTeamTypeFromEnvironment)() ?? this.getDerivedTeamTypeForAuthentication();
129
+ }
96
130
  getCurrentProfileStoreInfo(profiles, currentProfile) {
97
131
  return (profiles.find(profile => currentProfile.developerPortalIdentifier
98
132
  ? currentProfile.developerPortalIdentifier === profile.provisioningProfileId
@@ -10,6 +10,7 @@ import { MinimalAscApiKey } from '../credentials';
10
10
  export declare function resolveUserCredentialsAsync(options: Partial<Auth.UserCredentials>): Promise<Partial<Auth.UserCredentials>>;
11
11
  export declare function hasAscEnvVars(): boolean;
12
12
  export declare function resolveAscApiKeyAsync(ascApiKey?: MinimalAscApiKey): Promise<MinimalAscApiKey>;
13
+ export declare function resolveAppleTeamTypeFromEnvironment(): AppleTeamType | undefined;
13
14
  export declare function resolveAppleTeamAsync(options?: {
14
15
  teamId?: string;
15
16
  teamName?: string;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveUserCredentialsAsync = resolveUserCredentialsAsync;
4
4
  exports.hasAscEnvVars = hasAscEnvVars;
5
5
  exports.resolveAscApiKeyAsync = resolveAscApiKeyAsync;
6
+ exports.resolveAppleTeamTypeFromEnvironment = resolveAppleTeamTypeFromEnvironment;
6
7
  exports.resolveAppleTeamAsync = resolveAppleTeamAsync;
7
8
  exports.promptPasswordAsync = promptPasswordAsync;
8
9
  exports.deletePasswordAsync = deletePasswordAsync;