eas-cli 24.14.0 → 25.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +208 -158
  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/commandUtils/usageUtils.d.ts +14 -0
  10. package/build/commandUtils/usageUtils.js +40 -2
  11. package/build/commands/account/usage.js +55 -2
  12. package/build/commands/account/view.d.ts +6 -1
  13. package/build/commands/account/view.js +38 -8
  14. package/build/commands/simulator/get.js +5 -2
  15. package/build/commands/simulator/index.d.ts +3 -0
  16. package/build/commands/simulator/index.js +37 -2
  17. package/build/easSelect.d.ts +30 -0
  18. package/build/easSelect.js +57 -0
  19. package/build/graphql/generated.d.ts +370 -946
  20. package/build/graphql/generated.js +5 -74
  21. package/build/graphql/queries/AccountQuery.js +27 -1
  22. package/build/graphql/queries/DeviceRunSessionQuery.js +1 -0
  23. package/build/graphql/types/Account.js +8 -2
  24. package/build/project/accountSelection.d.ts +2 -3
  25. package/build/project/accountSelection.js +12 -15
  26. package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.js +4 -4
  27. package/build/project/projectInitialization.js +7 -6
  28. package/build/prompts.d.ts +2 -1
  29. package/build/prompts.js +2 -0
  30. package/build/simulator/frameAncestors.d.ts +9 -0
  31. package/build/simulator/frameAncestors.js +66 -0
  32. package/build/simulator/utils.d.ts +20 -5
  33. package/build/simulator/utils.js +105 -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/oclif.manifest.json +23 -3
  39. 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
  }
@@ -108,6 +109,31 @@ exports.AccountQuery = {
108
109
  id
109
110
  ...UsageMetricTotalFragment
110
111
  }
112
+ EAS_SIMULATOR: byBillingPeriod(date: $currentDate, service: SIMULATOR) {
113
+ unavailableServiceUsageMetrics {
114
+ service
115
+ }
116
+ id
117
+ ...UsageMetricTotalFragment
118
+ }
119
+ IOS_SIMULATOR_MINUTES: metricsForServiceMetric(
120
+ serviceMetric: SIMULATOR_USAGE
121
+ granularity: TOTAL
122
+ timespan: { start: $startDate, end: $endDate }
123
+ filterParams: { platform: "ios" }
124
+ ) {
125
+ id
126
+ ...AccountUsageMetricFragment
127
+ }
128
+ ANDROID_SIMULATOR_MINUTES: metricsForServiceMetric(
129
+ serviceMetric: SIMULATOR_USAGE
130
+ granularity: TOTAL
131
+ timespan: { start: $startDate, end: $endDate }
132
+ filterParams: { platform: "android" }
133
+ ) {
134
+ id
135
+ ...AccountUsageMetricFragment
136
+ }
111
137
  }
112
138
  }
113
139
  }
@@ -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
@@ -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
  `;
@@ -111,6 +112,11 @@ exports.EstimatedUsageFragmentNode = (0, graphql_tag_1.default) `
111
112
  platformBreakdown {
112
113
  ...EstimatedUsagePlatformBreakdownFragment
113
114
  }
115
+ jobTypeBreakdown {
116
+ workflows
117
+ simulator
118
+ other
119
+ }
114
120
  }
115
121
  `;
116
122
  exports.EstimatedOverageAndCostFragmentNode = (0, graphql_tag_1.default) `
@@ -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) {
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `--frame-ancestor` and `--cors-origin` values: origins of pages that may embed the simulator
3
+ * preview host in a frame, or call its API cross-origin. The server applies the same rules;
4
+ * checking here gives a fast, local error.
5
+ */
6
+ export declare const MAX_FRAME_ANCESTORS = 10;
7
+ export declare const MAX_CORS_ORIGINS = 10;
8
+ export declare function parseFrameAncestorList(entries: readonly string[]): string[];
9
+ export declare function parseCorsOriginList(entries: readonly string[]): string[];
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /**
3
+ * `--frame-ancestor` and `--cors-origin` values: origins of pages that may embed the simulator
4
+ * preview host in a frame, or call its API cross-origin. The server applies the same rules;
5
+ * checking here gives a fast, local error.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.MAX_CORS_ORIGINS = exports.MAX_FRAME_ANCESTORS = void 0;
9
+ exports.parseFrameAncestorList = parseFrameAncestorList;
10
+ exports.parseCorsOriginList = parseCorsOriginList;
11
+ exports.MAX_FRAME_ANCESTORS = 10;
12
+ exports.MAX_CORS_ORIGINS = 10;
13
+ // The shapes serve-sim and expo-device-hub accept: a host, an IPv6 literal, or a subdomain
14
+ // wildcard with at least two labels after the star.
15
+ const FRAMEABLE_HOSTNAME_PATTERN = /^(?:\[[0-9a-f:.]+\]|[a-z0-9.-]+|\*\.[a-z0-9-]+(?:\.[a-z0-9-]+)+)$/i;
16
+ const LOOPBACK_HOSTNAMES = new Set(['localhost', '127.0.0.1', '[::1]']);
17
+ function parseFrameAncestorList(entries) {
18
+ return parseOriginList(entries, {
19
+ flag: '--frame-ancestor',
20
+ maxCount: exports.MAX_FRAME_ANCESTORS,
21
+ purpose: 'embeds the preview',
22
+ });
23
+ }
24
+ function parseCorsOriginList(entries) {
25
+ return parseOriginList(entries, {
26
+ flag: '--cors-origin',
27
+ maxCount: exports.MAX_CORS_ORIGINS,
28
+ purpose: 'calls the preview API',
29
+ });
30
+ }
31
+ function parseOriginList(entries, { flag, maxCount, purpose }) {
32
+ if (entries.length > maxCount) {
33
+ throw new Error(`${flag} accepts at most ${maxCount} origins; received ${entries.length}. ` +
34
+ `Keep only the origins of pages that ${purpose}.`);
35
+ }
36
+ return [...new Set(entries.map(entry => parseOrigin(entry, flag, purpose)))];
37
+ }
38
+ function parseOrigin(entry, flag, purpose) {
39
+ const value = entry.trim();
40
+ let url;
41
+ try {
42
+ url = new URL(value);
43
+ }
44
+ catch {
45
+ throw new Error(`${flag} ${entry} is not a URL. Pass the origin of the page that ${purpose}, ` +
46
+ 'such as https://app.example.com, or a subdomain wildcard such as https://*.example.com.');
47
+ }
48
+ if (url.pathname !== '/' ||
49
+ url.search !== '' ||
50
+ url.hash !== '' ||
51
+ url.username !== '' ||
52
+ url.password !== '') {
53
+ throw new Error(`${flag} ${entry} must be an origin only. Browsers match origins by scheme, host and port, ` +
54
+ `so drop the path, query, hash and credentials: ${url.origin}.`);
55
+ }
56
+ const isLoopback = LOOPBACK_HOSTNAMES.has(url.hostname);
57
+ if (url.protocol !== 'https:' && !(url.protocol === 'http:' && isLoopback)) {
58
+ throw new Error(`${flag} ${entry} must use https. The preview is served over https, and browsers do not ` +
59
+ 'let an http page use it. Plain http is accepted for localhost only.');
60
+ }
61
+ if (!FRAMEABLE_HOSTNAME_PATTERN.test(url.hostname)) {
62
+ throw new Error(`${flag} ${entry} has a host the preview host cannot allow. Use a hostname, an IPv6 ` +
63
+ 'literal, or a subdomain wildcard with at least two labels after the star, such as https://*.example.com.');
64
+ }
65
+ return url.origin;
66
+ }
@@ -81,6 +81,15 @@ 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
+ /** Origins the session allows to embed the preview host; the embed URL is printed for them. */
88
+ frameAncestors?: readonly string[];
89
+ /** Origins the session allows to call the preview host API; the embed URL is printed for them. */
90
+ corsOrigins?: readonly string[];
91
+ };
92
+ export type PreviewAccessOrigins = Pick<PreviewLinkOptions, 'frameAncestors' | 'corsOrigins'>;
84
93
  /**
85
94
  * Preview link for a session. A gated preview needs the session token, and a browser cannot send
86
95
  * a header on a page load. The expo.dev preview page reads it from the fragment, which no request
@@ -88,10 +97,16 @@ type RemoteSessionInstructionsConfigType = 'env' | 'dotenv';
88
97
  */
89
98
  export declare function formatPreviewUrl(remoteConfig: DeviceRunSessionRemoteConfig, url: string, token: string | null | undefined): string;
90
99
  /**
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.
100
+ * Remote config for `--json`. Private sessions omit the direct preview API address and preview
101
+ * tokens. Public sessions include bearer preview links while preserving controller credentials.
102
+ * A session with frame ancestors or CORS origins also includes the preview API address, since
103
+ * the page on those origins needs it.
104
+ */
105
+ export declare function sanitizeRemoteConfigForJson(remoteConfig: DeviceRunSessionRemoteConfig, privatePreviewUrl: string, publicLink?: boolean, { frameAncestors, corsOrigins }?: PreviewAccessOrigins): DeviceRunSessionRemoteConfig;
106
+ /**
107
+ * The preview host address with the session token, which an embedding page loads directly. The
108
+ * expo.dev preview page cannot be framed by other sites. Null until the worker reports the host.
94
109
  */
95
- export declare function sanitizeRemoteConfigForJson(remoteConfig: DeviceRunSessionRemoteConfig): DeviceRunSessionRemoteConfig;
96
- export declare function formatRemoteSessionInstructions(remoteConfig: DeviceRunSessionRemoteConfig, configType: RemoteSessionInstructionsConfigType, { egressAllow, egressClientRunsInline, sessionUrl, platform }?: LocalEgressOptions): string;
110
+ export declare function formatEmbedPreviewUrl(remoteConfig: DeviceRunSessionRemoteConfig): string | null;
111
+ export declare function formatRemoteSessionInstructions(remoteConfig: DeviceRunSessionRemoteConfig, configType: RemoteSessionInstructionsConfigType, { egressAllow, egressClientRunsInline, sessionUrl, platform, privatePreviewUrl, publicLink, frameAncestors, corsOrigins, }?: LocalEgressOptions & PreviewLinkOptions): string;
97
112
  export {};