eas-cli 24.7.0 → 24.8.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 +453 -244
- 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 +8 -3
- 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 +0 -1
- 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 +0 -1
- package/build/commands/simulator/index.d.ts +2 -1
- package/build/commands/simulator/index.js +29 -11
- package/build/commands/simulator/list.d.ts +0 -1
- package/build/commands/simulator/list.js +0 -1
- package/build/commands/simulator/stop.d.ts +0 -1
- package/build/commands/simulator/stop.js +0 -1
- package/build/commands/submit/internal.d.ts +6 -0
- package/build/commands/submit/internal.js +6 -2
- 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 +167 -7
- package/build/graphql/generated.js +14 -2
- 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/submit/ios/AscApiKeySource.js +1 -1
- package/build/submit/ios/IosSubmitCommand.js +2 -2
- package/build/submit/ios/ensureTestFlightSetup.js +1 -4
- package/build/worker/upload.js +2 -2
- package/oclif.manifest.json +986 -882
- 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);
|
|
@@ -89,7 +92,7 @@ async function validateWorkflowBuildJobsAsync(parsedYaml, projectDir) {
|
|
|
89
92
|
const buildProfileNames = await (0, buildProfileUtils_1.buildProfileNamesFromProjectAsync)(projectDir);
|
|
90
93
|
const invalidBuildJobs = buildJobs.filter(job => !buildProfileNames.has(job.value.params.profile) &&
|
|
91
94
|
// If a profile name is interpolated, we can't check if it's valid until the workflow actually runs
|
|
92
|
-
!
|
|
95
|
+
!stringIsInterpolated(job.value.params.profile));
|
|
93
96
|
if (invalidBuildJobs.length > 0) {
|
|
94
97
|
const invalidBuildProfiles = new Set(invalidBuildJobs.map(job => job.value.params.profile));
|
|
95
98
|
throw new Error(`The build jobs in this workflow refer to the following build profiles that are not present in your eas.json file: ${[
|
|
@@ -110,6 +113,8 @@ function validateWorkflowJobTypes(parsedYaml, workflowJsonSchema) {
|
|
|
110
113
|
function validateWorkflowStructure(parsedYaml, workflowJsonSchema) {
|
|
111
114
|
delete workflowJsonSchema['$schema'];
|
|
112
115
|
const ajv = (0, ajv_1.createValidator)();
|
|
116
|
+
// Interpolated values cannot be format-checked until the workflow runs.
|
|
117
|
+
ajv.addFormat('uri', value => stringIsInterpolated(value) || validateUri(value));
|
|
113
118
|
const validate = ajv.compile(workflowJsonSchema);
|
|
114
119
|
const result = validate(parsedYaml);
|
|
115
120
|
if (!result) {
|
|
@@ -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 = {
|
|
@@ -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 = {
|
|
@@ -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>;
|
|
@@ -21,7 +21,7 @@ const utils_1 = require("../../simulator/utils");
|
|
|
21
21
|
const json_1 = require("../../utils/json");
|
|
22
22
|
const promise_1 = require("../../utils/promise");
|
|
23
23
|
const POLL_INTERVAL_MS = 5_000; // 5 seconds
|
|
24
|
-
const
|
|
24
|
+
const STARTUP_TIMEOUT_MS = 15 * 60 * 1_000; // 15 minutes, excluding time in the queue
|
|
25
25
|
const OUT_CONFIG_TYPE_VALUES = {
|
|
26
26
|
Env: 'env',
|
|
27
27
|
Dotenv: 'dotenv',
|
|
@@ -33,8 +33,8 @@ const APP_PLATFORM_BY_FLAG_VALUE = {
|
|
|
33
33
|
ios: generated_1.AppPlatform.Ios,
|
|
34
34
|
};
|
|
35
35
|
class Simulator extends EasCommand_1.default {
|
|
36
|
-
static
|
|
37
|
-
static
|
|
36
|
+
static aliases = ['simulator:start', 'sim:start'];
|
|
37
|
+
static hiddenAliases = ['sim'];
|
|
38
38
|
static description = '[EXPERIMENTAL] start a remote simulator session on EAS and get instructions to connect to it';
|
|
39
39
|
static flags = {
|
|
40
40
|
platform: core_1.Flags.option({
|
|
@@ -54,15 +54,19 @@ class Simulator extends EasCommand_1.default {
|
|
|
54
54
|
}),
|
|
55
55
|
'build-id': core_1.Flags.string({
|
|
56
56
|
description: 'EAS Build to install and launch before the simulator session is ready.',
|
|
57
|
-
exclusive: ['application-archive-url', 'expo-go'],
|
|
57
|
+
exclusive: ['build-fingerprint', 'application-archive-url', 'expo-go'],
|
|
58
|
+
}),
|
|
59
|
+
'build-fingerprint': core_1.Flags.string({
|
|
60
|
+
description: 'Fingerprint hash of an EAS Build to install and launch before the simulator session is ready. Uses the most recent finished build with this fingerprint that can be installed on the simulator.',
|
|
61
|
+
exclusive: ['build-id', 'application-archive-url', 'expo-go'],
|
|
58
62
|
}),
|
|
59
63
|
'application-archive-url': core_1.Flags.string({
|
|
60
64
|
description: 'Application archive URL to download, install, and launch before the simulator session is ready.',
|
|
61
|
-
exclusive: ['build-id', 'expo-go'],
|
|
65
|
+
exclusive: ['build-id', 'build-fingerprint', 'expo-go'],
|
|
62
66
|
}),
|
|
63
67
|
'expo-go': core_1.Flags.boolean({
|
|
64
68
|
description: "Install and launch Expo Go matching the current project's Expo SDK before the simulator session is ready.",
|
|
65
|
-
exclusive: ['build-id', 'application-archive-url'],
|
|
69
|
+
exclusive: ['build-id', 'build-fingerprint', 'application-archive-url'],
|
|
66
70
|
}),
|
|
67
71
|
'sdk-version': core_1.Flags.string({
|
|
68
72
|
description: 'Expo SDK version used to select Expo Go when --expo-go is passed. Defaults to the current project SDK.',
|
|
@@ -145,6 +149,7 @@ class Simulator extends EasCommand_1.default {
|
|
|
145
149
|
const tags = flags.tag?.map(tag => tag.trim()).filter(tag => tag.length > 0);
|
|
146
150
|
const deviceIdentifier = flags.device?.trim() || undefined;
|
|
147
151
|
const buildId = flags['build-id']?.trim() || undefined;
|
|
152
|
+
const buildFingerprint = flags['build-fingerprint']?.trim() || undefined;
|
|
148
153
|
const applicationArchiveUrlFromFlag = flags['application-archive-url']?.trim() || undefined;
|
|
149
154
|
const sdkVersionFromFlag = flags['sdk-version']?.trim() || undefined;
|
|
150
155
|
const launchArgs = flags['launch-arg'];
|
|
@@ -157,9 +162,10 @@ class Simulator extends EasCommand_1.default {
|
|
|
157
162
|
}
|
|
158
163
|
if ((launchArgs?.length || openUrl) &&
|
|
159
164
|
!buildId &&
|
|
165
|
+
!buildFingerprint &&
|
|
160
166
|
!applicationArchiveUrlFromFlag &&
|
|
161
167
|
!flags['expo-go']) {
|
|
162
|
-
throw new errors_1.EasCommandError('Launch options require an application source. Pass --build-id, --application-archive-url, or --expo-go.');
|
|
168
|
+
throw new errors_1.EasCommandError('Launch options require an application source. Pass --build-id, --build-fingerprint, --application-archive-url, or --expo-go.');
|
|
163
169
|
}
|
|
164
170
|
await (0, env_1.loadSimulatorEnvAsync)(projectDir);
|
|
165
171
|
const existingDeviceRunSessionId = process.env[env_1.EAS_SIMULATOR_SESSION_ID];
|
|
@@ -209,6 +215,7 @@ class Simulator extends EasCommand_1.default {
|
|
|
209
215
|
: { android: { deviceIdentifier } }
|
|
210
216
|
: {}),
|
|
211
217
|
...(buildId ? { buildId } : {}),
|
|
218
|
+
...(buildFingerprint ? { buildFingerprint } : {}),
|
|
212
219
|
...(applicationArchiveUrlFromFlag
|
|
213
220
|
? { applicationArchiveUrl: applicationArchiveUrlFromFlag }
|
|
214
221
|
: {}),
|
|
@@ -237,10 +244,10 @@ class Simulator extends EasCommand_1.default {
|
|
|
237
244
|
throw err;
|
|
238
245
|
}
|
|
239
246
|
const pollSpinner = (0, ora_1.ora)(`⏳ Waiting for ${flags.type} session to be ready`).start();
|
|
240
|
-
|
|
247
|
+
let startupDeadline = Date.now() + STARTUP_TIMEOUT_MS;
|
|
241
248
|
let remoteConfig;
|
|
242
249
|
try {
|
|
243
|
-
while (!sessionInterrupt.signal.aborted
|
|
250
|
+
while (!sessionInterrupt.signal.aborted) {
|
|
244
251
|
const session = await Promise.race([
|
|
245
252
|
DeviceRunSessionQuery_1.DeviceRunSessionQuery.byIdAsync(graphqlClient, deviceRunSessionId),
|
|
246
253
|
sessionInterrupt.abortPromise,
|
|
@@ -263,6 +270,17 @@ class Simulator extends EasCommand_1.default {
|
|
|
263
270
|
pollSpinner.succeed(`🎉 ${flags.type} session is ready`);
|
|
264
271
|
break;
|
|
265
272
|
}
|
|
273
|
+
if (jobRunStatus === generated_1.JobRunStatus.New || jobRunStatus === generated_1.JobRunStatus.InQueue) {
|
|
274
|
+
startupDeadline = undefined;
|
|
275
|
+
pollSpinner.text = '⏳ Simulator session queued or waiting for available concurrency';
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
startupDeadline ??= Date.now() + STARTUP_TIMEOUT_MS;
|
|
279
|
+
pollSpinner.text = `⏳ Waiting for ${flags.type} session to start`;
|
|
280
|
+
if (Date.now() >= startupDeadline) {
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
266
284
|
await (0, promise_1.sleepAsync)(POLL_INTERVAL_MS, sessionInterrupt.signal);
|
|
267
285
|
}
|
|
268
286
|
}
|
|
@@ -283,10 +301,10 @@ class Simulator extends EasCommand_1.default {
|
|
|
283
301
|
return;
|
|
284
302
|
}
|
|
285
303
|
if (!remoteConfig) {
|
|
286
|
-
pollSpinner.fail(`Timed out waiting for ${flags.type} session to
|
|
304
|
+
pollSpinner.fail(`Timed out waiting for ${flags.type} session to start`);
|
|
287
305
|
await ensureDeviceRunSessionStoppedSafelyAsync(graphqlClient, deviceRunSessionId);
|
|
288
306
|
sessionInterrupt.dispose();
|
|
289
|
-
throw new Error(`Timed out after ${Math.round(
|
|
307
|
+
throw new Error(`Timed out after ${Math.round(STARTUP_TIMEOUT_MS / 1000)}s waiting for ${flags.type} session to start (excluding time in the queue). ${(0, log_1.link)(deviceRunSessionUrl)}`);
|
|
290
308
|
}
|
|
291
309
|
if (flags['out-config-type'] === OUT_CONFIG_TYPE_VALUES.Dotenv) {
|
|
292
310
|
await writeSimulatorEnvSafelyAsync(projectDir, {
|
|
@@ -32,7 +32,6 @@ const PLATFORM_FLAG_VALUES = {
|
|
|
32
32
|
};
|
|
33
33
|
const PLATFORM_BY_FLAG_VALUE = Object.fromEntries(Object.entries(PLATFORM_FLAG_VALUES).map(([platform, value]) => [value, platform]));
|
|
34
34
|
class SimulatorList extends EasCommand_1.default {
|
|
35
|
-
static hidden = true;
|
|
36
35
|
static aliases = ['sim:list'];
|
|
37
36
|
static description = '[EXPERIMENTAL] list remote simulator sessions for the current project';
|
|
38
37
|
static flags = {
|
|
@@ -9,7 +9,6 @@ const ora_1 = require("../../ora");
|
|
|
9
9
|
const env_1 = require("../../simulator/env");
|
|
10
10
|
const json_1 = require("../../utils/json");
|
|
11
11
|
class SimulatorStop extends EasCommand_1.default {
|
|
12
|
-
static hidden = true;
|
|
13
12
|
static aliases = ['sim:stop'];
|
|
14
13
|
static description = '[EXPERIMENTAL] stop a remote simulator session on EAS by its simulator session ID';
|
|
15
14
|
static flags = {
|