eas-cli 24.13.0 → 25.0.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 (43) hide show
  1. package/README.md +185 -166
  2. package/build/billing/resolveAccount.js +38 -14
  3. package/build/build/utils/url.d.ts +1 -0
  4. package/build/build/utils/url.js +4 -0
  5. package/build/commandUtils/EasCommand.js +11 -5
  6. package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +1 -1
  7. package/build/commandUtils/new/configs.d.ts +2 -2
  8. package/build/commandUtils/new/configs.js +8 -20
  9. package/build/commands/account/view.d.ts +6 -1
  10. package/build/commands/account/view.js +38 -8
  11. package/build/commands/channel/protect.js +1 -1
  12. package/build/commands/channel/unprotect.js +1 -1
  13. package/build/commands/simulator/get.js +5 -2
  14. package/build/commands/simulator/index.d.ts +1 -0
  15. package/build/commands/simulator/index.js +10 -2
  16. package/build/commands/workflow/insights/maestro.d.ts +2 -0
  17. package/build/commands/workflow/insights/maestro.js +6 -0
  18. package/build/easSelect.d.ts +30 -0
  19. package/build/easSelect.js +57 -0
  20. package/build/graphql/generated.d.ts +344 -949
  21. package/build/graphql/generated.js +5 -74
  22. package/build/graphql/queries/AccountQuery.js +2 -1
  23. package/build/graphql/queries/DeviceRunSessionQuery.js +1 -0
  24. package/build/graphql/queries/WorkflowDeviceTestCaseInsightsQuery.js +11 -0
  25. package/build/graphql/types/Account.js +3 -2
  26. package/build/project/accountSelection.d.ts +2 -3
  27. package/build/project/accountSelection.js +12 -15
  28. package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.js +4 -4
  29. package/build/project/projectInitialization.js +7 -6
  30. package/build/prompts.d.ts +2 -1
  31. package/build/prompts.js +2 -0
  32. package/build/simulator/utils.d.ts +8 -5
  33. package/build/simulator/utils.js +56 -20
  34. package/build/user/User.d.ts +17 -1
  35. package/build/user/User.js +37 -2
  36. package/build/user/roles.d.ts +6 -0
  37. package/build/user/roles.js +35 -0
  38. package/build/workflow/insights/formatMaestroInsights.d.ts +9 -2
  39. package/build/workflow/insights/formatMaestroInsights.js +24 -0
  40. package/build/workflow/insights/maestroFilters.d.ts +5 -3
  41. package/build/workflow/insights/maestroFilters.js +5 -0
  42. package/oclif.manifest.json +439 -422
  43. package/package.json +6 -6
@@ -7,9 +7,9 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.BackgroundJobState = exports.BackgroundJobResultType = exports.AuthProviderIdentifier = exports.AuthProtocolType = exports.AuditLogsExportFormat = exports.AssetMetadataStatus = exports.AssetMapSourceType = exports.AppleTeamType = exports.AppleDeviceClass = exports.AppUploadSessionType = exports.AppStoreConnectWorkflowConnectionStatus = exports.AppStoreConnectUserRole = exports.AppStoreConnectBuildUploadState = exports.AppStoreConnectBuildProcessingState = exports.AppProfileImageWidth = exports.AppPrivacy = exports.AppPlatform = exports.AppObserveUserEventNamesOrderByField = exports.AppObserveUserEventListOrderByField = exports.AppObserveUserEventBreakdownDimension = exports.AppObserveUpdatesOrderByField = exports.AppObserveUpdatesOrderByDirection = exports.AppObservePropertyType = exports.AppObservePlatform = exports.AppObserveOrderDirection = exports.AppObserveNavigationRoutesOrderByField = exports.AppObserveMetricsListOrderByField = exports.AppObserveLogsOrderByField = exports.AppObserveEventsOrderByField = exports.AppObserveEventsOrderByDirection = exports.AppObserveErrorSeverity = exports.AppObserveErrorOccurrencesOrderByField = exports.AppObserveErrorKind = exports.AppObserveErrorGroupsOrderBy = exports.AppObserveErrorBreakdownDimension = exports.AppObserveCustomEventNamesOrderByField = exports.AppObserveCustomEventNamesOrderByDirection = exports.AppObserveCustomEventListOrderByField = exports.AppInternalDistributionBuildPrivacy = exports.AndroidKeystoreType = exports.AndroidFcmVersion = exports.AndroidBuildType = exports.AgentProviderConnectionStatus = exports.AgentProviderConnectionAuthorizationStatus = exports.AgentProvider = exports.ActivityTimelineProjectActivityType = exports.AccountUploadSessionType = exports.AccountMemberType = exports.AccountAppsSortByField = exports.AccessTokenScopeType = void 0;
10
- exports.GitHubAppEnvironment = exports.FingerprintSourceType = exports.Feature = exports.Experiment = exports.ExitInterviewOutcome = exports.ExitInterviewMessageRole = exports.EnvironmentVariableVisibility = exports.EnvironmentVariableScope = exports.EnvironmentSecretType = exports.EntityTypeName = exports.EchoVersionSource = exports.EchoTurnCompletionStatus = exports.EchoProjectVisibility = exports.EchoProjectUploadSessionType = exports.EchoProjectIconSource = exports.EchoMessageRole = exports.EchoMessagePartType = exports.EchoChatState = exports.EchoChangeType = exports.EchoBuildStatus = exports.EchoAgentType = exports.EasTotalPlanEnablementUnit = exports.EasServiceMetric = exports.EasService = exports.EasBuildWaiverType = exports.EasBuildDeprecationInfoType = exports.EasBuildBillingResourceClass = exports.DistributionType = exports.DeviceRunSessionType = exports.DeviceRunSessionStatus = exports.DeviceRunSessionResourceClass = exports.DeviceRunSessionRequestOrigin = exports.DeviceRunSessionEgress = exports.DashboardViewPin = exports.CustomDomainStatus = exports.CustomDomainDnsRecordType = exports.CrashSampleFor = exports.ContinentCode = exports.BuildWorkflow = exports.BuildTrigger = exports.BuildStatus = exports.BuildRetryDisabledReason = exports.BuildResourceClass = exports.BuildPriority = exports.BuildPhase = exports.BuildMode = exports.BuildLimitThresholdExceededMetadataType = exports.BuildIosEnterpriseProvisioning = exports.BuildCredentialsSource = exports.BuildAnnotationType = void 0;
11
- exports.SubmissionPriority = exports.SubmissionArchiveSourceType = exports.SubmissionAndroidReleaseStatus = exports.StatuspageServiceStatus = exports.StatuspageServiceName = exports.StatuspageIncidentStatus = exports.StatuspageIncidentImpact = exports.StandardOffer = exports.SourceMapSourceType = exports.SecondFactorMethod = exports.SandboxStatus = exports.SandboxResourceClass = exports.SandboxOperatingSystem = exports.Role = exports.ResponseType = exports.ResponseStatusType = exports.ResponseCacheStatus = exports.ResourceClassExperiment = exports.RequestsOrderByField = exports.RequestsOrderByDirection = exports.RequestMethod = exports.RealtimeLogsTargetType = exports.ProjectArchiveSourceType = exports.PostHogRegion = exports.PostHogDeepLinkPurpose = exports.Permission = exports.Order = exports.OnboardingEnvironment = exports.OnboardingDeviceType = exports.OfferType = exports.OAuthProvider = exports.NotificationType = exports.NotificationEvent = exports.LocalBuildArchiveSourceType = exports.JobRunStatus = exports.JobRunPriority = exports.IosSchemeBuildConfiguration = exports.IosManagedBuildType = exports.IosDistributionType = exports.IosBuildType = exports.InvoiceDiscountType = exports.InsightsFilterType = exports.GitHubJobRunTriggerType = exports.GitHubJobRunTriggerRunStatus = exports.GitHubJobRunJobType = exports.GitHubBuildTriggerType = exports.GitHubBuildTriggerRunStatus = exports.GitHubBuildTriggerExecutionBehavior = exports.GitHubAppInstallationStatus = exports.GitHubAppInstallationAccountType = void 0;
12
- exports.WorkflowsInsightsRunsOverTimeGranularity = exports.WorkflowsInsightsExportFormat = exports.WorkflowRunTriggerEventType = exports.WorkflowRunStatus = exports.WorkflowProjectSourceType = exports.WorkflowJobType = exports.WorkflowJobStatus = exports.WorkflowJobReviewDecision = exports.WorkflowDispatchInputType = exports.WorkflowDeviceTestCaseStatusFilter = exports.WorkflowDeviceTestCaseStatus = exports.WorkflowDeviceTestCaseStatSortField = exports.WorkflowDeviceTestCaseSortDirection = exports.WorkflowDeviceTestCaseInsightsTimeSeriesGranularity = exports.WorkflowArtifactStorageType = exports.WorkerLoggerLevel = exports.WorkerDeploymentLogLevel = exports.WorkerDeploymentCrashKind = exports.WebhookType = exports.UserSpecifiedAccountUsage = exports.UserEntityTypeName = exports.UserAgentPlatform = exports.UserAgentOs = exports.UserAgentBrowser = exports.UsageMetricsGranularity = exports.UsageMetricType = exports.UploadSessionType = exports.UpdatesTimelineItemType = exports.UpdateDiffReceiptStateValue = exports.UpdateDiffReceiptOrderByField = exports.UpdateDiffReceiptOrderByDirection = exports.TurtleSshTransportType = exports.TurtleSshTargetType = exports.TargetEntityMutationType = exports.SupabaseAdvisorType = exports.SupabaseAdvisorLintLevel = exports.SubmissionStatus = void 0;
10
+ exports.IosBuildType = exports.InvoiceDiscountType = exports.InsightsFilterType = exports.GitHubJobRunTriggerType = exports.GitHubJobRunTriggerRunStatus = exports.GitHubJobRunJobType = exports.GitHubBuildTriggerType = exports.GitHubBuildTriggerRunStatus = exports.GitHubBuildTriggerExecutionBehavior = exports.GitHubAppInstallationStatus = exports.GitHubAppInstallationAccountType = exports.GitHubAppEnvironment = exports.FingerprintSourceType = exports.Feature = exports.Experiment = exports.ExitInterviewOutcome = exports.ExitInterviewMessageRole = exports.EnvironmentVariableVisibility = exports.EnvironmentVariableScope = exports.EnvironmentSecretType = exports.EntityTypeName = exports.EasTotalPlanEnablementUnit = exports.EasServiceMetric = exports.EasService = exports.EasBuildWaiverType = exports.EasBuildDeprecationInfoType = exports.EasBuildBillingResourceClass = exports.DistributionType = exports.DeviceRunSessionType = exports.DeviceRunSessionStatus = exports.DeviceRunSessionResourceClass = exports.DeviceRunSessionRequestOrigin = exports.DeviceRunSessionEgress = exports.DashboardViewPin = exports.CustomDomainStatus = exports.CustomDomainDnsRecordType = exports.CrashSampleFor = exports.ContinentCode = exports.BuildWorkflow = exports.BuildTrigger = exports.BuildStatus = exports.BuildRetryDisabledReason = exports.BuildResourceClass = exports.BuildPriority = exports.BuildPhase = exports.BuildMode = exports.BuildLimitThresholdExceededMetadataType = exports.BuildIosEnterpriseProvisioning = exports.BuildCredentialsSource = exports.BuildAnnotationType = void 0;
11
+ exports.UploadSessionType = exports.UpdatesTimelineItemType = exports.UpdateDiffReceiptStateValue = exports.UpdateDiffReceiptOrderByField = exports.UpdateDiffReceiptOrderByDirection = exports.TurtleSshTransportType = exports.TurtleSshTargetType = exports.TargetEntityMutationType = exports.SupabaseAdvisorType = exports.SupabaseAdvisorLintLevel = exports.SubmissionStatus = exports.SubmissionPriority = exports.SubmissionArchiveSourceType = exports.SubmissionAndroidReleaseStatus = exports.StatuspageServiceStatus = exports.StatuspageServiceName = exports.StatuspageIncidentStatus = exports.StatuspageIncidentImpact = exports.StandardOffer = exports.SourceMapSourceType = exports.SecondFactorMethod = exports.SandboxStatus = exports.SandboxResourceClass = exports.SandboxOperatingSystem = exports.Role = exports.ResponseType = exports.ResponseStatusType = exports.ResponseCacheStatus = exports.ResourceClassExperiment = exports.RequestsOrderByField = exports.RequestsOrderByDirection = exports.RequestMethod = exports.RealtimeLogsTargetType = exports.ProjectArchiveSourceType = exports.PostHogRegion = exports.PostHogDeepLinkPurpose = exports.Permission = exports.Order = exports.OnboardingEnvironment = exports.OnboardingDeviceType = exports.OfferType = exports.OAuthProvider = exports.NotificationType = exports.NotificationEvent = exports.LocalBuildArchiveSourceType = exports.JobRunStatus = exports.JobRunPriority = exports.IosSchemeBuildConfiguration = exports.IosManagedBuildType = exports.IosDistributionType = void 0;
12
+ exports.WorkflowsInsightsRunsOverTimeGranularity = exports.WorkflowsInsightsExportFormat = exports.WorkflowRunTriggerEventType = exports.WorkflowRunStatus = exports.WorkflowProjectSourceType = exports.WorkflowJobType = exports.WorkflowJobStatus = exports.WorkflowJobReviewDecision = exports.WorkflowDispatchInputType = exports.WorkflowDeviceTestCaseStatusFilter = exports.WorkflowDeviceTestCaseStatus = exports.WorkflowDeviceTestCaseStatSortField = exports.WorkflowDeviceTestCaseSortDirection = exports.WorkflowDeviceTestCaseInsightsTimeSeriesGranularity = exports.WorkflowArtifactStorageType = exports.WorkerLoggerLevel = exports.WorkerDeploymentLogLevel = exports.WorkerDeploymentCrashKind = exports.WebhookType = exports.UserSpecifiedAccountUsage = exports.UserEntityTypeName = exports.UserAgentPlatform = exports.UserAgentOs = exports.UserAgentBrowser = exports.UsageMetricsGranularity = exports.UsageMetricType = void 0;
13
13
  var AccessTokenScopeType;
14
14
  (function (AccessTokenScopeType) {
15
15
  /** One account, named by accountID, narrowed to the scope's permissions. */
@@ -625,76 +625,6 @@ var EasTotalPlanEnablementUnit;
625
625
  EasTotalPlanEnablementUnit["Updater"] = "UPDATER";
626
626
  EasTotalPlanEnablementUnit["User"] = "USER";
627
627
  })(EasTotalPlanEnablementUnit || (exports.EasTotalPlanEnablementUnit = EasTotalPlanEnablementUnit = {}));
628
- var EchoAgentType;
629
- (function (EchoAgentType) {
630
- EchoAgentType["ClaudeCode"] = "CLAUDE_CODE";
631
- EchoAgentType["Codex"] = "CODEX";
632
- EchoAgentType["Gemini"] = "GEMINI";
633
- })(EchoAgentType || (exports.EchoAgentType = EchoAgentType = {}));
634
- var EchoBuildStatus;
635
- (function (EchoBuildStatus) {
636
- EchoBuildStatus["Building"] = "BUILDING";
637
- EchoBuildStatus["Failed"] = "FAILED";
638
- EchoBuildStatus["Pending"] = "PENDING";
639
- EchoBuildStatus["Success"] = "SUCCESS";
640
- })(EchoBuildStatus || (exports.EchoBuildStatus = EchoBuildStatus = {}));
641
- var EchoChangeType;
642
- (function (EchoChangeType) {
643
- EchoChangeType["Added"] = "ADDED";
644
- EchoChangeType["Deleted"] = "DELETED";
645
- EchoChangeType["Modified"] = "MODIFIED";
646
- EchoChangeType["Renamed"] = "RENAMED";
647
- })(EchoChangeType || (exports.EchoChangeType = EchoChangeType = {}));
648
- var EchoChatState;
649
- (function (EchoChatState) {
650
- EchoChatState["Active"] = "ACTIVE";
651
- EchoChatState["Archived"] = "ARCHIVED";
652
- })(EchoChatState || (exports.EchoChatState = EchoChatState = {}));
653
- var EchoMessagePartType;
654
- (function (EchoMessagePartType) {
655
- EchoMessagePartType["Compaction"] = "COMPACTION";
656
- EchoMessagePartType["Data"] = "DATA";
657
- EchoMessagePartType["File"] = "FILE";
658
- EchoMessagePartType["Reasoning"] = "REASONING";
659
- EchoMessagePartType["Source"] = "SOURCE";
660
- EchoMessagePartType["Step"] = "STEP";
661
- EchoMessagePartType["Subtask"] = "SUBTASK";
662
- EchoMessagePartType["Text"] = "TEXT";
663
- EchoMessagePartType["Tool"] = "TOOL";
664
- })(EchoMessagePartType || (exports.EchoMessagePartType = EchoMessagePartType = {}));
665
- /** Echo message role */
666
- var EchoMessageRole;
667
- (function (EchoMessageRole) {
668
- EchoMessageRole["Assistant"] = "ASSISTANT";
669
- EchoMessageRole["User"] = "USER";
670
- })(EchoMessageRole || (exports.EchoMessageRole = EchoMessageRole = {}));
671
- var EchoProjectIconSource;
672
- (function (EchoProjectIconSource) {
673
- EchoProjectIconSource["AiGenerated"] = "AI_GENERATED";
674
- EchoProjectIconSource["UserUploaded"] = "USER_UPLOADED";
675
- })(EchoProjectIconSource || (exports.EchoProjectIconSource = EchoProjectIconSource = {}));
676
- var EchoProjectUploadSessionType;
677
- (function (EchoProjectUploadSessionType) {
678
- EchoProjectUploadSessionType["ImageUpload"] = "IMAGE_UPLOAD";
679
- })(EchoProjectUploadSessionType || (exports.EchoProjectUploadSessionType = EchoProjectUploadSessionType = {}));
680
- var EchoProjectVisibility;
681
- (function (EchoProjectVisibility) {
682
- EchoProjectVisibility["Private"] = "PRIVATE";
683
- EchoProjectVisibility["Public"] = "PUBLIC";
684
- })(EchoProjectVisibility || (exports.EchoProjectVisibility = EchoProjectVisibility = {}));
685
- var EchoTurnCompletionStatus;
686
- (function (EchoTurnCompletionStatus) {
687
- EchoTurnCompletionStatus["Cancelled"] = "CANCELLED";
688
- EchoTurnCompletionStatus["Completed"] = "COMPLETED";
689
- EchoTurnCompletionStatus["Error"] = "ERROR";
690
- })(EchoTurnCompletionStatus || (exports.EchoTurnCompletionStatus = EchoTurnCompletionStatus = {}));
691
- var EchoVersionSource;
692
- (function (EchoVersionSource) {
693
- EchoVersionSource["Agent"] = "AGENT";
694
- EchoVersionSource["Github"] = "GITHUB";
695
- EchoVersionSource["Manual"] = "MANUAL";
696
- EchoVersionSource["Revert"] = "REVERT";
697
- })(EchoVersionSource || (exports.EchoVersionSource = EchoVersionSource = {}));
698
628
  var EntityTypeName;
699
629
  (function (EntityTypeName) {
700
630
  EntityTypeName["AccountEntity"] = "AccountEntity";
@@ -744,7 +674,6 @@ var EnvironmentSecretType;
744
674
  })(EnvironmentSecretType || (exports.EnvironmentSecretType = EnvironmentSecretType = {}));
745
675
  var EnvironmentVariableScope;
746
676
  (function (EnvironmentVariableScope) {
747
- EnvironmentVariableScope["EchoProject"] = "ECHO_PROJECT";
748
677
  EnvironmentVariableScope["Project"] = "PROJECT";
749
678
  EnvironmentVariableScope["Shared"] = "SHARED";
750
679
  })(EnvironmentVariableScope || (exports.EnvironmentVariableScope = EnvironmentVariableScope = {}));
@@ -935,6 +864,7 @@ var Permission;
935
864
  Permission["Own"] = "OWN";
936
865
  Permission["Publish"] = "PUBLISH";
937
866
  Permission["PublishProtected"] = "PUBLISH_PROTECTED";
867
+ Permission["Run"] = "RUN";
938
868
  Permission["View"] = "VIEW";
939
869
  })(Permission || (exports.Permission = Permission = {}));
940
870
  /** Which EAS surface a deep link was opened from; PostHog records it as an analytics label. */
@@ -1022,6 +952,7 @@ var Role;
1022
952
  Role["NotAdmin"] = "NOT_ADMIN";
1023
953
  Role["Owner"] = "OWNER";
1024
954
  Role["ReleaseManager"] = "RELEASE_MANAGER";
955
+ Role["Runner"] = "RUNNER";
1025
956
  Role["ViewOnly"] = "VIEW_ONLY";
1026
957
  })(Role || (exports.Role = Role = {}));
1027
958
  var SandboxOperatingSystem;
@@ -15,9 +15,10 @@ exports.AccountQuery = {
15
15
  byName(accountName: $accountName) {
16
16
  id
17
17
  name
18
- viewerUserPermission {
18
+ viewerUserPermission2 {
19
19
  id
20
20
  permissions
21
+ effectivePermissions
21
22
  }
22
23
  }
23
24
  }
@@ -34,6 +34,7 @@ exports.DeviceRunSessionQuery = {
34
34
  id
35
35
  name
36
36
  tags
37
+ publicPreview
37
38
  status
38
39
  type
39
40
  platform
@@ -45,6 +45,17 @@ exports.WorkflowDeviceTestCaseInsightsQuery = {
45
45
  currentValue
46
46
  previousValue
47
47
  }
48
+ platforms {
49
+ platform
50
+ totalRuns {
51
+ currentValue
52
+ previousValue
53
+ }
54
+ distinctTestCount {
55
+ currentValue
56
+ previousValue
57
+ }
58
+ }
48
59
  }
49
60
  timeSeries(granularity: $granularity) {
50
61
  bucketStartAt
@@ -13,8 +13,9 @@ exports.AccountFragmentNode = (0, graphql_tag_1.default) `
13
13
  id
14
14
  username
15
15
  }
16
- viewerUserPermission {
17
- role
16
+ viewerUserPermission2 {
17
+ permissions
18
+ effectivePermissions
18
19
  }
19
20
  }
20
21
  `;
@@ -1,4 +1,3 @@
1
- import { Choice } from '../prompts';
1
+ import { SelectChoice } from '../prompts';
2
2
  import { Actor } from '../user/User';
3
- export declare function getAccountNamesWhereUserHasSufficientPermissionsToCreateApp(actor: Actor): Set<string>;
4
- export declare function getAccountChoices(actor: Actor, namesWithSufficientPermissions: Set<string>): Choice[];
3
+ export declare function getAccountChoices(actor: Actor): SelectChoice[];
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAccountNamesWhereUserHasSufficientPermissionsToCreateApp = getAccountNamesWhereUserHasSufficientPermissionsToCreateApp;
4
3
  exports.getAccountChoices = getAccountChoices;
5
- const generated_1 = require("../graphql/generated");
6
- function getAccountNamesWhereUserHasSufficientPermissionsToCreateApp(actor) {
7
- return new Set(actor.accounts.filter(a => a.viewerUserPermission.role !== generated_1.Role.ViewOnly).map(it => it.name));
4
+ const User_1 = require("../user/User");
5
+ function getDisabledProps(account) {
6
+ const disabledReason = (0, User_1.getCannotCreateProjectsOnAccountReason)(account);
7
+ return disabledReason ? { disabled: true, disabledReason } : {};
8
8
  }
9
- function getAccountChoices(actor, namesWithSufficientPermissions) {
9
+ function getAccountChoices(actor) {
10
10
  const allAccounts = actor.accounts;
11
11
  const sortedAccounts = actor.__typename === 'Robot'
12
12
  ? allAccounts
@@ -17,9 +17,8 @@ function getAccountChoices(actor, namesWithSufficientPermissions) {
17
17
  ? {
18
18
  title: personalAccount.name,
19
19
  value: personalAccount,
20
- description: !namesWithSufficientPermissions.has(personalAccount.name)
21
- ? '(Personal) (Viewer Role)'
22
- : '(Personal)',
20
+ description: '(Personal)',
21
+ ...getDisabledProps(personalAccount),
23
22
  }
24
23
  : undefined;
25
24
  const userAccounts = allAccounts
@@ -27,18 +26,16 @@ function getAccountChoices(actor, namesWithSufficientPermissions) {
27
26
  .map(account => ({
28
27
  title: account.name,
29
28
  value: account,
30
- description: !namesWithSufficientPermissions.has(account.name)
31
- ? '(Team) (Viewer Role)'
32
- : '(Team)',
29
+ description: '(Team)',
30
+ ...getDisabledProps(account),
33
31
  }));
34
32
  const organizationAccounts = allAccounts
35
33
  ?.filter(account => account.name !== actor.username && !account.ownerUserActor)
36
34
  .map(account => ({
37
35
  title: account.name,
38
36
  value: account,
39
- description: !namesWithSufficientPermissions.has(account.name)
40
- ? '(Organization) (Viewer Role)'
41
- : '(Organization)',
37
+ description: '(Organization)',
38
+ ...getDisabledProps(account),
42
39
  }));
43
40
  let choices = [];
44
41
  if (personalAccountChoice) {
@@ -49,6 +46,6 @@ function getAccountChoices(actor, namesWithSufficientPermissions) {
49
46
  return sortedAccounts.map(account => ({
50
47
  title: account.name,
51
48
  value: account,
52
- description: !namesWithSufficientPermissions.has(account.name) ? '(Viewer Role)' : undefined,
49
+ ...getDisabledProps(account),
53
50
  }));
54
51
  }
@@ -6,12 +6,12 @@ const tslib_1 = require("tslib");
6
6
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
7
  const projectNotConfiguredError_1 = require("./projectNotConfiguredError");
8
8
  const url_1 = require("../build/utils/url");
9
- const generated_1 = require("../graphql/generated");
10
9
  const AppMutation_1 = require("../graphql/mutations/AppMutation");
11
10
  const AppQuery_1 = require("../graphql/queries/AppQuery");
12
11
  const log_1 = require("../log");
13
12
  const ora_1 = require("../ora");
14
13
  const prompts_1 = require("../prompts");
14
+ const User_1 = require("../user/User");
15
15
  /**
16
16
  * 1. Looks for an existing project on EAS servers. If found, ask the user whether this is the
17
17
  * project they would like to link. If yes, return that. If not, throw.
@@ -22,7 +22,6 @@ async function fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync(graph
22
22
  const { accountName, projectName } = projectInfo;
23
23
  const projectFullName = `@${accountName}/${projectName}`;
24
24
  const allAccounts = actor.accounts;
25
- const accountNamesWhereUserHasSufficientPublishPermissions = new Set(allAccounts.filter(a => a.viewerUserPermission.role !== generated_1.Role.ViewOnly).map(it => it.name));
26
25
  if (options.nonInteractive) {
27
26
  throw (0, projectNotConfiguredError_1.getUnconfiguredProjectError)({ actor, accountName });
28
27
  }
@@ -40,8 +39,9 @@ async function fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync(graph
40
39
  }
41
40
  return projectIdOnServer;
42
41
  }
43
- if (!accountNamesWhereUserHasSufficientPublishPermissions.has(accountName)) {
44
- throw new Error(`You don't have permission to create a new project on the ${accountName} account and no matching project already exists on the account.`);
42
+ const cannotCreateReason = (0, User_1.getCannotCreateProjectsOnAccountReason)(account);
43
+ if (cannotCreateReason) {
44
+ throw new Error(`No matching project exists on the ${accountName} account, and you can't create one. ${cannotCreateReason}`);
45
45
  }
46
46
  const affirmedCreate = await (0, prompts_1.confirmAsync)({
47
47
  message: `Would you like to automatically create an EAS project for ${projectFullName}?`,
@@ -156,14 +156,14 @@ async function initializeWithoutExplicitIDAsync(graphqlClient, actor, projectDir
156
156
  // --force with a different --account: fall through to re-link under the new account
157
157
  }
158
158
  const allAccounts = actor.accounts;
159
- const accountNamesWhereUserHasSufficientPermissionsToCreateApp = (0, accountSelection_1.getAccountNamesWhereUserHasSufficientPermissionsToCreateApp)(actor);
160
159
  if (accountNameArgument) {
161
160
  // with --force, a conflicting "owner" field is rewritten after linking
162
161
  if (exp.owner && exp.owner !== accountNameArgument && !force) {
163
162
  throw new Error(`The account specified with --account (${accountNameArgument}) does not match the "owner" field in your app config (${exp.owner}). Provide a matching --account or update the "owner" field.`);
164
163
  }
165
- if (!accountNamesWhereUserHasSufficientPermissionsToCreateApp.has(accountNameArgument)) {
166
- throw new Error(`You are not able to create projects in the "${accountNameArgument}" account. Accounts you have permissions to create projects in: ${(0, User_1.getCreatableAccountNames)(actor).join(', ')}`);
164
+ const cannotCreateReason = (0, User_1.getCannotCreateProjectsOnAccountNameReason)(actor, accountNameArgument);
165
+ if (cannotCreateReason) {
166
+ throw new Error(`${cannotCreateReason} Accounts you have permissions to create projects in: ${(0, User_1.getCreatableAccountNames)(actor).join(', ')}`);
167
167
  }
168
168
  }
169
169
  // if no --account flag or owner field, ask the user which account they want to use to create/link the project
@@ -180,7 +180,7 @@ async function initializeWithoutExplicitIDAsync(graphqlClient, actor, projectDir
180
180
  log_1.default.log(`Using default account ${accountName} for non-interactive and force mode`);
181
181
  }
182
182
  else {
183
- const choices = (0, accountSelection_1.getAccountChoices)(actor, accountNamesWhereUserHasSufficientPermissionsToCreateApp);
183
+ const choices = (0, accountSelection_1.getAccountChoices)(actor);
184
184
  accountName = (await (0, prompts_1.promptAsync)({
185
185
  type: 'select',
186
186
  name: 'account',
@@ -214,8 +214,9 @@ async function initializeWithoutExplicitIDAsync(graphqlClient, actor, projectDir
214
214
  await saveProjectIdAndLogSuccessAsync(projectDir, existingProjectIdOnServer);
215
215
  return { projectId: existingProjectIdOnServer, status: 'linked' };
216
216
  }
217
- if (!accountNamesWhereUserHasSufficientPermissionsToCreateApp.has(accountName)) {
218
- throw new Error(`You don't have permission to create a new project on the ${accountName} account and no matching project already exists on the account.`);
217
+ const cannotCreateReason = (0, User_1.getCannotCreateProjectsOnAccountNameReason)(actor, accountName);
218
+ if (cannotCreateReason) {
219
+ throw new Error(`No matching project exists on the ${accountName} account, and you can't create one. ${cannotCreateReason}`);
219
220
  }
220
221
  if (!skipConfirmation) {
221
222
  if (nonInteractive) {
@@ -1,6 +1,7 @@
1
1
  import { Answers, Choice, Options, PromptType } from 'prompts';
2
2
  import { Question } from './easMultiselect';
3
- export { PromptType, Question, Choice };
3
+ import { SelectChoice } from './easSelect';
4
+ export { PromptType, Question, Choice, SelectChoice };
4
5
  export interface ExpoChoice<T> extends Choice {
5
6
  value: T;
6
7
  }
package/build/prompts.js CHANGED
@@ -9,8 +9,10 @@ const tslib_1 = require("tslib");
9
9
  const os_1 = require("os");
10
10
  const prompts_1 = tslib_1.__importStar(require("prompts"));
11
11
  const easMultiselect_1 = require("./easMultiselect");
12
+ const easSelect_1 = require("./easSelect");
12
13
  if (prompts_1.prompts) {
13
14
  prompts_1.prompts.multiselect = easMultiselect_1.easMultiselect;
15
+ prompts_1.prompts.select = easSelect_1.easSelect;
14
16
  }
15
17
  async function promptAsync(questions, options = {}) {
16
18
  if (!process.stdin.isTTY && !global.test) {
@@ -81,6 +81,10 @@ export declare function formatLoopbackForwardNotice({ skipped }: LoopbackForward
81
81
  export declare function getLocalEgressEnvironmentVariables(egress: LocalEgressConfig | null): Record<string, string>;
82
82
  export declare function getRemoteSessionEnvironmentVariables(remoteConfig: DeviceRunSessionRemoteConfig, { egressAllow, platform }?: LocalEgressOptions): Record<string, string>;
83
83
  type RemoteSessionInstructionsConfigType = 'env' | 'dotenv';
84
+ type PreviewLinkOptions = {
85
+ privatePreviewUrl?: string;
86
+ publicLink?: boolean;
87
+ };
84
88
  /**
85
89
  * Preview link for a session. A gated preview needs the session token, and a browser cannot send
86
90
  * a header on a page load. The expo.dev preview page reads it from the fragment, which no request
@@ -88,10 +92,9 @@ type RemoteSessionInstructionsConfigType = 'env' | 'dotenv';
88
92
  */
89
93
  export declare function formatPreviewUrl(remoteConfig: DeviceRunSessionRemoteConfig, url: string, token: string | null | undefined): string;
90
94
  /**
91
- * Remote config for `--json`. Both URLs carry the token and the standalone token field is dropped,
92
- * so a consumer gets URLs that work rather than bare URLs that 401 next to a secret it has to know
93
- * to combine.
95
+ * Remote config for `--json`. Private sessions omit the direct preview API address and preview
96
+ * tokens. Public sessions include bearer preview links while preserving controller credentials.
94
97
  */
95
- export declare function sanitizeRemoteConfigForJson(remoteConfig: DeviceRunSessionRemoteConfig): DeviceRunSessionRemoteConfig;
96
- export declare function formatRemoteSessionInstructions(remoteConfig: DeviceRunSessionRemoteConfig, configType: RemoteSessionInstructionsConfigType, { egressAllow, egressClientRunsInline, sessionUrl, platform }?: LocalEgressOptions): string;
98
+ export declare function sanitizeRemoteConfigForJson(remoteConfig: DeviceRunSessionRemoteConfig, privatePreviewUrl: string, publicLink?: boolean): DeviceRunSessionRemoteConfig;
99
+ export declare function formatRemoteSessionInstructions(remoteConfig: DeviceRunSessionRemoteConfig, configType: RemoteSessionInstructionsConfigType, { egressAllow, egressClientRunsInline, sessionUrl, platform, privatePreviewUrl, publicLink, }?: LocalEgressOptions & PreviewLinkOptions): string;
97
100
  export {};
@@ -12,6 +12,8 @@ exports.getRemoteSessionEnvironmentVariables = getRemoteSessionEnvironmentVariab
12
12
  exports.formatPreviewUrl = formatPreviewUrl;
13
13
  exports.sanitizeRemoteConfigForJson = sanitizeRemoteConfigForJson;
14
14
  exports.formatRemoteSessionInstructions = formatRemoteSessionInstructions;
15
+ const tslib_1 = require("tslib");
16
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
15
17
  const generated_1 = require("../graphql/generated");
16
18
  const log_1 = require("../log");
17
19
  const env_1 = require("./env");
@@ -185,22 +187,49 @@ function formatPreviewApiUrl(url, token) {
185
187
  withToken.searchParams.set('token', token);
186
188
  return withToken.toString();
187
189
  }
190
+ function withoutPreviewToken(url) {
191
+ const parsed = new URL(url);
192
+ const hashParams = new URLSearchParams(parsed.hash.slice(1));
193
+ if (!parsed.searchParams.has('token') && !hashParams.has('token')) {
194
+ return url;
195
+ }
196
+ parsed.searchParams.delete('token');
197
+ if (hashParams.has('token')) {
198
+ hashParams.delete('token');
199
+ parsed.hash = hashParams.toString();
200
+ }
201
+ return parsed.toString();
202
+ }
203
+ function formatBrowserPreviewUrl(remoteConfig, url, token, { privatePreviewUrl, publicLink }) {
204
+ return publicLink
205
+ ? formatPreviewUrl(remoteConfig, url, token)
206
+ : (privatePreviewUrl ?? withoutPreviewToken(url));
207
+ }
208
+ function formatBrowserPreviewInstructions(remoteConfig, url, token, options) {
209
+ const previewUrl = formatBrowserPreviewUrl(remoteConfig, url, token, options);
210
+ return options.publicLink
211
+ ? `${chalk_1.default.yellow('Warning: Anyone with this link can view and control the simulator, including your app and logs that may contain sensitive data. Share this link only with trusted recipients.')}\n${previewUrl}`
212
+ : previewUrl;
213
+ }
188
214
  /**
189
- * Remote config for `--json`. Both URLs carry the token and the standalone token field is dropped,
190
- * so a consumer gets URLs that work rather than bare URLs that 401 next to a secret it has to know
191
- * to combine.
215
+ * Remote config for `--json`. Private sessions omit the direct preview API address and preview
216
+ * tokens. Public sessions include bearer preview links while preserving controller credentials.
192
217
  */
193
- function sanitizeRemoteConfigForJson(remoteConfig) {
218
+ function sanitizeRemoteConfigForJson(remoteConfig, privatePreviewUrl, publicLink = false) {
194
219
  switch (remoteConfig.__typename) {
195
220
  case 'ServeSimRunSessionRemoteConfig':
196
221
  case 'WebPreviewOnlyRunSessionRemoteConfig': {
197
222
  const { previewToken, ...rest } = remoteConfig;
198
223
  return {
199
224
  ...rest,
200
- previewUrl: formatPreviewUrl(remoteConfig, remoteConfig.previewUrl, previewToken),
201
- previewApiUrl: remoteConfig.previewApiUrl
202
- ? formatPreviewApiUrl(remoteConfig.previewApiUrl, previewToken)
203
- : remoteConfig.previewApiUrl,
225
+ previewUrl: formatBrowserPreviewUrl(remoteConfig, remoteConfig.previewUrl, previewToken, {
226
+ privatePreviewUrl,
227
+ publicLink,
228
+ }),
229
+ previewApiUrl: publicLink
230
+ ? remoteConfig.previewApiUrl &&
231
+ formatPreviewApiUrl(remoteConfig.previewApiUrl, previewToken)
232
+ : null,
204
233
  };
205
234
  }
206
235
  case 'AgentDeviceRunSessionRemoteConfig':
@@ -210,17 +239,24 @@ function sanitizeRemoteConfigForJson(remoteConfig) {
210
239
  return {
211
240
  ...rest,
212
241
  webPreviewUrl: remoteConfig.webPreviewUrl
213
- ? formatPreviewUrl(remoteConfig, remoteConfig.webPreviewUrl, webPreviewToken)
242
+ ? formatBrowserPreviewUrl(remoteConfig, remoteConfig.webPreviewUrl, webPreviewToken, {
243
+ privatePreviewUrl,
244
+ publicLink,
245
+ })
214
246
  : remoteConfig.webPreviewUrl,
215
- previewApiUrl: remoteConfig.previewApiUrl
216
- ? formatPreviewApiUrl(remoteConfig.previewApiUrl, webPreviewToken)
217
- : remoteConfig.previewApiUrl,
247
+ previewApiUrl: publicLink
248
+ ? remoteConfig.previewApiUrl &&
249
+ formatPreviewApiUrl(remoteConfig.previewApiUrl, webPreviewToken)
250
+ : null,
218
251
  };
219
252
  }
220
253
  }
221
254
  }
222
- function formatRemoteSessionInstructions(remoteConfig, configType, { egressAllow, egressClientRunsInline = false, sessionUrl, platform } = {}) {
223
- const instructions = formatControllerInstructions(remoteConfig, configType);
255
+ function formatRemoteSessionInstructions(remoteConfig, configType, { egressAllow, egressClientRunsInline = false, sessionUrl, platform, privatePreviewUrl, publicLink, } = {}) {
256
+ const instructions = formatControllerInstructions(remoteConfig, configType, {
257
+ privatePreviewUrl,
258
+ publicLink,
259
+ });
224
260
  const egress = getLocalEgressConfig(remoteConfig, egressAllow, platform);
225
261
  if (!egress) {
226
262
  return instructions;
@@ -255,7 +291,7 @@ function formatRemoteSessionInstructions(remoteConfig, configType, { egressAllow
255
291
  ]),
256
292
  ].join('\n');
257
293
  }
258
- function formatControllerInstructions(remoteConfig, configType) {
294
+ function formatControllerInstructions(remoteConfig, configType, previewLinkOptions) {
259
295
  switch (remoteConfig.__typename) {
260
296
  case 'AgentDeviceRunSessionRemoteConfig': {
261
297
  const environmentVariables = getControllerEnvironmentVariables(remoteConfig);
@@ -271,7 +307,7 @@ function formatControllerInstructions(remoteConfig, configType) {
271
307
  ...Object.entries(environmentVariables).map(([key, value]) => `export ${key}='${value}'`),
272
308
  ];
273
309
  if (remoteConfig.webPreviewUrl) {
274
- lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', formatPreviewUrl(remoteConfig, remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
310
+ lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', formatBrowserPreviewInstructions(remoteConfig, remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken, previewLinkOptions));
275
311
  }
276
312
  return lines.join('\n');
277
313
  }
@@ -301,7 +337,7 @@ function formatControllerInstructions(remoteConfig, configType) {
301
337
  ...Object.entries(environmentVariables).map(([key, value]) => `export ${key}='${value}'`),
302
338
  ];
303
339
  if (remoteConfig.webPreviewUrl) {
304
- lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', formatPreviewUrl(remoteConfig, remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
340
+ lines.push('', '🌐 Open the following URL in your browser to preview the simulator:', '', formatBrowserPreviewInstructions(remoteConfig, remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken, previewLinkOptions));
305
341
  }
306
342
  return lines.join('\n');
307
343
  }
@@ -321,7 +357,7 @@ function formatControllerInstructions(remoteConfig, configType) {
321
357
  '<appium-client> [args...]',
322
358
  ];
323
359
  if (remoteConfig.webPreviewUrl) {
324
- lines.push('', 'Open the simulator preview:', '', formatPreviewUrl(remoteConfig, remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken));
360
+ lines.push('', 'Open the simulator preview:', '', formatBrowserPreviewInstructions(remoteConfig, remoteConfig.webPreviewUrl, remoteConfig.webPreviewToken, previewLinkOptions));
325
361
  }
326
362
  return lines.join('\n');
327
363
  }
@@ -329,13 +365,13 @@ function formatControllerInstructions(remoteConfig, configType) {
329
365
  return [
330
366
  '🌐 Open the following URL in your browser to access the simulator:',
331
367
  '',
332
- formatPreviewUrl(remoteConfig, remoteConfig.previewUrl, remoteConfig.previewToken),
368
+ formatBrowserPreviewInstructions(remoteConfig, remoteConfig.previewUrl, remoteConfig.previewToken, previewLinkOptions),
333
369
  ].join('\n');
334
370
  case 'WebPreviewOnlyRunSessionRemoteConfig':
335
371
  return [
336
372
  '🌐 Open the following URL in your browser to access the simulator:',
337
373
  '',
338
- formatPreviewUrl(remoteConfig, remoteConfig.previewUrl, remoteConfig.previewToken),
374
+ formatBrowserPreviewInstructions(remoteConfig, remoteConfig.previewUrl, remoteConfig.previewToken, previewLinkOptions),
339
375
  ].join('\n');
340
376
  }
341
377
  }
@@ -1,7 +1,23 @@
1
1
  import { CurrentUserQuery, PartnerActor, Robot, SsoUser, User } from '../graphql/generated';
2
2
  export type Actor = NonNullable<CurrentUserQuery['meActor']>;
3
3
  /**
4
- * Names of the accounts where the actor can create projects (non-ViewOnly role), listed in the
4
+ * Whether the actor can create projects on the account with the credential used for this command.
5
+ * Creating a project requires the PUBLISH permission, and the scopes of a scoped credential cap
6
+ * `effectivePermissions`.
7
+ */
8
+ export declare function canCreateProjectsOnAccount(account: Actor['accounts'][number]): boolean;
9
+ /**
10
+ * Why the actor cannot create projects on the account, or null if they can. Tells apart a role
11
+ * without the PUBLISH permission from a credential whose scopes remove it.
12
+ */
13
+ export declare function getCannotCreateProjectsOnAccountReason(account: Actor['accounts'][number]): string | null;
14
+ /**
15
+ * `getCannotCreateProjectsOnAccountReason` for an account given by name, which may not be one of
16
+ * the actor's accounts.
17
+ */
18
+ export declare function getCannotCreateProjectsOnAccountNameReason(actor: Actor, accountName: string): string | null;
19
+ /**
20
+ * Names of the accounts where the actor can create projects, listed in the
5
21
  * same order as account selection prompts: the personal account first, then team accounts,
6
22
  * then organization accounts.
7
23
  */
@@ -1,16 +1,51 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.canCreateProjectsOnAccount = canCreateProjectsOnAccount;
4
+ exports.getCannotCreateProjectsOnAccountReason = getCannotCreateProjectsOnAccountReason;
5
+ exports.getCannotCreateProjectsOnAccountNameReason = getCannotCreateProjectsOnAccountNameReason;
3
6
  exports.getCreatableAccountNames = getCreatableAccountNames;
4
7
  exports.getActorDisplayName = getActorDisplayName;
5
8
  exports.getActorUsername = getActorUsername;
6
9
  const generated_1 = require("../graphql/generated");
7
10
  /**
8
- * Names of the accounts where the actor can create projects (non-ViewOnly role), listed in the
11
+ * Whether the actor can create projects on the account with the credential used for this command.
12
+ * Creating a project requires the PUBLISH permission, and the scopes of a scoped credential cap
13
+ * `effectivePermissions`.
14
+ */
15
+ function canCreateProjectsOnAccount(account) {
16
+ return account.viewerUserPermission2.effectivePermissions.includes(generated_1.Permission.Publish);
17
+ }
18
+ /**
19
+ * Why the actor cannot create projects on the account, or null if they can. Tells apart a role
20
+ * without the PUBLISH permission from a credential whose scopes remove it.
21
+ */
22
+ function getCannotCreateProjectsOnAccountReason(account) {
23
+ if (canCreateProjectsOnAccount(account)) {
24
+ return null;
25
+ }
26
+ if (account.viewerUserPermission2.permissions.includes(generated_1.Permission.Publish)) {
27
+ return `The permissions granted during authentication do not allow you to create projects on the "${account.name}" account. Run eas login to change the permission grant.`;
28
+ }
29
+ return `You do not have the required permissions to create projects on the "${account.name}" account.`;
30
+ }
31
+ /**
32
+ * `getCannotCreateProjectsOnAccountReason` for an account given by name, which may not be one of
33
+ * the actor's accounts.
34
+ */
35
+ function getCannotCreateProjectsOnAccountNameReason(actor, accountName) {
36
+ const account = actor.accounts.find(a => a.name === accountName);
37
+ if (!account) {
38
+ return `You do not have access to the "${accountName}" account.`;
39
+ }
40
+ return getCannotCreateProjectsOnAccountReason(account);
41
+ }
42
+ /**
43
+ * Names of the accounts where the actor can create projects, listed in the
9
44
  * same order as account selection prompts: the personal account first, then team accounts,
10
45
  * then organization accounts.
11
46
  */
12
47
  function getCreatableAccountNames(actor) {
13
- const creatableAccounts = actor.accounts.filter(a => a.viewerUserPermission.role !== generated_1.Role.ViewOnly);
48
+ const creatableAccounts = actor.accounts.filter(canCreateProjectsOnAccount);
14
49
  if (actor.__typename === 'Robot') {
15
50
  return creatableAccounts.map(it => it.name);
16
51
  }
@@ -0,0 +1,6 @@
1
+ import { Permission, Role } from '../graphql/generated';
2
+ /**
3
+ * Derives a member's role from their exact permission set. Mirrors `getRoleForPermissions` in www
4
+ * (server/www/src/utils/roles.ts): any other combination is CUSTOM.
5
+ */
6
+ export declare function getRoleForPermissions(permissions: readonly Permission[]): Role;