eas-cli 12.5.3 → 12.6.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 +131 -60
- package/build/channel/queries.js +12 -3
- package/build/commandUtils/context/DynamicProjectConfigContextField.d.ts +1 -1
- package/build/commandUtils/context/OptionalPrivateProjectConfigContextField.d.ts +1 -1
- package/build/commandUtils/context/PrivateProjectConfigContextField.d.ts +1 -1
- package/build/commandUtils/context/contextUtils/getProjectIdAsync.d.ts +1 -1
- package/build/commandUtils/flags.d.ts +2 -2
- package/build/commandUtils/flags.js +1 -6
- package/build/commands/channel/pause.d.ts +22 -0
- package/build/commands/channel/pause.js +90 -0
- package/build/commands/channel/resume.d.ts +22 -0
- package/build/commands/channel/resume.js +90 -0
- package/build/commands/env/create.d.ts +2 -2
- package/build/commands/env/create.js +13 -4
- package/build/commands/env/get.js +7 -11
- package/build/commands/env/link.js +3 -0
- package/build/commands/env/list.js +5 -1
- package/build/commands/env/pull.js +1 -1
- package/build/commands/env/push.d.ts +1 -2
- package/build/commands/env/push.js +86 -80
- package/build/commands/env/update.d.ts +2 -2
- package/build/commands/env/update.js +11 -7
- package/build/commands/update/edit.d.ts +2 -2
- package/build/commands/update/edit.js +41 -4
- package/build/eas-update/utils.d.ts +1 -1
- package/build/graphql/generated.d.ts +147 -19
- package/build/graphql/generated.js +19 -2
- package/build/graphql/mutations/EnvironmentVariableMutation.d.ts +1 -1
- package/build/graphql/queries/ChannelQuery.js +2 -0
- package/build/metadata/download.d.ts +1 -1
- package/build/metadata/upload.d.ts +1 -1
- package/build/update/configure.d.ts +1 -1
- package/build/utils/expoCli.d.ts +1 -1
- package/build/utils/prompts.d.ts +3 -1
- package/build/utils/prompts.js +36 -12
- package/oclif.manifest.json +103 -12
- package/package.json +3 -4
|
@@ -12,90 +12,102 @@ const EnvironmentVariableMutation_1 = require("../../graphql/mutations/Environme
|
|
|
12
12
|
const EnvironmentVariablesQuery_1 = require("../../graphql/queries/EnvironmentVariablesQuery");
|
|
13
13
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
14
14
|
const prompts_1 = require("../../prompts");
|
|
15
|
+
const prompts_2 = require("../../utils/prompts");
|
|
15
16
|
class EnvironmentVariablePush extends EasCommand_1.default {
|
|
16
17
|
async runAsync() {
|
|
17
|
-
|
|
18
|
-
const { environment, path: envPath } = this.validateFlags(flags);
|
|
18
|
+
let { flags: { environment: environments, path: envPath }, } = await this.parse(_a);
|
|
19
19
|
const { privateProjectConfig: { projectId }, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
|
|
20
20
|
nonInteractive: false,
|
|
21
21
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
environment,
|
|
27
|
-
filterNames: variableNames,
|
|
28
|
-
});
|
|
29
|
-
const existingDifferentVariables = [];
|
|
30
|
-
// Remove variables that are the same as the ones in the environment
|
|
31
|
-
existingVariables.forEach(variable => {
|
|
32
|
-
const existingVariableUpdate = updateVariables[variable.name];
|
|
33
|
-
if (existingVariableUpdate && existingVariableUpdate.value !== variable.value) {
|
|
34
|
-
existingDifferentVariables.push(variable);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
delete updateVariables[variable.name];
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
const existingDifferentSharedVariables = existingDifferentVariables.filter(variable => variable.scope === generated_1.EnvironmentVariableScope.Shared);
|
|
41
|
-
if (existingDifferentSharedVariables.length > 0) {
|
|
42
|
-
const existingDifferentSharedVariablesNames = existingDifferentSharedVariables.map(variable => variable.name);
|
|
43
|
-
log_1.default.error('Shared variables cannot be overwritten by eas env:push command.');
|
|
44
|
-
log_1.default.error('Remove them from the env file or unlink them from the project to continue:');
|
|
45
|
-
existingDifferentSharedVariablesNames.forEach(name => {
|
|
46
|
-
log_1.default.error(`- ${name}`);
|
|
22
|
+
if (!environments) {
|
|
23
|
+
environments = await (0, prompts_2.promptVariableEnvironmentAsync)({
|
|
24
|
+
nonInteractive: false,
|
|
25
|
+
multiple: true,
|
|
47
26
|
});
|
|
48
|
-
throw new Error('Shared variables cannot be overwritten by eas env:push command');
|
|
49
27
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
:
|
|
56
|
-
|
|
57
|
-
|
|
28
|
+
const updateVariables = await this.parseEnvFileAsync(envPath, environments);
|
|
29
|
+
const variableNames = Object.keys(updateVariables);
|
|
30
|
+
for (const environment of environments) {
|
|
31
|
+
const displayedEnvironment = environment.toLocaleLowerCase();
|
|
32
|
+
const existingVariables = await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.byAppIdAsync(graphqlClient, {
|
|
33
|
+
appId: projectId,
|
|
34
|
+
environment,
|
|
35
|
+
filterNames: variableNames,
|
|
58
36
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
37
|
+
const existingDifferentVariables = [];
|
|
38
|
+
// Remove variables that are the same as the ones in the environment
|
|
39
|
+
existingVariables.forEach(existingVariable => {
|
|
40
|
+
const existingVariableUpdate = updateVariables[existingVariable.name];
|
|
41
|
+
if (existingVariableUpdate) {
|
|
42
|
+
const hasMoreEnvironments = existingVariableUpdate.environments.some(newEnv => !existingVariable.environments?.includes(newEnv));
|
|
43
|
+
if (existingVariableUpdate.value !== existingVariable.value || hasMoreEnvironments) {
|
|
44
|
+
existingDifferentVariables.push(existingVariable);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
delete updateVariables[existingVariable.name];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const existingDifferentSharedVariables = existingDifferentVariables.filter(variable => variable.scope === generated_1.EnvironmentVariableScope.Shared);
|
|
52
|
+
if (existingDifferentSharedVariables.length > 0) {
|
|
53
|
+
const existingDifferentSharedVariablesNames = existingDifferentSharedVariables.map(variable => variable.name);
|
|
54
|
+
log_1.default.error('Shared variables cannot be overwritten by eas env:push command.');
|
|
55
|
+
log_1.default.error('Remove them from the env file or unlink them from the project to continue:');
|
|
56
|
+
existingDifferentSharedVariablesNames.forEach(name => {
|
|
57
|
+
log_1.default.error(`- ${name}`);
|
|
77
58
|
});
|
|
78
|
-
|
|
59
|
+
throw new Error('Shared variables cannot be overwritten by eas env:push command');
|
|
79
60
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
61
|
+
if (existingDifferentVariables.length > 0) {
|
|
62
|
+
log_1.default.warn(`Some variables already exist in the ${displayedEnvironment} environment.`);
|
|
63
|
+
const variableNames = existingDifferentVariables.map(variable => variable.name);
|
|
64
|
+
const confirmationMessage = variableNames.length > 1
|
|
65
|
+
? `The ${variableNames.join(', ')} environment variables already exist in ${displayedEnvironment} environment. Do you want to override them all?`
|
|
66
|
+
: `The ${variableNames[0]} environment variable already exists in ${displayedEnvironment} environment. Do you want to override it?`;
|
|
67
|
+
const confirm = await (0, prompts_1.confirmAsync)({
|
|
68
|
+
message: confirmationMessage,
|
|
69
|
+
});
|
|
70
|
+
let variablesToOverwrite = [];
|
|
71
|
+
if (!confirm && existingDifferentVariables.length === 0) {
|
|
72
|
+
throw new Error('No new variables to push.');
|
|
73
|
+
}
|
|
74
|
+
if (confirm) {
|
|
75
|
+
variablesToOverwrite = existingDifferentVariables.map(variable => variable.name);
|
|
84
76
|
}
|
|
85
77
|
else {
|
|
86
|
-
|
|
78
|
+
const promptResult = await (0, prompts_1.promptAsync)({
|
|
79
|
+
type: 'multiselect',
|
|
80
|
+
name: 'variablesToOverwrite',
|
|
81
|
+
message: 'Select variables to overwrite:',
|
|
82
|
+
// @ts-expect-error property missing from `@types/prompts`
|
|
83
|
+
optionsPerPage: 20,
|
|
84
|
+
choices: existingDifferentVariables.map(variable => ({
|
|
85
|
+
title: `${variable.name}: ${updateVariables[variable.name].value} (was ${variable.value ?? '(secret)'})`,
|
|
86
|
+
value: variable.name,
|
|
87
|
+
})),
|
|
88
|
+
});
|
|
89
|
+
variablesToOverwrite = promptResult.variablesToOverwrite;
|
|
90
|
+
}
|
|
91
|
+
for (const existingVariable of existingVariables) {
|
|
92
|
+
const name = existingVariable.name;
|
|
93
|
+
if (variablesToOverwrite.includes(name)) {
|
|
94
|
+
updateVariables[name]['overwrite'] = true;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
delete updateVariables[name];
|
|
98
|
+
}
|
|
87
99
|
}
|
|
88
100
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
// Check if any of the sensitive variables already exist in the environment. Prompt the user to overwrite them.
|
|
102
|
+
const existingSensitiveVariables = existingVariables.filter(variable => variable.visibility !== generated_1.EnvironmentVariableVisibility.Public);
|
|
103
|
+
if (existingSensitiveVariables.length > 0) {
|
|
104
|
+
const existingSensitiveVariablesNames = existingSensitiveVariables.map(variable => `- ${variable.name}`);
|
|
105
|
+
const confirm = await (0, prompts_1.confirmAsync)({
|
|
106
|
+
message: `You are about to overwrite sensitive variables.\n${existingSensitiveVariablesNames.join('\n')}\n Do you want to continue?`,
|
|
107
|
+
});
|
|
108
|
+
if (!confirm) {
|
|
109
|
+
throw new Error('Aborting...');
|
|
110
|
+
}
|
|
99
111
|
}
|
|
100
112
|
}
|
|
101
113
|
const variablesToPush = Object.values(updateVariables);
|
|
@@ -104,9 +116,9 @@ class EnvironmentVariablePush extends EasCommand_1.default {
|
|
|
104
116
|
return;
|
|
105
117
|
}
|
|
106
118
|
await EnvironmentVariableMutation_1.EnvironmentVariableMutation.createBulkEnvironmentVariablesForAppAsync(graphqlClient, variablesToPush, projectId);
|
|
107
|
-
log_1.default.log(`Uploaded env file to ${
|
|
119
|
+
log_1.default.log(`Uploaded env file to ${environments.join(', ').toLocaleLowerCase()}.`);
|
|
108
120
|
}
|
|
109
|
-
async parseEnvFileAsync(envPath,
|
|
121
|
+
async parseEnvFileAsync(envPath, environments) {
|
|
110
122
|
if (!(await fs_extra_1.default.exists(envPath))) {
|
|
111
123
|
throw new Error(`File ${envPath} does not exist.`);
|
|
112
124
|
}
|
|
@@ -116,7 +128,7 @@ class EnvironmentVariablePush extends EasCommand_1.default {
|
|
|
116
128
|
pushInput[name] = {
|
|
117
129
|
name,
|
|
118
130
|
value,
|
|
119
|
-
|
|
131
|
+
environments,
|
|
120
132
|
visibility: name.startsWith('EXPO_SENSITIVE')
|
|
121
133
|
? generated_1.EnvironmentVariableVisibility.Sensitive
|
|
122
134
|
: generated_1.EnvironmentVariableVisibility.Public,
|
|
@@ -124,12 +136,6 @@ class EnvironmentVariablePush extends EasCommand_1.default {
|
|
|
124
136
|
}
|
|
125
137
|
return pushInput;
|
|
126
138
|
}
|
|
127
|
-
validateFlags(flags) {
|
|
128
|
-
if (!flags.environment) {
|
|
129
|
-
throw new Error('Please provide an environment to push the env file to.');
|
|
130
|
-
}
|
|
131
|
-
return { ...flags, environment: flags.environment };
|
|
132
|
-
}
|
|
133
139
|
}
|
|
134
140
|
_a = EnvironmentVariablePush;
|
|
135
141
|
EnvironmentVariablePush.description = 'push env file';
|
|
@@ -139,7 +145,7 @@ EnvironmentVariablePush.contextDefinition = {
|
|
|
139
145
|
..._a.ContextOptions.LoggedIn,
|
|
140
146
|
};
|
|
141
147
|
EnvironmentVariablePush.flags = {
|
|
142
|
-
...flags_1.
|
|
148
|
+
...flags_1.EASMultiEnvironmentFlag,
|
|
143
149
|
path: core_1.Flags.string({
|
|
144
150
|
description: 'Path to the input `.env` file',
|
|
145
151
|
default: '.env.local',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
-
import { EnvironmentVariableEnvironment, EnvironmentVariableScope
|
|
2
|
+
import { EnvironmentVariableEnvironment, EnvironmentVariableScope } from '../../graphql/generated';
|
|
3
3
|
export default class EnvironmentVariableUpdate extends EasCommand {
|
|
4
4
|
static description: string;
|
|
5
5
|
static hidden: boolean;
|
|
@@ -7,7 +7,7 @@ export default class EnvironmentVariableUpdate extends EasCommand {
|
|
|
7
7
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
8
|
environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment[] | undefined>;
|
|
9
9
|
scope: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableScope>;
|
|
10
|
-
visibility: import("@oclif/core/lib/interfaces").OptionFlag<
|
|
10
|
+
visibility: import("@oclif/core/lib/interfaces").OptionFlag<"plaintext" | "encrypted" | "sensitive" | undefined>;
|
|
11
11
|
'variable-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
12
|
'variable-environment': import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment | undefined>;
|
|
13
13
|
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
@@ -48,7 +48,7 @@ class EnvironmentVariableUpdate extends EasCommand_1.default {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
if (existingVariables.length === 0) {
|
|
51
|
-
throw new Error(`Variable with name ${currentName} ${currentEnvironment ? `in environment ${currentEnvironment}` : ''} does not exist ${suffix}.`);
|
|
51
|
+
throw new Error(`Variable with name ${currentName} ${currentEnvironment ? `in environment ${currentEnvironment.toLocaleLowerCase()}` : ''} does not exist ${suffix}.`);
|
|
52
52
|
}
|
|
53
53
|
else if (existingVariables.length > 1) {
|
|
54
54
|
selectedVariable = await (0, prompts_1.selectAsync)('Select variable', existingVariables.map(variable => ({
|
|
@@ -94,6 +94,7 @@ class EnvironmentVariableUpdate extends EasCommand_1.default {
|
|
|
94
94
|
}
|
|
95
95
|
async promptForMissingFlagsAsync(selectedVariable, { name, value, environment: environments, visibility, 'non-interactive': nonInteractive, type, ...rest }) {
|
|
96
96
|
let newType;
|
|
97
|
+
let newVisibility;
|
|
97
98
|
if (type === 'file') {
|
|
98
99
|
newType = generated_1.EnvironmentSecretType.FileBase64;
|
|
99
100
|
}
|
|
@@ -107,7 +108,6 @@ class EnvironmentVariableUpdate extends EasCommand_1.default {
|
|
|
107
108
|
name = undefined;
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
|
-
log_1.default.log(selectedVariable.type, generated_1.EnvironmentSecretType.String === selectedVariable.type, generated_1.EnvironmentSecretType.FileBase64 === selectedVariable.type);
|
|
111
111
|
if (!type && !value && !nonInteractive) {
|
|
112
112
|
newType = await (0, prompts_2.promptVariableTypeAsync)(nonInteractive, selectedVariable.type);
|
|
113
113
|
if (!newType || newType === selectedVariable.type) {
|
|
@@ -118,6 +118,7 @@ class EnvironmentVariableUpdate extends EasCommand_1.default {
|
|
|
118
118
|
value = await (0, prompts_2.promptVariableValueAsync)({
|
|
119
119
|
nonInteractive,
|
|
120
120
|
required: false,
|
|
121
|
+
filePath: (newType ?? selectedVariable.type) === generated_1.EnvironmentSecretType.FileBase64,
|
|
121
122
|
initial: (newType ?? selectedVariable.type) === generated_1.EnvironmentSecretType.FileBase64
|
|
122
123
|
? undefined
|
|
123
124
|
: selectedVariable.value,
|
|
@@ -127,7 +128,7 @@ class EnvironmentVariableUpdate extends EasCommand_1.default {
|
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
let environmentFilePath;
|
|
130
|
-
if (newType === generated_1.EnvironmentSecretType.FileBase64 && value) {
|
|
131
|
+
if ((newType ?? selectedVariable.type) === generated_1.EnvironmentSecretType.FileBase64 && value) {
|
|
131
132
|
environmentFilePath = path_1.default.resolve(value);
|
|
132
133
|
if (!(await fs_extra_1.default.pathExists(environmentFilePath))) {
|
|
133
134
|
throw new Error(`File "${value}" does not exist`);
|
|
@@ -147,17 +148,20 @@ class EnvironmentVariableUpdate extends EasCommand_1.default {
|
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
if (!visibility) {
|
|
150
|
-
|
|
151
|
-
if (!
|
|
152
|
-
|
|
151
|
+
newVisibility = await (0, prompts_2.promptVariableVisibilityAsync)(nonInteractive, selectedVariable.visibility);
|
|
152
|
+
if (!newVisibility || newVisibility === selectedVariable.visibility) {
|
|
153
|
+
newVisibility = undefined;
|
|
153
154
|
}
|
|
154
155
|
}
|
|
155
156
|
}
|
|
157
|
+
if (visibility) {
|
|
158
|
+
newVisibility = (0, prompts_2.parseVisibility)(visibility);
|
|
159
|
+
}
|
|
156
160
|
return {
|
|
157
161
|
name,
|
|
158
162
|
value,
|
|
159
163
|
environment: environments,
|
|
160
|
-
visibility,
|
|
164
|
+
visibility: newVisibility,
|
|
161
165
|
scope: rest.scope ?? generated_1.EnvironmentVariableScope.Project,
|
|
162
166
|
'non-interactive': nonInteractive,
|
|
163
167
|
type: newType,
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
2
|
export default class UpdateEdit extends EasCommand {
|
|
3
3
|
static description: string;
|
|
4
|
-
static hidden: boolean;
|
|
5
4
|
static args: {
|
|
6
5
|
name: string;
|
|
7
|
-
required: boolean;
|
|
8
6
|
description: string;
|
|
9
7
|
}[];
|
|
10
8
|
static flags: {
|
|
11
9
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
10
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
11
|
'rollout-percentage': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
|
|
12
|
+
branch: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
14
13
|
};
|
|
15
14
|
static contextDefinition: {
|
|
16
15
|
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
16
|
+
privateProjectConfig: import("../../commandUtils/context/PrivateProjectConfigContextField").PrivateProjectConfigContextField;
|
|
17
17
|
};
|
|
18
18
|
runAsync(): Promise<void>;
|
|
19
19
|
}
|
|
@@ -5,21 +5,56 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const core_1 = require("@oclif/core");
|
|
6
6
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
7
7
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
+
const queries_1 = require("../../branch/queries");
|
|
8
9
|
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
9
10
|
const flags_1 = require("../../commandUtils/flags");
|
|
10
11
|
const PublishMutation_1 = require("../../graphql/mutations/PublishMutation");
|
|
11
12
|
const UpdateQuery_1 = require("../../graphql/queries/UpdateQuery");
|
|
12
13
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
13
14
|
const prompts_1 = require("../../prompts");
|
|
15
|
+
const queries_2 = require("../../update/queries");
|
|
14
16
|
const utils_1 = require("../../update/utils");
|
|
15
17
|
const json_1 = require("../../utils/json");
|
|
16
18
|
class UpdateEdit extends EasCommand_1.default {
|
|
17
19
|
async runAsync() {
|
|
18
|
-
const { args: { groupId }, flags: { 'rollout-percentage': rolloutPercentage, json: jsonFlag, 'non-interactive': nonInteractive, }, } = await this.parse(_a);
|
|
19
|
-
const { loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, { nonInteractive });
|
|
20
|
+
const { args: { groupId: maybeGroupId }, flags: { 'rollout-percentage': rolloutPercentage, json: jsonFlag, 'non-interactive': nonInteractive, branch: branchFlag, }, } = await this.parse(_a);
|
|
21
|
+
const { privateProjectConfig: { projectId }, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, { nonInteractive });
|
|
20
22
|
if (jsonFlag) {
|
|
21
23
|
(0, json_1.enableJsonOutput)();
|
|
22
24
|
}
|
|
25
|
+
let groupId = maybeGroupId;
|
|
26
|
+
if (!groupId) {
|
|
27
|
+
let branch = branchFlag;
|
|
28
|
+
if (!branch) {
|
|
29
|
+
const validationMessage = 'Branch name may not be empty.';
|
|
30
|
+
if (nonInteractive) {
|
|
31
|
+
throw new Error(validationMessage);
|
|
32
|
+
}
|
|
33
|
+
const selectedBranch = await (0, queries_1.selectBranchOnAppAsync)(graphqlClient, {
|
|
34
|
+
projectId,
|
|
35
|
+
promptTitle: 'On which branch would you like search for an update to edit?',
|
|
36
|
+
displayTextForListItem: updateBranch => ({
|
|
37
|
+
title: updateBranch.name,
|
|
38
|
+
}),
|
|
39
|
+
paginatedQueryOptions: {
|
|
40
|
+
json: jsonFlag,
|
|
41
|
+
nonInteractive,
|
|
42
|
+
offset: 0,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
branch = selectedBranch.name;
|
|
46
|
+
}
|
|
47
|
+
const selectedUpdateGroup = await (0, queries_2.selectUpdateGroupOnBranchAsync)(graphqlClient, {
|
|
48
|
+
projectId,
|
|
49
|
+
branchName: branch,
|
|
50
|
+
paginatedQueryOptions: {
|
|
51
|
+
json: jsonFlag,
|
|
52
|
+
nonInteractive,
|
|
53
|
+
offset: 0,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
groupId = selectedUpdateGroup[0].group;
|
|
57
|
+
}
|
|
23
58
|
const proposedUpdatesToEdit = (await UpdateQuery_1.UpdateQuery.viewUpdateGroupAsync(graphqlClient, { groupId })).map(u => ({ updateId: u.id, rolloutPercentage: u.rolloutPercentage }));
|
|
24
59
|
const updatesToEdit = proposedUpdatesToEdit.filter((u) => u.rolloutPercentage !== null && u.rolloutPercentage !== undefined);
|
|
25
60
|
if (updatesToEdit.length === 0) {
|
|
@@ -79,11 +114,9 @@ class UpdateEdit extends EasCommand_1.default {
|
|
|
79
114
|
}
|
|
80
115
|
_a = UpdateEdit;
|
|
81
116
|
UpdateEdit.description = 'edit all the updates in an update group';
|
|
82
|
-
UpdateEdit.hidden = true;
|
|
83
117
|
UpdateEdit.args = [
|
|
84
118
|
{
|
|
85
119
|
name: 'groupId',
|
|
86
|
-
required: true,
|
|
87
120
|
description: 'The ID of an update group to edit.',
|
|
88
121
|
},
|
|
89
122
|
];
|
|
@@ -94,9 +127,13 @@ UpdateEdit.flags = {
|
|
|
94
127
|
min: 0,
|
|
95
128
|
max: 100,
|
|
96
129
|
}),
|
|
130
|
+
branch: core_1.Flags.string({
|
|
131
|
+
description: 'Branch for which to list updates to select from',
|
|
132
|
+
}),
|
|
97
133
|
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
98
134
|
};
|
|
99
135
|
UpdateEdit.contextDefinition = {
|
|
136
|
+
..._a.ContextOptions.ProjectConfig,
|
|
100
137
|
..._a.ContextOptions.LoggedIn,
|
|
101
138
|
};
|
|
102
139
|
exports.default = UpdateEdit;
|