eas-cli 24.7.0 → 24.9.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.
- package/README.md +505 -278
- package/build/build/createContext.js +1 -2
- package/build/build/runBuildAndSubmit.js +4 -1
- package/build/commandUtils/supabase.d.ts +6 -1
- package/build/commandUtils/supabase.js +53 -0
- package/build/commandUtils/workflow/validation.d.ts +1 -0
- package/build/commandUtils/workflow/validation.js +19 -5
- package/build/commands/account/view.js +12 -0
- package/build/commands/integrations/asc/connect.js +3 -0
- package/build/commands/integrations/supabase/advisors.d.ts +16 -0
- package/build/commands/integrations/supabase/advisors.js +153 -0
- package/build/commands/simulator/availability.d.ts +0 -1
- package/build/commands/simulator/availability.js +0 -1
- package/build/commands/simulator/egress.d.ts +0 -1
- package/build/commands/simulator/egress.js +0 -1
- package/build/commands/simulator/events.d.ts +0 -1
- package/build/commands/simulator/events.js +4 -3
- package/build/commands/simulator/exec.d.ts +0 -1
- package/build/commands/simulator/exec.js +0 -1
- package/build/commands/simulator/get.d.ts +0 -1
- package/build/commands/simulator/get.js +1 -1
- package/build/commands/simulator/index.d.ts +2 -1
- package/build/commands/simulator/index.js +40 -21
- package/build/commands/simulator/list.d.ts +0 -1
- package/build/commands/simulator/list.js +4 -3
- package/build/commands/simulator/stop.d.ts +0 -1
- package/build/commands/simulator/stop.js +0 -1
- package/build/commands/submit/internal.d.ts +10 -1
- package/build/commands/submit/internal.js +26 -4
- package/build/commands/update/index.d.ts +2 -0
- package/build/commands/update/index.js +45 -4
- package/build/commands/update/republish.d.ts +1 -0
- package/build/commands/update/republish.js +6 -0
- package/build/commands/update/roll-back-to-embedded.d.ts +1 -0
- package/build/commands/update/roll-back-to-embedded.js +7 -1
- package/build/commands/update/rollback.d.ts +1 -0
- package/build/commands/update/rollback.js +11 -3
- package/build/commands/workflow/validate.js +1 -0
- package/build/credentials/context.js +7 -0
- package/build/credentials/ios/actions/AscApiKeyUtils.d.ts +2 -1
- package/build/credentials/ios/actions/AscApiKeyUtils.js +43 -4
- package/build/credentials/ios/appstore/AppStoreApi.d.ts +5 -0
- package/build/credentials/ios/appstore/AppStoreApi.js +18 -9
- package/build/credentials/ios/appstore/authenticate.d.ts +6 -0
- package/build/credentials/ios/appstore/authenticate.js +22 -1
- package/build/credentials/ios/appstore/resolveCredentials.js +16 -4
- package/build/devices/actions/create/developerPortalMethod.js +1 -1
- package/build/env.d.ts +4 -0
- package/build/env.js +4 -0
- package/build/fetch.js +2 -2
- package/build/graphql/generated.d.ts +348 -26
- package/build/graphql/generated.js +42 -3
- package/build/graphql/queries/SupabaseQuery.d.ts +2 -1
- package/build/graphql/queries/SupabaseQuery.js +42 -0
- package/build/graphql/queries/WorkflowJobSshQuery.d.ts +1 -0
- package/build/graphql/queries/WorkflowJobSshQuery.js +43 -0
- package/build/graphql/types/SupabaseConnection.d.ts +9 -2
- package/build/graphql/types/SupabaseConnection.js +16 -1
- package/build/integrations/asc/ascApiKey.js +2 -1
- package/build/integrations/shared/envFile.js +5 -3
- package/build/integrations/supabase/provision.d.ts +2 -2
- package/build/integrations/supabase/provision.js +6 -4
- package/build/metadata/auth.js +4 -4
- package/build/ora.js +12 -2
- package/build/project/maybeUploadSourceMapsAsync.d.ts +34 -0
- package/build/project/maybeUploadSourceMapsAsync.js +156 -0
- package/build/simulator/egress.d.ts +11 -4
- package/build/simulator/egress.js +72 -10
- package/build/simulator/env.d.ts +1 -0
- package/build/simulator/env.js +4 -1
- package/build/simulator/utils.d.ts +15 -5
- package/build/simulator/utils.js +33 -11
- package/build/submit/ios/AscApiKeySource.js +1 -1
- package/build/submit/ios/IosSubmitCommand.js +2 -2
- package/build/submit/ios/ensureTestFlightSetup.js +1 -4
- package/build/update/active-rollout.d.ts +8 -0
- package/build/update/active-rollout.js +82 -0
- package/build/update/republish.d.ts +4 -1
- package/build/update/republish.js +13 -3
- package/build/update/roll-back-to-embedded.d.ts +4 -1
- package/build/update/roll-back-to-embedded.js +14 -3
- package/build/uploads.js +5 -1
- package/build/user/expoBrowserAuthFlowLauncher.js +0 -1
- package/build/worker/upload.js +2 -2
- package/oclif.manifest.json +828 -668
- package/package.json +9 -8
- package/build/commandUtils/new/templates/CLAUDE.md +0 -1
|
@@ -30,8 +30,7 @@ async function createBuildContextAsync({ buildProfileName, buildProfile, easJson
|
|
|
30
30
|
const developmentClient = buildProfile.developmentClient ??
|
|
31
31
|
(platform === eas_build_job_1.Platform.ANDROID
|
|
32
32
|
? buildProfile?.gradleCommand === ':app:assembleDebug'
|
|
33
|
-
: buildProfile?.buildConfiguration === 'Debug')
|
|
34
|
-
false;
|
|
33
|
+
: buildProfile?.buildConfiguration === 'Debug');
|
|
35
34
|
const requiredPackageManager = (0, package_manager_1.resolvePackageManager)(projectDir);
|
|
36
35
|
const refreshAdHocProvisioningProfile = refreshAdHocProvisioningProfileFlag ?? false;
|
|
37
36
|
const credentialsCtx = new context_1.CredentialsContext({
|
|
@@ -307,7 +307,10 @@ async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildP
|
|
|
307
307
|
if (easJsonCliConfig?.appVersionSource === eas_json_1.AppVersionSource.REMOTE) {
|
|
308
308
|
(0, remoteVersionSource_1.validateAppConfigForRemoteVersionSource)(buildCtx.exp, buildProfile.platform);
|
|
309
309
|
}
|
|
310
|
-
|
|
310
|
+
// Custom builds run the steps from the profile's config file instead of the
|
|
311
|
+
// standard managed pipeline, so the managed-workflow checks do not apply.
|
|
312
|
+
const isCustomBuild = !!buildProfile.profile.config;
|
|
313
|
+
if (buildCtx.workflow === eas_build_job_1.Workflow.MANAGED && !isCustomBuild) {
|
|
311
314
|
if (!sdkVersionChecked) {
|
|
312
315
|
await (0, expoSdk_1.checkExpoSdkIsSupportedAsync)(buildCtx);
|
|
313
316
|
sdkVersionChecked = true;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { SupabaseConnectionData, SupabaseOrganizationData, SupabaseProjectData } from '../graphql/types/SupabaseConnection';
|
|
1
|
+
import { SupabaseAdvisorLintData, SupabaseAdvisorType, SupabaseConnectionData, SupabaseOrganizationData, SupabaseProjectData } from '../graphql/types/SupabaseConnection';
|
|
2
|
+
export declare const SUPABASE_REAUTHORIZATION_REQUIRED_ERROR_CODE = "SUPABASE_REAUTHORIZATION_REQUIRED_ERROR";
|
|
2
3
|
export declare function getSupabaseProjectDashboardUrl(project: Pick<SupabaseProjectData, 'supabaseProjectRef'>): string;
|
|
3
4
|
/**
|
|
4
5
|
* Accepts whatever a user is likely to have on hand: the bare reference ID, the dashboard URL, or
|
|
@@ -11,3 +12,7 @@ export declare function formatSupabaseOrganization(connection: Pick<SupabaseConn
|
|
|
11
12
|
export declare function formatSupabaseProjectLabel(project: Pick<SupabaseProjectData, 'supabaseProjectRef' | 'supabaseProjectName'>): string;
|
|
12
13
|
export declare function formatSupabaseProject(project: SupabaseProjectData): string;
|
|
13
14
|
export declare function logNoSupabaseProject(projectName: string): void;
|
|
15
|
+
export declare function getSupabaseAdvisorsDashboardUrl(project: Pick<SupabaseProjectData, 'supabaseProjectRef'>, type: SupabaseAdvisorType): string;
|
|
16
|
+
export declare function isSupabaseReauthorizationRequiredError(error: unknown): boolean;
|
|
17
|
+
export declare function summarizeSupabaseAdvisorLints(lints: readonly SupabaseAdvisorLintData[]): string;
|
|
18
|
+
export declare function formatSupabaseAdvisorLints(project: Pick<SupabaseProjectData, 'supabaseProjectRef'>, type: SupabaseAdvisorType, lints: readonly SupabaseAdvisorLintData[]): string;
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUPABASE_REAUTHORIZATION_REQUIRED_ERROR_CODE = void 0;
|
|
3
4
|
exports.getSupabaseProjectDashboardUrl = getSupabaseProjectDashboardUrl;
|
|
4
5
|
exports.parseSupabaseProjectRef = parseSupabaseProjectRef;
|
|
5
6
|
exports.formatSupabaseOrganization = formatSupabaseOrganization;
|
|
6
7
|
exports.formatSupabaseProjectLabel = formatSupabaseProjectLabel;
|
|
7
8
|
exports.formatSupabaseProject = formatSupabaseProject;
|
|
8
9
|
exports.logNoSupabaseProject = logNoSupabaseProject;
|
|
10
|
+
exports.getSupabaseAdvisorsDashboardUrl = getSupabaseAdvisorsDashboardUrl;
|
|
11
|
+
exports.isSupabaseReauthorizationRequiredError = isSupabaseReauthorizationRequiredError;
|
|
12
|
+
exports.summarizeSupabaseAdvisorLints = summarizeSupabaseAdvisorLints;
|
|
13
|
+
exports.formatSupabaseAdvisorLints = formatSupabaseAdvisorLints;
|
|
9
14
|
const tslib_1 = require("tslib");
|
|
15
|
+
const core_1 = require("@urql/core");
|
|
10
16
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
17
|
+
const SupabaseConnection_1 = require("../graphql/types/SupabaseConnection");
|
|
11
18
|
const log_1 = tslib_1.__importStar(require("../log"));
|
|
19
|
+
exports.SUPABASE_REAUTHORIZATION_REQUIRED_ERROR_CODE = 'SUPABASE_REAUTHORIZATION_REQUIRED_ERROR';
|
|
12
20
|
function getSupabaseProjectDashboardUrl(project) {
|
|
13
21
|
return `https://supabase.com/dashboard/project/${encodeURIComponent(project.supabaseProjectRef)}`;
|
|
14
22
|
}
|
|
@@ -80,3 +88,48 @@ function formatSupabaseProject(project) {
|
|
|
80
88
|
function logNoSupabaseProject(projectName) {
|
|
81
89
|
log_1.default.warn(`No Supabase project is linked to Expo app ${chalk_1.default.bold(projectName)} on EAS.`);
|
|
82
90
|
}
|
|
91
|
+
function getSupabaseAdvisorsDashboardUrl(project, type) {
|
|
92
|
+
return `${getSupabaseProjectDashboardUrl(project)}/advisors/${type.toLowerCase()}`;
|
|
93
|
+
}
|
|
94
|
+
function isSupabaseReauthorizationRequiredError(error) {
|
|
95
|
+
return (error instanceof core_1.CombinedError &&
|
|
96
|
+
error.graphQLErrors.some(graphQLError => graphQLError.extensions?.errorCode === exports.SUPABASE_REAUTHORIZATION_REQUIRED_ERROR_CODE));
|
|
97
|
+
}
|
|
98
|
+
const ADVISOR_LINT_LEVEL_LABELS = {
|
|
99
|
+
[SupabaseConnection_1.SupabaseAdvisorLintLevel.Error]: ['error', 'errors'],
|
|
100
|
+
[SupabaseConnection_1.SupabaseAdvisorLintLevel.Warn]: ['warning', 'warnings'],
|
|
101
|
+
[SupabaseConnection_1.SupabaseAdvisorLintLevel.Info]: ['info', 'info'],
|
|
102
|
+
};
|
|
103
|
+
const ADVISOR_LINT_LEVEL_MARKERS = {
|
|
104
|
+
[SupabaseConnection_1.SupabaseAdvisorLintLevel.Error]: chalk_1.default.red('✖'),
|
|
105
|
+
[SupabaseConnection_1.SupabaseAdvisorLintLevel.Warn]: chalk_1.default.yellow('▲'),
|
|
106
|
+
[SupabaseConnection_1.SupabaseAdvisorLintLevel.Info]: chalk_1.default.blue('●'),
|
|
107
|
+
};
|
|
108
|
+
function summarizeSupabaseAdvisorLints(lints) {
|
|
109
|
+
if (lints.length === 0) {
|
|
110
|
+
return 'No unresolved findings';
|
|
111
|
+
}
|
|
112
|
+
return Object.keys(ADVISOR_LINT_LEVEL_LABELS)
|
|
113
|
+
.map(level => [level, lints.filter(lint => lint.level === level).length])
|
|
114
|
+
.filter(([, count]) => count > 0)
|
|
115
|
+
.map(([level, count]) => `${count} ${ADVISOR_LINT_LEVEL_LABELS[level][count === 1 ? 0 : 1]}`)
|
|
116
|
+
.join(', ');
|
|
117
|
+
}
|
|
118
|
+
function formatInlineCode(text) {
|
|
119
|
+
return text
|
|
120
|
+
.replaceAll('\\`', '`')
|
|
121
|
+
.split('`')
|
|
122
|
+
.map((part, index) => (index % 2 === 1 ? chalk_1.default.cyan(part) : part))
|
|
123
|
+
.join('');
|
|
124
|
+
}
|
|
125
|
+
function formatSupabaseAdvisorLints(project, type, lints) {
|
|
126
|
+
const heading = `${chalk_1.default.bold(type === SupabaseConnection_1.SupabaseAdvisorType.Security ? 'Security' : 'Performance')} · ${summarizeSupabaseAdvisorLints(lints)}`;
|
|
127
|
+
const dashboardUrl = getSupabaseAdvisorsDashboardUrl(project, type);
|
|
128
|
+
const rows = lints.map(lint => [
|
|
129
|
+
` ${ADVISOR_LINT_LEVEL_MARKERS[lint.level]} ${lint.level === SupabaseConnection_1.SupabaseAdvisorLintLevel.Warn ? 'WARNING' : lint.level} ${chalk_1.default.bold(lint.title)}`,
|
|
130
|
+
...(lint.entity ? [` ${chalk_1.default.dim(lint.entity)}`] : []),
|
|
131
|
+
` ${formatInlineCode(lint.detail)}`,
|
|
132
|
+
` ${(0, log_1.link)(`${dashboardUrl}?id=${encodeURIComponent(lint.cacheKey)}`, { text: chalk_1.default.underline('View in Supabase ↗'), dim: false })}`,
|
|
133
|
+
].join('\n'));
|
|
134
|
+
return [heading, ...rows].join('\n\n');
|
|
135
|
+
}
|
|
@@ -4,4 +4,5 @@ export declare function validateWorkflowFileAsync(workflowFileContents: {
|
|
|
4
4
|
filePath: string;
|
|
5
5
|
}, projectDir: string, graphqlClient: ExpoGraphqlClient, projectId: string): Promise<void>;
|
|
6
6
|
export declare function logWorkflowValidationErrors(error: unknown): void;
|
|
7
|
+
export declare function validateWorkflowStructure(parsedYaml: any, workflowJsonSchema: any): void;
|
|
7
8
|
export declare function workflowContentsFromParsedYaml(parsedYaml: any): string;
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateWorkflowFileAsync = validateWorkflowFileAsync;
|
|
4
4
|
exports.logWorkflowValidationErrors = logWorkflowValidationErrors;
|
|
5
|
+
exports.validateWorkflowStructure = validateWorkflowStructure;
|
|
5
6
|
exports.workflowContentsFromParsedYaml = workflowContentsFromParsedYaml;
|
|
6
7
|
const tslib_1 = require("tslib");
|
|
7
8
|
const errors_1 = require("@expo/eas-json/build/errors");
|
|
8
9
|
const core_1 = require("@urql/core");
|
|
9
10
|
const fs_1 = require("fs");
|
|
10
11
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
|
+
const ajv_formats_1 = tslib_1.__importDefault(require("ajv-formats"));
|
|
11
13
|
const YAML = tslib_1.__importStar(require("yaml"));
|
|
12
14
|
const compositeFunctions_1 = require("./compositeFunctions");
|
|
13
15
|
const buildProfileUtils_1 = require("./buildProfileUtils");
|
|
@@ -18,8 +20,9 @@ const ajv_1 = require("../../metadata/utils/ajv");
|
|
|
18
20
|
const workflowFile_1 = require("../../utils/workflowFile");
|
|
19
21
|
const parse_1 = require("./parse");
|
|
20
22
|
const jobTypesWithBuildProfile = new Set(['build', 'repack']);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
+
const validateUri = ajv_formats_1.default.get('uri');
|
|
24
|
+
const stringIsInterpolated = (value) => {
|
|
25
|
+
return value.includes('${{') && value.includes('}}');
|
|
23
26
|
};
|
|
24
27
|
async function validateWorkflowFileAsync(workflowFileContents, projectDir, graphqlClient, projectId) {
|
|
25
28
|
const parsedYaml = (0, parse_1.parsedYamlFromWorkflowContents)(workflowFileContents);
|
|
@@ -82,14 +85,15 @@ async function validateWorkflowOnServerAsync(graphqlClient, projectId, workflowF
|
|
|
82
85
|
}
|
|
83
86
|
async function validateWorkflowBuildJobsAsync(parsedYaml, projectDir) {
|
|
84
87
|
const jobs = jobsFromWorkflow(parsedYaml);
|
|
85
|
-
|
|
88
|
+
// `profile` is optional (e.g. on `repack`), so only jobs that set one can be checked against eas.json.
|
|
89
|
+
const buildJobs = jobs.filter(job => jobTypesWithBuildProfile.has(job.value.type) && typeof job.value.params?.profile === 'string');
|
|
86
90
|
if (buildJobs.length === 0) {
|
|
87
91
|
return;
|
|
88
92
|
}
|
|
89
93
|
const buildProfileNames = await (0, buildProfileUtils_1.buildProfileNamesFromProjectAsync)(projectDir);
|
|
90
94
|
const invalidBuildJobs = buildJobs.filter(job => !buildProfileNames.has(job.value.params.profile) &&
|
|
91
95
|
// If a profile name is interpolated, we can't check if it's valid until the workflow actually runs
|
|
92
|
-
!
|
|
96
|
+
!stringIsInterpolated(job.value.params.profile));
|
|
93
97
|
if (invalidBuildJobs.length > 0) {
|
|
94
98
|
const invalidBuildProfiles = new Set(invalidBuildJobs.map(job => job.value.params.profile));
|
|
95
99
|
throw new Error(`The build jobs in this workflow refer to the following build profiles that are not present in your eas.json file: ${[
|
|
@@ -100,6 +104,11 @@ async function validateWorkflowBuildJobsAsync(parsedYaml, projectDir) {
|
|
|
100
104
|
function validateWorkflowJobTypes(parsedYaml, workflowJsonSchema) {
|
|
101
105
|
const jobs = jobsFromWorkflow(parsedYaml);
|
|
102
106
|
const jobTypes = jobTypesFromWorkflowSchema(workflowJsonSchema);
|
|
107
|
+
if (jobTypes.length === 0) {
|
|
108
|
+
// The schema no longer lists job types where we expect them; leave job validation to the schema.
|
|
109
|
+
log_1.default.debug('No job types found in the workflow schema, skipping job type validation.');
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
103
112
|
const invalidJobs = jobs.filter(job => job.value.type && !jobTypes.includes(job.value.type));
|
|
104
113
|
if (invalidJobs.length > 0) {
|
|
105
114
|
throw new Error(`The following jobs have invalid types: ${invalidJobs
|
|
@@ -110,6 +119,8 @@ function validateWorkflowJobTypes(parsedYaml, workflowJsonSchema) {
|
|
|
110
119
|
function validateWorkflowStructure(parsedYaml, workflowJsonSchema) {
|
|
111
120
|
delete workflowJsonSchema['$schema'];
|
|
112
121
|
const ajv = (0, ajv_1.createValidator)();
|
|
122
|
+
// Interpolated values cannot be format-checked until the workflow runs.
|
|
123
|
+
ajv.addFormat('uri', value => stringIsInterpolated(value) || validateUri(value));
|
|
113
124
|
const validate = ajv.compile(workflowJsonSchema);
|
|
114
125
|
const result = validate(parsedYaml);
|
|
115
126
|
if (!result) {
|
|
@@ -158,5 +169,8 @@ function jobsFromWorkflow(parsedYaml) {
|
|
|
158
169
|
});
|
|
159
170
|
}
|
|
160
171
|
function jobTypesFromWorkflowSchema(workflowJsonSchema) {
|
|
161
|
-
|
|
172
|
+
// Not every job variant has a `type` (e.g. a job that calls a reusable workflow with `uses`).
|
|
173
|
+
return (workflowJsonSchema?.properties?.jobs?.additionalProperties?.anyOf ?? [])
|
|
174
|
+
.map((props) => props?.properties?.type?.const)
|
|
175
|
+
.filter((jobType) => typeof jobType === 'string');
|
|
162
176
|
}
|
|
@@ -54,12 +54,24 @@ class AccountView extends EasCommand_1.default {
|
|
|
54
54
|
return 'Admin';
|
|
55
55
|
case generated_1.Role.Developer:
|
|
56
56
|
return 'Developer';
|
|
57
|
+
case generated_1.Role.ReleaseManager:
|
|
58
|
+
return 'Release Manager';
|
|
57
59
|
case generated_1.Role.ViewOnly:
|
|
58
60
|
return 'Viewer';
|
|
59
61
|
case generated_1.Role.Custom:
|
|
60
62
|
case generated_1.Role.HasAdmin:
|
|
61
63
|
case generated_1.Role.NotAdmin:
|
|
62
64
|
return 'Custom';
|
|
65
|
+
// A role added to the API after this version of the CLI was published. TypeScript narrows
|
|
66
|
+
// `role` to `never` here, but the server can still send one, so render its name rather than
|
|
67
|
+
// returning undefined.
|
|
68
|
+
default: {
|
|
69
|
+
const unknownRole = role;
|
|
70
|
+
return unknownRole
|
|
71
|
+
.split('_')
|
|
72
|
+
.map(word => word.charAt(0) + word.slice(1).toLowerCase())
|
|
73
|
+
.join(' ');
|
|
74
|
+
}
|
|
63
75
|
}
|
|
64
76
|
}
|
|
65
77
|
}
|
|
@@ -88,6 +88,9 @@ class IntegrationsAscConnect extends EasCommand_1.default {
|
|
|
88
88
|
throw new errors_1.EasCommandError(`Multiple App Store Connect API keys match Apple key identifier "${apiKeyId}".`);
|
|
89
89
|
}
|
|
90
90
|
else if (keysByAppleId.length === 1) {
|
|
91
|
+
if (!keysByAppleId[0].issuerIdentifier) {
|
|
92
|
+
throw new errors_1.EasCommandError(`App Store Connect API key "${apiKeyId}" is an individual key (it has no Issuer ID). Individual keys are not supported for the App Store Connect connection. Use a team API key.`);
|
|
93
|
+
}
|
|
91
94
|
apiKeyId = keysByAppleId[0].id;
|
|
92
95
|
}
|
|
93
96
|
else {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import EasCommand from '../../../commandUtils/EasCommand';
|
|
2
|
+
export default class IntegrationsSupabaseAdvisors extends EasCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
type: import("@oclif/core/lib/interfaces").OptionFlag<"security" | "performance" | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
static contextDefinition: {
|
|
11
|
+
loggedIn: import("../../../commandUtils/context/LoggedInContextField").default;
|
|
12
|
+
privateProjectConfig: import("../../../commandUtils/context/PrivateProjectConfigContextField").PrivateProjectConfigContextField;
|
|
13
|
+
};
|
|
14
|
+
runAsync(): Promise<void>;
|
|
15
|
+
private fetchLintsAsync;
|
|
16
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const EasCommand_1 = tslib_1.__importDefault(require("../../../commandUtils/EasCommand"));
|
|
7
|
+
const errors_1 = require("../../../commandUtils/errors");
|
|
8
|
+
const flags_1 = require("../../../commandUtils/flags");
|
|
9
|
+
const supabase_1 = require("../../../commandUtils/supabase");
|
|
10
|
+
const SupabaseMutation_1 = require("../../../graphql/mutations/SupabaseMutation");
|
|
11
|
+
const SupabaseQuery_1 = require("../../../graphql/queries/SupabaseQuery");
|
|
12
|
+
const SupabaseConnection_1 = require("../../../graphql/types/SupabaseConnection");
|
|
13
|
+
const provision_1 = require("../../../integrations/supabase/provision");
|
|
14
|
+
const log_1 = tslib_1.__importStar(require("../../../log"));
|
|
15
|
+
const ora_1 = require("../../../ora");
|
|
16
|
+
const projectUtils_1 = require("../../../project/projectUtils");
|
|
17
|
+
const prompts_1 = require("../../../prompts");
|
|
18
|
+
const json_1 = require("../../../utils/json");
|
|
19
|
+
const ADVISOR_TYPES = [SupabaseConnection_1.SupabaseAdvisorType.Security, SupabaseConnection_1.SupabaseAdvisorType.Performance];
|
|
20
|
+
const REAUTH_COMMAND = 'eas integrations:supabase:advisors';
|
|
21
|
+
class IntegrationsSupabaseAdvisors extends EasCommand_1.default {
|
|
22
|
+
static description = "list unresolved findings from the Supabase Security and Performance Advisors for this app's primary Supabase project";
|
|
23
|
+
static examples = [
|
|
24
|
+
'<%= config.bin %> <%= command.id %>',
|
|
25
|
+
'<%= config.bin %> <%= command.id %> --type security',
|
|
26
|
+
'<%= config.bin %> <%= command.id %> --json --non-interactive',
|
|
27
|
+
];
|
|
28
|
+
static flags = {
|
|
29
|
+
type: core_1.Flags.option({
|
|
30
|
+
description: 'Only show one advisor',
|
|
31
|
+
options: ['security', 'performance'],
|
|
32
|
+
})(),
|
|
33
|
+
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
34
|
+
};
|
|
35
|
+
static contextDefinition = {
|
|
36
|
+
...this.ContextOptions.ProjectConfig,
|
|
37
|
+
};
|
|
38
|
+
async runAsync() {
|
|
39
|
+
const { flags } = await this.parse(IntegrationsSupabaseAdvisors);
|
|
40
|
+
const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
|
|
41
|
+
if (jsonFlag) {
|
|
42
|
+
(0, json_1.enableJsonOutput)();
|
|
43
|
+
}
|
|
44
|
+
const types = flags.type === 'security'
|
|
45
|
+
? [SupabaseConnection_1.SupabaseAdvisorType.Security]
|
|
46
|
+
: flags.type === 'performance'
|
|
47
|
+
? [SupabaseConnection_1.SupabaseAdvisorType.Performance]
|
|
48
|
+
: ADVISOR_TYPES;
|
|
49
|
+
const { privateProjectConfig: { projectId, exp }, loggedIn: { graphqlClient }, } = await this.getContextAsync(IntegrationsSupabaseAdvisors, {
|
|
50
|
+
nonInteractive,
|
|
51
|
+
withServerSideEnvironment: null,
|
|
52
|
+
});
|
|
53
|
+
const project = await SupabaseQuery_1.SupabaseQuery.getSupabaseProjectByAppIdAsync(graphqlClient, projectId);
|
|
54
|
+
if (!project) {
|
|
55
|
+
if (jsonFlag) {
|
|
56
|
+
(0, json_1.printJsonOnlyOutput)({ project: null, security: null, performance: null });
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
(0, supabase_1.logNoSupabaseProject)(exp.slug);
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
let result = await this.fetchLintsAsync(graphqlClient, projectId, types, nonInteractive);
|
|
64
|
+
if (result === undefined) {
|
|
65
|
+
if (nonInteractive) {
|
|
66
|
+
throw new errors_1.EasCommandError(`Expo cannot read this project's advisors until the Supabase connection grants the database read permission. Run ${chalk_1.default.bold(REAUTH_COMMAND)} interactively to re-authorize.`);
|
|
67
|
+
}
|
|
68
|
+
log_1.default.warn('Expo cannot read the Supabase advisors until the Supabase connection is re-authorized with the database read permission.');
|
|
69
|
+
const confirmed = await (0, prompts_1.confirmAsync)({
|
|
70
|
+
message: 'Re-authorize Supabase in your browser now?',
|
|
71
|
+
});
|
|
72
|
+
if (!confirmed) {
|
|
73
|
+
log_1.default.warn(`Run ${chalk_1.default.bold(REAUTH_COMMAND)} when you are ready to re-authorize.`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId);
|
|
77
|
+
const connection = await SupabaseQuery_1.SupabaseQuery.getSupabaseConnectionByAccountIdAsync(graphqlClient, account.id, { useCache: false });
|
|
78
|
+
const authorized = await (0, provision_1.authorizeViaBrowserAsync)(graphqlClient, account, false, connection?.updatedAt);
|
|
79
|
+
if (connection &&
|
|
80
|
+
authorized.supabaseOrganizationSlug !== connection.supabaseOrganizationSlug) {
|
|
81
|
+
await SupabaseMutation_1.SupabaseMutation.setSupabaseConnectionOrganizationAsync(graphqlClient, {
|
|
82
|
+
supabaseConnectionId: authorized.id,
|
|
83
|
+
organizationSlug: connection.supabaseOrganizationSlug,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
log_1.default.newLine();
|
|
87
|
+
result = await this.fetchLintsAsync(graphqlClient, projectId, types, nonInteractive);
|
|
88
|
+
if (result === undefined) {
|
|
89
|
+
throw new errors_1.EasCommandError(`Supabase still denies access to the advisors after re-authorizing. Check that the Expo integration is allowed to read the database for ${chalk_1.default.bold((0, supabase_1.formatSupabaseProjectLabel)(project))}.`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (result === null) {
|
|
93
|
+
if (jsonFlag) {
|
|
94
|
+
(0, json_1.printJsonOnlyOutput)({ project: null, security: null, performance: null });
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
(0, supabase_1.logNoSupabaseProject)(exp.slug);
|
|
98
|
+
}
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (jsonFlag) {
|
|
102
|
+
(0, json_1.printJsonOnlyOutput)({
|
|
103
|
+
project: {
|
|
104
|
+
ref: result.project.supabaseProjectRef,
|
|
105
|
+
name: result.project.supabaseProjectName,
|
|
106
|
+
dashboardUrls: Object.fromEntries(types.map(type => [
|
|
107
|
+
type.toLowerCase(),
|
|
108
|
+
(0, supabase_1.getSupabaseAdvisorsDashboardUrl)(result.project, type),
|
|
109
|
+
])),
|
|
110
|
+
},
|
|
111
|
+
security: types.includes(SupabaseConnection_1.SupabaseAdvisorType.Security) ? result.security : undefined,
|
|
112
|
+
performance: types.includes(SupabaseConnection_1.SupabaseAdvisorType.Performance)
|
|
113
|
+
? result.performance
|
|
114
|
+
: undefined,
|
|
115
|
+
});
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
log_1.default.newLine();
|
|
119
|
+
log_1.default.log(`${chalk_1.default.bold('Dashboard')}: ${(0, log_1.link)((0, supabase_1.getSupabaseProjectDashboardUrl)(result.project), { dim: false })}`);
|
|
120
|
+
for (const type of types) {
|
|
121
|
+
const lints = type === SupabaseConnection_1.SupabaseAdvisorType.Security ? result.security : result.performance;
|
|
122
|
+
log_1.default.newLine();
|
|
123
|
+
if (lints === null) {
|
|
124
|
+
log_1.default.warn(`${type === SupabaseConnection_1.SupabaseAdvisorType.Security ? 'Security' : 'Performance'} advisors are unavailable. Try again or open ${(0, supabase_1.getSupabaseAdvisorsDashboardUrl)(result.project, type)}.`);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
log_1.default.log((0, supabase_1.formatSupabaseAdvisorLints)(result.project, type, lints));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
async fetchLintsAsync(graphqlClient, projectId, types, nonInteractive) {
|
|
132
|
+
const spinner = nonInteractive ? null : (0, ora_1.ora)('Fetching Supabase advisor findings').start();
|
|
133
|
+
try {
|
|
134
|
+
const result = await SupabaseQuery_1.SupabaseQuery.getSupabaseAdvisorLintsByAppIdAsync(graphqlClient, projectId, types);
|
|
135
|
+
if (result) {
|
|
136
|
+
spinner?.succeed(`Fetched Supabase advisor findings for ${(0, supabase_1.formatSupabaseProjectLabel)(result.project)}`);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
spinner?.stop();
|
|
140
|
+
}
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
if ((0, supabase_1.isSupabaseReauthorizationRequiredError)(error)) {
|
|
145
|
+
spinner?.fail('Supabase needs to be re-authorized');
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
spinner?.fail('Failed to fetch Supabase advisor findings');
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
exports.default = IntegrationsSupabaseAdvisors;
|
|
@@ -9,7 +9,6 @@ const ora_1 = require("../../ora");
|
|
|
9
9
|
const utils_1 = require("../../simulator/utils");
|
|
10
10
|
const json_1 = require("../../utils/json");
|
|
11
11
|
class SimulatorAvailability extends EasCommand_1.default {
|
|
12
|
-
static hidden = true;
|
|
13
12
|
static aliases = ['sim:availability'];
|
|
14
13
|
static description = '[EXPERIMENTAL] check whether EAS Simulator is enabled for the current project account';
|
|
15
14
|
static flags = {
|
|
@@ -7,7 +7,6 @@ const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
|
7
7
|
const egress_1 = require("../../simulator/egress");
|
|
8
8
|
const env_1 = require("../../simulator/env");
|
|
9
9
|
class SimulatorEgress extends EasCommand_1.default {
|
|
10
|
-
static hidden = true;
|
|
11
10
|
static aliases = ['sim:egress'];
|
|
12
11
|
static description = `[EXPERIMENTAL] run the local egress client for a simulator session to route proxied HTTP(S) requests through this machine`;
|
|
13
12
|
static flags = {
|
|
@@ -14,7 +14,6 @@ const promise_1 = require("../../utils/promise");
|
|
|
14
14
|
const POLL_INTERVAL_MS = 5_000;
|
|
15
15
|
const POST_STOP_REFRESH_COUNT = 2;
|
|
16
16
|
class SimulatorEvents extends EasCommand_1.default {
|
|
17
|
-
static hidden = true;
|
|
18
17
|
static aliases = ['sim:events'];
|
|
19
18
|
static description = '[EXPERIMENTAL] show activity events from a remote simulator session';
|
|
20
19
|
static flags = {
|
|
@@ -90,8 +89,10 @@ class SimulatorEvents extends EasCommand_1.default {
|
|
|
90
89
|
(0, json_1.printJsonOnlyOutput)({ deviceRunSessionId, events });
|
|
91
90
|
return;
|
|
92
91
|
}
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
// Any status that isn't final counts as running, so statuses added later (such as queued
|
|
93
|
+
// and starting) keep follow mode going.
|
|
94
|
+
const isRunning = session.status !== generated_1.DeviceRunSessionStatus.Stopped &&
|
|
95
|
+
session.status !== generated_1.DeviceRunSessionStatus.Errored;
|
|
95
96
|
if (isRunning) {
|
|
96
97
|
observedRunningSession = true;
|
|
97
98
|
remainingPostStopRefreshes = 0;
|
|
@@ -5,7 +5,6 @@ const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
|
|
|
5
5
|
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
6
6
|
const env_1 = require("../../simulator/env");
|
|
7
7
|
class SimulatorExec extends EasCommand_1.default {
|
|
8
|
-
static hidden = true;
|
|
9
8
|
static aliases = ['sim:exec'];
|
|
10
9
|
static description = `[EXPERIMENTAL] execute a simulator command with ${env_1.SIMULATOR_DOTENV_FILE_NAME} environment loaded`;
|
|
11
10
|
static strict = false;
|
|
@@ -15,7 +15,6 @@ const files_1 = require("../../utils/files");
|
|
|
15
15
|
const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields"));
|
|
16
16
|
const json_1 = require("../../utils/json");
|
|
17
17
|
class SimulatorGet extends EasCommand_1.default {
|
|
18
|
-
static hidden = true;
|
|
19
18
|
static aliases = ['sim:get'];
|
|
20
19
|
static description = '[EXPERIMENTAL] get info about a remote simulator session on EAS by its simulator session ID';
|
|
21
20
|
static flags = {
|
|
@@ -80,6 +79,7 @@ class SimulatorGet extends EasCommand_1.default {
|
|
|
80
79
|
if (session.remoteConfig) {
|
|
81
80
|
log_1.default.log((0, utils_1.formatRemoteSessionInstructions)(session.remoteConfig, 'env', {
|
|
82
81
|
sessionUrl: deviceRunSessionUrl,
|
|
82
|
+
platform: session.platform,
|
|
83
83
|
}));
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
2
|
export default class Simulator extends EasCommand {
|
|
3
|
-
static hidden: boolean;
|
|
4
3
|
static aliases: string[];
|
|
4
|
+
static hiddenAliases: string[];
|
|
5
5
|
static description: string;
|
|
6
6
|
static flags: {
|
|
7
7
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
@@ -11,6 +11,7 @@ export default class Simulator extends EasCommand {
|
|
|
11
11
|
tag: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
12
|
device: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
13
|
'build-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
'build-fingerprint': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
15
|
'application-archive-url': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
16
|
'expo-go': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
17
|
'sdk-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|